public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Makefile fixes
@ 2012-07-10 20:57 Daniel Richard G.
  2012-08-11  8:06 ` Ross Johnson
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Richard G. @ 2012-07-10 20:57 UTC (permalink / raw)
  To: pthreads-win32

[-- Attachment #1: Type: text/plain, Size: 4479 bytes --]

Hello list,

I have a series of patches to contribute to pthreads-win32. This is the 
first one.

The attached patch, against the CVS source, does the following:

* Factors out the long lists of object and source files and object
   dependencies into common.mk (also attached as I can't do "cvs add"),
   which is now included by Bmakefile, GNUmakefile and Makefile. Variables
   are used to address the different object/resource file extensions.

   I had noticed inconsistencies among the lists of objects/sources in each
   of the three makefiles, so this approach will put an end to that.

* Fixes incorrect flags/objects used for building the static library

* Adjusts some compiler flags to facilitate building and testing the
   library

* Adds targets (all-tests, all-tests-cflags) to run the test suite on all
   of the library's build configurations, as these tend to have different
   codepaths that can significantly affect correctness

* "Make" syntax tweaks


Below is a more detailed walk-through of the changes:

++ Bmakefile

@ Factored out common variable definitions into common.mk

@ Use new RESOURCE_OBJS variable instead of a literal "version.res"

@ Factored out common dependencies into common.mk

   Added end-of-file comment

++ GNUmakefile

@ I had trouble with test programs not running because DLLs for
   libgcc/libstdc++/libgomp were not in the PATH, so these flags will link
   them statically. (As MinGW is intended to produce "standalone" binaries,
   this is what most people will probably want to do anyway)

@ MAKE is already set by the Make program

   Factored out common variable definitions into common.mk

   As GNU Make supports "+=", use this to add RESOURCE_OBJS to the three
   object-file-list variables

@ Use $(MAKE), not "make" in the help text (e.g. MAKE could be "gmake")

   New all-tests and all-tests-cflags targets (note that the latter is less
   useful for MinGW compared to MSVC)

@ Static builds use small objects, not inlined/aggregate ones, so
   -DPTW32_BUILD_INLINED doesn't belong here

@ Likewise, static builds should use SMALL_STATIC_OBJS, not
   DLL_INLINED_OBJS

@ Factored out common dependencies into common.mk

   Added end-of-file comment

++ Makefile

@ Factored out common variable definitions into common.mk

@ Removed "@" prefix from $(MAKE) invocations in the "all" target, as that
   suppressed useful information (e.g. if you're redirecting terminal output
   to a file for later review)

   New all-tests and all-tests-cflags targets (the latter covers both /MD
   and /MT configurations)

@ Static builds use small objects, not inlined/aggregate ones, so
   -DPTW32_BUILD_INLINED doesn't belong here

@ Fixed "install" rule for static builds (no *.dll file)

@ Added new RESOURCE_OBJS variable where needed

   Static builds should use SMALL_STATIC_OBJS, not DLL_INLINED_OBJS

@ Factored out common dependencies into common.mk

   Added end-of-file comment

++ tests/GNUmakefile

@ ECHO should be defined without the "@", as that is already given in the
   target recipes

   Define TOUCH so that it uses ECHO

   Define ECHO before TOUCH, for ordering

   Don't define MAKE, because that should be set by the Make program itself

@ New variable XLIBS, to specify system/third-party libraries needed by
   some tests

   Only a couple of tests need -lws2_32 -lgomp; don't add these libs to
   everything if we can help it

   Use -static-libgcc and PTW32_FLAGS in CFLAGS, to avoid a dynamic
   dependency on libgcc and build with the same flags as the ptw32 library

@ Replaced "make" with $(MAKE), and a nice straight margin for the target
   descriptions

@ Only one test needs -fopenmp; don't add it to everything

   Added -static-libstdc++ where useful

@ Normalized use of $(ECHO): prefixed by "@", and argument is double-quoted

   Add -lws2_32, -fopenmp et al. only to the tests that need them, using GNU
   Make magic

@ Show the compiler invocations directly

   The -lsupc++ bit only caused errors on my system

   XLIBS is used here

@ idem

++ tests/Makefile

@ Define TOUCH so that it uses ECHO

   Define ECHO before TOUCH, for ordering

@ Use $(MAKE), not "nmake" in the help text

@ Use /nologo in the various $(MAKE) invocations to get rid of annoying
   Microsoft boilerplate

   Show the compiler invocations directly


--Daniel


-- 
Daniel Richard G. || danielg@teragram.com || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch against CVS source --]
[-- Type: text/x-diff; name="ptw32-makefiles.patch", Size: 47761 bytes --]

Index: Bmakefile
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/Bmakefile,v
retrieving revision 1.10
diff -u -b -r1.10 Bmakefile
--- Bmakefile	1 Jul 2011 00:51:56 -0000	1.10
+++ Bmakefile	10 Jul 2012 20:47:39 -0000
@@ -27,189 +27,10 @@
 #C cleanup code
 BCFLAGS	= $(PTW32_FLAGS) $(CFLAGS)
 
-# 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
-
-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
-
-EXIT_SRCS	= \
-		pthread_exit.c
-
-MISC_SRCS	= \
-		pthread_equal.c \
-		pthread_getconcurrency.c \
-		pthread_once.c \
-		pthread_self.c \
-		pthread_setconcurrency.c \
-		ptw32_calloc.c \
-		ptw32_MCS_lock.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_mutexattr_setrobust.c \
-		pthread_mutexattr_getrobust.c \
-		pthread_mutex_lock.c \
-		pthread_mutex_timedlock.c \
-		pthread_mutex_unlock.c \
-		pthread_mutex_trylock.c \
-		pthread_mutex_consistent.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_relmillisecs.c \
-		ptw32_throw.c \
-		ptw32_getprocessors.c
-
-RWLOCK_SRCS	= \
-		ptw32_rwlock_check_need_init.c \
-		ptw32_rwlock_cancelwrwait.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_timedrdlock.c \
-		pthread_rwlock_wrlock.c \
-		pthread_rwlock_timedwrlock.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
-
-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
+OBJEXT = obj
+RESEXT = res
 
+include common.mk
 
 all: clean $(DLLS)
 
@@ -238,11 +59,11 @@
 	copy pthread*.dll $(DLLDEST)
 	copy pthread*.lib $(LIBDEST)
 
-$(DLLS): $(DLL_OBJS) version.res
+$(DLLS): $(DLL_OBJS) $(RESOURCE_OBJS)
 	ilink32 /Tpd /Gi c0d32x.obj $(DLL_OBJS), \
 		$@, ,\
 		cw32mti.lib import32.lib, ,\
-		version.res
+		$(RESOURCE_OBJS)
 
 .c.obj:
 	$(CC) $(OPTIM) $(BCFLAGS) -c $<
@@ -250,19 +71,4 @@
 .rc.res:
 	$(RC) $(RCFLAGS) $<
 
-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)
-exit.obj:	exit.c $(EXIT_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)
-version.res:	version.rc $(INCL)
+# end Bmakefile
Index: GNUmakefile
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/GNUmakefile,v
retrieving revision 1.48
diff -u -b -r1.48 GNUmakefile
--- GNUmakefile	27 May 2012 04:15:07 -0000	1.48
+++ GNUmakefile	10 Jul 2012 20:47:39 -0000
@@ -62,8 +62,9 @@
 XOPT	=
 
 RCFLAGS		= --include-dir=.
+LFLAGS		= -static-libgcc -static-libstdc++
 # Uncomment this if config.h defines RETAIN_WSALASTERROR
-#LFLAGS		= -lws2_32
+#LFLAGS		+= -lws2_32
 
 # ----------------------------------------------------------------------
 # The library can be built with some alternative behaviour to
@@ -97,345 +98,16 @@
 GCE_CFLAGS	= $(PTW32_FLAGS) -mthreads
 
 ## Mingw
-MAKE		?= make
 CFLAGS	= $(OPT) $(XOPT) -I. -DHAVE_PTW32_CONFIG_H -Wall
 
-DLL_INLINED_OBJS	= \
-		pthread.o \
-		version.o
-
-# Agregate modules for inlinability
-DLL_OBJS	= \
-		attr.o \
-		barrier.o \
-		cancel.o \
-		cleanup.o \
-		condvar.o \
-		create.o \
-		dll.o \
-		errno.o \
-		exit.o \
-		fork.o \
-		global.o \
-		misc.o \
-		mutex.o \
-		nonportable.o \
-		private.o \
-		rwlock.o \
-		sched.o \
-		semaphore.o \
-		signal.o \
-		spin.o \
-		sync.o \
-		tsd.o \
-		version.o
-
-# Separate modules for minimum size statically linked images
-SMALL_STATIC_OBJS	= \
-		pthread_attr_init.o \
-		pthread_attr_destroy.o \
-		pthread_attr_getdetachstate.o \
-		pthread_attr_setdetachstate.o \
-		pthread_attr_getstackaddr.o \
-		pthread_attr_setstackaddr.o \
-		pthread_attr_getstacksize.o \
-		pthread_attr_setstacksize.o \
-		pthread_attr_getscope.o \
-		pthread_attr_setscope.o \
-		pthread_attr_setschedpolicy.o \
-		pthread_attr_getschedpolicy.o \
-		pthread_attr_setschedparam.o \
-		pthread_attr_getschedparam.o \
-		pthread_attr_setinheritsched.o \
-		pthread_attr_getinheritsched.o \
-		pthread_barrier_init.o \
-		pthread_barrier_destroy.o \
-		pthread_barrier_wait.o \
-		pthread_barrierattr_init.o \
-		pthread_barrierattr_destroy.o \
-		pthread_barrierattr_setpshared.o \
-		pthread_barrierattr_getpshared.o \
-		pthread_setcancelstate.o \
-		pthread_setcanceltype.o \
-		pthread_testcancel.o \
-		pthread_cancel.o \
-		cleanup.o \
-		pthread_condattr_destroy.o \
-		pthread_condattr_getpshared.o \
-		pthread_condattr_init.o \
-		pthread_condattr_setpshared.o \
-		pthread_cond_destroy.o \
-		pthread_cond_init.o \
-		pthread_cond_signal.o \
-		pthread_cond_wait.o \
-		create.o \
-		dll.o \
-		autostatic.o \
-		errno.o \
-		pthread_exit.o \
-		fork.o \
-		global.o \
-		pthread_mutex_init.o \
-		pthread_mutex_destroy.o \
-		pthread_mutexattr_init.o \
-		pthread_mutexattr_destroy.o \
-		pthread_mutexattr_getpshared.o \
-		pthread_mutexattr_setpshared.o \
-		pthread_mutexattr_settype.o \
-		pthread_mutexattr_gettype.o \
-		pthread_mutexattr_setrobust.o \
-		pthread_mutexattr_getrobust.o \
-		pthread_mutex_lock.o \
-		pthread_mutex_timedlock.o \
-		pthread_mutex_unlock.o \
-		pthread_mutex_trylock.o \
-		pthread_mutex_consistent.o \
-		pthread_mutexattr_setkind_np.o \
-		pthread_mutexattr_getkind_np.o \
-		pthread_getw32threadhandle_np.o \
-		pthread_getunique_np.o \
-		pthread_delay_np.o \
-		pthread_num_processors_np.o \
-		pthread_win32_attach_detach_np.o \
-		pthread_equal.o \
-		pthread_getconcurrency.o \
-		pthread_once.o \
-		pthread_self.o \
-		pthread_setconcurrency.o \
-		pthread_rwlock_init.o \
-		pthread_rwlock_destroy.o \
-		pthread_rwlockattr_init.o \
-		pthread_rwlockattr_destroy.o \
-		pthread_rwlockattr_getpshared.o \
-		pthread_rwlockattr_setpshared.o \
-		pthread_rwlock_rdlock.o \
-		pthread_rwlock_wrlock.o \
-		pthread_rwlock_unlock.o \
-		pthread_rwlock_tryrdlock.o \
-		pthread_rwlock_trywrlock.o \
-		pthread_setschedparam.o \
-		pthread_getschedparam.o \
-		pthread_timechange_handler_np.o \
-		ptw32_is_attr.o \
-		ptw32_cond_check_need_init.o \
-		ptw32_MCS_lock.o \
-		ptw32_mutex_check_need_init.o \
-		ptw32_processInitialize.o \
-		ptw32_processTerminate.o \
-		ptw32_threadStart.o \
-		ptw32_threadDestroy.o \
-		ptw32_tkAssocCreate.o \
-		ptw32_tkAssocDestroy.o \
-		ptw32_callUserDestroyRoutines.o \
-		ptw32_timespec.o \
-		ptw32_throw.o \
-		ptw32_getprocessors.o \
-		ptw32_calloc.o \
-		ptw32_new.o \
-		ptw32_reuse.o \
-		ptw32_semwait.o \
-		ptw32_relmillisecs.o \
-		ptw32_rwlock_check_need_init.o \
-		sched_get_priority_max.o \
-		sched_get_priority_min.o \
-		sched_setscheduler.o \
-		sched_getscheduler.o \
-		sched_yield.o \
-		sem_init.o \
-		sem_destroy.o \
-		sem_trywait.o \
-		sem_timedwait.o \
-		sem_wait.o \
-		sem_post.o \
-		sem_post_multiple.o \
-		sem_getvalue.o \
-		sem_open.o \
-		sem_close.o \
-		sem_unlink.o \
-		signal.o \
-		pthread_kill.o \
-		ptw32_spinlock_check_need_init.o \
-		pthread_spin_init.o \
-		pthread_spin_destroy.o \
-		pthread_spin_lock.o \
-		pthread_spin_unlock.o \
-		pthread_spin_trylock.o \
-		pthread_detach.o \
-		pthread_join.o \
-		pthread_key_create.o \
-		pthread_key_delete.o \
-		pthread_setspecific.o \
-		pthread_getspecific.o \
-		w32_CancelableWait.o \
-		version.o
-
-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
-
-EXIT_SRCS	= \
-		pthread_exit.c
-
-MISC_SRCS	= \
-		pthread_equal.c \
-		pthread_getconcurrency.c \
-		pthread_kill.c \
-		pthread_once.c \
-		pthread_self.c \
-		pthread_setconcurrency.c \
-		ptw32_calloc.c \
-		ptw32_MCS_lock.c \
-		ptw32_new.c \
-		ptw32_reuse.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_mutexattr_setrobust.c \
-		pthread_mutexattr_getrobust.c \
-		pthread_mutex_lock.c \
-		pthread_mutex_timedlock.c \
-		pthread_mutex_unlock.c \
-		pthread_mutex_trylock.c \
-		pthread_mutex_consistent.c
-
-NONPORTABLE_SRCS = \
-		pthread_mutexattr_setkind_np.c \
-		pthread_mutexattr_getkind_np.c \
-		pthread_getw32threadhandle_np.c \
-                pthread_getunique_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_semwait.c \
-		ptw32_relmillisecs.c \
-		ptw32_timespec.c \
-		ptw32_throw.c \
-		ptw32_getprocessors.c
-
-RWLOCK_SRCS	= \
-		ptw32_rwlock_check_need_init.c \
-		ptw32_rwlock_cancelwrwait.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_timedrdlock.c \
-		pthread_rwlock_wrlock.c \
-		pthread_rwlock_timedwrlock.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
-
-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
+OBJEXT = o
+RESEXT = o
 
+include common.mk
+
+DLL_INLINED_OBJS += $(RESOURCE_OBJS)
+DLL_OBJS += $(RESOURCE_OBJS)
+SMALL_STATIC_OBJS += $(RESOURCE_OBJS)
 
 GCE_DLL	= pthreadGCE$(DLL_VER).dll
 GCED_DLL= pthreadGCE$(DLL_VERD).dll
@@ -459,21 +131,40 @@
 
 help:
 	@ echo "Run one of the following command lines:"
-	@ echo "make clean GC            (to build the GNU C dll with C cleanup code)"
-	@ echo "make clean GCE           (to build the GNU C dll with C++ exception handling)"
-	@ echo "make clean GC-inlined    (to build the GNU C inlined dll with C cleanup code)"
-	@ echo "make clean GCE-inlined   (to build the GNU C inlined dll with C++ exception handling)"
-	@ echo "make clean GC-static     (to build the GNU C inlined static lib with C cleanup code)"
-	@ echo "make clean GC-debug      (to build the GNU C debug dll with C cleanup code)"
-	@ echo "make clean GCE-debug     (to build the GNU C debug dll with C++ exception handling)"
-	@ echo "make clean GC-inlined-debug    (to build the GNU C inlined debug dll with C cleanup code)"
-	@ echo "make clean GCE-inlined-debug   (to build the GNU C inlined debug dll with C++ exception handling)"
-	@ echo "make clean GC-static-debug     (to build the GNU C inlined static debug lib with C cleanup code)"
+	@ echo "$(MAKE) clean GC            (to build the GNU C dll with C cleanup code)"
+	@ echo "$(MAKE) clean GCE           (to build the GNU C dll with C++ exception handling)"
+	@ echo "$(MAKE) clean GC-inlined    (to build the GNU C inlined dll with C cleanup code)"
+	@ echo "$(MAKE) clean GCE-inlined   (to build the GNU C inlined dll with C++ exception handling)"
+	@ echo "$(MAKE) clean GC-static     (to build the GNU C inlined static lib with C cleanup code)"
+	@ echo "$(MAKE) clean GC-debug      (to build the GNU C debug dll with C cleanup code)"
+	@ echo "$(MAKE) clean GCE-debug     (to build the GNU C debug dll with C++ exception handling)"
+	@ echo "$(MAKE) clean GC-inlined-debug    (to build the GNU C inlined debug dll with C cleanup code)"
+	@ echo "$(MAKE) clean GCE-inlined-debug   (to build the GNU C inlined debug dll with C++ exception handling)"
+	@ echo "$(MAKE) clean GC-static-debug     (to build the GNU C inlined static debug lib with C cleanup code)"
 
 all:
 	@ $(MAKE) clean GCE
 	@ $(MAKE) clean GC
 
+TEST_ENV = PTW32_FLAGS="$(PTW32_FLAGS) -DNO_ERROR_DIALOGS"
+
+all-tests:
+	$(MAKE) realclean GCE
+	cd tests && $(MAKE) clean GCE $(TEST_ENV)
+	$(MAKE) realclean GC
+	cd tests && $(MAKE) clean GC $(TEST_ENV) && $(MAKE) clean GCX $(TEST_ENV)
+	$(MAKE) realclean GCE-inlined
+	cd tests && $(MAKE) clean GCE $(TEST_ENV)
+	$(MAKE) realclean GC-inlined
+	cd tests && $(MAKE) clean GC $(TEST_ENV) && $(MAKE) clean GCX $(TEST_ENV)
+	$(MAKE) realclean GC-static
+	cd tests && $(MAKE) clean GC-static $(TEST_ENV)
+	@ echo "$@ completed successfully."
+
+all-tests-cflags:
+	$(MAKE) all-tests PTW32_FLAGS="-Wall -Wextra"
+	@ echo "$@ completed successfully."
+
 GC:
 		$(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
 
@@ -499,10 +190,10 @@
 		$(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_CXX -g -O0" $(GCED_INLINED_STAMP)
 
 GC-static:
-		$(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP)
+		$(MAKE) XOPT="-DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP)
 
 GC-static-debug:
-		$(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_STATIC_STAMP)
+		$(MAKE) XOPT="-DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_STATIC_STAMP)
 
 tests:
 	@ cd tests
@@ -544,9 +235,9 @@
 	$(DLLTOOL) -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
 	echo touched > $(GCE_INLINED_STAMP)
 
-$(GC_STATIC_STAMP) $(GCD_STATIC_STAMP): $(DLL_INLINED_OBJS)
+$(GC_STATIC_STAMP) $(GCD_STATIC_STAMP): $(SMALL_STATIC_OBJS)
 	$(RM) $(GC_LIB)
-	$(AR) -rv $(GC_LIB) $(DLL_INLINED_OBJS)
+	$(AR) -rv $(GC_LIB) $(SMALL_STATIC_OBJS)
 	$(RANLIB) $(GC_LIB)
 	echo touched > $(GC_STATIC_STAMP)
 
@@ -575,19 +266,4 @@
 	-$(RM) $(GCED_INLINED_STAMP)
 	-$(RM) $(GCD_STATIC_STAMP)
 
-attr.o:		attr.c $(ATTR_SRCS) $(INCL)
-barrier.o:	barrier.c $(BARRIER_SRCS) $(INCL)
-cancel.o:	cancel.c $(CANCEL_SRCS) $(INCL)
-condvar.o:	condvar.c $(CONDVAR_SRCS) $(INCL)
-exit.o:		exit.c $(EXIT_SRCS) $(INCL)
-misc.o:		misc.c $(MISC_SRCS) $(INCL)
-mutex.o:	mutex.c $(MUTEX_SRCS) $(INCL)
-nonportable.o:	nonportable.c $(NONPORTABLE_SRCS) $(INCL)
-private.o:	private.c $(PRIVATE_SRCS) $(INCL)
-rwlock.o:	rwlock.c $(RWLOCK_SRCS) $(INCL)
-sched.o:	sched.c $(SCHED_SRCS) $(INCL)
-semaphore.o:	semaphore.c $(SEMAPHORE_SRCS) $(INCL)
-spin.o:		spin.c $(SPIN_SRCS) $(INCL)
-sync.o:		sync.c $(SYNC_SRCS) $(INCL)
-tsd.o:		tsd.c $(TSD_SRCS) $(INCL)
-version.o:	version.rc $(INCL)
+# end GNUmakefile
Index: Makefile
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/Makefile,v
retrieving revision 1.54
diff -u -b -r1.54 Makefile
--- Makefile	26 May 2012 11:46:24 -0000	1.54
+++ Makefile	10 Jul 2012 20:47:39 -0000
@@ -46,338 +46,10 @@
 VCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 VCFLAGSD	= $(CPPFLAGS) $(CFLAGSD)
 
-DLL_INLINED_OBJS = \
-		pthread.obj \
-		version.res
-
-# Aggregate modules for inlinability
-DLL_OBJS	= \
-		attr.obj \
-		barrier.obj \
-		cancel.obj \
-		cleanup.obj \
-		condvar.obj \
-		create.obj \
-		dll.obj \
-		autostatic.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 \
-		version.res
-
-# 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 \
-		autostatic.obj \
-		errno.obj \
-		pthread_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_mutexattr_setrobust.obj \
-		pthread_mutexattr_getrobust.obj \
-		pthread_mutex_lock.obj \
-		pthread_mutex_timedlock.obj \
-		pthread_mutex_unlock.obj \
-		pthread_mutex_trylock.obj \
-		pthread_mutex_consistent.obj \
-		pthread_mutexattr_setkind_np.obj \
-		pthread_mutexattr_getkind_np.obj \
-		pthread_getw32threadhandle_np.obj \
-		pthread_getunique_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_getprocessors.obj \
-		ptw32_calloc.obj \
-		ptw32_new.obj \
-		ptw32_reuse.obj \
-		ptw32_rwlock_check_need_init.obj \
-		ptw32_cond_check_need_init.obj \
-		ptw32_mutex_check_need_init.obj \
-		ptw32_semwait.obj \
-		ptw32_relmillisecs.obj \
-		ptw32_MCS_lock.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 \
-		signal.obj \
-		pthread_kill.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 \
-		version.res
-
-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
-
-EXIT_SRCS	= \
-		pthread_exit.c
-
-MISC_SRCS	= \
-		pthread_equal.c \
-		pthread_getconcurrency.c \
-		pthread_kill.c \
-		pthread_once.c \
-		pthread_self.c \
-		pthread_setconcurrency.c \
-		ptw32_calloc.c \
-		ptw32_MCS_lock.c \
-		ptw32_new.c \
-		ptw32_reuse.c \
-		ptw32_relmillisecs.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_mutexattr_setrobust.c \
-		pthread_mutexattr_getrobust.c \
-		pthread_mutex_lock.c \
-		pthread_mutex_timedlock.c \
-		pthread_mutex_unlock.c \
-		pthread_mutex_trylock.c \
-		pthread_mutex_consistent.c
-
-NONPORTABLE_SRCS = \
-		pthread_mutexattr_setkind_np.c \
-		pthread_mutexattr_getkind_np.c \
-		pthread_getw32threadhandle_np.c \
-		pthread_getunique_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_semwait.c \
-		ptw32_timespec.c \
-		ptw32_throw.c \
-		ptw32_getprocessors.c
-
-RWLOCK_SRCS	= \
-		ptw32_rwlock_check_need_init.c \
-		ptw32_rwlock_cancelwrwait.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_timedrdlock.c \
-		pthread_rwlock_wrlock.c \
-		pthread_rwlock_timedwrlock.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
-
-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
+OBJEXT = obj
+RESEXT = res
 
+include common.mk
 
 help:
 	@ echo Run one of the following command lines:
@@ -397,12 +69,36 @@
 	@ echo nmake clean VC-static-debug     (to build the debug MSVC static lib with C cleanup code)
 
 all:
-	@ $(MAKE) /E clean VCE-inlined
-	@ $(MAKE) /E clean VSE-inlined
-	@ $(MAKE) /E clean VC-inlined
-	@ $(MAKE) /E clean VCE-inlined-debug
-	@ $(MAKE) /E clean VSE-inlined-debug
-	@ $(MAKE) /E clean VC-inlined-debug
+	$(MAKE) /E clean VCE-inlined
+	$(MAKE) /E clean VSE-inlined
+	$(MAKE) /E clean VC-inlined
+	$(MAKE) /E clean VCE-inlined-debug
+	$(MAKE) /E clean VSE-inlined-debug
+	$(MAKE) /E clean VC-inlined-debug
+
+TEST_ENV = CFLAGS="$(CFLAGS) /DNO_ERROR_DIALOGS"
+
+all-tests:
+	$(MAKE) /E realclean VCE
+	cd tests && $(MAKE) /E clean VCE $(TEST_ENV)
+	$(MAKE) /E realclean VSE
+	cd tests && $(MAKE) /E clean VSE $(TEST_ENV)
+	$(MAKE) /E realclean VC
+	cd tests && $(MAKE) /E clean VC $(TEST_ENV) && $(MAKE) /E clean VCX $(TEST_ENV)
+	$(MAKE) /E realclean VCE-inlined
+	cd tests && $(MAKE) /E clean VCE $(TEST_ENV)
+	$(MAKE) /E realclean VSE-inlined
+	cd tests && $(MAKE) /E clean VSE $(TEST_ENV)
+	$(MAKE) /E realclean VC-inlined
+	cd tests && $(MAKE) /E clean VC $(TEST_ENV) && $(MAKE) /E clean VCX $(TEST_ENV)
+	$(MAKE) /E realclean VC-static
+	cd tests && $(MAKE) /E clean VC-static $(TEST_ENV)
+	@ echo $@ completed successfully.
+
+all-tests-cflags:
+	$(MAKE) all-tests XCFLAGS="/W3 /WX /MD /nologo"
+	$(MAKE) all-tests XCFLAGS="/W3 /WX /MT /nologo"
+	@ echo $@ completed successfully.
 
 VCE:
 	@ $(MAKE) /E /nologo EHFLAGS="$(VCEFLAGS)" CLEANUP=__CLEANUP_CXX pthreadVCE$(DLL_VER).dll
@@ -445,10 +141,10 @@
 	@ $(MAKE) /E /nologo EHFLAGS="$(VCFLAGSD) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VERD).stamp
 
 VC-static:
-	@ $(MAKE) /E /nologo EHFLAGS="$(VCFLAGS) /DPTW32_BUILD_INLINED /DPTW32_STATIC_LIB" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VER).static
+	@ $(MAKE) /E /nologo EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VER).static
 
 VC-static-debug:
-	@ $(MAKE) /E /nologo EHFLAGS="$(VCFLAGSD) /DPTW32_BUILD_INLINED /DPTW32_STATIC_LIB" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VERD).static
+	@ $(MAKE) /E /nologo EHFLAGS="$(VCFLAGSD) /DPTW32_STATIC_LIB" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VERD).static
 
 realclean: clean
 	if exist pthread*.dll del pthread*.dll
@@ -467,23 +163,22 @@
 	if exist *.i del *.i
 	if exist *.res del *.res
 
-
 install:
-	copy pthread*.dll $(DLLDEST)
+	if exist pthread*.dll copy pthread*.dll $(DLLDEST)
 	copy pthread*.lib $(LIBDEST)
 	copy pthread.h $(HDRDEST)
 	copy sched.h $(HDRDEST)
 	copy semaphore.h $(HDRDEST)
 
-$(DLLS): $(DLL_OBJS)
-	$(CC) /LDd /Zi /nologo $(DLL_OBJS) /link /implib:$*.lib $(XLIBS) /out:$@
+$(DLLS): $(DLL_OBJS) $(RESOURCE_OBJS)
+	$(CC) /LDd /Zi /nologo $(DLL_OBJS) $(RESOURCE_OBJS) /link /implib:$*.lib $(XLIBS) /out:$@
 
-$(INLINED_STAMPS): $(DLL_INLINED_OBJS)
-	$(CC) /LDd /Zi /nologo $(DLL_INLINED_OBJS) /link /implib:$*.lib $(XLIBS) /out:$*.dll
+$(INLINED_STAMPS): $(DLL_INLINED_OBJS) $(RESOURCE_OBJS)
+	$(CC) /LDd /Zi /nologo $(DLL_INLINED_OBJS) $(RESOURCE_OBJS) /link /implib:$*.lib $(XLIBS) /out:$*.dll
 
-$(STATIC_STAMPS): $(DLL_INLINED_OBJS)
+$(STATIC_STAMPS): $(SMALL_STATIC_OBJS) $(RESOURCE_OBJS)
 	if exist $*.lib del $*.lib
-	lib $(DLL_INLINED_OBJS) /out:$*.lib
+	lib $(SMALL_STATIC_OBJS) $(RESOURCE_OBJS) /out:$*.lib
 
 .c.obj:
 	$(CC) $(EHFLAGS) /D$(CLEANUP) -c $<
@@ -496,19 +191,4 @@
 .c.i:
 	$(CC) /P /O2 /Ob1 $(VCFLAGS) $<
 
-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)
-exit.obj:	exit.c $(EXIT_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)
-version.res:	version.rc $(INCL)
+# end Makefile
Index: tests/GNUmakefile
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/tests/GNUmakefile,v
retrieving revision 1.64
diff -u -b -r1.64 GNUmakefile
--- tests/GNUmakefile	27 May 2012 04:15:08 -0000	1.64
+++ tests/GNUmakefile	10 Jul 2012 20:47:39 -0000
@@ -37,10 +37,9 @@
 MV	= mv -f
 RM	= rm -f
 CAT	= cat
+ECHO	= echo
 MKDIR	= mkdir
-TOUCH	= echo Passed >
-ECHO	= @echo
-MAKE	= make -k
+TOUCH	= $(ECHO) Passed >
 
 # For cross compiling use e.g.
 # # make CROSS=i386-mingw32msvc- clean GC
@@ -59,12 +58,12 @@
 #
 # Mingw32
 #
+XLIBS	=
 XXCFLAGS	= 
-XXLIBS	= -lws2_32 -lgomp
+XXLIBS	=
 OPT	= -O3
 DOPT	= -g -O0
-#CFLAGS	= -O3 -UNDEBUG -Wall $(XXCFLAGS)
-CFLAGS	= ${OPT} -UNDEBUG -Wall $(XXCFLAGS)
+CFLAGS	= ${OPT} -static-libgcc -UNDEBUG -Wall $(XXCFLAGS) $(PTW32_FLAGS)
 BUILD_DIR	= ..
 INCLUDES	= -I.
 
@@ -172,15 +171,15 @@
 
 help:
 	@ $(ECHO) "Run one of the following command lines:"
-	@ $(ECHO) "make clean GC    (to test using GC dll with C (no EH) applications)"
-	@ $(ECHO) "make clean GCX   (to test using GC dll with C++ (EH) applications)"
-	@ $(ECHO) "make clean GCE   (to test using GCE dll with C++ (EH) applications)"
-	@ $(ECHO) "make clean GC-bench	  (to benchtest using GNU C dll with C cleanup code)"
-	@ $(ECHO) "make clean GCE-bench   (to benchtest using GNU C dll with C++ exception handling)"
-	@ $(ECHO) "make clean GC-stress	  (to stresstest using GNU C dll with C cleanup code)"
-	@ $(ECHO) "make clean GCE-stress   (to stresstest using GNU C dll with C++ exception handling)"
-	@ $(ECHO) "make clean GC-static   (to test using GC static lib with C (no EH) applications)"
-	@ $(ECHO) "make clean GC-debug    (to test using GC dll with C (no EH) applications)"
+	@ $(ECHO) "$(MAKE) clean GC          (to test using GC dll with C (no EH) applications)"
+	@ $(ECHO) "$(MAKE) clean GCX         (to test using GC dll with C++ (EH) applications)"
+	@ $(ECHO) "$(MAKE) clean GCE         (to test using GCE dll with C++ (EH) applications)"
+	@ $(ECHO) "$(MAKE) clean GC-bench    (to benchtest using GNU C dll with C cleanup code)"
+	@ $(ECHO) "$(MAKE) clean GCE-bench   (to benchtest using GNU C dll with C++ exception handling)"
+	@ $(ECHO) "$(MAKE) clean GC-stress   (to stresstest using GNU C dll with C cleanup code)"
+	@ $(ECHO) "$(MAKE) clean GCE-stress  (to stresstest using GNU C dll with C++ exception handling)"
+	@ $(ECHO) "$(MAKE) clean GC-static   (to test using GC static lib with C (no EH) applications)"
+	@ $(ECHO) "$(MAKE) clean GC-debug    (to test using GC dll with C (no EH) applications)"
 
 all:
 	@ $(MAKE) clean GC
@@ -188,28 +187,28 @@
 	@ $(MAKE) clean GCE
 
 GC:
-	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-pass
+	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" all-pass
 
 GC-asm:
-	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-asm
+	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" all-asm
 
 GCE:
-	$(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_CXX" all-pass
+	$(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -static-libstdc++ -D__CLEANUP_CXX" all-pass
 
 GCX:
-	$(MAKE) TEST=GC CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_C" all-pass
+	$(MAKE) TEST=GC CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_C" all-pass
 
 GC-bench:
 	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
 
 GCE-bench:
-	$(MAKE) TEST=GCE  CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
+	$(MAKE) TEST=GCE  CC=$(CXX) XXCFLAGS="-mthreads -static-libstdc++ -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
 
 GC-debug:
-	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
+	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
 
 GCE-debug:
-	$(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -D__CLEANUP_CXX" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
+	$(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-static-libstdc++ -D__CLEANUP_CXX" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
 
 GC-bench-debug:
 	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" OPT="${OPT}" DLL_VER="$(DLL_VER)d" all-bench
@@ -218,28 +217,33 @@
 	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" XXLIBS="-lws2_32" DLL="" all-static
 
 GC-stress:
-	$(ECHO) Stress tests can take a long time since they are trying to
-	$(ECHO) expose weaknesses that may be intermittant or statistically rare.
-	$(ECHO) A pass does not prove correctness, but may give greater confidence.
+	@ $(ECHO) "Stress tests can take a long time since they are trying to"
+	@ $(ECHO) "expose weaknesses that may be intermittant or statistically rare."
+	@ $(ECHO) "A pass does not prove correctness, but may give greater confidence."
 	$(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="" all-stress
 
 GCE-stress:
-	$(MAKE) TEST=GCE  CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="" all-stress
+	$(MAKE) TEST=GCE  CC=$(CXX) XXCFLAGS="-mthreads -static-libstdc++ -D__CLEANUP_CXX" XXLIBS="" all-stress
 
 all-asm: $(ASM)
-	@ $(ECHO) ALL TESTS PASSED! Congratulations!
+	@ $(ECHO) "ALL TESTS PASSED! Congratulations!"
 
 all-pass: $(PASSES)
-	@ $(ECHO) ALL TESTS PASSED! Congratulations!
+	@ $(ECHO) "ALL TESTS PASSED! Congratulations!"
 
 all-bench: $(BENCHRESULTS)
-	@ $(ECHO) BENCH TESTS COMPLETED.
+	@ $(ECHO) "BENCH TESTS COMPLETED."
 
 all-stress: $(STRESSRESULTS)
-	@ $(ECHO) STRESS TESTS COMPLETED.
+	@ $(ECHO) "STRESS TESTS COMPLETED."
 
 all-static: $(STATICRESULTS)
-	@ $(ECHO) ALL STATIC TESTS PASSED! Congratulations!
+	@ $(ECHO) "ALL STATIC TESTS PASSED! Congratulations!"
+
+cancel9.exe: XLIBS = -lws2_32
+
+openmp1.exe: CFLAGS += -fopenmp
+openmp1.exe: XLIBS = -Wl,-Bstatic -lgomp -Wl,-Bdynamic
 
 benchtest1.bench:
 benchtest2.bench:
@@ -404,15 +408,14 @@
 
 %.exe: %.c $(LIB) $(DLL) $(HDR) $(QAPC)
 	@ $(ECHO) Compiling $@
-	@ $(ECHO) $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS)
-	@ $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS)
+	$(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) $(XLIBS) $(XXLIBS)
 
 %.pre: %.c $(HDR)
-	@ $(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
+	$(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
 
 %.s: %.c $(HDR)
 	@ $(ECHO) Compiling $@
-	@ $(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
+	$(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
 
 $(COPYFILES):
 	@ $(ECHO) Copying $(BUILD_DIR)/$@
@@ -420,8 +423,7 @@
 
 benchlib.o: benchlib.c
 	@ $(ECHO) Compiling $@
-	@ $(ECHO) $(CC) -c $(CFLAGS) $< $(INCLUDES)
-	@ $(CC) -c $(CFLAGS) $< $(INCLUDES)
+	$(CC) -c $(CFLAGS) $< $(INCLUDES)
 
 pthread.dll: $(DLL)
 	@ $(CP) $(DLL) $@
Index: tests/Makefile
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/tests/Makefile,v
retrieving revision 1.85
diff -u -b -r1.85 Makefile
--- tests/Makefile	27 May 2012 04:15:09 -0000	1.85
+++ tests/Makefile	10 Jul 2012 20:47:39 -0000
@@ -36,9 +36,9 @@
 CP	= copy
 RM	= erase
 CAT	= type
-MKDIR	= mkdir
-TOUCH	= echo Passed >
 ECHO	= echo
+MKDIR	= mkdir
+TOUCH	= $(ECHO) Passed >
 
 # The next path is relative to $BUILD_DIR
 QAPC	= # ..\QueueUserAPCEx\User\quserex.dll
@@ -170,19 +170,19 @@
 
 help:
 	@ $(ECHO) Run one of the following command lines:
-	@ $(ECHO) nmake clean VC          (to test using VC dll with VC (no EH) apps)
-	@ $(ECHO) nmake clean VC-bench    (to benchtest using VC dll with C bench apps)
-	@ $(ECHO) nmake clean VC-stress   (to stresstest using VC dll with C stress apps)
-	@ $(ECHO) nmake clean VC-static   (to test using VC static lib with VC (no EH) apps)
-	@ $(ECHO) nmake clean VCX         (to test using VC dll with VC++ (EH) applications)
-	@ $(ECHO) nmake clean VCX-bench   (to benchtest using VC dll with C++ bench apps)
-	@ $(ECHO) nmake clean VCX-stress  (to stresstest using VC dll with C++ stress apps)
-	@ $(ECHO) nmake clean VCE         (to test using the VCE dll with VC++ EH applications)
-	@ $(ECHO) nmake clean VCE-bench   (to benchtest using VCE dll with C++ bench apps)
-	@ $(ECHO) nmake clean VCE-stress  (to stresstest using VCE dll with C++ stress apps)
-	@ $(ECHO) nmake clean VSE         (to test using VSE dll with VC (SEH) apps)
-	@ $(ECHO) nmake clean VSE-bench   (to benchtest using VSE dll with SEH bench apps)
-	@ $(ECHO) nmake clean VSE-stress  (to stresstest using VSE dll with SEH stress apps)
+	@ $(ECHO) $(MAKE) clean VC          (to test using VC dll with VC (no EH) apps)
+	@ $(ECHO) $(MAKE) clean VC-bench    (to benchtest using VC dll with C bench apps)
+	@ $(ECHO) $(MAKE) clean VC-stress   (to stresstest using VC dll with C stress apps)
+	@ $(ECHO) $(MAKE) clean VC-static   (to test using VC static lib with VC (no EH) apps)
+	@ $(ECHO) $(MAKE) clean VCX         (to test using VC dll with VC++ (EH) applications)
+	@ $(ECHO) $(MAKE) clean VCX-bench   (to benchtest using VC dll with C++ bench apps)
+	@ $(ECHO) $(MAKE) clean VCX-stress  (to stresstest using VC dll with C++ stress apps)
+	@ $(ECHO) $(MAKE) clean VCE         (to test using the VCE dll with VC++ EH applications)
+	@ $(ECHO) $(MAKE) clean VCE-bench   (to benchtest using VCE dll with C++ bench apps)
+	@ $(ECHO) $(MAKE) clean VCE-stress  (to stresstest using VCE dll with C++ stress apps)
+	@ $(ECHO) $(MAKE) clean VSE         (to test using VSE dll with VC (SEH) apps)
+	@ $(ECHO) $(MAKE) clean VSE-bench   (to benchtest using VSE dll with SEH bench apps)
+	@ $(ECHO) $(MAKE) clean VSE-stress  (to stresstest using VSE dll with SEH stress apps)
 
 all:
 	@ $(MAKE) /E clean VC
@@ -234,54 +234,52 @@
 	@ $(TOUCH) $*.pass
 
 VC:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" tests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" tests
 
 VCE:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" tests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" tests
 
 VSE:	
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests
 
 VCX:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" tests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" tests
 
 VC-bench:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" XXLIBS="benchlib.o" benchtests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" XXLIBS="benchlib.o" benchtests
 
 VCE-bench:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" XXLIBS="benchlib.o" benchtests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" XXLIBS="benchlib.o" benchtests
 
 VSE-bench:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" XXLIBS="benchlib.o" benchtests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" XXLIBS="benchlib.o" benchtests
 
 VCX-bench:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests
 
 VC-stress:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" stresstests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" stresstests
 
 VCE-stress:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" stresstests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" stresstests
 
 VSE-stress:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" stresstests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" stresstests
 
 VCX-stress:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" stresstests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" stresstests
 
 VC-static:
-	@ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" statictests
+	@ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" statictests
 
 .c.exe:
-	@ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
-	@ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
+	$(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
 
 .c.o:
-	@ $(ECHO) $(CC) $(EHFLAGS) /c $(CFLAGS) $(INCLUDES) $< /Fo$@
-	@ $(CC) $(EHFLAGS) $(CFLAGS) /c $(INCLUDES) $< /Fo$@
+	$(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) /c $< /Fo$@
 
 .c.i:
-	@ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
+	$(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
 
 $(COPYFILES):
 	@ $(ECHO) Copying $(BUILD_DIR)\$@

[-- Attachment #3: New file for 'cvs add' --]
[-- Type: text/plain, Size: 10551 bytes --]

# Common makefile definitions

RESOURCE_OBJS	= \
		version.$(RESEXT)

DLL_INLINED_OBJS = \
		pthread.$(OBJEXT)

# Aggregate modules for inlinability
DLL_OBJS	= \
		attr.$(OBJEXT) \
		barrier.$(OBJEXT) \
		cancel.$(OBJEXT) \
		cleanup.$(OBJEXT) \
		condvar.$(OBJEXT) \
		create.$(OBJEXT) \
		dll.$(OBJEXT) \
		errno.$(OBJEXT) \
		exit.$(OBJEXT) \
		fork.$(OBJEXT) \
		global.$(OBJEXT) \
		misc.$(OBJEXT) \
		mutex.$(OBJEXT) \
		nonportable.$(OBJEXT) \
		private.$(OBJEXT) \
		rwlock.$(OBJEXT) \
		sched.$(OBJEXT) \
		semaphore.$(OBJEXT) \
		signal.$(OBJEXT) \
		spin.$(OBJEXT) \
		sync.$(OBJEXT) \
		tsd.$(OBJEXT)

# Separate modules for minimising the size of statically linked images
SMALL_STATIC_OBJS	= \
		autostatic.$(OBJEXT) \
		cleanup.$(OBJEXT) \
		create.$(OBJEXT) \
		dll.$(OBJEXT) \
		errno.$(OBJEXT) \
		fork.$(OBJEXT) \
		global.$(OBJEXT) \
		pthread_attr_destroy.$(OBJEXT) \
		pthread_attr_getdetachstate.$(OBJEXT) \
		pthread_attr_getinheritsched.$(OBJEXT) \
		pthread_attr_getschedparam.$(OBJEXT) \
		pthread_attr_getschedpolicy.$(OBJEXT) \
		pthread_attr_getscope.$(OBJEXT) \
		pthread_attr_getstackaddr.$(OBJEXT) \
		pthread_attr_getstacksize.$(OBJEXT) \
		pthread_attr_init.$(OBJEXT) \
		pthread_attr_setdetachstate.$(OBJEXT) \
		pthread_attr_setinheritsched.$(OBJEXT) \
		pthread_attr_setschedparam.$(OBJEXT) \
		pthread_attr_setschedpolicy.$(OBJEXT) \
		pthread_attr_setscope.$(OBJEXT) \
		pthread_attr_setstackaddr.$(OBJEXT) \
		pthread_attr_setstacksize.$(OBJEXT) \
		pthread_barrier_destroy.$(OBJEXT) \
		pthread_barrier_init.$(OBJEXT) \
		pthread_barrier_wait.$(OBJEXT) \
		pthread_barrierattr_destroy.$(OBJEXT) \
		pthread_barrierattr_getpshared.$(OBJEXT) \
		pthread_barrierattr_init.$(OBJEXT) \
		pthread_barrierattr_setpshared.$(OBJEXT) \
		pthread_cancel.$(OBJEXT) \
		pthread_cond_destroy.$(OBJEXT) \
		pthread_cond_init.$(OBJEXT) \
		pthread_cond_signal.$(OBJEXT) \
		pthread_cond_wait.$(OBJEXT) \
		pthread_condattr_destroy.$(OBJEXT) \
		pthread_condattr_getpshared.$(OBJEXT) \
		pthread_condattr_init.$(OBJEXT) \
		pthread_condattr_setpshared.$(OBJEXT) \
		pthread_delay_np.$(OBJEXT) \
		pthread_detach.$(OBJEXT) \
		pthread_equal.$(OBJEXT) \
		pthread_exit.$(OBJEXT) \
		pthread_getconcurrency.$(OBJEXT) \
		pthread_getschedparam.$(OBJEXT) \
		pthread_getspecific.$(OBJEXT) \
		pthread_getunique_np.$(OBJEXT) \
		pthread_getw32threadhandle_np.$(OBJEXT) \
		pthread_join.$(OBJEXT) \
		pthread_key_create.$(OBJEXT) \
		pthread_key_delete.$(OBJEXT) \
		pthread_kill.$(OBJEXT) \
		pthread_mutex_consistent.$(OBJEXT) \
		pthread_mutex_destroy.$(OBJEXT) \
		pthread_mutex_init.$(OBJEXT) \
		pthread_mutex_lock.$(OBJEXT) \
		pthread_mutex_timedlock.$(OBJEXT) \
		pthread_mutex_trylock.$(OBJEXT) \
		pthread_mutex_unlock.$(OBJEXT) \
		pthread_mutexattr_destroy.$(OBJEXT) \
		pthread_mutexattr_getkind_np.$(OBJEXT) \
		pthread_mutexattr_getpshared.$(OBJEXT) \
		pthread_mutexattr_getrobust.$(OBJEXT) \
		pthread_mutexattr_gettype.$(OBJEXT) \
		pthread_mutexattr_init.$(OBJEXT) \
		pthread_mutexattr_setkind_np.$(OBJEXT) \
		pthread_mutexattr_setpshared.$(OBJEXT) \
		pthread_mutexattr_setrobust.$(OBJEXT) \
		pthread_mutexattr_settype.$(OBJEXT) \
		pthread_num_processors_np.$(OBJEXT) \
		pthread_once.$(OBJEXT) \
		pthread_rwlock_destroy.$(OBJEXT) \
		pthread_rwlock_init.$(OBJEXT) \
		pthread_rwlock_rdlock.$(OBJEXT) \
		pthread_rwlock_timedrdlock.$(OBJEXT) \
		pthread_rwlock_timedwrlock.$(OBJEXT) \
		pthread_rwlock_tryrdlock.$(OBJEXT) \
		pthread_rwlock_trywrlock.$(OBJEXT) \
		pthread_rwlock_unlock.$(OBJEXT) \
		pthread_rwlock_wrlock.$(OBJEXT) \
		pthread_rwlockattr_destroy.$(OBJEXT) \
		pthread_rwlockattr_getpshared.$(OBJEXT) \
		pthread_rwlockattr_init.$(OBJEXT) \
		pthread_rwlockattr_setpshared.$(OBJEXT) \
		pthread_self.$(OBJEXT) \
		pthread_setcancelstate.$(OBJEXT) \
		pthread_setcanceltype.$(OBJEXT) \
		pthread_setconcurrency.$(OBJEXT) \
		pthread_setschedparam.$(OBJEXT) \
		pthread_setspecific.$(OBJEXT) \
		pthread_spin_destroy.$(OBJEXT) \
		pthread_spin_init.$(OBJEXT) \
		pthread_spin_lock.$(OBJEXT) \
		pthread_spin_trylock.$(OBJEXT) \
		pthread_spin_unlock.$(OBJEXT) \
		pthread_testcancel.$(OBJEXT) \
		pthread_timechange_handler_np.$(OBJEXT) \
		pthread_win32_attach_detach_np.$(OBJEXT) \
		ptw32_MCS_lock.$(OBJEXT) \
		ptw32_callUserDestroyRoutines.$(OBJEXT) \
		ptw32_calloc.$(OBJEXT) \
		ptw32_cond_check_need_init.$(OBJEXT) \
		ptw32_getprocessors.$(OBJEXT) \
		ptw32_is_attr.$(OBJEXT) \
		ptw32_mutex_check_need_init.$(OBJEXT) \
		ptw32_new.$(OBJEXT) \
		ptw32_processInitialize.$(OBJEXT) \
		ptw32_processTerminate.$(OBJEXT) \
		ptw32_relmillisecs.$(OBJEXT) \
		ptw32_reuse.$(OBJEXT) \
		ptw32_rwlock_cancelwrwait.$(OBJEXT) \
		ptw32_rwlock_check_need_init.$(OBJEXT) \
		ptw32_semwait.$(OBJEXT) \
		ptw32_spinlock_check_need_init.$(OBJEXT) \
		ptw32_threadDestroy.$(OBJEXT) \
		ptw32_threadStart.$(OBJEXT) \
		ptw32_throw.$(OBJEXT) \
		ptw32_timespec.$(OBJEXT) \
		ptw32_tkAssocCreate.$(OBJEXT) \
		ptw32_tkAssocDestroy.$(OBJEXT) \
		sched_get_priority_max.$(OBJEXT) \
		sched_get_priority_min.$(OBJEXT) \
		sched_getscheduler.$(OBJEXT) \
		sched_setscheduler.$(OBJEXT) \
		sched_yield.$(OBJEXT) \
		sem_close.$(OBJEXT) \
		sem_destroy.$(OBJEXT) \
		sem_getvalue.$(OBJEXT) \
		sem_init.$(OBJEXT) \
		sem_open.$(OBJEXT) \
		sem_post.$(OBJEXT) \
		sem_post_multiple.$(OBJEXT) \
		sem_timedwait.$(OBJEXT) \
		sem_trywait.$(OBJEXT) \
		sem_unlink.$(OBJEXT) \
		sem_wait.$(OBJEXT) \
		signal.$(OBJEXT) \
		w32_CancelableWait.$(OBJEXT)

INCL		= \
		config.h \
		implement.h \
		need_errno.h \
		pthread.h \
		semaphore.h \
		need_errno.h

ATTR_SRCS	= \
		pthread_attr_init.c \
		pthread_attr_destroy.c \
		pthread_attr_getdetachstate.c \
		pthread_attr_setdetachstate.c \
		pthread_attr_getscope.c \
		pthread_attr_setscope.c \
		pthread_attr_getstackaddr.c \
		pthread_attr_setstackaddr.c \
		pthread_attr_getstacksize.c \
		pthread_attr_setstacksize.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

EXIT_SRCS	= \
		pthread_exit.c

MISC_SRCS	= \
		pthread_equal.c \
		pthread_getconcurrency.c \
		pthread_kill.c \
		pthread_once.c \
		pthread_self.c \
		pthread_setconcurrency.c \
		ptw32_calloc.c \
		ptw32_MCS_lock.c \
		ptw32_new.c \
		ptw32_reuse.c \
		ptw32_relmillisecs.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_mutexattr_setrobust.c \
		pthread_mutexattr_getrobust.c \
		pthread_mutex_lock.c \
		pthread_mutex_timedlock.c \
		pthread_mutex_unlock.c \
		pthread_mutex_trylock.c \
		pthread_mutex_consistent.c

NONPORTABLE_SRCS = \
		pthread_mutexattr_setkind_np.c \
		pthread_mutexattr_getkind_np.c \
		pthread_getw32threadhandle_np.c \
		pthread_getunique_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_semwait.c \
		ptw32_timespec.c \
		ptw32_throw.c \
		ptw32_getprocessors.c

RWLOCK_SRCS	= \
		ptw32_rwlock_check_need_init.c \
		ptw32_rwlock_cancelwrwait.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_timedrdlock.c \
		pthread_rwlock_wrlock.c \
		pthread_rwlock_timedwrlock.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

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

attr.$(OBJEXT):		attr.c $(ATTR_SRCS) $(INCL)
barrier.$(OBJEXT):	barrier.c $(BARRIER_SRCS) $(INCL)
cancel.$(OBJEXT):	cancel.c $(CANCEL_SRCS) $(INCL)
condvar.$(OBJEXT):	condvar.c $(CONDVAR_SRCS) $(INCL)
exit.$(OBJEXT):		exit.c $(EXIT_SRCS) $(INCL)
misc.$(OBJEXT):		misc.c $(MISC_SRCS) $(INCL)
mutex.$(OBJEXT):	mutex.c $(MUTEX_SRCS) $(INCL)
nonportable.$(OBJEXT):	nonportable.c $(NONPORTABLE_SRCS) $(INCL)
private.$(OBJEXT):	private.c $(PRIVATE_SRCS) $(INCL)
rwlock.$(OBJEXT):	rwlock.c $(RWLOCK_SRCS) $(INCL)
sched.$(OBJEXT):	sched.c $(SCHED_SRCS) $(INCL)
semaphore.$(OBJEXT):	semaphore.c $(SEMAPHORE_SRCS) $(INCL)
spin.$(OBJEXT):		spin.c $(SPIN_SRCS) $(INCL)
sync.$(OBJEXT):		sync.c $(SYNC_SRCS) $(INCL)
tsd.$(OBJEXT):		tsd.c $(TSD_SRCS) $(INCL)
version.$(RESEXT):	version.rc $(INCL)

# end common.mk

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Makefile fixes
  2012-07-10 20:57 [PATCH] Makefile fixes Daniel Richard G.
@ 2012-08-11  8:06 ` Ross Johnson
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Johnson @ 2012-08-11  8:06 UTC (permalink / raw)
  To: pthreads-win32

