summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--GNUmakefile12
-rw-r--r--Makefile11
-rw-r--r--README16
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/GNUmakefile15
-rw-r--r--tests/Makefile12
-rw-r--r--tests/self1.c7
8 files changed, 82 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index aa7eeb9..0226f76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-01 Ross Johnson <ross at callisto.canberra.edu.au>
+
+ * GNUmakefile: Add target to build libpthreadGC1.a as a static link
+ library.
+ * Makefile: Likewise for pthreadGC1.lib.
+
2005-04-01 Kevin Lussier <Kevin at codegreennetworks.com>
* sem_timedwait.c (sem_timedwait): Increase size of temp variables to
diff --git a/GNUmakefile b/GNUmakefile
index 9e6be70..18181e4 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -29,7 +29,7 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
-DLL_VER = 2
+DLL_VER = 1
DEVROOT = C:\PTHREADS
@@ -427,6 +427,7 @@ GCE_INLINED_STAMP = pthreadGCE$(DLL_VER).stamp
GC_DLL = pthreadGC$(DLL_VER).dll
GC_LIB = libpthreadGC$(DLL_VER).a
GC_INLINED_STAMP = pthreadGC$(DLL_VER).stamp
+GC_STATIC_STAMP = libpthreadGC$(DLL_VER).stamp
PTHREAD_DEF = pthread.def
@@ -436,6 +437,7 @@ help:
@ echo "make clean GC (to build the GNU C 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-inlined (to build the GNU C inlined dll with C cleanup code)"
+ @ echo "make clean GC-static (to build the GNU C inlined static lib with C cleanup code)"
all:
@ $(MAKE) clean GCE
@@ -453,6 +455,9 @@ GC-inlined:
GCE-inlined:
$(MAKE) CC=g++ XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
+GC-static:
+ $(MAKE) CC=gcc XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP)
+
tests:
@ cd tests
@ $(MAKE) auto
@@ -493,6 +498,11 @@ $(GCE_INLINED_STAMP): $(DLL_INLINED_OBJS)
dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
echo touched > $(GCE_INLINED_STAMP)
+$(GC_STATIC_STAMP): $(DLL_INLINED_OBJS)
+ $(RM) $(GC_LIB)
+ $(AR) -rv $(GC_LIB) $(DLL_INLINED_OBJS)
+ echo touched > $(GC_STATIC_STAMP)
+
clean:
-$(RM) *~
-$(RM) *.i
diff --git a/Makefile b/Makefile
index 3827782..22ed80d 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
# DLL_VER:
# See pthread.h and README - This number is computed as 'current - age'
-DLL_VER = 2
+DLL_VER = 1
DEVROOT = c:\pthreads
@@ -17,6 +17,7 @@ LIBDEST = $(DEVROOT)\DLL
DLLS = pthreadVCE$(DLL_VER).dll pthreadVSE$(DLL_VER).dll pthreadVC$(DLL_VER).dll
INLINED_STAMPS = pthreadVCE$(DLL_VER).stamp pthreadVSE$(DLL_VER).stamp pthreadVC$(DLL_VER).stamp
+STATIC_STAMPS = pthreadVCE$(DLL_VER).static pthreadVSE$(DLL_VER).static pthreadVC$(DLL_VER).static
OPTIM = /O2 /Ob2
#OPTIM =
@@ -368,6 +369,7 @@ help:
@ echo nmake clean VCE-inlined (to build the MSVC inlined dll with C++ exception handling)
@ echo nmake clean VSE-inlined (to build the MSVC inlined dll with structured exception handling)
@ echo nmake clean VC-inlined (to build the MSVC inlined dll with C cleanup code)
+ @ echo nmake clean VC-static (to build the MSVC static lib with C cleanup code)
all:
@ nmake clean VCE-inlined
@@ -396,6 +398,9 @@ VSE-inlined:
VC-inlined:
@ nmake /nologo EHFLAGS="$(OPTIM) $(VCFLAGS) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VER).stamp
+VC-static:
+ @ nmake /nologo EHFLAGS="$(OPTIM) $(VCFLAGS) /DPTW32_BUILD_INLINED /DPTW32_STATIC_LIB" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VER).static
+
realclean: clean
if exist *.dll del *.dll
if exist *.lib del *.lib
@@ -426,6 +431,10 @@ $(INLINED_STAMPS): $(DLL_INLINED_OBJS)
/link /nodefaultlib:libcmt /implib:$*.lib \
msvcrt.lib wsock32.lib /out:$*.dll
+$(STATIC_STAMPS): $(DLL_INLINED_OBJS)
+ if exist $*.lib del $*.lib
+ lib $(DLL_INLINED_OBJS) /out:$*.lib
+
.c.obj:
cl $(EHFLAGS) /D$(CLEANUP) -c $<
diff --git a/README b/README
index bd74307..c6e8718 100644
--- a/README
+++ b/README
@@ -378,6 +378,22 @@ make clean GCX (tests the GC version of the library with C++ (EH)
applications)
+Building the library as a statically linkable library
+-----------------------------------------------------
+
+General: PTW32_STATIC_LIB must be defined for both the library build and the
+application build. The following 'make' command lines define this for the
+library build.
+
+MSVC (creates pthreadVCn.lib as a static link lib):
+nmake clean VC-static
+
+MinGW32 (creates libpthreadGCn.a as a static link lib):
+make clean GC-static
+
+Define PTW32_STATIC_LIB when building your application.
+
+
Building the library under Cygwin
---------------------------------
diff --git a/tests/ChangeLog b/tests/ChangeLog
index edf7ded..3d152ba 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-01 Ross Johnson <ross@desk.home>
+
+ * GNUmakefile: Add target to test linking static link library.
+ * Makefile: Likewise.
+ * self1.c: Run process attach/detach routines when static linked.
+
2005-03-16 Ross Johnson <rpj@callisto.canberra.edu.au>
* mutex5.c: Prevent optimiser from removing asserts.
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index 08709a8..4ecce80 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -74,7 +74,6 @@ COPYFILES = $(HDR) $(LIB) $(DLL) $(QAPC)
# If a test case returns a non-zero exit code to the shell, make will
# stop.
-XTESTS = once3
TESTS = sizes loadfree \
self1 mutex5 mutex1 mutex1e mutex1n mutex1r \
semaphore1 semaphore2 semaphore3 \
@@ -108,8 +107,12 @@ TESTS = sizes loadfree \
BENCHTESTS = \
benchtest1 benchtest2 benchtest3 benchtest4 benchtest5
+STATICTESTS = \
+ self1
+
PASSES = $(TESTS:%=%.pass)
BENCHRESULTS = $(BENCHTESTS:%=%.bench)
+STATICRESULTS = $(STATICTESTS:%=%.pass)
help:
@ $(ECHO) "Run one of the following command lines:"
@@ -118,6 +121,7 @@ help:
@ $(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-static (to test using GC static lib with C (no EH) applications)"
all:
@ $(MAKE) clean GC
@@ -139,12 +143,20 @@ GC-bench:
GCE-bench:
$(MAKE) TEST=GCE CC=g++ XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
+GC-static:
+ $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" DLL="" all-static
+
all-pass: $(PASSES)
@ $(ECHO) ALL TESTS PASSED! Congratulations!
all-bench: $(BENCHRESULTS)
@ $(ECHO) BENCH TESTS COMPLETED.
+all-static: $(STATICRESULTS)
+ @ $(ECHO) ALL STATIC TESTS PASSED! Congratulations!
+ @ $(ECHO) Build and test the DLL to run all tests.
+ @ $(ECHO) This test only confirms that the static lib links correctly.
+
benchtest1.bench:
benchtest2.bench:
benchtest3.bench:
@@ -332,4 +344,5 @@ clean:
- $(RM) *.exe
- $(RM) *.pass
- $(RM) *.bench
+ - $(RM) *.static
- $(RM) *.log
diff --git a/tests/Makefile b/tests/Makefile
index dfb0f3c..f9dfd41 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -120,6 +120,9 @@ PASSES= sizes.pass loadfree.pass \
BENCHRESULTS = \
benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench
+STATICRESULTS = \
+ self1.pass
+
help:
@ $(ECHO) Run one of the following command lines:
@ $(ECHO) nmake clean VC (to test using VC dll with VC (no EH) applications)
@@ -130,6 +133,7 @@ help:
@ $(ECHO) nmake clean VCX-bench (to benchtest using VC dll with C++ bench app)
@ $(ECHO) nmake clean VCE-bench (to benchtest using VCE dll with C++ bench app)
@ $(ECHO) nmake clean VSE-bench (to benchtest using VSE dll with SEH bench app)
+ @ $(ECHO) nmake clean VC-static (to test using VC static lib with VC (no EH) applications)
all:
@ nmake clean VC
@@ -148,6 +152,11 @@ tests: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC) $(PASSES)
benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(XXLIBS) $(BENCHRESULTS)
@ $(ECHO) ALL BENCH TESTS DONE.
+statictests: $(CPLIB) $(CPDLL) $(CPHDR) $(STATICRESULTS)
+ @ $(ECHO) ALL STATIC TESTS DONE.
+ @ $(ECHO) Build and test the DLL to run all tests.
+ @ $(ECHO) The static test only confirms that the .lib links correctly.
+
sizes.pass: sizes.exe
@ $(ECHO) ... Running $(TEST)$(DLL_VER) test: $*.exe
@ .\$*.exe > SIZES.$(TEST)
@@ -191,6 +200,9 @@ VC-bench:
VCX-bench:
@ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests
+VC-static:
+ @ nmake 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)
diff --git a/tests/self1.c b/tests/self1.c
index 773aee1..59498d9 100644
--- a/tests/self1.c
+++ b/tests/self1.c
@@ -54,9 +54,16 @@ main(int argc, char * argv[])
*/
pthread_t self;
+#ifdef PTW32_STATIC_LIB
+ pthread_win32_process_attach_np();
+#endif
+
self = pthread_self();
assert(self.p != NULL);
+#ifdef PTW32_STATIC_LIB
+ pthread_win32_process_detach_np();
+#endif
return 0;
}