1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
# Makefile for the pthreads test suite.
# If all of the .pass files can be created, the test suite has passed.
#
# --------------------------------------------------------------------------
#
# Pthreads-win32 - POSIX Threads Library for Win32
# Copyright(C) 1998 John E. Bossom
# Copyright(C) 1999,2012 Pthreads-win32 contributors
#
# The current list of contributors is contained
# in the file CONTRIBUTORS included with the source
# code distribution. The list can also be seen at the
# following World Wide Web location:
# http://sources.redhat.com/pthreads-win32/contributors.html
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library in the file COPYING.LIB;
# if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
DLL_VER = 2$(EXTRAVERSION)
CP = cp -f
MV = mv -f
RM = rm -f
CAT = cat
MKDIR = mkdir
ECHO = echo
TOUCH = $(ECHO) Passed >
TESTFILE = test -f
TESTDIR = test -d
AND = &&
# For cross compiling use e.g.
# # make CROSS=i386-mingw32msvc- clean GC
CROSS =
# For cross testing use e.g.
# # make RUN=wine CROSS=i386-mingw32msvc- clean GC
RUN =
AR = $(CROSS)ar
DLLTOOL = $(CROSS)dlltool
CC = $(CROSS)gcc
CXX = $(CROSS)g++
RANLIB = $(CROSS)ranlib
#
# Mingw
#
XLIBS =
XXCFLAGS =
XXLIBS =
OPT = -O3
DOPT = -g -O0
CFLAGS = ${OPT} $(ARCH) -UNDEBUG -Wall $(XXCFLAGS)
LFLAGS = $(ARCH) $(XXLFLAGS)
#
# 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++
BUILD_DIR = ..
INCLUDES = -I.
TEST = GC
# Default lib version
GCX = GC$(DLL_VER)
# Files we need to run the tests
# - paths are relative to pthreads build dir.
HDR = pthread.h semaphore.h sched.h
LIB = libpthread$(GCX).a
DLL = pthread$(GCX).dll
# The next path is relative to $BUILD_DIR
QAPC = # ../QueueUserAPCEx/User/quserex.dll
include common.mk
.INTERMEDIATE: $(ALL_KNOWN_TESTS:%=%.exe) $(BENCHTESTS:%=%.exe)
.SECONDARY: $(ALL_KNOWN_TESTS:%=%.exe) $(ALL_KNOWN_TESTS:%=%.pass) $(BENCHTESTS:%=%.exe) $(BENCHTESTS:%=%.bench)
.PRECIOUS: $(ALL_KNOWN_TESTS:%=%.exe) $(ALL_KNOWN_TESTS:%=%.pass) $(BENCHTESTS:%=%.exe) $(BENCHTESTS:%=%.bench)
ASM = $(ALL_KNOWN_TESTS:%=%.s)
TESTS = $(ALL_KNOWN_TESTS)
BENCHRESULTS = $(BENCHTESTS:%=%.bench)
#
# To build and run "foo.exe" and "bar.exe" only use, e.g.:
# make clean GC NO_DEPS=1 TESTS="foo bar"
#
# To build and run "foo.exe" and "bar.exe" and run all prerequisite tests
# use, e.g.:
# make clean GC TESTS="foo bar"
#
# Set TESTS to one or more tests.
#
ifndef NO_DEPS
include runorder.mk
endif
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 GC-debug (to test using GC dll with C (no EH) applications)"
@ $(ECHO) "$(MAKE) clean GC-static (to test using GC static lib with C (no EH) applications)"
@ $(ECHO) "$(MAKE) clean GC-static-debug (to test using GC static lib with C (no EH) applications)"
@ $(ECHO) "$(MAKE) clean GCE-static (to test using GC static lib with C (no EH) applications)"
@ $(ECHO) "$(MAKE) clean GCE-static-debug (to test using GC static lib with C (no EH) applications)"
@ $(ECHO) "$(MAKE) clean GCE-debug (to test using GCE dll with C++ (EH) applications)"
@ $(ECHO) "$(MAKE) clean GCX-static (to test using GC static lib with C++ applications)"
@ $(ECHO) "$(MAKE) clean GCX-static-debug (to test using GC static lib with C++ applications)"
@ $(ECHO) "$(MAKE) clean GCX-debug (to test using GCE dll with C++ (EH) applications)"
@ $(ECHO) "$(MAKE) clean GC-foo (to build individual test \"foo.c\" with C and run using GC dll)"
@ $(ECHO) "$(MAKE) clean GCE-foo (to build individual tests \"foo.c\" with C++ and run using GCE dll)"
@ $(ECHO) "$(MAKE) clean GCX-foo (to build individual tests \"foo.c\" with C++ and run using GC dll)"
GC:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" allpassed
GC-asm:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" all-asm
GC-bench:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
GC-bench-debug:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" OPT="${DOPT}" all-bench
GC-debug:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" OPT="${DOPT}" allpassed
GC-static GC-small-static:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" DLL="" allpassed
GC-static-debug GC-small-static-debug:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" OPT="$(DOPT)" DLL="" allpassed
GCE:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)" CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" allpassed
GCE-debug:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_CXX" OPT="${DOPT}" allpassed
GCE-static GCE-small-static:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)" CC=$(CXX) XXCFLAGS="-D__CLEANUP_CXX -DPTW32_STATIC_LIB" DLL="" allpassed
GCE-static-debug GCE-small-static-debug:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_CXX -DPTW32_STATIC_LIB" OPT="$(DOPT)" DLL="" allpassed
GCX:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_C" allpassed
GCX-debug:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_C" OPT="${DOPT}" allpassed
GCX-static GCX-small-static:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CXX) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" DLL="" allpassed
GCX-static-debug GCX-small-static-debug:
@ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" OPT="$(DOPT)" DLL="" allpassed
all-asm: $(ASM)
@ $(ECHO) "ALL TESTS PASSED! Congratulations!"
allpassed: $(HDR) $(LIB) $(DLL) $(QAPC) $(TESTS:%=%.pass)
@ $(ECHO) "ALL TESTS PASSED! Congratulations!"
all-bench: $(HDR) $(LIB) $(DLL) $(QAPC) $(XXLIBS) $(BENCHRESULTS)
@ $(ECHO) "ALL BENCH TESTS COMPLETED."
cancel9.exe: XLIBS = -lws2_32
%.pass: %.exe
@ $(ECHO) Running $(TEST) test \"$*\"
@ $(RUN) ./$*
@ $(ECHO) Passed
@ $(TOUCH) $@
%.bench: %.exe
@ $(ECHO) Running $(TEST) test \"$*\"
@ $(RUN) ./$*
@ $(ECHO) Done
@ $(TOUCH) $@
%.exe: %.c
$(CC) $(CFLAGS) $(LFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) $(XLIBS) $(XXLIBS)
%.pre: %.c $(HDR)
$(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
%.s: %.c $(HDR)
@ $(ECHO) Compiling $@
$(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
$(HDR) $(LIB) $(DLL) $(QAPC):
@ $(ECHO) Copying $(BUILD_DIR)/$@
@ $(TESTFILE) $(BUILD_DIR)/$@ $(AND) $(CP) $(BUILD_DIR)/$@ .
benchlib.o: benchlib.c
@ $(ECHO) Compiling $@
$(CC) -c $(CFLAGS) $< $(INCLUDES)
clean:
- $(RM) *.dll
- $(RM) *.lib
- $(RM) pthread.h
- $(RM) semaphore.h
- $(RM) sched.h
- $(RM) *.a
- $(RM) *.e
- $(RM) *.i
- $(RM) *.o
- $(RM) *.s
- $(RM) *.so
- $(RM) *.obj
- $(RM) *.pdb
- $(RM) *.exe
- $(RM) *.manifest
- $(RM) *.pass
- $(RM) *.bench
- $(RM) *.log
|