After some off-list collaboration pretty much all of these changes have 
been applied now, although some are optional, e.g. by way of 
uncommenting the makefiles in places etc., in particular the static 
linking of libgcc etc. with the rationale being to maintain consistency 
with existing use.

In addition to these, static linked builds have been fixed with patches 
again from Daniel. The autostatic.c code was not being linked in.

Thanks.

On 11/07/2012 6:56 AM, Daniel Richard G. wrote:
> Hello list,
>
> I have a series of patches to contribute to pthreads-win32. This is 
> the first one.
>
> The attached patch, against the CVS source, does the following:
>
> * Factors out the long lists of object and source files and object
>   dependencies into common.mk (also attached as I can't do "cvs add"),
>   which is now included by Bmakefile, GNUmakefile and Makefile. Variables
>   are used to address the different object/resource file extensions.
>
>   I had noticed inconsistencies among the lists of objects/sources in 
> each
>   of the three makefiles, so this approach will put an end to that.
>
> * Fixes incorrect flags/objects used for building the static library
>
> * Adjusts some compiler flags to facilitate building and testing the
>   library
>
> * Adds targets (all-tests, all-tests-cflags) to run the test suite on all
>   of the library's build configurations, as these tend to have different
>   codepaths that can significantly affect correctness
>
> * "Make" syntax tweaks
>
>
> Below is a more detailed walk-through of the changes:
>
> ++ Bmakefile
>
> @ Factored out common variable definitions into common.mk
>
> @ Use new RESOURCE_OBJS variable instead of a literal "version.res"
>
> @ Factored out common dependencies into common.mk
>
>   Added end-of-file comment
>
> ++ GNUmakefile
>
> @ I had trouble with test programs not running because DLLs for
>   libgcc/libstdc++/libgomp were not in the PATH, so these flags will link
>   them statically. (As MinGW is intended to produce "standalone" 
> binaries,
>   this is what most people will probably want to do anyway)
>
> @ MAKE is already set by the Make program
>
>   Factored out common variable definitions into common.mk
>
>   As GNU Make supports "+=", use this to add RESOURCE_OBJS to the three
>   object-file-list variables
>
> @ Use $(MAKE), not "make" in the help text (e.g. MAKE could be "gmake")
>
>   New all-tests and all-tests-cflags targets (note that the latter is 
> less
>   useful for MinGW compared to MSVC)
>
> @ Static builds use small objects, not inlined/aggregate ones, so
>   -DPTW32_BUILD_INLINED doesn't belong here
>
> @ Likewise, static builds should use SMALL_STATIC_OBJS, not
>   DLL_INLINED_OBJS
>
> @ Factored out common dependencies into common.mk
>
>   Added end-of-file comment
>
> ++ Makefile
>
> @ Factored out common variable definitions into common.mk
>
> @ Removed "@" prefix from $(MAKE) invocations in the "all" target, as 
> that
>   suppressed useful information (e.g. if you're redirecting terminal 
> output
>   to a file for later review)
>
>   New all-tests and all-tests-cflags targets (the latter covers both /MD
>   and /MT configurations)
>
> @ Static builds use small objects, not inlined/aggregate ones, so
>   -DPTW32_BUILD_INLINED doesn't belong here
>
> @ Fixed "install" rule for static builds (no *.dll file)
>
> @ Added new RESOURCE_OBJS variable where needed
>
>   Static builds should use SMALL_STATIC_OBJS, not DLL_INLINED_OBJS
>
> @ Factored out common dependencies into common.mk
>
>   Added end-of-file comment
>
> ++ tests/GNUmakefile
>
> @ ECHO should be defined without the "@", as that is already given in the
>   target recipes
>
>   Define TOUCH so that it uses ECHO
>
>   Define ECHO before TOUCH, for ordering
>
>   Don't define MAKE, because that should be set by the Make program 
> itself
>
> @ New variable XLIBS, to specify system/third-party libraries needed by
>   some tests
>
>   Only a couple of tests need -lws2_32 -lgomp; don't add these libs to
>   everything if we can help it
>
>   Use -static-libgcc and PTW32_FLAGS in CFLAGS, to avoid a dynamic
>   dependency on libgcc and build with the same flags as the ptw32 library
>
> @ Replaced "make" with $(MAKE), and a nice straight margin for the target
>   descriptions
>
> @ Only one test needs -fopenmp; don't add it to everything
>
>   Added -static-libstdc++ where useful
>
> @ Normalized use of $(ECHO): prefixed by "@", and argument is 
> double-quoted
>
>   Add -lws2_32, -fopenmp et al. only to the tests that need them, 
> using GNU
>   Make magic
>
> @ Show the compiler invocations directly
>
>   The -lsupc++ bit only caused errors on my system
>
>   XLIBS is used here
>
> @ idem
>
> ++ tests/Makefile
>
> @ Define TOUCH so that it uses ECHO
>
>   Define ECHO before TOUCH, for ordering
>
> @ Use $(MAKE), not "nmake" in the help text
>
> @ Use /nologo in the various $(MAKE) invocations to get rid of annoying
>   Microsoft boilerplate
>
>   Show the compiler invocations directly
>
>
> --Daniel
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-11  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 20:57 [PATCH] Makefile fixes Daniel Richard G.
2012-08-11  8:06 ` Ross Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).