blob: ddaa96caa3ad1b134230c06a9810e0402808118c (
plain)
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
#
# --------------------------------------------------------------------------
#
# Pthreads-win32 - POSIX Threads Library for Win32
# Copyright(C) 1998 John E. Bossom
# Copyright(C) 1999,2002 Pthreads-win32 contributors
#
# Contact Email: rpj@ise.canberra.edu.au
#
# 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
#
DEVROOT = C:\PTHREADS
DLLDEST = $(DEVROOT)\DLL
LIBDEST = $(DEVROOT)\DLL
#RM = rm
#MV = mv
#CP = cp
RM = erase
MV = rename
CP = copy
CC = gcc
CXX = g++
AR = ar
OPT = -O3
#OPT = -O3 -DTEST_ICE
#OPT = -O2 -DNDEBUG -finline-functions
LFLAGS = -lwsock32
GC_CFLAGS = -D__CLEANUP_C
GCE_CFLAGS = -D__CLEANUP_CXX -x c++ -mthreads
## Mingw32
MAKE = make
CFLAGS = $(OPT) -I. -D_WIN32_WINNT=0x400 -DHAVE_CONFIG_H -Wall
## Cygwin G++
#CFLAGS = $(OPT) -x $(GLANG) -fhandle-exceptions -D_WIN32_WINNT=0x400 -I. -DHAVE_CONFIG_H -Wall
# Agregate modules for inlinability
DLL_OBJS = \
attr.o \
barrier.o \
cancel.o \
cleanup.o \
condvar.o \
create.o \
dll.o \
errno.o \
exit.o \
fork.o \
global.o \
misc.o \
mutex.o \
nonportable.o \
private.o \
rwlock.o \
sched.o \
semaphore.o \
signal.o \
spin.o \
sync.o \
tsd.o
# Separate modules for minimum size statically linked images
SMALL_STATIC_OBJS = \
attr_is_attr.o \
attr_init.o \
attr_destroy.o \
attr_getdetachstate.o \
attr_setdetachstate.o \
attr_getstackaddr.o \
attr_setstackaddr.o \
attr_getstacksize.o \
attr_setstacksize.o \
attr_getscope.o \
attr_setscope.o \
barrier_init.o \
barrier_destroy.o \
barrier_wait.o \
barrier_attr_init.o \
barrier_attr_destroy.o \
barrier_attr_setpshared.o \
barrier_attr_getpshared.o \
cancel_setcancelstate.o \
cancel_setcanceltype.o \
cancel_testcancel.o \
cancel_cancel.o \
cleanup.o \
condvar_attr_destroy.o \
condvar_attr_getpshared.o \
condvar_attr_init.o \
condvar_attr_setpshared.o \
condvar_check_need_init.o \
condvar_destroy.o \
condvar_init.o \
condvar_signal.o \
condvar_wait.o \
create.o \
dll.o \
errno.o \
exit.o \
fork.o \
global.o \
mutex.o \
np_mutexattr_setkind.o \
np_mutexattr_getkind.o \
np_getw32threadhandle.o \
np_delay.o \
np_num_processors.o \
np_win32_attach.o \
private.o \
pthread_equal.o \
pthread_getconcurrency.o \
pthread_once.o \
pthread_self.o \
pthread_setconcurrency.o \
ptw32_calloc.o \
ptw32_new.o \
rwlock.o \
sched.o \
semaphore_init.o \
semaphore_destroy.o \
semaphore_trywait.o \
semaphore_timedwait.o \
semaphore_wait.o \
semaphore_post.o \
semaphore_postmultiple.o \
semaphore_getvalue.o \
semaphore_increase.o \
semaphore_decrease.o \
semaphore_open.o \
semaphore_close.o \
semaphore_unlink.o \
signal.o \
spin.o \
sync.o \
tsd.o \
w32_CancelableWait.o
INCL = \
config.h \
implement.h \
semaphore.h \
pthread.h \
need_errno.h
ATTR_SRCS = \
attr_is_attr.c \
attr_init.c \
attr_destroy.c \
attr_getdetachstate.c \
attr_setdetachstate.c \
attr_getstackaddr.c \
attr_setstackaddr.c \
attr_getstacksize.c \
attr_setstacksize.c \
attr_getscope.c \
attr_setscope.c
BARRIER_SRCS = \
barrier_init.c \
barrier_destroy.c \
barrier_wait.c \
barrier_attr_init.c \
barrier_attr_destroy.c \
barrier_attr_setpshared.c \
barrier_attr_getpshared.c
CANCEL_SRCS = \
cancel_setcancelstate.c \
cancel_setcanceltype.c \
cancel_testcancel.c \
cancel_cancel.c
CONDVAR_SRCS = \
condvar_attr_destroy.c \
condvar_attr_getpshared.c \
condvar_attr_init.c \
condvar_attr_setpshared.c \
condvar_check_need_init.c \
condvar_destroy.c \
condvar_init.c \
condvar_signal.c \
condvar_wait.c
MISC_SRCS = \
pthread_equal.c \
pthread_getconcurrency.c \
pthread_once.c \
pthread_self.c \
pthread_setconcurrency.c \
ptw32_calloc.c \
ptw32_new.c \
w32_CancelableWait.c
NONPORTABLE_SRCS = \
np_mutexattr_setkind.c \
np_mutexattr_getkind.c \
np_getw32threadhandle.c \
np_delay.c \
np_num_processors.c \
np_win32_attach.c
SEMAPHORE_SRCS = \
semaphore_init.c \
semaphore_destroy.c \
semaphore_trywait.c \
semaphore_timedwait.c \
semaphore_wait.c \
semaphore_post.c \
semaphore_postmultiple.c \
semaphore_getvalue.c \
semaphore_increase.c \
semaphore_decrease.c \
semaphore_open.c \
semaphore_close.c \
semaphore_unlink.c
GC_DLL = pthreadGC.dll
GCE_DLL = pthreadGCE.dll
GC_LIB = libpthreadGC.a
GCE_LIB = libpthreadGCE.a
all:
@ echo Run one of the following command lines:
@ echo make clean GCE (to build the GNU C dll with C++ exception handling)
@ echo make clean GC (to build the GNU C dll with C cleanup code)
auto:
@ $(MAKE) clean GCE
@ $(MAKE) clean GC
GC:
$(MAKE) CLEANUP_FLAGS="$(GC_CFLAGS)" $(GC_DLL)
GCE:
$(MAKE) CLEANUP_FLAGS="$(GCE_CFLAGS)" $(GCE_DLL)
tests:
@ cd tests
@ $(MAKE) auto
%.pre: %.c
$(CC) -E -o $@ $(CFLAGS) $^
%.s: %.c
$(CC) -c $(CFLAGS) -Wa,-ahl $^ > $@
.SUFFIXES: .dll .c .o
.c.o:; $(CC) -c -o $@ $(CFLAGS) $(CLEANUP_FLAGS) $<
$(GC_DLL): $(DLL_OBJS)
$(CC) $(OPT) -shared -o $@ $^ $(LFLAGS)
dlltool -k --dllname $@ --output-lib $(GC_LIB) --def pthread.def
$(GCE_DLL): $(DLL_OBJS)
$(CXX) $(OPT) -mthreads -shared -o $@ $^ $(LFLAGS)
dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def pthread.def
clean:
-$(RM) *~
-$(RM) *.pre
-$(RM) *.o
-$(RM) *.exe
realclean: clean
-$(RM) $(GC_LIB)
-$(RM) $(GCE_LIB)
-$(RM) $(GC_DLL)
-$(RM) $(GCE_DLL)
attr.o: attr.c $(ATTR_SRCS) $(INCL)
barrier.o: barrier.c $(BARRIER_SRCS) $(INCL)
cancel.o: cancel.c $(CANCEL_SRCS) $(INCL)
condvar.o: condvar.c $(CONDVAR_SRCS) $(INCL)
misc.o: misc.c $(MISC_SRCS) $(INCL)
nonportable.o: nonportable.c $(NONPORTABLE_SRCS) $(INCL)
semaphore.o: semaphore.c $(SEMAPHORE_SRCS) $(INCL)
|