forked from GerHobbelt/pthread-win32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
269 lines (221 loc) · 9.52 KB
/
Makefile
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# This makefile is compatible with MS nmake
#
# The variables $DLLDEST and $LIBDEST hold the destination directories for the
# dll and the lib, respectively. Probably all that needs to change is $DEVROOT.
# PTW32_VER:
# See pthread.h and README for the description of version numbering.
PTW32_VER = 3$(EXTRAVERSION)
PTW32_VER_DEBUG= $(PTW32_VER)d
DESTROOT = ..\PTHREADS-BUILT
DLLDEST = $(DESTROOT)\bin
LIBDEST = $(DESTROOT)\lib
HDRDEST = $(DESTROOT)\include
DLLS = pthreadVCE$(PTW32_VER).dll pthreadVSE$(PTW32_VER).dll pthreadVC$(PTW32_VER).dll \
pthreadVCE$(PTW32_VER_DEBUG).dll pthreadVSE$(PTW32_VER_DEBUG).dll pthreadVC$(PTW32_VER_DEBUG).dll
INLINED_STATIC_STAMPS = pthreadVCE$(PTW32_VER).inlined_static_stamp pthreadVSE$(PTW32_VER).inlined_static_stamp \
pthreadVC$(PTW32_VER).inlined_static_stamp pthreadVCE$(PTW32_VER_DEBUG).inlined_static_stamp \
pthreadVSE$(PTW32_VER_DEBUG).inlined_static_stamp pthreadVC$(PTW32_VER_DEBUG).inlined_static_stamp
SMALL_STATIC_STAMPS = pthreadVCE$(PTW32_VER).small_static_stamp pthreadVSE$(PTW32_VER).small_static_stamp \
pthreadVC$(PTW32_VER).small_static_stamp pthreadVCE$(PTW32_VER_DEBUG).small_static_stamp \
pthreadVSE$(PTW32_VER_DEBUG).small_static_stamp pthreadVC$(PTW32_VER_DEBUG).small_static_stamp
CC = cl /errorReport:none /nologo
CPPFLAGS = /I. /DHAVE_CONFIG_H
XCFLAGS =
CFLAGS = /W3 /O2 /Ob2 $(XCFLAGS)
CFLAGSD = /W3 /Z7 $(XCFLAGS)
# Uncomment this if config.h defines RETAIN_WSALASTERROR
#XLIBS = wsock32.lib
# Default cleanup style
CLEANUP = PTW32_CLEANUP_C
# C++ Exceptions
# (Note: If you are using Microsoft VC++6.0, the library needs to be built
# with /EHa instead of /EHs or else cancellation won't work properly.)
VCEFLAGS = /EHs /TP $(CPPFLAGS) $(CFLAGS)
VCEFLAGSD = /EHs /TP $(CPPFLAGS) $(CFLAGSD)
#Structured Exceptions
VSEFLAGS = $(CPPFLAGS) $(CFLAGS)
VSEFLAGSD = $(CPPFLAGS) $(CFLAGSD)
#C cleanup code
VCFLAGS = $(CPPFLAGS) $(CFLAGS)
VCFLAGSD = $(CPPFLAGS) $(CFLAGSD)
OBJEXT = obj
OEXT = o
RESEXT = res
include common.mk
DLL_OBJS = $(DLL_OBJS) $(RESOURCE_OBJS)
STATIC_OBJS = $(STATIC_OBJS) $(RESOURCE_OBJS)
STATIC_OBJS_SMALL = $(STATIC_OBJS_SMALL) $(RESOURCE_OBJS)
help:
@ echo To just build all possible versions and install them in $(DESTROOT)
@ echo nmake all install
@ echo ------------------------------------------
@ echo Or run one of the following command lines:
@ echo nmake clean all-tests
@ echo nmake -DEXHAUSTIVE clean all-tests
@ echo nmake clean all-tests-md
@ echo nmake clean all-tests-mt
@ echo nmake clean VC
@ echo nmake clean VC-debug
@ echo nmake clean VC-static
@ echo nmake clean VC-static-debug
@ echo nmake clean VCE
@ echo nmake clean VCE-debug
@ echo nmake clean VCE-static
@ echo nmake clean VCE-static-debug
@ echo nmake clean VSE
@ echo nmake clean VSE-debug
@ echo nmake clean VSE-static
@ echo nmake clean VSE-static-debug
all:
$(MAKE) /E clean VC-static
$(MAKE) /E clean VCE-static
$(MAKE) /E clean VSE-static
$(MAKE) /E clean VC-static-debug
$(MAKE) /E clean VCE-static-debug
$(MAKE) /E clean VSE-static-debug
$(MAKE) /E clean VC
$(MAKE) /E clean VCE
$(MAKE) /E clean VSE
$(MAKE) /E clean VC-debug
$(MAKE) /E clean VCE-debug
$(MAKE) /E clean VSE-debug
$(MAKE) /E clean
TEST_ENV = CFLAGS="$(CFLAGS) /DNO_ERROR_DIALOGS"
all-tests:
$(MAKE) all-tests-md all-tests-mt
all-tests-dll:
$(MAKE) /E realclean VC$(XDBG)
cd tests && $(MAKE) /E clean VC$(XDBG) $(TEST_ENV)
$(MAKE) /E realclean VCE$(XDBG)
cd tests && $(MAKE) /E clean VCE$(XDBG) $(TEST_ENV)
$(MAKE) /E realclean VSE$(XDBG)
cd tests && $(MAKE) /E clean VSE$(XDBG) $(TEST_ENV)
all-tests-static:
cd tests && $(MAKE) /E clean VC-static$(XDBG)-nolib $(TEST_ENV)
$(MAKE) /E realclean VC-static$(XDBG)
cd tests && $(MAKE) /E clean VC-static$(XDBG) $(TEST_ENV)
$(MAKE) /E realclean VCE-static$(XDBG)
cd tests && $(MAKE) /E clean VCE-static$(XDBG) $(TEST_ENV)
$(MAKE) /E realclean VSE-static$(XDBG)
cd tests && $(MAKE) /E clean VSE-static$(XDBG) $(TEST_ENV)
$(MAKE) realclean
@ echo $@ completed successfully.
all-tests-md:
@ -$(SETENV)
$(MAKE) all-tests-dll
!IF DEFINED(EXHAUSTIVE)
$(MAKE) all-tests-dll XDBG="-debug"
!ENDIF
@ echo $@ completed successfully.
all-tests-mt:
@ -$(SETENV)
$(MAKE) all-tests-static
!IF DEFINED(EXHAUSTIVE)
$(MAKE) all-tests-static XDBG="-debug"
!ENDIF
@ echo $@ completed successfully.
VCE:
@ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCEFLAGS) /D_WINDLL /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).dll
VCE-debug:
@ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCEFLAGSD) /D_WINDLL /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).dll
VSE:
@ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VSEFLAGS) /D_WINDLL /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).dll
VSE-debug:
@ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VSEFLAGSD) /D_WINDLL /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).dll
VC:
@ $(MAKE) /E /nologo XCFLAGS="/MD" EHFLAGS="$(VCFLAGS) /D_WINDLL /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_C pthreadVC$(PTW32_VER).dll
VC-debug:
@ $(MAKE) /E /nologo XCFLAGS="/MDd" EHFLAGS="$(VCFLAGSD) /D_WINDLL /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).dll
#
# Static builds
#
#VCE-small-static:
# @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCEFLAGS) /DPTW32_STATIC_LIB" CLEANUP=PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).small_static_stamp
#VCE-small-static-debug:
# @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCEFLAGSD) /DPTW32_STATIC_LIB" CLEANUP=PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).small_static_stamp
#VSE-small-static:
# @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VSEFLAGS) /DPTW32_STATIC_LIB" CLEANUP=PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).small_static_stamp
#VSE-small-static-debug:
# @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VSEFLAGSD) /DPTW32_STATIC_LIB" CLEANUP=PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).small_static_stamp
#VC-small-static:
# @ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" CLEANUP=PTW32_CLEANUP_C pthreadVC$(PTW32_VER).small_static_stamp
#VC-small-static-debug:
# @ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /DPTW32_STATIC_LIB" CLEANUP=PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).small_static_stamp
VCE-static:
@ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCEFLAGS) /DPTW32_STATIC_LIB /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER).inlined_static_stamp
VCE-static-debug:
@ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCEFLAGSD) /DPTW32_STATIC_LIB /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_CXX pthreadVCE$(PTW32_VER_DEBUG).inlined_static_stamp
VSE-static:
@ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VSEFLAGS) /DPTW32_STATIC_LIB /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER).inlined_static_stamp
VSE-static-debug:
@ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VSEFLAGSD) /DPTW32_STATIC_LIB /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_SEH pthreadVSE$(PTW32_VER_DEBUG).inlined_static_stamp
VC-static:
@ $(MAKE) /E /nologo XCFLAGS="/MT" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_C pthreadVC$(PTW32_VER).inlined_static_stamp
VC-static-debug:
@ $(MAKE) /E /nologo XCFLAGS="/MTd" EHFLAGS="$(VCFLAGSD) /DPTW32_STATIC_LIB /DPTW32_BUILD_INLINED" CLEANUP=PTW32_CLEANUP_C pthreadVC$(PTW32_VER_DEBUG).inlined_static_stamp
realclean: clean
if exist *.dll del *.dll
if exist *.lib del *.lib
if exist *.a del *.a
if exist *.manifest del *.manifest
if exist make.log.txt del make.log.txt
cd tests && $(MAKE) realclean
clean:
if exist *.obj del *.obj
if exist *.def del *.def
if exist *.ilk del *.ilk
if exist *.idb del *.idb
if exist *.pdb del *.pdb
if exist *.exp del *.exp
if exist *.map del *.map
if exist *.o del *.o
if exist *.i del *.i
if exist *.res del *.res
if exist *_stamp del *_stamp
cd tests && $(MAKE) clean
# Very basic install. It assumes "realclean" was done just prior to build target.
install:
if not exist $(DLLDEST) mkdir $(DLLDEST)
if not exist $(LIBDEST) mkdir $(LIBDEST)
if not exist $(HDRDEST) mkdir $(HDRDEST)
if exist pthreadV*.dll copy pthreadV*.dll $(DLLDEST)
if exist pthreadV*.lib copy pthreadV*.lib $(LIBDEST)
if exist libpthreadV*.lib copy libpthreadV*.lib $(LIBDEST)
copy _ptw32.h $(HDRDEST)
copy pthread.h $(HDRDEST)
copy sched.h $(HDRDEST)
copy semaphore.h $(HDRDEST)
$(DLLS): $(DLL_OBJS)
$(CC) /LDd /Zi $(DLL_OBJS) /link /implib:$*.lib $(XLIBS) /out:$@
$(INLINED_STATIC_STAMPS): $(STATIC_OBJS)
if exist lib$*.lib del lib$*.lib
lib $(STATIC_OBJS) /out:lib$*.lib
echo. >$@
$(SMALL_STATIC_STAMPS): $(STATIC_OBJS_SMALL)
if exist lib$*.lib del lib$*.lib
lib $(STATIC_OBJS_SMALL) /out:lib$*.lib
echo. >$@
.c.obj:
$(CC) $(XCFLAGS) $(EHFLAGS) /D$(CLEANUP) -c $<
.c.o:
$(CC) $(XCFLAGS) $(EHFLAGS) /D$(CLEANUP) /Fo$*.$(OEXT) -c $<
# TARGET_CPU is an environment variable set by Visual Studio Command Prompt
# as provided by the SDK (VS 2010 Express plus SDK 7.1)
# PLATFORM is an environment variable that may be set in the VS 2013 Express x64 cross
# development environment
# On my HP Compaq PC running VS 10, PLATFORM was defined as "HPD" but PROCESSOR_ARCHITECTURE
# was defined as "x86"
.rc.res:
!IF DEFINED(PLATFORM)
! IF DEFINED(PROCESSOR_ARCHITECTURE)
rc /dPTW32_ARCH$(PROCESSOR_ARCHITECTURE) /dPTW32_RC_MSC /d$(CLEANUP) $<
! ELSE
rc /dPTW32_ARCH$(PLATFORM) /dPTW32_RC_MSC /d$(CLEANUP) $<
! ENDIF
!ELSE IF DEFINED(TARGET_CPU)
rc /dPTW32_ARCH$(TARGET_CPU) /dPTW32_RC_MSC /d$(CLEANUP) $<
!ELSE
rc /dPTW32_ARCHx86 /dPTW32_RC_MSC /d$(CLEANUP) $<
!ENDIF
.c.i:
$(CC) /P /O2 /Ob1 $(VCFLAGS) $<