1 # This makefile is compatible with MS nmake and can be used as a
2 # replacement for buildlib.bat. I've changed the target from an ordinary dll
3 # (/LD) to a debugging dll (/LDd).
5 # The variables $DLLDEST and $LIBDEST hold the destination directories for the
6 # dll and the lib, respectively. Probably all that needs to change is $DEVROOT.
10 # See pthread.h and README - This number is computed as 'current - age'
16 DLLDEST
= $(DEVROOT
)\dll
17 LIBDEST
= $(DEVROOT
)\lib
18 HDRDEST
= $(DEVROOT
)\
include
20 DLLS
= pthreadVCE
$(DLL_VER
).dll pthreadVSE
$(DLL_VER
).dll pthreadVC
$(DLL_VER
).dll \
21 pthreadVCE
$(DLL_VERD
).dll pthreadVSE
$(DLL_VERD
).dll pthreadVC
$(DLL_VERD
).dll
22 INLINED_STAMPS
= pthreadVCE
$(DLL_VER
).stamp pthreadVSE
$(DLL_VER
).stamp pthreadVC
$(DLL_VER
).stamp \
23 pthreadVCE
$(DLL_VERD
).stamp pthreadVSE
$(DLL_VERD
).stamp pthreadVC
$(DLL_VERD
).stamp
24 STATIC_STAMPS
= pthreadVCE
$(DLL_VER
).static pthreadVSE
$(DLL_VER
).static pthreadVC
$(DLL_VER
).static \
25 pthreadVCE
$(DLL_VERD
).static pthreadVSE
$(DLL_VERD
).static pthreadVC
$(DLL_VERD
).static
28 CPPFLAGS
= /I.
/DHAVE_PTW32_CONFIG_H
29 XCFLAGS
= /W3
/MD
/nologo
30 CFLAGS
= /O2
/Ob2
$(XCFLAGS
)
31 CFLAGSD
= /Z7
$(XCFLAGS
)
33 # Uncomment this if config.h defines RETAIN_WSALASTERROR
36 # Default cleanup style
40 VCEFLAGS
= /EHsc
/TP
$(CPPFLAGS
) $(CFLAGS
)
41 VCEFLAGSD
= /EHsc
/TP
$(CPPFLAGS
) $(CFLAGSD
)
42 #Structured Exceptions
43 VSEFLAGS
= $(CPPFLAGS
) $(CFLAGS
)
44 VSEFLAGSD
= $(CPPFLAGS
) $(CFLAGSD
)
46 VCFLAGS
= $(CPPFLAGS
) $(CFLAGS
)
47 VCFLAGSD
= $(CPPFLAGS
) $(CFLAGSD
)
53 # Aggregate modules for inlinability
80 # Separate modules for minimising the size of statically linked images
82 pthread_attr_init.obj \
83 pthread_attr_destroy.obj \
84 pthread_attr_getdetachstate.obj \
85 pthread_attr_setdetachstate.obj \
86 pthread_attr_getstackaddr.obj \
87 pthread_attr_setstackaddr.obj \
88 pthread_attr_getstacksize.obj \
89 pthread_attr_setstacksize.obj \
90 pthread_attr_getscope.obj \
91 pthread_attr_setscope.obj \
92 pthread_attr_setschedpolicy.obj \
93 pthread_attr_getschedpolicy.obj \
94 pthread_attr_setschedparam.obj \
95 pthread_attr_getschedparam.obj \
96 pthread_attr_setinheritsched.obj \
97 pthread_attr_getinheritsched.obj \
98 pthread_barrier_init.obj \
99 pthread_barrier_destroy.obj \
100 pthread_barrier_wait.obj \
101 pthread_barrierattr_init.obj \
102 pthread_barrierattr_destroy.obj \
103 pthread_barrierattr_setpshared.obj \
104 pthread_barrierattr_getpshared.obj \
105 pthread_setcancelstate.obj \
106 pthread_setcanceltype.obj \
107 pthread_testcancel.obj \
110 pthread_condattr_destroy.obj \
111 pthread_condattr_getpshared.obj \
112 pthread_condattr_init.obj \
113 pthread_condattr_setpshared.obj \
114 pthread_cond_destroy.obj \
115 pthread_cond_init.obj \
116 pthread_cond_signal.obj \
117 pthread_cond_wait.obj \
125 pthread_mutex_init.obj \
126 pthread_mutex_destroy.obj \
127 pthread_mutexattr_init.obj \
128 pthread_mutexattr_destroy.obj \
129 pthread_mutexattr_getpshared.obj \
130 pthread_mutexattr_setpshared.obj \
131 pthread_mutexattr_settype.obj \
132 pthread_mutexattr_gettype.obj \
133 pthread_mutexattr_setrobust.obj \
134 pthread_mutexattr_getrobust.obj \
135 pthread_mutex_lock.obj \
136 pthread_mutex_timedlock.obj \
137 pthread_mutex_unlock.obj \
138 pthread_mutex_trylock.obj \
139 pthread_mutex_consistent.obj \
140 pthread_mutexattr_setkind_np.obj \
141 pthread_mutexattr_getkind_np.obj \
142 pthread_getw32threadhandle_np.obj \
143 pthread_getunique_np.obj \
144 pthread_delay_np.obj \
145 pthread_num_processors_np.obj \
146 pthread_win32_attach_detach_np.obj \
148 pthread_getconcurrency.obj \
151 pthread_setconcurrency.obj \
152 pthread_rwlock_init.obj \
153 pthread_rwlock_destroy.obj \
154 pthread_rwlockattr_init.obj \
155 pthread_rwlockattr_destroy.obj \
156 pthread_rwlockattr_getpshared.obj \
157 pthread_rwlockattr_setpshared.obj \
158 pthread_rwlock_rdlock.obj \
159 pthread_rwlock_wrlock.obj \
160 pthread_rwlock_unlock.obj \
161 pthread_rwlock_tryrdlock.obj \
162 pthread_rwlock_trywrlock.obj \
163 pthread_setschedparam.obj \
164 pthread_getschedparam.obj \
165 pthread_timechange_handler_np.obj \
167 ptw32_processInitialize.obj \
168 ptw32_processTerminate.obj \
169 ptw32_threadStart.obj \
170 ptw32_threadDestroy.obj \
171 ptw32_tkAssocCreate.obj \
172 ptw32_tkAssocDestroy.obj \
173 ptw32_callUserDestroyRoutines.obj \
176 ptw32_getprocessors.obj \
180 ptw32_rwlock_check_need_init.obj \
181 ptw32_cond_check_need_init.obj \
182 ptw32_mutex_check_need_init.obj \
184 ptw32_relmillisecs.obj \
186 sched_get_priority_max.obj \
187 sched_get_priority_min.obj \
188 sched_setscheduler.obj \
189 sched_getscheduler.obj \
197 sem_post_multiple.obj \
204 ptw32_spinlock_check_need_init.obj \
205 pthread_spin_init.obj \
206 pthread_spin_destroy.obj \
207 pthread_spin_lock.obj \
208 pthread_spin_unlock.obj \
209 pthread_spin_trylock.obj \
212 pthread_key_create.obj \
213 pthread_key_delete.obj \
214 pthread_setspecific.obj \
215 pthread_getspecific.obj \
216 w32_CancelableWait.obj \
219 INCL
= config.h implement.h semaphore.h pthread.h need_errno.h
222 pthread_attr_init.c \
223 pthread_attr_destroy.c \
224 pthread_attr_getdetachstate.c \
225 pthread_attr_setdetachstate.c \
226 pthread_attr_getstackaddr.c \
227 pthread_attr_setstackaddr.c \
228 pthread_attr_getstacksize.c \
229 pthread_attr_setstacksize.c \
230 pthread_attr_getscope.c \
231 pthread_attr_setscope.c
234 pthread_barrier_init.c \
235 pthread_barrier_destroy.c \
236 pthread_barrier_wait.c \
237 pthread_barrierattr_init.c \
238 pthread_barrierattr_destroy.c \
239 pthread_barrierattr_setpshared.c \
240 pthread_barrierattr_getpshared.c
243 pthread_setcancelstate.c \
244 pthread_setcanceltype.c \
245 pthread_testcancel.c \
249 ptw32_cond_check_need_init.c \
250 pthread_condattr_destroy.c \
251 pthread_condattr_getpshared.c \
252 pthread_condattr_init.c \
253 pthread_condattr_setpshared.c \
254 pthread_cond_destroy.c \
255 pthread_cond_init.c \
256 pthread_cond_signal.c \
264 pthread_getconcurrency.c \
268 pthread_setconcurrency.c \
273 ptw32_relmillisecs.c \
277 ptw32_mutex_check_need_init.c \
278 pthread_mutex_init.c \
279 pthread_mutex_destroy.c \
280 pthread_mutexattr_init.c \
281 pthread_mutexattr_destroy.c \
282 pthread_mutexattr_getpshared.c \
283 pthread_mutexattr_setpshared.c \
284 pthread_mutexattr_settype.c \
285 pthread_mutexattr_gettype.c \
286 pthread_mutexattr_setrobust.c \
287 pthread_mutexattr_getrobust.c \
288 pthread_mutex_lock.c \
289 pthread_mutex_timedlock.c \
290 pthread_mutex_unlock.c \
291 pthread_mutex_trylock.c \
292 pthread_mutex_consistent.c
295 pthread_mutexattr_setkind_np.c \
296 pthread_mutexattr_getkind_np.c \
297 pthread_getw32threadhandle_np.c \
298 pthread_getunique_np.c \
300 pthread_num_processors_np.c \
301 pthread_win32_attach_detach_np.c \
302 pthread_timechange_handler_np.c
306 ptw32_processInitialize.c \
307 ptw32_processTerminate.c \
308 ptw32_threadStart.c \
309 ptw32_threadDestroy.c \
310 ptw32_tkAssocCreate.c \
311 ptw32_tkAssocDestroy.c \
312 ptw32_callUserDestroyRoutines.c \
316 ptw32_getprocessors.c
319 ptw32_rwlock_check_need_init.c \
320 ptw32_rwlock_cancelwrwait.c \
321 pthread_rwlock_init.c \
322 pthread_rwlock_destroy.c \
323 pthread_rwlockattr_init.c \
324 pthread_rwlockattr_destroy.c \
325 pthread_rwlockattr_getpshared.c \
326 pthread_rwlockattr_setpshared.c \
327 pthread_rwlock_rdlock.c \
328 pthread_rwlock_timedrdlock.c \
329 pthread_rwlock_wrlock.c \
330 pthread_rwlock_timedwrlock.c \
331 pthread_rwlock_unlock.c \
332 pthread_rwlock_tryrdlock.c \
333 pthread_rwlock_trywrlock.c
336 pthread_attr_setschedpolicy.c \
337 pthread_attr_getschedpolicy.c \
338 pthread_attr_setschedparam.c \
339 pthread_attr_getschedparam.c \
340 pthread_attr_setinheritsched.c \
341 pthread_attr_getinheritsched.c \
342 pthread_setschedparam.c \
343 pthread_getschedparam.c \
344 sched_get_priority_max.c \
345 sched_get_priority_min.c \
346 sched_setscheduler.c \
347 sched_getscheduler.c \
357 sem_post_multiple.c \
364 ptw32_spinlock_check_need_init.c \
365 pthread_spin_init.c \
366 pthread_spin_destroy.c \
367 pthread_spin_lock.c \
368 pthread_spin_unlock.c \
369 pthread_spin_trylock.c
376 pthread_key_create.c \
377 pthread_key_delete.c \
378 pthread_setspecific.c \
379 pthread_getspecific.c
383 @ echo Run one of the following command lines
:
384 @ echo nmake
clean VCE
(to build the MSVC dll with C
++ exception handling
)
385 @ echo nmake
clean VSE
(to build the MSVC dll with structured exception handling
)
386 @ echo nmake
clean VC
(to build the MSVC dll with C cleanup code
)
387 @ echo nmake
clean VCE-inlined
(to build the MSVC inlined dll with C
++ exception handling
)
388 @ echo nmake
clean VSE-inlined
(to build the MSVC inlined dll with structured exception handling
)
389 @ echo nmake
clean VC-inlined
(to build the MSVC inlined dll with C cleanup code
)
390 @ echo nmake
clean VC-static
(to build the MSVC static lib with C cleanup code
)
391 @ echo nmake
clean VCE-debug
(to build the debug MSVC dll with C
++ exception handling
)
392 @ echo nmake
clean VSE-debug
(to build the debug MSVC dll with structured exception handling
)
393 @ echo nmake
clean VC-debug
(to build the debug MSVC dll with C cleanup code
)
394 @ echo nmake
clean VCE-inlined-debug
(to build the debug MSVC inlined dll with C
++ exception handling
)
395 @ echo nmake
clean VSE-inlined-debug
(to build the debug MSVC inlined dll with structured exception handling
)
396 @ echo nmake
clean VC-inlined-debug
(to build the debug MSVC inlined dll with C cleanup code
)
397 @ echo nmake
clean VC-static-debug
(to build the debug MSVC static lib with C cleanup code
)
400 @
$(MAKE
) /E
clean VCE-inlined
401 @
$(MAKE
) /E
clean VSE-inlined
402 @
$(MAKE
) /E
clean VC-inlined
403 @
$(MAKE
) /E
clean VCE-inlined-debug
404 @
$(MAKE
) /E
clean VSE-inlined-debug
405 @
$(MAKE
) /E
clean VC-inlined-debug
408 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCEFLAGS)" CLEANUP
=__CLEANUP_CXX pthreadVCE
$(DLL_VER
).dll
411 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCEFLAGSD)" CLEANUP
=__CLEANUP_CXX pthreadVCE
$(DLL_VERD
).dll
414 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VSEFLAGS)" CLEANUP
=__CLEANUP_SEH pthreadVSE
$(DLL_VER
).dll
417 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VSEFLAGSD)" CLEANUP
=__CLEANUP_SEH pthreadVSE
$(DLL_VERD
).dll
420 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCFLAGS)" CLEANUP
=__CLEANUP_C pthreadVC
$(DLL_VER
).dll
423 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCFLAGSD)" CLEANUP
=__CLEANUP_C pthreadVC
$(DLL_VERD
).dll
426 # The so-called inlined DLL is just a single translation unit with
427 # inlining optimisation turned on.
430 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCEFLAGS) /DPTW32_BUILD_INLINED" CLEANUP
=__CLEANUP_CXX pthreadVCE
$(DLL_VER
).stamp
433 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCEFLAGSD) /DPTW32_BUILD_INLINED" CLEANUP
=__CLEANUP_CXX pthreadVCE
$(DLL_VERD
).stamp
436 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VSEFLAGS) /DPTW32_BUILD_INLINED" CLEANUP
=__CLEANUP_SEH pthreadVSE
$(DLL_VER
).stamp
439 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VSEFLAGSD) /DPTW32_BUILD_INLINED" CLEANUP
=__CLEANUP_SEH pthreadVSE
$(DLL_VERD
).stamp
442 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCFLAGS) /DPTW32_BUILD_INLINED" CLEANUP
=__CLEANUP_C pthreadVC
$(DLL_VER
).stamp
445 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCFLAGSD) /DPTW32_BUILD_INLINED" CLEANUP
=__CLEANUP_C pthreadVC
$(DLL_VERD
).stamp
448 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCFLAGS) /DPTW32_BUILD_INLINED /DPTW32_STATIC_LIB" CLEANUP
=__CLEANUP_C pthreadVC
$(DLL_VER
).static
451 @
$(MAKE
) /E
/nologo EHFLAGS
="$(VCFLAGSD) /DPTW32_BUILD_INLINED /DPTW32_STATIC_LIB" CLEANUP
=__CLEANUP_C pthreadVC
$(DLL_VERD
).static
454 if exist pthread
*.dll del pthread
*.dll
455 if exist pthread
*.lib del pthread
*.lib
456 if exist
*.manifest del
*.manifest
457 if exist
*.stamp del
*.stamp
460 if exist
*.obj del
*.obj
461 if exist
*.def del
*.def
462 if exist
*.ilk del
*.ilk
463 if exist
*.pdb del
*.pdb
464 if exist
*.exp del
*.exp
465 if exist
*.map del
*.map
468 if exist
*.res del
*.res
472 copy pthread
*.dll
$(DLLDEST
)
473 copy pthread
*.lib
$(LIBDEST
)
474 copy pthread.h
$(HDRDEST
)
475 copy sched.h
$(HDRDEST
)
476 copy semaphore.h
$(HDRDEST
)
479 $(CC
) /LDd
/Zi
/nologo
$(DLL_OBJS
) /link
/implib
:$*.lib
$(XLIBS
) /out
:$@
481 $(INLINED_STAMPS
): $(DLL_INLINED_OBJS
)
482 $(CC
) /LDd
/Zi
/nologo
$(DLL_INLINED_OBJS
) /link
/implib
:$*.lib
$(XLIBS
) /out
:$*.dll
484 $(STATIC_STAMPS
): $(DLL_INLINED_OBJS
)
485 if exist
$*.lib del
$*.lib
486 lib
$(DLL_INLINED_OBJS
) /out
:$*.lib
489 $(CC
) $(EHFLAGS
) /D
$(CLEANUP
) -c
$<
491 # TARGET_CPU is an environment variable set by Visual Studio Command Prompt
492 # as provided by the SDK
494 rc
/dPTW32_ARCH
$(TARGET_CPU
) /dPTW32_RC_MSC
/d
$(CLEANUP
) $<
497 $(CC
) /P
/O2
/Ob1
$(VCFLAGS
) $<
499 attr.obj
: attr.c
$(ATTR_SRCS
) $(INCL
)
500 barrier.obj
: barrier.c
$(BARRIER_SRCS
) $(INCL
)
501 cancel.obj
: cancel.c
$(CANCEL_SRCS
) $(INCL
)
502 condvar.obj
: condvar.c
$(CONDVAR_SRCS
) $(INCL
)
503 exit.obj
: exit.c
$(EXIT_SRCS
) $(INCL
)
504 misc.obj
: misc.c
$(MISC_SRCS
) $(INCL
)
505 mutex.obj
: mutex.c
$(MUTEX_SRCS
) $(INCL
)
506 nonportable.obj
: nonportable.c
$(NONPORTABLE_SRCS
) $(INCL
)
507 private.obj
: private.c
$(PRIVATE_SRCS
) $(INCL
)
508 rwlock.obj
: rwlock.c
$(RWLOCK_SRCS
) $(INCL
)
509 sched.obj
: sched.c
$(SCHED_SRCS
) $(INCL
)
510 semaphore.obj
: semaphore.c
$(SEMAPHORE_SRCS
) $(INCL
)
511 spin.obj
: spin.c
$(SPIN_SRCS
) $(INCL
)
512 sync.obj
: sync.c
$(SYNC_SRCS
) $(INCL
)
513 tsd.obj
: tsd.c
$(TSD_SRCS
) $(INCL
)
514 version.res
: version.rc
$(INCL
)