From a416ab17ecf9f2cb0f1e3f7bd645a8d1ce690ca2 Mon Sep 17 00:00:00 2001 From: rpj Date: Mon, 18 Feb 2002 03:16:52 +0000 Subject: Major reorganisation of source code; new routine and tests added. --- Makefile | 644 ++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 391 insertions(+), 253 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4bb23c7..1a19e97 100644 --- a/Makefile +++ b/Makefile @@ -1,253 +1,391 @@ -# This makefile is compatible with MS nmake and can be used as a -# replacement for buildlib.bat. I've changed the target from an ordinary dll -# (/LD) to a debugging dll (/LDd). -# -# The variables $DLLDEST and $LIBDEST hold the destination directories for the -# dll and the lib, respectively. Probably all that needs to change is $DEVROOT. - -DEVROOT=c:\pthreads - -DLLDEST=$(DEVROOT)\DLL -LIBDEST=$(DEVROOT)\DLL - -DLLS = pthreadVCE.dll pthreadVSE.dll pthreadVC.dll - -OPTIM = /O2 - -# C++ Exceptions -VCEFLAGS = /GX /TP /D__CLEANUP_CXX -#Structured Exceptions -VSEFLAGS = /D__CLEANUP_SEH -#C cleanup code -VCFLAGS = /D__CLEANUP_C - -#CFLAGS = $(OPTIM) /W3 /MT /nologo /Yd /Zi /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H /DTEST_ICE -CFLAGS = $(OPTIM) /W3 /MT /nologo /Yd /Zi /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H - -# Agregate modules for inlinability -DLL_OBJS = \ - attr.obj \ - barrier.obj \ - cancel.obj \ - cleanup.obj \ - condvar.obj \ - create.obj \ - dll.obj \ - errno.obj \ - exit.obj \ - fork.obj \ - global.obj \ - misc.obj \ - mutex.obj \ - nonportable.obj \ - private.obj \ - rwlock.obj \ - sched.obj \ - semaphore.obj \ - signal.obj \ - spin.obj \ - sync.obj \ - tsd.obj - -# Separate modules for minimising the size of statically linked images -SMALL_STATIC_OBJS = \ - attr_is_attr.obj \ - attr_init.obj \ - attr_destroy.obj \ - attr_getdetachstate.obj \ - attr_setdetachstate.obj \ - attr_getstackaddr.obj \ - attr_setstackaddr.obj \ - attr_getstacksize.obj \ - attr_setstacksize.obj \ - attr_getscope.obj \ - attr_setscope.obj \ - barrier_init.obj \ - barrier_destroy.obj \ - barrier_wait.obj \ - barrier_attr_init.obj \ - barrier_attr_destroy.obj \ - barrier_attr_setpshared.obj \ - barrier_attr_getpshared.obj \ - cancel_setcancelstate.obj \ - cancel_setcanceltype.obj \ - cancel_testcancel.obj \ - cancel_cancel.obj \ - cleanup.obj \ - condvar_attr_destroy.obj \ - condvar_attr_getpshared.obj \ - condvar_attr_init.obj \ - condvar_attr_setpshared.obj \ - condvar_check_need_init.obj \ - condvar_destroy.obj \ - condvar_init.obj \ - condvar_signal.obj \ - condvar_wait.obj \ - create.obj \ - dll.obj \ - errno.obj \ - exit.obj \ - fork.obj \ - global.obj \ - mutex.obj \ - np_mutexattr_setkind.obj \ - np_mutexattr_getkind.obj \ - np_getw32threadhandle.obj \ - np_delay.obj \ - np_num_processors.obj \ - np_win32_attach.obj \ - private.obj \ - pthread_equal.obj \ - pthread_getconcurrency.obj \ - pthread_once.obj \ - pthread_self.obj \ - pthread_setconcurrency.obj \ - ptw32_calloc.obj \ - ptw32_new.obj \ - rwlock.obj \ - sched.obj \ - semaphore_init.obj \ - semaphore_destroy.obj \ - semaphore_trywait.obj \ - semaphore_timedwait.obj \ - semaphore_wait.obj \ - semaphore_post.obj \ - semaphore_postmultiple.obj \ - semaphore_getvalue.obj \ - semaphore_increase.obj \ - semaphore_decrease.obj \ - semaphore_open.obj \ - semaphore_close.obj \ - semaphore_unlink.obj \ - signal.obj \ - spin.obj \ - sync.obj \ - tsd.obj \ - w32_CancelableWait.obj - -INCL = config.h implement.h semaphore.h pthread.h need_errno.h - -ATTR_SRCS = \ - attr_is_attr.c \ - attr_init.c \ - attr_destroy.c \ - attr_getdetachstate.c \ - attr_setdetachstate.c \ - attr_getstackaddr.c \ - attr_setstackaddr.c \ - attr_getstacksize.c \ - attr_setstacksize.c \ - attr_getscope.c \ - attr_setscope.c - -BARRIER_SRCS = \ - barrier_init.c \ - barrier_destroy.c \ - barrier_wait.c \ - barrier_attr_init.c \ - barrier_attr_destroy.c \ - barrier_attr_setpshared.c \ - barrier_attr_getpshared.c - -CANCEL_SRCS = \ - cancel_setcancelstate.c \ - cancel_setcanceltype.c \ - cancel_testcancel.c \ - cancel_cancel.c - -CONDVAR_SRCS = \ - condvar_attr_destroy.c \ - condvar_attr_getpshared.c \ - condvar_attr_init.c \ - condvar_attr_setpshared.c \ - condvar_check_need_init.c \ - condvar_destroy.c \ - condvar_init.c \ - condvar_signal.c \ - condvar_wait.c - -MISC_SRCS = \ - pthread_equal.c \ - pthread_getconcurrency.c \ - pthread_once.c \ - pthread_self.c \ - pthread_setconcurrency.c \ - ptw32_calloc.c \ - ptw32_new.c \ - w32_CancelableWait.c - -NONPORTABLE_SRCS = \ - np_mutexattr_setkind.c \ - np_mutexattr_getkind.c \ - np_getw32threadhandle.c \ - np_delay.c \ - np_num_processors.c \ - np_win32_attach.c - -SEMAPHORE_SRCS = \ - semaphore_init.c \ - semaphore_destroy.c \ - semaphore_trywait.c \ - semaphore_timedwait.c \ - semaphore_wait.c \ - semaphore_post.c \ - semaphore_postmultiple.c \ - semaphore_getvalue.c \ - semaphore_increase.c \ - semaphore_decrease.c \ - semaphore_open.c \ - semaphore_close.c \ - semaphore_unlink.c - -all: - @ echo Run one of the following command lines: - @ echo nmake clean VCE (to build the MSVC dll with C++ exception handling) - @ echo nmake clean VSE (to build the MSVC dll with structured exception handling) - @ echo nmake clean VC (to build the MSVC dll with C cleanup code) - -auto: - @ nmake clean VCE - @ nmake clean VSE - @ nmake clean VC - -VCE: - @ nmake /nologo EHFLAGS="$(VCEFLAGS)" pthreadVCE.dll - -VSE: - @ nmake /nologo EHFLAGS="$(VSEFLAGS)" pthreadVSE.dll - -VC: - @ nmake /nologo EHFLAGS="$(VCFLAGS)" pthreadVC.dll - -realclean: clean - if exist *.dll del *.dll - if exist *.lib del *.lib - -clean: - if exist *.obj del *.obj - if exist *.ilk del *.ilk - if exist *.pdb del *.pdb - if exist *.exp del *.exp - if exist *.o del *.o - - -install: $(DLLS) - copy pthread*.dll $(DLLDEST) - copy pthread*.lib $(LIBDEST) - -$(DLLS): $(DLL_OBJS) pthread.def - cl /LD /Zi /nologo $(DLL_OBJS) \ - /link /nodefaultlib:libcmt /implib:$*.lib \ - msvcrt.lib wsock32.lib /def:pthread.def /out:$@ - -.c.obj: - cl $(EHFLAGS) $(CFLAGS) -c $< - -attr.obj: attr.c $(ATTR_SRCS) $(INCL) -barrier.obj: barrier.c $(BARRIER_SRCS) $(INCL) -cancel.obj: cancel.c $(CANCEL_SRCS) $(INCL) -condvar.obj: condvar.c $(CONDVAR_SRCS) $(INCL) -misc.obj: misc.c $(MISC_SRCS) $(INCL) -nonportable.obj: nonportable.c $(NONPORTABLE_SRCS) $(INCL) -semaphore.obj: semaphore.c $(SEMAPHORE_SRCS) $(INCL) - +# This makefile is compatible with MS nmake and can be used as a +# replacement for buildlib.bat. I've changed the target from an ordinary dll +# (/LD) to a debugging dll (/LDd). +# +# The variables $DLLDEST and $LIBDEST hold the destination directories for the +# dll and the lib, respectively. Probably all that needs to change is $DEVROOT. + +DEVROOT=c:\pthreads + +DLLDEST=$(DEVROOT)\DLL +LIBDEST=$(DEVROOT)\DLL + +DLLS = pthreadVCE.dll pthreadVSE.dll pthreadVC.dll + +OPTIM = /O2 + +# C++ Exceptions +VCEFLAGS = /GX /TP /D__CLEANUP_CXX +#Structured Exceptions +VSEFLAGS = /D__CLEANUP_SEH +#C cleanup code +VCFLAGS = /D__CLEANUP_C + +#CFLAGS = $(OPTIM) /W3 /MT /nologo /Yd /Zi /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H /DTEST_ICE +CFLAGS = $(OPTIM) /W3 /MT /nologo /Yd /Zi /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H + +# Agregate modules for inlinability +DLL_OBJS = \ + attr.obj \ + barrier.obj \ + cancel.obj \ + cleanup.obj \ + condvar.obj \ + create.obj \ + dll.obj \ + errno.obj \ + exit.obj \ + fork.obj \ + global.obj \ + misc.obj \ + mutex.obj \ + nonportable.obj \ + private.obj \ + rwlock.obj \ + sched.obj \ + semaphore.obj \ + signal.obj \ + spin.obj \ + sync.obj \ + tsd.obj + +# Separate modules for minimising the size of statically linked images +SMALL_STATIC_OBJS = \ + pthread_attr_init.obj \ + pthread_attr_destroy.obj \ + pthread_attr_getdetachstate.obj \ + pthread_attr_setdetachstate.obj \ + pthread_attr_getstackaddr.obj \ + pthread_attr_setstackaddr.obj \ + pthread_attr_getstacksize.obj \ + pthread_attr_setstacksize.obj \ + pthread_attr_getscope.obj \ + pthread_attr_setscope.obj \ + pthread_attr_setschedpolicy.obj \ + pthread_attr_getschedpolicy.obj \ + pthread_attr_setschedparam.obj \ + pthread_attr_getschedparam.obj \ + pthread_attr_setinheritsched.obj \ + pthread_attr_getinheritsched.obj \ + pthread_barrier_init.obj \ + pthread_barrier_destroy.obj \ + pthread_barrier_wait.obj \ + pthread_barrierattr_init.obj \ + pthread_barrierattr_destroy.obj \ + pthread_barrierattr_setpshared.obj \ + pthread_barrierattr_getpshared.obj \ + pthread_setcancelstate.obj \ + pthread_setcanceltype.obj \ + pthread_testcancel.obj \ + pthread_cancel.obj \ + cleanup.obj \ + pthread_condattr_destroy.obj \ + pthread_condattr_getpshared.obj \ + pthread_condattr_init.obj \ + pthread_condattr_setpshared.obj \ + pthread_cond_destroy.obj \ + pthread_cond_init.obj \ + pthread_cond_signal.obj \ + pthread_cond_wait.obj \ + create.obj \ + dll.obj \ + errno.obj \ + exit.obj \ + fork.obj \ + global.obj \ + pthread_mutex_init.obj \ + pthread_mutex_destroy.obj \ + pthread_mutexattr_init.obj \ + pthread_mutexattr_destroy.obj \ + pthread_mutexattr_getpshared.obj \ + pthread_mutexattr_setpshared.obj \ + pthread_mutexattr_settype.obj \ + pthread_mutexattr_gettype.obj \ + pthread_mutex_lock.obj \ + pthread_mutex_timedlock.obj \ + pthread_mutex_unlock.obj \ + pthread_mutex_trylock.obj \ + pthread_mutexattr_setkind_np.obj \ + pthread_mutexattr_getkind_np.obj \ + pthread_getw32threadhandle_np.obj \ + pthread_delay_np.obj \ + pthread_num_processors_np.obj \ + pthread_win32_attach_detach_np.obj \ + pthread_equal.obj \ + pthread_getconcurrency.obj \ + pthread_once.obj \ + pthread_self.obj \ + pthread_setconcurrency.obj \ + pthread_rwlock_init.obj \ + pthread_rwlock_destroy.obj \ + pthread_rwlockattr_init.obj \ + pthread_rwlockattr_destroy.obj \ + pthread_rwlockattr_getpshared.obj \ + pthread_rwlockattr_setpshared.obj \ + pthread_rwlock_rdlock.obj \ + pthread_rwlock_wrlock.obj \ + pthread_rwlock_unlock.obj \ + pthread_rwlock_tryrdlock.obj \ + pthread_rwlock_trywrlock.obj \ + pthread_setschedparam.obj \ + pthread_getschedparam.obj \ + pthread_timechange_handler_np.obj \ + ptw32_is_attr.obj \ + ptw32_processInitialize.obj \ + ptw32_processTerminate.obj \ + ptw32_threadStart.obj \ + ptw32_threadDestroy.obj \ + ptw32_tkAssocCreate.obj \ + ptw32_tkAssocDestroy.obj \ + ptw32_callUserDestroyRoutines.obj \ + ptw32_timespec.obj \ + ptw32_throw.obj \ + ptw32_InterlockedCompareExchange.obj \ + ptw32_getprocessors.obj \ + ptw32_calloc.obj \ + ptw32_new.obj \ + ptw32_rwlock_check_need_init.obj \ + ptw32_cond_check_need_init.obj \ + ptw32_mutex_check_need_init.obj \ + sched_get_priority_max.obj \ + sched_get_priority_min.obj \ + sched_setscheduler.obj \ + sched_getscheduler.obj \ + sched_yield.obj \ + sem_init.obj \ + sem_destroy.obj \ + sem_trywait.obj \ + sem_timedwait.obj \ + sem_wait.obj \ + sem_post.obj \ + sem_post_multiple.obj \ + sem_getvalue.obj \ + sem_open.obj \ + sem_close.obj \ + sem_unlink.obj \ + ptw32_increase_semaphore.obj \ + ptw32_decrease_semaphore.obj \ + signal.obj \ + ptw32_spinlock_check_need_init.obj \ + pthread_spin_init.obj \ + pthread_spin_destroy.obj \ + pthread_spin_lock.obj \ + pthread_spin_unlock.obj \ + pthread_spin_trylock.obj \ + pthread_detach.obj \ + pthread_join.obj \ + pthread_key_create.obj \ + pthread_key_delete.obj \ + pthread_setspecific.obj \ + pthread_getspecific.obj \ + w32_CancelableWait.obj + +INCL = config.h implement.h semaphore.h pthread.h need_errno.h + +ATTR_SRCS = \ + pthread_attr_init.c \ + pthread_attr_destroy.c \ + pthread_attr_getdetachstate.c \ + pthread_attr_setdetachstate.c \ + pthread_attr_getstackaddr.c \ + pthread_attr_setstackaddr.c \ + pthread_attr_getstacksize.c \ + pthread_attr_setstacksize.c \ + pthread_attr_getscope.c \ + pthread_attr_setscope.c + +BARRIER_SRCS = \ + pthread_barrier_init.c \ + pthread_barrier_destroy.c \ + pthread_barrier_wait.c \ + pthread_barrierattr_init.c \ + pthread_barrierattr_destroy.c \ + pthread_barrierattr_setpshared.c \ + pthread_barrierattr_getpshared.c + +CANCEL_SRCS = \ + pthread_setcancelstate.c \ + pthread_setcanceltype.c \ + pthread_testcancel.c \ + pthread_cancel.c + +CONDVAR_SRCS = \ + ptw32_cond_check_need_init.c \ + pthread_condattr_destroy.c \ + pthread_condattr_getpshared.c \ + pthread_condattr_init.c \ + pthread_condattr_setpshared.c \ + pthread_cond_destroy.c \ + pthread_cond_init.c \ + pthread_cond_signal.c \ + pthread_cond_wait.c + +MISC_SRCS = \ + pthread_equal.c \ + pthread_getconcurrency.c \ + pthread_once.c \ + pthread_self.c \ + pthread_setconcurrency.c \ + ptw32_calloc.c \ + ptw32_new.c \ + w32_CancelableWait.c + +MUTEX_SRCS = \ + ptw32_mutex_check_need_init.c \ + pthread_mutex_init.c \ + pthread_mutex_destroy.c \ + pthread_mutexattr_init.c \ + pthread_mutexattr_destroy.c \ + pthread_mutexattr_getpshared.c \ + pthread_mutexattr_setpshared.c \ + pthread_mutexattr_settype.c \ + pthread_mutexattr_gettype.c \ + pthread_mutex_lock.c \ + pthread_mutex_timedlock.c \ + pthread_mutex_unlock.c \ + pthread_mutex_trylock.c + +NONPORTABLE_SRCS = \ + pthread_mutexattr_setkind_np.c \ + pthread_mutexattr_getkind_np.c \ + pthread_getw32threadhandle_np.c \ + pthread_delay_np.c \ + pthread_num_processors_np.c \ + pthread_win32_attach_detach_np.c \ + pthread_timechange_handler_np.c + +PRIVATE_SRCS = \ + ptw32_is_attr.c \ + ptw32_processInitialize.c \ + ptw32_processTerminate.c \ + ptw32_threadStart.c \ + ptw32_threadDestroy.c \ + ptw32_tkAssocCreate.c \ + ptw32_tkAssocDestroy.c \ + ptw32_callUserDestroyRoutines.c \ + ptw32_timespec.c \ + ptw32_throw.c \ + ptw32_InterlockedCompareExchange.c \ + ptw32_getprocessors.c + +RWLOCK_SRCS = \ + ptw32_rwlock_check_need_init.c \ + pthread_rwlock_init.c \ + pthread_rwlock_destroy.c \ + pthread_rwlockattr_init.c \ + pthread_rwlockattr_destroy.c \ + pthread_rwlockattr_getpshared.c \ + pthread_rwlockattr_setpshared.c \ + pthread_rwlock_rdlock.c \ + pthread_rwlock_wrlock.c \ + pthread_rwlock_unlock.c \ + pthread_rwlock_tryrdlock.c \ + pthread_rwlock_trywrlock.c + +SCHED_SRCS = \ + pthread_attr_setschedpolicy.c \ + pthread_attr_getschedpolicy.c \ + pthread_attr_setschedparam.c \ + pthread_attr_getschedparam.c \ + pthread_attr_setinheritsched.c \ + pthread_attr_getinheritsched.c \ + pthread_setschedparam.c \ + pthread_getschedparam.c \ + sched_get_priority_max.c \ + sched_get_priority_min.c \ + sched_setscheduler.c \ + sched_getscheduler.c \ + sched_yield.c + +SEMAPHORE_SRCS = \ + sem_init.c \ + sem_destroy.c \ + sem_trywait.c \ + sem_timedwait.c \ + sem_wait.c \ + sem_post.c \ + sem_post_multiple.c \ + sem_getvalue.c \ + sem_open.c \ + sem_close.c \ + sem_unlink.c \ + ptw32_increase_semaphore.c \ + ptw32_decrease_semaphore.c + +SPIN_SRCS = \ + ptw32_spinlock_check_need_init.c \ + pthread_spin_init.c \ + pthread_spin_destroy.c \ + pthread_spin_lock.c \ + pthread_spin_unlock.c \ + pthread_spin_trylock.c + +SYNC_SRCS = \ + pthread_detach.c \ + pthread_join.c + +TSD_SRCS = \ + pthread_key_create.c \ + pthread_key_delete.c \ + pthread_setspecific.c \ + pthread_getspecific.c + + +all: + @ echo Run one of the following command lines: + @ echo nmake clean VCE (to build the MSVC dll with C++ exception handling) + @ echo nmake clean VSE (to build the MSVC dll with structured exception handling) + @ echo nmake clean VC (to build the MSVC dll with C cleanup code) + +auto: + @ nmake clean VCE + @ nmake clean VSE + @ nmake clean VC + +VCE: + @ nmake /nologo EHFLAGS="$(VCEFLAGS)" pthreadVCE.dll + +VSE: + @ nmake /nologo EHFLAGS="$(VSEFLAGS)" pthreadVSE.dll + +VC: + @ nmake /nologo EHFLAGS="$(VCFLAGS)" pthreadVC.dll + +realclean: clean + if exist *.dll del *.dll + if exist *.lib del *.lib + +clean: + if exist *.obj del *.obj + if exist *.ilk del *.ilk + if exist *.pdb del *.pdb + if exist *.exp del *.exp + if exist *.o del *.o + + +install: $(DLLS) + copy pthread*.dll $(DLLDEST) + copy pthread*.lib $(LIBDEST) + +$(DLLS): $(DLL_OBJS) pthread.def + cl /LD /Zi /nologo $(DLL_OBJS) \ + /link /nodefaultlib:libcmt /implib:$*.lib \ + msvcrt.lib wsock32.lib /def:pthread.def /out:$@ + +.c.obj: + cl $(EHFLAGS) $(CFLAGS) -c $< + +attr.obj: attr.c $(ATTR_SRCS) $(INCL) +barrier.obj: barrier.c $(BARRIER_SRCS) $(INCL) +cancel.obj: cancel.c $(CANCEL_SRCS) $(INCL) +condvar.obj: condvar.c $(CONDVAR_SRCS) $(INCL) +misc.obj: misc.c $(MISC_SRCS) $(INCL) +mutex.obj: mutex.c $(MUTEX_SRCS) $(INCL) +nonportable.obj: nonportable.c $(NONPORTABLE_SRCS) $(INCL) +private.obj: private.c $(PRIVATE_SRCS) $(INCL) +rwlock.obj: rwlock.c $(RWLOCK_SRCS) $(INCL) +sched.obj: sched.c $(SCHED_SRCS) $(INCL) +semaphore.obj: semaphore.c $(SEMAPHORE_SRCS) $(INCL) +spin.obj: spin.c $(SPIN_SRCS) $(INCL) +sync.obj: sync.c $(SYNC_SRCS) $(INCL) +tsd.obj: tsd.c $(TSD_SRCS) $(INCL) -- cgit v1.2.3