aboutsummaryrefslogtreecommitdiff
path: root/pthreads/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'pthreads/GNUmakefile')
-rw-r--r--pthreads/GNUmakefile645
1 files changed, 197 insertions, 448 deletions
diff --git a/pthreads/GNUmakefile b/pthreads/GNUmakefile
index a117dfe51..10ec13c91 100644
--- a/pthreads/GNUmakefile
+++ b/pthreads/GNUmakefile
@@ -3,9 +3,7 @@
#
# Pthreads-win32 - POSIX Threads Library for Win32
# Copyright(C) 1998 John E. Bossom
-# Copyright(C) 1999,2005 Pthreads-win32 contributors
-#
-# Contact Email: rpj@callisto.canberra.edu.au
+# Copyright(C) 1999,2012 Pthreads-win32 contributors
#
# The current list of contributors is contained
# in the file CONTRIBUTORS included with the source
@@ -29,41 +27,83 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
-DLL_VER = 2
-DLL_VERD= $(DLL_VER)d
+DLL_VER = 2$(EXTRAVERSION)
-DEVROOT = C:\PTHREADS
+# See pthread.h and README for the description of version numbering.
+DLL_VERD= $(DLL_VER)d
-DLLDEST = $(DEVROOT)\DLL
-LIBDEST = $(DEVROOT)\DLL
+DESTROOT = ../PTHREADS-BUILT
+DEST_LIB_NAME = libpthread.a
+DLLDEST = $(DESTROOT)/bin
+LIBDEST = $(DESTROOT)/lib
+HDRDEST = $(DESTROOT)/include
# If Running MsysDTK
RM = rm -f
MV = mv -f
CP = cp -f
+MKDIR = mkdir -p
+ECHO = echo
+TESTNDIR = test ! -d
+TESTFILE = test -f
+AND = &&
# If not.
#RM = erase
#MV = rename
#CP = copy
+#MKDIR = mkdir
+#ECHO = echo
+#TESTNDIR = if exist
+#TESTFILE = if exist
+# AND =
# For cross compiling use e.g.
# make CROSS=x86_64-w64-mingw32- clean GC-inlined
CROSS =
-AR = $(CROSS)ar
+AR = $(CROSS)ar
DLLTOOL = $(CROSS)dlltool
CC = $(CROSS)gcc
CXX = $(CROSS)g++
RANLIB = $(CROSS)ranlib
-RC = $(CROSS)windres
-
-OPT = $(CLEANUP) -O3 # -finline-functions -findirect-inlining
-XOPT =
-
-RCFLAGS = --include-dir=.
+RC = $(CROSS)windres
+
+# Build for non-native architecture. E.g. "-m64" "-m32" etc.
+# Not fully tested fully, needs gcc built with "--enable-multilib"
+# Check your "gcc -v" output for the options used to build your gcc.
+# You can set this as a shell variable or on the make comand line.
+# You don't need to uncomment it here unless you want to hardwire
+# a value.
+#ARCH =
+
+ifeq ($(ARCH),-m32)
+RES_TARGET = --target pe-i386
+endif
+ifeq ($(ARCH),-m64)
+RES_TARGET = --target pe-x86-64
+endif
+
+OPT = $(CLEANUP) -O3 # -finline-functions -findirect-inlining
+XOPT =
+
+RCFLAGS = --include-dir=.
+LFLAGS = $(ARCH)
# Uncomment this if config.h defines RETAIN_WSALASTERROR
-#LFLAGS = -lws2_32
+#LFLAGS += -lws2_32
+#
+# Uncomment this next to link the GCC/C++ runtime libraries statically
+# (Be sure to read about these options and their associated caveats
+# at http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html)
+#
+# NOTE 1: Doing this appears to break GCE:pthread_cleanup_*(), which
+# relies on C++ class destructors being called when leaving scope.
+#
+# NOTE 2: If you do this DO NOT distribute your pthreads DLLs with
+# the official filenaming, i.e. pthreadVC2.dll, etc. Instead, change DLL_VER
+# above to "2slgcc" for example, to build "pthreadGC2slgcc.dll", etc.
+#
+#LFLAGS += -static-libgcc -static-libstdc++
# ----------------------------------------------------------------------
# The library can be built with some alternative behaviour to
@@ -96,418 +136,137 @@ RCFLAGS = --include-dir=.
GC_CFLAGS = $(PTW32_FLAGS)
GCE_CFLAGS = $(PTW32_FLAGS) -mthreads
-## Mingw32
-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
+## Mingw
+#MAKE ?= make
+CFLAGS = $(OPT) $(XOPT) $(ARCH) -I. -DHAVE_CONFIG_H -Wall
+OBJEXT = o
+RESEXT = o
+
+include common.mk
+
+DLL_OBJS += $(RESOURCE_OBJS)
+STATIC_OBJS += $(RESOURCE_OBJS)
GCE_DLL = pthreadGCE$(DLL_VER).dll
GCED_DLL= pthreadGCE$(DLL_VERD).dll
GCE_LIB = libpthreadGCE$(DLL_VER).a
GCED_LIB= libpthreadGCE$(DLL_VERD).a
-GCE_INLINED_STAMP = pthreadGCE$(DLL_VER).stamp
-GCED_INLINED_STAMP = pthreadGCE$(DLL_VERD).stamp
-GCE_STATIC_STAMP = libpthreadGCE$(DLL_VER).stamp
-GCED_STATIC_STAMP = libpthreadGCE$(DLL_VERD).stamp
GC_DLL = pthreadGC$(DLL_VER).dll
GCD_DLL = pthreadGC$(DLL_VERD).dll
GC_LIB = libpthreadGC$(DLL_VER).a
GCD_LIB = libpthreadGC$(DLL_VERD).a
-GC_INLINED_STAMP = pthreadGC$(DLL_VER).stamp
-GCD_INLINED_STAMP = pthreadGC$(DLL_VERD).stamp
-GC_STATIC_STAMP = libpthreadGC$(DLL_VER).stamp
-GCD_STATIC_STAMP = libpthreadGC$(DLL_VERD).stamp
+GC_INLINED_STATIC_STAMP = libpthreadGC$(DLL_VER).inlined_static_stamp
+GCD_INLINED_STATIC_STAMP = libpthreadGC$(DLL_VERD).inlined_static_stamp
+GCE_INLINED_STATIC_STAMP = libpthreadGCE$(DLL_VER).inlined_static_stamp
+GCED_INLINED_STATIC_STAMP = libpthreadGCE$(DLL_VERD).inlined_static_stamp
+GC_SMALL_STATIC_STAMP = libpthreadGC$(DLL_VER).small_static_stamp
+GCD_SMALL_STATIC_STAMP = libpthreadGC$(DLL_VERD).small_static_stamp
+GCE_SMALL_STATIC_STAMP = libpthreadGCE$(DLL_VER).small_static_stamp
+GCED_SMALL_STATIC_STAMP = libpthreadGCE$(DLL_VERD).small_static_stamp
PTHREAD_DEF = pthread.def
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 GC-debug (to build the GNU C debug dll with C cleanup code)"
+ @ echo "$(MAKE) clean GCE (to build the GNU C dll with C++ exception handling)"
+ @ echo "$(MAKE) clean GCE-debug (to build the GNU C debug dll with C++ exception handling)"
+ @ echo "$(MAKE) clean GC-static (to build the GNU C static lib with C cleanup code)"
+ @ echo "$(MAKE) clean GC-static-debug (to build the GNU C static debug lib with C cleanup code)"
+ @ echo "$(MAKE) clean GCE-static (to build the GNU C++ static lib with C++ cleanup code)"
+ @ echo "$(MAKE) clean GCE-static-debug (to build the GNU C++ static debug lib with C++ cleanup code)"
+ @ echo "$(MAKE) clean GC-small-static (to build the GNU C static lib with C cleanup code)"
+ @ echo "$(MAKE) clean GC-small-static-debug (to build the GNU C static debug lib with C cleanup code)"
+ @ echo "$(MAKE) clean GCE-small-static (to build the GNU C++ static lib with C++ cleanup code)"
+ @ echo "$(MAKE) clean GCE-small-static-debug (to build the GNU C++ static debug lib with C++ cleanup code)"
all:
- @ $(MAKE) clean GCE
@ $(MAKE) clean GC
+ @ $(MAKE) clean GCE
+ @ $(MAKE) clean GC-static
+ @ $(MAKE) clean GCE-static
+
+TEST_ENV = PTW32_FLAGS="$(PTW32_FLAGS) -DNO_ERROR_DIALOGS" DLL_VER=$(DLL_VER) ARCH="$(ARCH)"
+
+all-tests:
+ $(MAKE) realclean GC-small-static
+ cd tests && $(MAKE) clean GC-small-static $(TEST_ENV) && $(MAKE) clean GCX-small-static $(TEST_ENV)
+ $(MAKE) realclean GCE-small-static
+ cd tests && $(MAKE) clean GCE-small-static $(TEST_ENV)
+ @ $(ECHO) "$@ completed successfully."
+ $(MAKE) realclean GC
+ cd tests && $(MAKE) clean GC $(TEST_ENV) && $(MAKE) clean GCX $(TEST_ENV)
+ $(MAKE) realclean GCE
+ cd tests && $(MAKE) clean GCE $(TEST_ENV)
+ $(MAKE) realclean GC-static
+ cd tests && $(MAKE) clean GC-static $(TEST_ENV) && $(MAKE) clean GCX-static $(TEST_ENV)
+ $(MAKE) realclean GCE-static
+ cd tests && $(MAKE) clean GCE-static $(TEST_ENV)
+ $(MAKE) realclean
+
+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)
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
GC-debug:
- $(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_DLL)
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_DLL)
GCE:
- $(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
GCE-debug:
- $(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_CXX -g -O0" $(GCED_DLL)
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_CXX -g -O0" $(GCED_DLL)
+
+GC-static:
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_INLINED_STATIC_STAMP)
-GC-inlined:
- $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP)
+GC-static-debug:
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_INLINED_STATIC_STAMP)
-GC-inlined-debug:
- $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_INLINED_STAMP)
+GC-small-static:
+ $(MAKE) XOPT="-DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(STATIC_OBJS)" $(GC_SMALL_STATIC_STAMP)
-GCE-inlined:
- $(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
+GC-small-static-debug:
+ $(MAKE) XOPT="-DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(STATIC_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_SMALL_STATIC_STAMP)
-GCE-inlined-debug:
- $(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)
+GCE-static:
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_INLINED_STATIC_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)
+GCE-static-debug:
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCED_INLINED_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)
+GCE-small-static:
+ $(MAKE) XOPT="-DPTW32_STATIC_LIB" CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(STATIC_OBJS)" $(GCE_SMALL_STATIC_STAMP)
+
+GCE-small-static-debug:
+ $(MAKE) XOPT="-DPTW32_STATIC_LIB" CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(STATIC_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCED_SMALL_STATIC_STAMP)
tests:
@ cd tests
@ $(MAKE) auto
+# Very basic install. It assumes "realclean" was done just prior to build target if
+# you want the installed $(DEVDEST_LIB_NAME) to match that build.
+install:
+ -$(TESTNDIR) $(DLLDEST) $(AND) $(MKDIR) $(DLLDEST)
+ -$(TESTNDIR) $(LIBDEST) $(AND) $(MKDIR) $(LIBDEST)
+ -$(TESTNDIR) $(HDRDEST) $(AND) $(MKDIR) $(HDRDEST)
+ $(CP) pthreadGC*.dll $(DLLDEST)
+ $(CP) libpthreadGC*.a $(LIBDEST)
+ $(CP) pthread.h $(HDRDEST)
+ $(CP) sched.h $(HDRDEST)
+ $(CP) semaphore.h $(HDRDEST)
+ -$(TESTFILE) libpthreadGC$(DLL_VER).a $(AND) $(CP) libpthreadGC$(DLL_VER).a $(LIBDEST)/$(DEST_LIB_NAME)
+ -$(TESTFILE) libpthreadGC$(DLL_VERD).a $(AND) $(CP) libpthreadGC$(DLL_VERD).a $(LIBDEST)/$(DEST_LIB_NAME)
+ -$(TESTFILE) libpthreadGCE$(DLL_VER).a $(AND) $(CP) libpthreadGCE$(DLL_VER).a $(LIBDEST)/$(DEST_LIB_NAME)
+ -$(TESTFILE) libpthreadGCE$(DLL_VERD).a $(AND) $(CP) libpthreadGCE$(DLL_VERD).a $(LIBDEST)/$(DEST_LIB_NAME)
+
%.pre: %.c
$(CC) -E -o $@ $(CFLAGS) $^
@@ -515,7 +274,7 @@ tests:
$(CC) -c $(CFLAGS) -DPTW32_BUILD_INLINED -Wa,-ahl $^ > $@
%.o: %.rc
- $(RC) $(RCFLAGS) $(CLEANUP) -o $@ $<
+ $(RC) $(RES_TARGET) $(RCFLAGS) $(CLEANUP) -o $@ -i $<
.SUFFIXES: .dll .rc .c .o
@@ -523,32 +282,24 @@ tests:
$(GC_DLL) $(GCD_DLL): $(DLL_OBJS)
- $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS)
- $(DLLTOOL) -z pthread.def $(DLL_OBJS)
- $(DLLTOOL) -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
-
-$(GCE_DLL): $(DLL_OBJS)
- $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS)
- $(DLLTOOL) -z pthread.def $(DLL_OBJS)
- $(DLLTOOL) -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
-
-$(GC_INLINED_STAMP) $(GCD_INLINED_STAMP): $(DLL_INLINED_OBJS)
- $(CC) $(OPT) $(XOPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
- $(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS)
- $(DLLTOOL) -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
- echo touched > $(GC_INLINED_STAMP)
-
-$(GCE_INLINED_STAMP) $(GCED_INLINED_STAMP): $(DLL_INLINED_OBJS)
- $(CC) $(OPT) $(XOPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
- $(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS)
- $(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)
- $(RM) $(GC_LIB)
- $(AR) -rv $(GC_LIB) $(DLL_INLINED_OBJS)
- $(RANLIB) $(GC_LIB)
- echo touched > $(GC_STATIC_STAMP)
+ $(CC) $(OPT) -shared -o $@ $^ $(LFLAGS)
+ $(DLLTOOL) -z pthread.def $^
+ $(DLLTOOL) -k --dllname $@ --output-lib lib$(basename $@).a --def $(PTHREAD_DEF)
+
+$(GCE_DLL) $(GCED_DLL): $(DLL_OBJS)
+ $(CC) $(OPT) -mthreads -shared -o $@ $^ $(LFLAGS)
+ $(DLLTOOL) -z pthread.def $^
+ $(DLLTOOL) -k --dllname $@ --output-lib lib$(basename $@).a --def $(PTHREAD_DEF)
+
+$(GC_INLINED_STATIC_STAMP) $(GCE_INLINED_STATIC_STAMP) $(GCD_INLINED_STATIC_STAMP) $(GCED_INLINED_STATIC_STAMP): $(DLL_OBJS)
+ $(RM) $(basename $@).a
+ $(AR) -rsv $(basename $@).a $^
+ $(ECHO) touched > $@
+
+$(GC_SMALL_STATIC_STAMP) $(GCE_SMALL_STATIC_STAMP) $(GCD_SMALL_STATIC_STAMP) $(GCED_SMALL_STATIC_STAMP): $(STATIC_OBJS)
+ $(RM) $(basename $@).a
+ $(AR) -rsv $(basename $@).a $^
+ $(ECHO) touched > $@
clean:
-$(RM) *~
@@ -557,37 +308,35 @@ clean:
-$(RM) *.o
-$(RM) *.obj
-$(RM) *.exe
+ -$(RM) *.manifest
-$(RM) $(PTHREAD_DEF)
realclean: clean
- -$(RM) $(GC_LIB)
- -$(RM) $(GCE_LIB)
- -$(RM) $(GC_DLL)
- -$(RM) $(GCE_DLL)
- -$(RM) $(GC_INLINED_STAMP)
- -$(RM) $(GCE_INLINED_STAMP)
- -$(RM) $(GC_STATIC_STAMP)
- -$(RM) $(GCD_LIB)
- -$(RM) $(GCED_LIB)
- -$(RM) $(GCD_DLL)
- -$(RM) $(GCED_DLL)
- -$(RM) $(GCD_INLINED_STAMP)
- -$(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)
+ -$(RM) lib*.a
+ -$(RM) *.lib
+ -$(RM) pthread*.dll
+ -$(RM) *_stamp
+ -cd tests && $(MAKE) clean
+
+var_check_list =
+
+define var_check_target
+var-check-$(1):
+ @for src in $($(1)); do \
+ fgrep -q "\"$$$$src\"" $(2) && continue; \
+ echo "$$$$src is in \$$$$($(1)), but not in $(2)"; \
+ exit 1; \
+ done
+ @grep '^# *include *".*\.c"' $(2) | cut -d'"' -f2 | while read src; do \
+ echo " $($(1)) " | fgrep -q " $$$$src " && continue; \
+ echo "$$$$src is in $(2), but not in \$$$$($(1))"; \
+ exit 1; \
+ done
+ @echo "$(1) <-> $(2): OK"
+
+var_check_list += var-check-$(1)
+endef
+
+$(eval $(call var_check_target,PTHREAD_SRCS,pthread.c))
+
+srcs-vars-check: $(var_check_list)