GNUmakefile 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. # Makefile for the pthreads test suite.
  2. # If all of the .pass files can be created, the test suite has passed.
  3. #
  4. # --------------------------------------------------------------------------
  5. #
  6. # Pthreads-win32 - POSIX Threads Library for Win32
  7. # Copyright(C) 1998 John E. Bossom
  8. # Copyright(C) 1999,2005 Pthreads-win32 contributors
  9. #
  10. # Contact Email: [email protected]
  11. #
  12. # The current list of contributors is contained
  13. # in the file CONTRIBUTORS included with the source
  14. # code distribution. The list can also be seen at the
  15. # following World Wide Web location:
  16. # http://sources.redhat.com/pthreads-win32/contributors.html
  17. #
  18. # This library is free software; you can redistribute it and/or
  19. # modify it under the terms of the GNU Lesser General Public
  20. # License as published by the Free Software Foundation; either
  21. # version 2 of the License, or (at your option) any later version.
  22. #
  23. # This library is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. # Lesser General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Lesser General Public
  29. # License along with this library in the file COPYING.LIB;
  30. # if not, write to the Free Software Foundation, Inc.,
  31. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  32. #
  33. DLL_VER = 2
  34. CP = cp -f
  35. MV = mv -f
  36. RM = rm -f
  37. CAT = cat
  38. MKDIR = mkdir
  39. TOUCH = echo Passed >
  40. ECHO = @echo
  41. MAKE = make -k
  42. # For cross compiling use e.g.
  43. # # make CROSS=i386-mingw32msvc- clean GC
  44. CROSS =
  45. # For cross testing use e.g.
  46. # # make RUN=wine CROSS=i386-mingw32msvc- clean GC
  47. RUN =
  48. AR = $(CROSS)ar
  49. DLLTOOL = $(CROSS)dlltool
  50. CC = $(CROSS)gcc
  51. CXX = $(CROSS)g++
  52. RANLIB = $(CROSS)ranlib
  53. #
  54. # Mingw32
  55. #
  56. XXCFLAGS =
  57. XXLIBS = -lws2_32 -lgomp
  58. OPT = -O3
  59. DOPT = -g -O0
  60. #CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
  61. CFLAGS = ${OPT} -UNDEBUG -Wall $(XXCFLAGS)
  62. BUILD_DIR = ..
  63. INCLUDES = -I.
  64. .INTERMEDIATE: %.exe %.pass
  65. .SECONDARY: %.exe %.pass
  66. .PRECIOUS: %.exe %.pass
  67. TEST = GC
  68. # Default lib version
  69. GCX = $(TEST)$(DLL_VER)
  70. # Files we need to run the tests
  71. # - paths are relative to pthreads build dir.
  72. HDR = pthread.h semaphore.h sched.h
  73. LIB = libpthread$(GCX).a
  74. DLL = pthread$(GCX).dll
  75. # The next path is relative to $BUILD_DIR
  76. QAPC = # ../QueueUserAPCEx/User/quserex.dll
  77. COPYFILES = $(HDR) $(LIB) $(DLL) $(QAPC)
  78. # If a test case returns a non-zero exit code to the shell, make will
  79. # stop.
  80. TESTS = \
  81. sizes loadfree \
  82. self1 mutex5 mutex1 mutex1e mutex1n mutex1r \
  83. semaphore1 semaphore2 semaphore3 \
  84. condvar1 condvar1_1 condvar1_2 condvar2 condvar2_1 exit1 \
  85. create1 create2 create3 reuse1 reuse2 equal1 \
  86. sequence1 kill1 valid1 valid2 \
  87. exit2 exit3 exit4 exit5 \
  88. join0 join1 detach1 join2 join3 \
  89. mutex2 mutex2r mutex2e mutex3 mutex3r mutex3e \
  90. mutex4 mutex6 mutex6n mutex6e mutex6r \
  91. mutex6s mutex6es mutex6rs \
  92. mutex7 mutex7n mutex7e mutex7r mutex8 mutex8n mutex8e mutex8r \
  93. robust1 robust2 robust3 robust4 robust5 \
  94. count1 \
  95. once1 once2 once3 once4 self2 \
  96. cancel1 cancel2 \
  97. semaphore4 semaphore4t semaphore5 \
  98. barrier1 barrier2 barrier3 barrier4 barrier5 barrier6 \
  99. tsd1 tsd2 openmp1 delay1 delay2 eyal1 \
  100. condvar3 condvar3_1 condvar3_2 condvar3_3 \
  101. condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \
  102. errno1 \
  103. rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 rwlock7 rwlock8 \
  104. rwlock2_t rwlock3_t rwlock4_t rwlock5_t rwlock6_t rwlock6_t2 \
  105. context1 cancel3 cancel4 cancel5 cancel6a cancel6d \
  106. cancel7 cancel8 \
  107. cleanup0 cleanup1 cleanup2 cleanup3 \
  108. priority1 priority2 inherit1 \
  109. spin1 spin2 spin3 spin4 \
  110. exception1 exception2 exception3 \
  111. cancel9 stress1
  112. STRESSTESTS = \
  113. stress1
  114. BENCHTESTS = \
  115. benchtest1 benchtest2 benchtest3 benchtest4 benchtest5
  116. STATICTESTS = \
  117. sizes \
  118. self1 mutex5 mutex1 mutex1e mutex1n mutex1r \
  119. semaphore1 semaphore2 semaphore3 \
  120. condvar1 condvar1_1 condvar1_2 condvar2 condvar2_1 exit1 \
  121. create1 create2 create3 reuse1 reuse2 equal1 \
  122. sequence1 kill1 valid1 valid2 \
  123. exit2 exit3 exit4 exit5 \
  124. join0 join1 detach1 join2 join3 \
  125. mutex2 mutex2r mutex2e mutex3 mutex3r mutex3e \
  126. mutex4 mutex6 mutex6n mutex6e mutex6r \
  127. mutex6s mutex6es mutex6rs \
  128. mutex7 mutex7n mutex7e mutex7r mutex8 mutex8n mutex8e mutex8r \
  129. robust1 robust2 robust3 robust4 robust5 \
  130. count1 \
  131. once1 once2 once3 once4 self2 \
  132. cancel1 cancel2 \
  133. semaphore4 semaphore4t semaphore5 \
  134. barrier1 barrier2 barrier3 barrier4 barrier5 barrier6 \
  135. tsd1 tsd2 delay1 delay2 eyal1 \
  136. condvar3 condvar3_1 condvar3_2 condvar3_3 \
  137. condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \
  138. errno1 \
  139. rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 rwlock7 rwlock8 \
  140. rwlock2_t rwlock3_t rwlock4_t rwlock5_t rwlock6_t rwlock6_t2 \
  141. context1 cancel3 cancel4 cancel5 cancel6a cancel6d \
  142. cancel7 cancel8 \
  143. cleanup0 cleanup1 cleanup2 cleanup3 \
  144. priority1 priority2 inherit1 \
  145. spin1 spin2 spin3 spin4 \
  146. exception1 exception2 exception3 \
  147. cancel9 stress1
  148. ALLTESTS = $(TESTS) $(BENCHTESTS)
  149. ASM = $(ALLTESTS:%=%.s)
  150. PASSES = $(TESTS:%=%.pass)
  151. BENCHRESULTS = $(BENCHTESTS:%=%.bench)
  152. STRESSRESULTS = $(STRESSTESTS:%=%.pass)
  153. STATICRESULTS = $(STATICTESTS:%=%.pass)
  154. help:
  155. @ $(ECHO) "Run one of the following command lines:"
  156. @ $(ECHO) "make clean GC (to test using GC dll with C (no EH) applications)"
  157. @ $(ECHO) "make clean GCX (to test using GC dll with C++ (EH) applications)"
  158. @ $(ECHO) "make clean GCE (to test using GCE dll with C++ (EH) applications)"
  159. @ $(ECHO) "make clean GC-bench (to benchtest using GNU C dll with C cleanup code)"
  160. @ $(ECHO) "make clean GCE-bench (to benchtest using GNU C dll with C++ exception handling)"
  161. @ $(ECHO) "make clean GC-stress (to stresstest using GNU C dll with C cleanup code)"
  162. @ $(ECHO) "make clean GCE-stress (to stresstest using GNU C dll with C++ exception handling)"
  163. @ $(ECHO) "make clean GC-static (to test using GC static lib with C (no EH) applications)"
  164. @ $(ECHO) "make clean GC-debug (to test using GC dll with C (no EH) applications)"
  165. all:
  166. @ $(MAKE) clean GC
  167. @ $(MAKE) clean GCX
  168. @ $(MAKE) clean GCE
  169. GC:
  170. $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-pass
  171. GC-asm:
  172. $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-asm
  173. GCE:
  174. $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_CXX" all-pass
  175. GCX:
  176. $(MAKE) TEST=GC CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_C" all-pass
  177. GC-bench:
  178. $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
  179. GCE-bench:
  180. $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
  181. GC-debug:
  182. $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
  183. GCE-debug:
  184. $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -D__CLEANUP_CXX" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
  185. GC-bench-debug:
  186. $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" OPT="${OPT}" DLL_VER="$(DLL_VER)d" all-bench
  187. GC-static:
  188. $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" XXLIBS="-lws2_32" DLL="" all-static
  189. GC-stress:
  190. $(ECHO) Stress tests can take a long time since they are trying to
  191. $(ECHO) expose weaknesses that may be intermittant or statistically rare.
  192. $(ECHO) A pass does not prove correctness, but may give greater confidence.
  193. $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="" all-stress
  194. GCE-stress:
  195. $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="" all-stress
  196. all-asm: $(ASM)
  197. @ $(ECHO) ALL TESTS PASSED! Congratulations!
  198. all-pass: $(PASSES)
  199. @ $(ECHO) ALL TESTS PASSED! Congratulations!
  200. all-bench: $(BENCHRESULTS)
  201. @ $(ECHO) BENCH TESTS COMPLETED.
  202. all-stress: $(STRESSRESULTS)
  203. @ $(ECHO) STRESS TESTS COMPLETED.
  204. all-static: $(STATICRESULTS)
  205. @ $(ECHO) ALL STATIC TESTS PASSED! Congratulations!
  206. benchtest1.bench:
  207. benchtest2.bench:
  208. benchtest3.bench:
  209. benchtest4.bench:
  210. benchtest5.bench:
  211. barrier1.pass: semaphore4.pass
  212. barrier2.pass: barrier1.pass
  213. barrier3.pass: barrier2.pass
  214. barrier4.pass: barrier3.pass
  215. barrier5.pass: barrier4.pass
  216. barrier6.pass: barrier5.pass
  217. cancel1.pass: create1.pass
  218. cancel2.pass: cancel1.pass
  219. cancel3.pass: context1.pass
  220. cancel4.pass: cancel3.pass
  221. cancel5.pass: cancel3.pass
  222. cancel6a.pass: cancel3.pass
  223. cancel6d.pass: cancel3.pass
  224. cancel7.pass: kill1.pass
  225. cancel8.pass: cancel7.pass
  226. cancel9.pass: cancel8.pass
  227. cleanup0.pass: cancel5.pass
  228. cleanup1.pass: cleanup0.pass
  229. cleanup2.pass: cleanup1.pass
  230. cleanup3.pass: cleanup2.pass
  231. condvar1.pass:
  232. condvar1_1.pass: condvar1.pass
  233. condvar1_2.pass: join2.pass
  234. condvar2.pass: condvar1.pass
  235. condvar2_1.pass: condvar2.pass join2.pass
  236. condvar3.pass: create1.pass condvar2.pass
  237. condvar3_1.pass: condvar3.pass join2.pass
  238. condvar3_2.pass: condvar3_1.pass
  239. condvar3_3.pass: condvar3_2.pass
  240. condvar4.pass: create1.pass
  241. condvar5.pass: condvar4.pass
  242. condvar6.pass: condvar5.pass
  243. condvar7.pass: condvar6.pass cleanup1.pass
  244. condvar8.pass: condvar7.pass
  245. condvar9.pass: condvar8.pass
  246. context1.pass: cancel1.pass
  247. count1.pass: join1.pass
  248. create1.pass: mutex2.pass
  249. create2.pass: create1.pass
  250. create3.pass: create2.pass
  251. delay1.pass:
  252. delay2.pass: delay1.pass
  253. detach1.pass: join0.pass
  254. equal1.pass: create1.pass
  255. errno1.pass: mutex3.pass
  256. exception1.pass: cancel4.pass
  257. exception2.pass: exception1.pass
  258. exception3.pass: exception2.pass
  259. exit1.pass:
  260. exit2.pass: create1.pass
  261. exit3.pass: create1.pass
  262. exit4.pass:
  263. exit5.pass: exit4.pass kill1.pass
  264. eyal1.pass: tsd1.pass
  265. inherit1.pass: join1.pass priority1.pass
  266. join0.pass: create1.pass
  267. join1.pass: create1.pass
  268. join2.pass: create1.pass
  269. join3.pass: join2.pass
  270. kill1.pass:
  271. loadfree.pass: pthread.dll
  272. mutex1.pass: self1.pass
  273. mutex1n.pass: mutex1.pass
  274. mutex1e.pass: mutex1.pass
  275. mutex1r.pass: mutex1.pass
  276. mutex2.pass: mutex1.pass
  277. mutex2r.pass: mutex2.pass
  278. mutex2e.pass: mutex2.pass
  279. mutex3.pass: create1.pass
  280. mutex3r.pass: mutex3.pass
  281. mutex3e.pass: mutex3.pass
  282. mutex4.pass: mutex3.pass
  283. mutex5.pass:
  284. mutex6.pass: mutex4.pass
  285. mutex6n.pass: mutex4.pass
  286. mutex6e.pass: mutex4.pass
  287. mutex6r.pass: mutex4.pass
  288. mutex6s.pass: mutex6.pass
  289. mutex6rs.pass: mutex6r.pass
  290. mutex6es.pass: mutex6e.pass
  291. mutex7.pass: mutex6.pass
  292. mutex7n.pass: mutex6n.pass
  293. mutex7e.pass: mutex6e.pass
  294. mutex7r.pass: mutex6r.pass
  295. mutex8.pass: mutex7.pass
  296. mutex8n.pass: mutex7n.pass
  297. mutex8e.pass: mutex7e.pass
  298. mutex8r.pass: mutex7r.pass
  299. once1.pass: create1.pass
  300. once2.pass: once1.pass
  301. once3.pass: once2.pass
  302. once4.pass: once3.pass
  303. openmp1.pass: tsd2.pass
  304. priority1.pass: join1.pass
  305. priority2.pass: priority1.pass barrier3.pass
  306. reuse1.pass: create3.pass
  307. reuse2.pass: reuse1.pass
  308. robust1.pass: mutex8r.pass
  309. robust2.pass: mutex8r.pass
  310. robust3.pass: robust2.pass
  311. robust4.pass: robust3.pass
  312. robust5.pass: robust4.pass
  313. rwlock1.pass: condvar6.pass
  314. rwlock2.pass: rwlock1.pass
  315. rwlock3.pass: rwlock2.pass join2.pass
  316. rwlock4.pass: rwlock3.pass
  317. rwlock5.pass: rwlock4.pass
  318. rwlock6.pass: rwlock5.pass
  319. rwlock7.pass: rwlock6.pass
  320. rwlock8.pass: rwlock7.pass
  321. rwlock2_t.pass: rwlock2.pass
  322. rwlock3_t.pass: rwlock2_t.pass
  323. rwlock4_t.pass: rwlock3_t.pass
  324. rwlock5_t.pass: rwlock4_t.pass
  325. rwlock6_t.pass: rwlock5_t.pass
  326. rwlock6_t2.pass: rwlock6_t.pass
  327. self1.pass:
  328. self2.pass: create1.pass
  329. semaphore1.pass:
  330. semaphore2.pass:
  331. semaphore3.pass: semaphore2.pass
  332. semaphore4.pass: semaphore3.pass cancel1.pass
  333. semaphore4t.pass: semaphore4.pass
  334. semaphore5.pass: semaphore4.pass
  335. sequence1.pass: reuse2.pass
  336. sizes.pass:
  337. spin1.pass:
  338. spin2.pass: spin1.pass
  339. spin3.pass: spin2.pass
  340. spin4.pass: spin3.pass
  341. stress1.pass:
  342. tsd1.pass: barrier5.pass join1.pass
  343. tsd2.pass: tsd1.pass
  344. valid1.pass: join1.pass
  345. valid2.pass: valid1.pass
  346. sizes.pass: sizes.exe
  347. @ $(ECHO) Running $*
  348. @ $(RUN) ./$< > SIZES.$(TEST)
  349. @ $(CAT) SIZES.$(TEST)
  350. @ $(ECHO) Passed
  351. @ $(TOUCH) $@
  352. %.pass: %.exe
  353. @ $(ECHO) Running $*
  354. @ $(RUN) ./$*
  355. @ $(ECHO) Passed
  356. @ $(TOUCH) $@
  357. %.bench: $(LIB) $(DLL) $(HDR) $(QAPC) $(XXLIBS) %.exe
  358. @ $(ECHO) Running $*
  359. @ $(RUN) ./$*
  360. @ $(ECHO) Done
  361. @ $(TOUCH) $@
  362. %.exe: %.c $(LIB) $(DLL) $(HDR) $(QAPC)
  363. @ $(ECHO) Compiling $@
  364. @ $(ECHO) $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS)
  365. @ $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS)
  366. %.pre: %.c $(HDR)
  367. @ $(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
  368. %.s: %.c $(HDR)
  369. @ $(ECHO) Compiling $@
  370. @ $(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
  371. $(COPYFILES):
  372. @ $(ECHO) Copying $(BUILD_DIR)/$@
  373. @ $(CP) $(BUILD_DIR)/$@ .
  374. benchlib.o: benchlib.c
  375. @ $(ECHO) Compiling $@
  376. @ $(ECHO) $(CC) -c $(CFLAGS) $< $(INCLUDES)
  377. @ $(CC) -c $(CFLAGS) $< $(INCLUDES)
  378. pthread.dll: $(DLL)
  379. @ $(CP) $(DLL) $@
  380. clean:
  381. - $(RM) *.dll
  382. - $(RM) *.lib
  383. - $(RM) pthread.h
  384. - $(RM) semaphore.h
  385. - $(RM) sched.h
  386. - $(RM) *.a
  387. - $(RM) *.e
  388. - $(RM) *.i
  389. - $(RM) *.o
  390. - $(RM) *.s
  391. - $(RM) *.so
  392. - $(RM) *.obj
  393. - $(RM) *.pdb
  394. - $(RM) *.exe
  395. - $(RM) *.pass
  396. - $(RM) *.bench
  397. - $(RM) *.static
  398. - $(RM) *.log