2
# --------------------------------------------------------------------------
4
# Pthreads-win32 - POSIX Threads Library for Win32
5
# Copyright(C) 1998 John E. Bossom
6
# Copyright(C) 1999,2005 Pthreads-win32 contributors
8
# Contact Email: rpj@callisto.canberra.edu.au
10
# The current list of contributors is contained
11
# in the file CONTRIBUTORS included with the source
12
# code distribution. The list can also be seen at the
13
# following World Wide Web location:
14
# http://sources.redhat.com/pthreads-win32/contributors.html
16
# This library is free software; you can redistribute it and/or
17
# modify it under the terms of the GNU Lesser General Public
18
# License as published by the Free Software Foundation; either
19
# version 2 of the License, or (at your option) any later version.
21
# This library is distributed in the hope that it will be useful,
22
# but WITHOUT ANY WARRANTY; without even the implied warranty of
23
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24
# Lesser General Public License for more details.
26
# You should have received a copy of the GNU Lesser General Public
27
# License along with this library in the file COPYING.LIB;
28
# if not, write to the Free Software Foundation, Inc.,
29
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
37
DLLDEST = $(DEVROOT)\DLL
38
LIBDEST = $(DEVROOT)\DLL
50
# For cross compiling use e.g.
51
# make CROSS=i386-mingw32msvc- clean GC-inlined
55
DLLTOOL = $(CROSS)dlltool
58
RANLIB = $(CROSS)ranlib
61
OPT = $(CLEANUP) -O3 -finline-functions
62
DOPT = $(CLEANUP) -g -O0
65
RCFLAGS = --include-dir=.
68
# ----------------------------------------------------------------------
69
# The library can be built with some alternative behaviour to
70
# facilitate development of applications on Win32 that will be ported
71
# to other POSIX systems. Nothing definable here will make the library
72
# non-compliant, but applications that make assumptions that POSIX
73
# does not garrantee may fail or misbehave under some settings.
75
# PTW32_THREAD_ID_REUSE_INCREMENT
77
# POSIX says that applications should assume that thread IDs can be
78
# recycled. However, Solaris and some other systems use a [very large]
79
# sequence number as the thread ID, which provides virtual uniqueness.
80
# Pthreads-win32 provides pseudo-unique IDs when the default increment
81
# (1) is used, but pthread_t is not a scalar type like Solaris's.
84
# Set to any value in the range: 0 <= value <= 2^wordsize
87
# Set to 0 to emulate non recycle-unique behaviour like Linux or *BSD.
88
# Set to 1 for recycle-unique thread IDs (this is the default).
89
# Set to some other +ve value to emulate smaller word size types
90
# (i.e. will wrap sooner).
92
#PTW32_FLAGS = "-DPTW32_THREAD_ID_REUSE_INCREMENT=0"
94
# ----------------------------------------------------------------------
96
GC_CFLAGS = $(PTW32_FLAGS)
97
GCE_CFLAGS = $(PTW32_FLAGS) -mthreads
101
CFLAGS = $(OPT) $(XOPT) -I. -DHAVE_CONFIG_H -Wall
107
# Agregate modules for inlinability
133
# Separate modules for minimum size statically linked images
134
SMALL_STATIC_OBJS = \
135
pthread_attr_init.o \
136
pthread_attr_destroy.o \
137
pthread_attr_getdetachstate.o \
138
pthread_attr_setdetachstate.o \
139
pthread_attr_getstackaddr.o \
140
pthread_attr_setstackaddr.o \
141
pthread_attr_getstacksize.o \
142
pthread_attr_setstacksize.o \
143
pthread_attr_getscope.o \
144
pthread_attr_setscope.o \
145
pthread_attr_setschedpolicy.o \
146
pthread_attr_getschedpolicy.o \
147
pthread_attr_setschedparam.o \
148
pthread_attr_getschedparam.o \
149
pthread_attr_setinheritsched.o \
150
pthread_attr_getinheritsched.o \
151
pthread_barrier_init.o \
152
pthread_barrier_destroy.o \
153
pthread_barrier_wait.o \
154
pthread_barrierattr_init.o \
155
pthread_barrierattr_destroy.o \
156
pthread_barrierattr_setpshared.o \
157
pthread_barrierattr_getpshared.o \
158
pthread_setcancelstate.o \
159
pthread_setcanceltype.o \
160
pthread_testcancel.o \
163
pthread_condattr_destroy.o \
164
pthread_condattr_getpshared.o \
165
pthread_condattr_init.o \
166
pthread_condattr_setpshared.o \
167
pthread_cond_destroy.o \
168
pthread_cond_init.o \
169
pthread_cond_signal.o \
170
pthread_cond_wait.o \
177
pthread_mutex_init.o \
178
pthread_mutex_destroy.o \
179
pthread_mutexattr_init.o \
180
pthread_mutexattr_destroy.o \
181
pthread_mutexattr_getpshared.o \
182
pthread_mutexattr_setpshared.o \
183
pthread_mutexattr_settype.o \
184
pthread_mutexattr_gettype.o \
185
pthread_mutex_lock.o \
186
pthread_mutex_timedlock.o \
187
pthread_mutex_unlock.o \
188
pthread_mutex_trylock.o \
189
pthread_mutexattr_setkind_np.o \
190
pthread_mutexattr_getkind_np.o \
191
pthread_getw32threadhandle_np.o \
193
pthread_num_processors_np.o \
194
pthread_win32_attach_detach_np.o \
196
pthread_getconcurrency.o \
199
pthread_setconcurrency.o \
200
pthread_rwlock_init.o \
201
pthread_rwlock_destroy.o \
202
pthread_rwlockattr_init.o \
203
pthread_rwlockattr_destroy.o \
204
pthread_rwlockattr_getpshared.o \
205
pthread_rwlockattr_setpshared.o \
206
pthread_rwlock_rdlock.o \
207
pthread_rwlock_wrlock.o \
208
pthread_rwlock_unlock.o \
209
pthread_rwlock_tryrdlock.o \
210
pthread_rwlock_trywrlock.o \
211
pthread_setschedparam.o \
212
pthread_getschedparam.o \
213
pthread_timechange_handler_np.o \
215
ptw32_cond_check_need_init.o \
217
ptw32_mutex_check_need_init.o \
218
ptw32_processInitialize.o \
219
ptw32_processTerminate.o \
220
ptw32_threadStart.o \
221
ptw32_threadDestroy.o \
222
ptw32_tkAssocCreate.o \
223
ptw32_tkAssocDestroy.o \
224
ptw32_callUserDestroyRoutines.o \
227
ptw32_InterlockedCompareExchange.o \
228
ptw32_getprocessors.o \
233
ptw32_relmillisecs.o \
234
ptw32_rwlock_check_need_init.o \
235
sched_get_priority_max.o \
236
sched_get_priority_min.o \
237
sched_setscheduler.o \
238
sched_getscheduler.o \
246
sem_post_multiple.o \
253
ptw32_spinlock_check_need_init.o \
254
pthread_spin_init.o \
255
pthread_spin_destroy.o \
256
pthread_spin_lock.o \
257
pthread_spin_unlock.o \
258
pthread_spin_trylock.o \
261
pthread_key_create.o \
262
pthread_key_delete.o \
263
pthread_setspecific.o \
264
pthread_getspecific.o \
265
w32_CancelableWait.o \
276
pthread_attr_init.c \
277
pthread_attr_destroy.c \
278
pthread_attr_getdetachstate.c \
279
pthread_attr_setdetachstate.c \
280
pthread_attr_getstackaddr.c \
281
pthread_attr_setstackaddr.c \
282
pthread_attr_getstacksize.c \
283
pthread_attr_setstacksize.c \
284
pthread_attr_getscope.c \
285
pthread_attr_setscope.c
288
pthread_barrier_init.c \
289
pthread_barrier_destroy.c \
290
pthread_barrier_wait.c \
291
pthread_barrierattr_init.c \
292
pthread_barrierattr_destroy.c \
293
pthread_barrierattr_setpshared.c \
294
pthread_barrierattr_getpshared.c
297
pthread_setcancelstate.c \
298
pthread_setcanceltype.c \
299
pthread_testcancel.c \
303
ptw32_cond_check_need_init.c \
304
pthread_condattr_destroy.c \
305
pthread_condattr_getpshared.c \
306
pthread_condattr_init.c \
307
pthread_condattr_setpshared.c \
308
pthread_cond_destroy.c \
309
pthread_cond_init.c \
310
pthread_cond_signal.c \
318
pthread_getconcurrency.c \
322
pthread_setconcurrency.c \
330
ptw32_mutex_check_need_init.c \
331
pthread_mutex_init.c \
332
pthread_mutex_destroy.c \
333
pthread_mutexattr_init.c \
334
pthread_mutexattr_destroy.c \
335
pthread_mutexattr_getpshared.c \
336
pthread_mutexattr_setpshared.c \
337
pthread_mutexattr_settype.c \
338
pthread_mutexattr_gettype.c \
339
pthread_mutex_lock.c \
340
pthread_mutex_timedlock.c \
341
pthread_mutex_unlock.c \
342
pthread_mutex_trylock.c
345
pthread_mutexattr_setkind_np.c \
346
pthread_mutexattr_getkind_np.c \
347
pthread_getw32threadhandle_np.c \
349
pthread_num_processors_np.c \
350
pthread_win32_attach_detach_np.c \
351
pthread_timechange_handler_np.c
355
ptw32_processInitialize.c \
356
ptw32_processTerminate.c \
357
ptw32_threadStart.c \
358
ptw32_threadDestroy.c \
359
ptw32_tkAssocCreate.c \
360
ptw32_tkAssocDestroy.c \
361
ptw32_callUserDestroyRoutines.c \
363
ptw32_relmillisecs.c \
366
ptw32_InterlockedCompareExchange.c \
367
ptw32_getprocessors.c
370
ptw32_rwlock_check_need_init.c \
371
ptw32_rwlock_cancelwrwait.c \
372
pthread_rwlock_init.c \
373
pthread_rwlock_destroy.c \
374
pthread_rwlockattr_init.c \
375
pthread_rwlockattr_destroy.c \
376
pthread_rwlockattr_getpshared.c \
377
pthread_rwlockattr_setpshared.c \
378
pthread_rwlock_rdlock.c \
379
pthread_rwlock_timedrdlock.c \
380
pthread_rwlock_wrlock.c \
381
pthread_rwlock_timedwrlock.c \
382
pthread_rwlock_unlock.c \
383
pthread_rwlock_tryrdlock.c \
384
pthread_rwlock_trywrlock.c
387
pthread_attr_setschedpolicy.c \
388
pthread_attr_getschedpolicy.c \
389
pthread_attr_setschedparam.c \
390
pthread_attr_getschedparam.c \
391
pthread_attr_setinheritsched.c \
392
pthread_attr_getinheritsched.c \
393
pthread_setschedparam.c \
394
pthread_getschedparam.c \
395
sched_get_priority_max.c \
396
sched_get_priority_min.c \
397
sched_setscheduler.c \
398
sched_getscheduler.c \
408
sem_post_multiple.c \
415
ptw32_spinlock_check_need_init.c \
416
pthread_spin_init.c \
417
pthread_spin_destroy.c \
418
pthread_spin_lock.c \
419
pthread_spin_unlock.c \
420
pthread_spin_trylock.c
427
pthread_key_create.c \
428
pthread_key_delete.c \
429
pthread_setspecific.c \
430
pthread_getspecific.c
433
GCE_DLL = pthreadGCE$(DLL_VER).dll
434
GCED_DLL= pthreadGCE$(DLL_VERD).dll
435
GCE_LIB = libpthreadGCE$(DLL_VER).a
436
GCED_LIB= libpthreadGCE$(DLL_VERD).a
437
GCE_INLINED_STAMP = pthreadGCE$(DLL_VER).stamp
438
GCED_INLINED_STAMP = pthreadGCE$(DLL_VERD).stamp
440
GC_DLL = pthreadGC$(DLL_VER).dll
441
GCD_DLL = pthreadGC$(DLL_VERD).dll
442
GC_LIB = libpthreadGC$(DLL_VER).a
443
GCD_LIB = libpthreadGC$(DLL_VERD).a
444
GC_INLINED_STAMP = pthreadGC$(DLL_VER).stamp
445
GCD_INLINED_STAMP = pthreadGC$(DLL_VERD).stamp
446
GC_STATIC_STAMP = libpthreadGC$(DLL_VER).stamp
447
GCD_STATIC_STAMP = libpthreadGC$(DLL_VERD).stamp
449
PTHREAD_DEF = pthread.def
452
@ echo "Run one of the following command lines:"
453
@ echo "make clean GC (to build the GNU C dll with C cleanup code)"
454
@ echo "make clean GCE (to build the GNU C dll with C++ exception handling)"
455
@ echo "make clean GC-inlined (to build the GNU C inlined dll with C cleanup code)"
456
@ echo "make clean GCE-inlined (to build the GNU C inlined dll with C++ exception handling)"
457
@ echo "make clean GC-static (to build the GNU C inlined static lib with C cleanup code)"
458
@ echo "make clean GC-debug (to build the GNU C debug dll with C cleanup code)"
459
@ echo "make clean GCE-debug (to build the GNU C debug dll with C++ exception handling)"
460
@ echo "make clean GC-inlined-debug (to build the GNU C inlined debug dll with C cleanup code)"
461
@ echo "make clean GCE-inlined-debug (to build the GNU C inlined debug dll with C++ exception handling)"
462
@ echo "make clean GC-static-debug (to build the GNU C inlined static debug lib with C cleanup code)"
469
$(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
472
$(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_DLL)
475
$(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
478
$(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_DLL)
481
$(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP)
484
$(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_INLINED_STAMP)
487
$(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
490
$(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_INLINED_STAMP)
493
$(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP)
496
$(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="$(DOPT)" $(GCD_STATIC_STAMP)
503
$(CC) -E -o $@ $(CFLAGS) $^
506
$(CC) -c $(CFLAGS) -DPTW32_BUILD_INLINED -Wa,-ahl $^ > $@
509
$(RC) $(RCFLAGS) $(CLEANUP) -o $@ $<
511
.SUFFIXES: .dll .rc .c .o
513
.c.o:; $(CC) -c -o $@ $(CFLAGS) $(XC_FLAGS) $<
516
$(GC_DLL) $(GCD_DLL): $(DLL_OBJS)
517
$(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS)
518
$(DLLTOOL) -z pthread.def $(DLL_OBJS)
519
$(DLLTOOL) -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
521
$(GCE_DLL): $(DLL_OBJS)
522
$(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS)
523
$(DLLTOOL) -z pthread.def $(DLL_OBJS)
524
$(DLLTOOL) -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
526
$(GC_INLINED_STAMP) $(GCD_INLINED_STAMP): $(DLL_INLINED_OBJS)
527
$(CC) $(OPT) $(XOPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
528
$(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS)
529
$(DLLTOOL) -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
530
echo touched > $(GC_INLINED_STAMP)
532
$(GCE_INLINED_STAMP) $(GCED_INLINED_STAMP): $(DLL_INLINED_OBJS)
533
$(CC) $(OPT) $(XOPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
534
$(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS)
535
$(DLLTOOL) -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
536
echo touched > $(GCE_INLINED_STAMP)
538
$(GC_STATIC_STAMP) $(GCD_STATIC_STAMP): $(DLL_INLINED_OBJS)
540
$(AR) -rv $(GC_LIB) $(DLL_INLINED_OBJS)
542
echo touched > $(GC_STATIC_STAMP)
550
-$(RM) $(PTHREAD_DEF)
557
-$(RM) $(GC_INLINED_STAMP)
558
-$(RM) $(GCE_INLINED_STAMP)
559
-$(RM) $(GC_STATIC_STAMP)
564
-$(RM) $(GCD_INLINED_STAMP)
565
-$(RM) $(GCED_INLINED_STAMP)
566
-$(RM) $(GCD_STATIC_STAMP)
568
attr.o: attr.c $(ATTR_SRCS) $(INCL)
569
barrier.o: barrier.c $(BARRIER_SRCS) $(INCL)
570
cancel.o: cancel.c $(CANCEL_SRCS) $(INCL)
571
condvar.o: condvar.c $(CONDVAR_SRCS) $(INCL)
572
exit.o: exit.c $(EXIT_SRCS) $(INCL)
573
misc.o: misc.c $(MISC_SRCS) $(INCL)
574
mutex.o: mutex.c $(MUTEX_SRCS) $(INCL)
575
nonportable.o: nonportable.c $(NONPORTABLE_SRCS) $(INCL)
576
private.o: private.c $(PRIVATE_SRCS) $(INCL)
577
rwlock.o: rwlock.c $(RWLOCK_SRCS) $(INCL)
578
sched.o: sched.c $(SCHED_SRCS) $(INCL)
579
semaphore.o: semaphore.c $(SEMAPHORE_SRCS) $(INCL)
580
spin.o: spin.c $(SPIN_SRCS) $(INCL)
581
sync.o: sync.c $(SYNC_SRCS) $(INCL)
582
tsd.o: tsd.c $(TSD_SRCS) $(INCL)
583
version.o: version.rc $(INCL)