GNUmakefile 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. # DUMA configuration:
  2. #
  3. # add "-DDUMA_NO_GLOBAL_MALLOC_FREE" (without quotes)
  4. # for not defining malloc/free in global namespace
  5. #
  6. # add "-DDUMA_EXPLICIT_INIT" (without quotes)
  7. # to do all the "risky" stuff getenv(), sem_init(), write() .. explicitly
  8. # from main().
  9. # you have to call duma_init() explicitly from main() this option also
  10. # avoids leak error messages for allocations before duma_init() got called.
  11. # this helps for leaky standard environments.
  12. #
  13. # add "-DDUMA_NO_THREAD_SAFETY" (without quotes)
  14. # for not supporting multi-threading
  15. #
  16. # add "-DDUMA_SO_NO_CPP_SUPPORT" or "-DDUMA_LIB_NO_CPP_SUPPORT" (without quotes)
  17. # for not directing new/delete to malloc/free
  18. #
  19. # add "-DDUMA_SO_NO_LEAKDETECTION" or "-DDUMA_LIB_NO_LEAKDETECTION" (without quotes)
  20. # if you don't want support for leak detection
  21. #
  22. # add "-DDUMA_SO_PREFER_ATEXIT" or "-DDUMA_LIB_PREFER_ATEXIT" (without quotes)
  23. # if you prefer atexit() over GNU Compiler's function attribute "destructor"
  24. #
  25. # add "-DDUMA_SO_PREFER_GETENV" or "-DDUMA_LIB_PREFER_GETENV" (without quotes)
  26. # if you prefer standard C library getenv() over global char **environ
  27. #
  28. # add "-DDUMA_OLD_NEW_MACRO" (without quotes)
  29. # if you want to use DUMA's old style NEW_ELEM() / NEW_ARRAY() macros.
  30. # when not defining this option, a standard conform new syntax can get used.
  31. # unfortunately you have to use DEL_ELEM/DEL_ARRAY further to utilize
  32. # filename and linenumber of deallocation calls
  33. #
  34. # add "-DDUMA_SO_NO_HANG_MSG" or "-DDUMA_LIB_NO_HANG_MSG" (without quotes)
  35. # set this if you want to suppress the extra messages around atexit().
  36. #
  37. # add "-DDUMA_NO_STRERROR" (without quotes)
  38. # set this if you want to suppress calls to strerror() to avoid recursion
  39. # on specific platforms.
  40. #
  41. ########################################
  42. #
  43. # preprocessor flags for building the shared library (DUMA_SO_LIBRARY):
  44. # - DUMA_SO_NO_CPP_SUPPORT
  45. # - DUMA_SO_NO_LEAKDETECTION
  46. # - DUMA_SO_PREFER_ATEXIT
  47. # - DUMA_SO_PREFER_GETENV
  48. # - DUMA_SO_NO_HANG_MSG
  49. #
  50. # preprocessor flags for building the static library:
  51. # - DUMA_LIB_NO_CPP_SUPPORT
  52. # - DUMA_LIB_NO_LEAKDETECTION
  53. # - DUMA_LIB_PREFER_ATEXIT
  54. # - DUMA_LIB_PREFER_GETENV
  55. # - DUMA_LIB_NO_HANG_MSG
  56. # - DUMA_NO_GLOBAL_MALLOC_FREE
  57. # - DUMA_EXPLICIT_INIT
  58. # - DUMA_NO_THREAD_SAFETY
  59. # - DUMA_OLD_NEW_MACRO
  60. # - DUMA_OLD_DEL_MACRO
  61. # - DUMA_NO_STRERROR
  62. #
  63. ########################################
  64. # edit following line
  65. DUMA_OPTIONS=
  66. # no leak detection on any platform:
  67. # use static library for finding leaks - with information memory was allocated
  68. # i think leak-checking without further information is quite useless!
  69. # additionaly too many platforms/environments are broken.
  70. DUMA_OPTIONS += -DDUMA_SO_NO_LEAKDETECTION
  71. # some test cases:
  72. #DUMA_OPTIONS += -DDUMA_LIB_NO_LEAKDETECTION
  73. #DUMA_OPTIONS += -DDUMA_NO_THREAD_SAFETY
  74. #DUMA_OPTIONS += -DDUMA_NO_CPP_SUPPORT
  75. PIC=-fPIC -DPIC
  76. DUMA_SO_OPTIONS=$(PIC) -DDUMA_SO_LIBRARY
  77. # for FreeBSD 5.4
  78. # DUMA_OPTIONS += -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS
  79. #
  80. # for FreeBSD 5.4 if DUMA_EXPLICIT_INIT is not set
  81. # DUMA_OPTIONS += -DDUMA_NO_LEAKDETECTION
  82. #
  83. # for cygwin environment on Windows
  84. # DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
  85. # also define 'WIN32'
  86. # some defaults:
  87. INSTALL=install
  88. RM=rm
  89. RMFORCE=rm -f
  90. ECHO=echo
  91. ECHOLF=echo .
  92. CC=cc
  93. CXX=c++
  94. LD=ld
  95. AR=ar
  96. RANLIB=ranlib
  97. INSTALL=install
  98. ifndef $(OS)
  99. OS=$(shell uname -s 2>/dev/null | tr '[:upper:]' '[:lower:]' 2>/dev/null || true)
  100. endif
  101. # dynamic dependencies
  102. DUMA_DYN_DEPS=$(DUMASO) tstheap_so$(EXEPOSTFIX) dumatestpp_so$(EXEPOSTFIX)
  103. # some OS specifics:
  104. ifeq ($(OS), Windows_NT)
  105. ifeq ($(OSTYPE), msys)
  106. $(info using settings for OS=Windows_NT, OSTYPE=msys)
  107. # call mingw32-make OSTYPE=msys
  108. # from Windows command prompt
  109. # having added the PATH for MINGW/bin
  110. # using explicit initialization to avoid leak report
  111. # from __w32_sharedptr_initialize() function
  112. BSWITCH=101
  113. DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
  114. RM=del
  115. RMFORCE=del /F 2>nul
  116. ECHO=echo
  117. ECHOLF=echo .
  118. CURPATH=
  119. DUMA_DYN_DEPS=
  120. DUMASO=
  121. CFLAGS=-g -O0
  122. CPPFLAGS=-g -O0
  123. LIBS=
  124. EXEPOSTFIX=.exe
  125. endif
  126. ifeq ($(OSTYPE), msys-sh)
  127. $(info using settings for OS=Windows_NT, OSTYPE=msys-sh)
  128. # call mingw32-make OSTYPE=msyssh
  129. # from MSYS shell
  130. # having added the PATH for MINGW/bin
  131. # using explicit initialization to avoid leak report
  132. # from __w32_sharedptr_initialize() function
  133. BSWITCH=102
  134. DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
  135. CC=mingw32-gcc
  136. CXX=mingw32-g++
  137. RM=rm
  138. RMFORCE=rm -f
  139. ECHO=echo
  140. ECHOLF=echo
  141. CURPATH=./
  142. DUMA_DYN_DEPS=
  143. DUMASO=
  144. CFLAGS=-g -O0
  145. CPPFLAGS=-g -O0
  146. LIBS=
  147. EXEPOSTFIX=.exe
  148. endif
  149. ifeq ($(OSTYPE), cygwin)
  150. $(info using settings for OS=Windows_NT, OSTYPE=cygwin)
  151. # call make OSTYPE=cygwin
  152. BSWITCH=103
  153. DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
  154. CURPATH=./
  155. DUMA_DYN_DEPS=
  156. DUMASO=
  157. CFLAGS=-g -O0 -DWIN32 -Wall -Wextra
  158. CPPFLAGS=-g -O0 -DWIN32 -Wall -Wextra
  159. LIBS=
  160. EXEPOSTFIX=.exe
  161. endif
  162. ifndef BSWITCH
  163. $(info using settings for OS=Windows_NT)
  164. BSWITCH=100
  165. DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
  166. CURPATH=./
  167. DUMA_DYN_DEPS=
  168. DUMASO=
  169. CFLAGS=-g -O0 -DWIN32
  170. CPPFLAGS=-g -O0 -DWIN32
  171. LIBS=
  172. EXEPOSTFIX=.exe
  173. endif
  174. endif
  175. ifeq ($(OS), osx)
  176. $(info using settings for OS=osx)
  177. # tested on darwin 8.0, which is the base for mac-osx
  178. # call: make OS=osx
  179. BSWITCH=210
  180. DUMA_OPTIONS += -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS
  181. DUMA_OPTIONS += -DDUMA_SO_PREFER_GETENV
  182. # DUMA_OPTIONS += -DDUMA_LIB_NO_LEAKDETECTION
  183. CURPATH=./
  184. # DUMA_DYN_DEPS=
  185. DUMASO=libduma.dylib
  186. DUMASO_LINK1=libduma.dylib
  187. CFLAGS=-g -O0
  188. CPPFLAGS=-g -O0
  189. LIBS=-lpthread
  190. EXEPOSTFIX=
  191. endif
  192. ifeq ($(OS), freebsd)
  193. $(info using settings for OS=freebsd)
  194. BSWITCH=310
  195. DUMA_OPTIONS += -DDUMA_NO_THREAD_SAFETY
  196. DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
  197. CURPATH=./
  198. DUMA_DYN_DEPS=
  199. DUMASO=
  200. DUMASO_LINK1=
  201. CFLAGS=-g -O0
  202. CPPFLAGS=-g -O0
  203. LIBS=-lpthread
  204. EXEPOSTFIX=
  205. endif
  206. ifeq ($(OS), netbsd)
  207. $(info using settings for OS=netbsd)
  208. BSWITCH=320
  209. CURPATH=./
  210. DUMASO=libduma.so.0.0.0
  211. DUMASO_LINK1=libduma.so.0
  212. DUMASO_LINK2=libduma.so
  213. CFLAGS=-g -O0
  214. CPPFLAGS=-g -O0
  215. LIBS=-lpthread
  216. EXEPOSTFIX=
  217. endif
  218. ifeq ($(OS), solaris)
  219. $(info using settings for OS=solaris)
  220. BSWITCH=410
  221. DUMA_OPTIONS += -DDUMA_NO_STRERROR
  222. CURPATH=./
  223. DUMA_DYN_DEPS=
  224. DUMASO=libduma.so.0.0.0
  225. DUMASO_LINK1=libduma.so.0
  226. DUMASO_LINK2=libduma.so
  227. CFLAGS=-g -O0
  228. CPPFLAGS=-g -O0
  229. LDFLAGS += -lgcc_s
  230. LDOPTIONS += -lgcc_s
  231. LIBS=-Wl,-R/opt/sfw/lib -lpthread
  232. EXEPOSTFIX=
  233. endif
  234. ifeq ($(OS), linux)
  235. $(info using settings for OS=linux)
  236. # Linux with GNU compiler and tools.
  237. CC=gcc
  238. CXX=g++
  239. BSWITCH=510
  240. CURPATH=./
  241. DUMASO=libduma.so.0.0.0
  242. DUMASO_LINK1=libduma.so.0
  243. DUMASO_LINK2=libduma.so
  244. CFLAGS=-g -O0 -Wall -Wextra
  245. CPPFLAGS=-g -O0 -Wall -Wextra
  246. LIBS=-lpthread
  247. EXEPOSTFIX=
  248. RM=rm -v --
  249. RMFORCE=rm -vf --
  250. ECHO=echo
  251. ECHOLF=echo ""
  252. endif
  253. ifndef BSWITCH
  254. # default is generic full Unix
  255. BSWITCH=610
  256. $(warning using default options. OS/OSTYPE not set or contain unknown values!)
  257. CURPATH=./
  258. DUMASO=libduma.so.0.0.0
  259. DUMASO_LINK1=libduma.so.0
  260. DUMASO_LINK2=libduma.so
  261. CFLAGS=-g -O0 -Wall -Wextra
  262. CPPFLAGS=-g -O0 -Wall -Wextra
  263. LIBS=-lpthread
  264. EXEPOSTFIX=
  265. endif
  266. ifndef HOST_CFLAGS
  267. HOST_CFLAGS=$(CFLAGS)
  268. endif
  269. ifndef CC_FOR_BUILD
  270. CC_FOR_BUILD=$(CC)
  271. endif
  272. ############################################################
  273. ifndef prefix
  274. prefix=/usr
  275. $(info using default prefix [$(prefix)])
  276. endif
  277. MAN_INSTALL_DIR=$(prefix)/share/man/man3
  278. DOC_INSTALL_DIR=$(prefix)/share/doc/duma
  279. ifndef srcdir
  280. srcdir=.
  281. $(info using default srcdir [$(srcdir)])
  282. endif
  283. ifndef exec_prefix
  284. exec_prefix=$(prefix)
  285. $(info using default exec_prefix [$(exec_prefix)])
  286. endif
  287. # The directory for installing executable programs that users can run.
  288. ifndef bindir
  289. bindir=$(exec_prefix)/bin
  290. endif
  291. # The directory for installing read-only architecture independent data files.
  292. ifndef datadir
  293. datadir=$(prefix)/share
  294. endif
  295. # The directory for installing read-only data files that pertain to a single machine--that is to say, files for configuring a host.
  296. ifndef sysconfdir
  297. sysconfdir=$(prefix)/etc
  298. endif
  299. # The directory for object files and libraries of object code.
  300. ifndef libdir
  301. libdir=$(exec_prefix)/lib
  302. endif
  303. # The directory for installing header files to be included by user programs with the C `#include' preprocessor directive.
  304. ifndef includedir
  305. includedir=$(prefix)/include
  306. endif
  307. PACKAGE_SOURCE=README.txt CHANGELOG LICENSE COPYING-GPL COPYING-LGPL duma.3 Makefile gdbinit.rc \
  308. duma.h dumapp.h duma_sem.h paging.h print.h duma_hlp.h noduma.h \
  309. duma.c dumapp.cpp sem_inc.c print.c \
  310. tests/dumatest.c tests/tstheap.c tests/thread-test.c tests/testmt.c tests/dumatestpp.cpp tests/testoperators.cpp \
  311. createconf.c make_git_source_version.sh
  312. OBJECTS=dumapp.o duma.o sem_inc.o print.o
  313. SO_OBJECTS=dumapp_so.o duma_so.o sem_inc_so.o print_so.o
  314. # Make all the top-level targets the makefile knows about.
  315. all: verinfo.h libduma.a $(DUMA_DYN_DEPS)
  316. @ $(ECHO) "Build complete - you can now run make test."
  317. # Perform self tests on the program this makefile builds.
  318. check test: tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS)
  319. @ $(ECHOLF)
  320. @ $(ECHO) "Testing DUMA (static library):"
  321. $(CURPATH)dumatest$(EXEPOSTFIX)
  322. @ $(ECHOLF)
  323. $(CURPATH)tstheap$(EXEPOSTFIX) 3072
  324. @ $(ECHOLF)
  325. $(CURPATH)testoperators$(EXEPOSTFIX)
  326. @ $(ECHOLF)
  327. @ $(ECHO) "DUMA static confidence test PASSED."
  328. ifdef DUMASO
  329. @ $(ECHOLF)
  330. @ $(ECHO) "Testing DUMA (dynamic library)."
  331. ifeq ($(OS), solaris)
  332. LD_PRELOAD=./$(DUMASO) DYLD_INSERT_LIBRARIES=./$(DUMASO) DYLD_FORCE_FLAT_NAMESPACE=1 exec $(CURPATH)tstheap_so 3072
  333. else
  334. (export LD_PRELOAD=./$(DUMASO); export DYLD_INSERT_LIBRARIES=./$(DUMASO); export DYLD_FORCE_FLAT_NAMESPACE=1 ; exec $(CURPATH)tstheap_so 3072)
  335. endif
  336. @ $(ECHOLF)
  337. @ $(ECHO) "DUMA dynamic confidence test PASSED."
  338. @ $(ECHOLF)
  339. @ $(ECHO) "You may now run make install and then installcheck"
  340. @ $(ECHOLF)
  341. endif
  342. # Perform installation tests (if any).
  343. # The user must build and install the program before running the tests.
  344. installcheck:
  345. ifdef DUMASO
  346. @ $(ECHOLF)
  347. @ $(ECHO) "Testing installed DUMA (dynamic library)."
  348. @ $(bindir)/duma $(CURPATH)tstheap_so 3072
  349. @ $(ECHOLF)
  350. @ $(ECHO) "DUMA installcheck test PASSED."
  351. @ $(ECHOLF)
  352. endif
  353. # Print variables of Makefile
  354. printvars:
  355. @echo OS [$(OS)]
  356. @echo OSTYPE [$(OSTYPE)]
  357. @echo bswitch [$(BSWITCH)]
  358. @echo srcdir [$(srcdir)]
  359. @echo prefix [$(prefix)]
  360. @echo exec_prefix [$(exec_prefix)]
  361. @echo bindir [$(bindir)]
  362. @echo datadir [$(datadir)]
  363. @echo sysconfdir [$(sysconfdir)]
  364. @echo libdir [$(libdir)]
  365. @echo includedir [$(includedir)]
  366. ifneq ($(oldincludedir),)
  367. @echo oldincludedir [$(oldincludedir)]
  368. else
  369. @echo oldincludedir empty
  370. endif
  371. @echo MAN_INSTALL_DIR [$(MAN_INSTALL_DIR)]
  372. @echo DOC_INSTALL_DIR [$(DOC_INSTALL_DIR)]
  373. @echo MAKE [$(MAKE)]
  374. @echo CC [$(CC)]
  375. @echo CFLAGS [$(CFLAGS)]
  376. @echo CXX [$(CXX)]
  377. @echo CPPFLAGS [$(CPPFLAGS)]
  378. @echo LD [$(LD)]
  379. @echo AR [$(AR)]
  380. @echo LIBS [$(LIBS)]
  381. @echo RANLIB [$(RANLIB)]
  382. @echo INSTALL [$(INSTALL)]
  383. @echo RM [$(RM)]
  384. @echo RMFORCE [$(RMFORCE)]
  385. @echo ECHO [$(ECHO)]
  386. @echo ECHOLF [$(ECHOLF)]
  387. @echo PIC [$(PIC)]
  388. @echo EXEPOSTFIX [$(EXEPOSTFIX)]
  389. @echo CURPATH [$(CURPATH)]
  390. @echo DUMA_OPTIONS [$(DUMA_OPTIONS)]
  391. @echo DUMA_SO_OPTIONS [$(DUMA_SO_OPTIONS)]
  392. @echo OBJECTS [$(OBJECTS)]
  393. @echo SO_OBJECTS [$(SO_OBJECTS)]
  394. @echo DUMASO [$(DUMASO)]
  395. @echo DUMASO_LINK1 [$(DUMASO_LINK1)]
  396. @echo DUMASO_LINK2 [$(DUMASO_LINK2)]
  397. @echo DUMA_DYN_DEPS [$(DUMA_DYN_DEPS)]
  398. @echo PACKAGE_SOURCE [$(PACKAGE_SOURCE)]
  399. # Print filenames unknown to git
  400. printuk:
  401. - git status -s --untracked-files=all 2>/dev/null | grep '^? '
  402. # Print filenames known to git but not "up-to-date" (modified)
  403. printmod:
  404. - git status -s 2>/dev/null |grep '^\ \?M '
  405. # Copy the executable file into a directory that users typically search for
  406. # commands; copy any auxiliary files that the executable uses into the
  407. # directories where it will look for them.
  408. install: libduma.a duma.3 $(DUMASO)
  409. - mkdir -p $(DESTDIR)$(DOC_INSTALL_DIR)
  410. $(INSTALL) -m 644 README.txt $(DESTDIR)$(DOC_INSTALL_DIR)
  411. - mkdir -p $(DESTDIR)$(includedir)
  412. $(INSTALL) -m 644 noduma.h duma.h dumapp.h duma_sem.h duma_config.h $(DESTDIR)$(includedir)
  413. - mkdir -p $(DESTDIR)$(bindir)
  414. $(INSTALL) -m 755 duma.sh $(DESTDIR)$(bindir)/duma
  415. - mkdir -p $(DESTDIR)$(libdir)
  416. $(INSTALL) -m 644 libduma.a $(DESTDIR)$(libdir)
  417. ifdef DUMASO
  418. $(INSTALL) -m 755 $(DUMASO) $(DESTDIR)$(libdir)
  419. endif
  420. ifdef DUMASO_LINK1
  421. - $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK1)
  422. ln -s $(DUMASO) $(DESTDIR)$(libdir)/$(DUMASO_LINK1)
  423. endif
  424. ifdef DUMASO_LINK2
  425. - $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK2)
  426. ln -s $(DUMASO) $(DESTDIR)$(libdir)/$(DUMASO_LINK2)
  427. endif
  428. - mkdir -p $(DESTDIR)$(MAN_INSTALL_DIR)
  429. $(INSTALL) -m 644 duma.3 $(DESTDIR)/$(MAN_INSTALL_DIR)/duma.3
  430. # Delete all the installed files that the `install' target would create
  431. uninstall:
  432. - $(RMFORCE) $(DESTDIR)$(DOC_INSTALL_DIR)/README.txt
  433. - $(RMFORCE) $(DESTDIR)$(includedir)/noduma.h
  434. - $(RMFORCE) $(DESTDIR)$(includedir)/duma.h
  435. - $(RMFORCE) $(DESTDIR)$(includedir)/dumapp.h
  436. - $(RMFORCE) $(DESTDIR)$(includedir)/duma_sem.h
  437. - $(RMFORCE) $(DESTDIR)$(includedir)/duma_config.h
  438. - $(RMFORCE) $(DESTDIR)$(bindir)/duma
  439. - $(RMFORCE) $(DESTDIR)$(libdir)/libduma.a
  440. ifdef DUMASO
  441. - $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO)
  442. endif
  443. ifdef DUMASO_LINK1
  444. - $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK1)
  445. endif
  446. ifdef DUMASO_LINK2
  447. - $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK2)
  448. endif
  449. - $(RMFORCE) $(DESTDIR)$(MAN_INSTALL_DIR)/duma.3
  450. # Delete all files that are normally created by running make.
  451. clean:
  452. - $(RMFORCE) $(OBJECTS) $(SO_OBJECTS) tstheap.o dumatest.o thread-test.o testmt.o dumatestpp.o \
  453. tstheap_so.o dumatestpp_so.o testoperators.o \
  454. tstheap$(EXEPOSTFIX) tstheap_so$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) dumatestpp_so$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) \
  455. thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) \
  456. libduma.a $(DUMASO) libduma.cat DUMA.shar
  457. # Any of these targets might be defined to delete more files than `clean' does.
  458. # For example, this would delete configuration files or links that you would
  459. # normally create as preparation for compilation, even if the makefile itself
  460. # cannot create these files.
  461. distclean realclean clobber: clean
  462. - $(RMFORCE) duma_config.h verinfo.h createconf.o createconf$(EXEPOSTFIX)
  463. roff:
  464. nroff -man < duma.3 > duma.cat
  465. DUMA.shar: $(PACKAGE_SOURCE)
  466. shar $(PACKAGE_SOURCE) > DUMA.shar
  467. shar: DUMA.shar
  468. libduma.a: duma_config.h verinfo.h $(OBJECTS)
  469. - $(RMFORCE) libduma.a
  470. $(AR) crv libduma.a $(OBJECTS)
  471. $(RANLIB) libduma.a
  472. verinfo.h: FORCE
  473. - $(CURPATH)make_git_source_version.sh > $(CURPATH)verinfo.h
  474. $(shell touch verinfo.h || true)
  475. duma_config.h:
  476. $(MAKE) reconfig
  477. reconfig: createconf$(EXEPOSTFIX) createconf.o createconf.c
  478. - $(CURPATH)createconf$(EXEPOSTFIX)
  479. dos2unix:
  480. @ dos2unix --d2u $(PACKAGE_SOURCE)
  481. createconf$(EXEPOSTFIX): createconf.o
  482. - $(RMFORCE) createconf$(EXEPOSTFIX)
  483. $(CC_FOR_BUILD) $(HOST_CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf$(EXEPOSTFIX)
  484. tstheap$(EXEPOSTFIX): libduma.a tstheap.o
  485. - $(RMFORCE) tstheap$(EXEPOSTFIX)
  486. $(CC) $(CFLAGS) tstheap.o libduma.a -o tstheap$(EXEPOSTFIX) $(LIBS)
  487. dumatest$(EXEPOSTFIX): libduma.a dumatest.o
  488. - $(RMFORCE) dumatest$(EXEPOSTFIX)
  489. $(CC) $(CFLAGS) dumatest.o libduma.a -o dumatest$(EXEPOSTFIX) $(LIBS)
  490. dumatestpp$(EXEPOSTFIX): libduma.a dumatestpp.o duma_sem.h dumapp.h
  491. - $(RMFORCE) dumatestpp$(EXEPOSTFIX)
  492. $(CXX) $(CPPFLAGS) dumatestpp.o libduma.a -o dumatestpp$(EXEPOSTFIX) $(LIBS)
  493. thread-test$(EXEPOSTFIX): libduma.a thread-test.o
  494. - $(RMFORCE) thread-test$(EXEPOSTFIX)
  495. $(CC) $(CFLAGS) thread-test.o libduma.a -o thread-test$(EXEPOSTFIX) $(LIBS)
  496. testmt$(EXEPOSTFIX): libduma.a testmt.o
  497. - $(RMFORCE) testmt$(EXEPOSTFIX)
  498. $(CC) $(CFLAGS) testmt.o libduma.a -o testmt$(EXEPOSTFIX) $(LIBS)
  499. testoperators$(EXEPOSTFIX): libduma.a testoperators.o duma_sem.h dumapp.h
  500. - $(RMFORCE) testoperators$(EXEPOSTFIX)
  501. $(CXX) $(CPPFLAGS) testoperators.o libduma.a -o testoperators$(EXEPOSTFIX) $(LIBS)
  502. testmemlimit$(EXEPOSTFIX): libduma.a testmemlimit.o
  503. - $(RMFORCE) testmemlimit$(EXEPOSTFIX)
  504. $(CC) $(CFLAGS) testmemlimit.o libduma.a -o testmemlimit$(EXEPOSTFIX) $(LIBS)
  505. tstheap_so$(EXEPOSTFIX): tstheap_so.o
  506. - $(RMFORCE) tstheap_so$(EXEPOSTFIX)
  507. $(CC) $(CFLAGS) tstheap_so.o -o tstheap_so$(EXEPOSTFIX) $(LIBS)
  508. dumatestpp_so$(EXEPOSTFIX): dumatestpp_so.o
  509. - $(RMFORCE) dumatestpp_so$(EXEPOSTFIX)
  510. $(CXX) $(CPPFLAGS) dumatestpp_so.o -o dumatestpp_so$(EXEPOSTFIX) $(LIBS)
  511. testmemlimit_so$(EXEPOSTFIX): testmemlimit_so.o
  512. - $(RMFORCE) testmemlimit_so$(EXEPOSTFIX)
  513. $(CC) $(CFLAGS) testmemlimit_so.o -o testmemlimit_so$(EXEPOSTFIX) $(LIBS)
  514. $(OBJECTS) tstheap.o dumatest.o thread-test.o testmt.o dumatestpp.o: duma.h
  515. ifeq ($(OS), Windows_NT)
  516. # do nothing
  517. else
  518. ifeq ($(OS), osx)
  519. $(DUMASO): duma_config.h verinfo.h $(SO_OBJECTS)
  520. $(CXX) -g -dynamiclib -Wl -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
  521. $(CXX) -g -dynamiclib -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
  522. else
  523. $(DUMASO): duma_config.h verinfo.h $(SO_OBJECTS)
  524. $(CXX) -g -shared -Wl,-soname,$(DUMASO) -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
  525. # $(CXX) -g -shared -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
  526. endif
  527. endif
  528. #
  529. # define rules how to build objects for createconf
  530. #
  531. createconf.o:
  532. $(CC_FOR_BUILD) $(HOST_CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
  533. #
  534. # define rules how to build objects for shared library
  535. #
  536. dumapp_so.o: dumapp.cpp duma.h duma_sem.h dumapp.h
  537. $(CXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c dumapp.cpp -o $@
  538. duma_so.o: duma.c duma.h duma_config.h verinfo.h
  539. $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c duma.c -o $@
  540. sem_inc_so.o: sem_inc.c duma_sem.h
  541. $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c sem_inc.c -o $@
  542. print_so.o: print.c print.h
  543. $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c print.c -o $@
  544. # DUMA_SO_OPTIONS needed cause duma.h is included explicitly
  545. tstheap_so.o:
  546. $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tests/tstheap.c -o $@
  547. dumatestpp_so.o:
  548. $(CXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c tests/dumatestpp.cpp -o $@
  549. testmemlimit_so.o:
  550. $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tests/testmemlimit.c -o $@
  551. #
  552. # define rules how to build objects for static library
  553. #
  554. dumapp.o: dumapp.cpp duma.h duma_sem.h dumapp.h
  555. $(CXX) $(CPPFLAGS) -c dumapp.cpp -o $@
  556. duma.o: duma.c duma.h duma_config.h verinfo.h
  557. $(CC) $(CFLAGS) -c duma.c -o $@
  558. sem_inc.o: sem_inc.c duma_sem.h
  559. $(CC) $(CFLAGS) -c sem_inc.c -o $@
  560. print.o: print.c print.h
  561. $(CC) $(CFLAGS) -c print.c -o $@
  562. #
  563. # define rules how to build the test objects
  564. #
  565. dumatest.o: tests/dumatest.c duma.h duma_config.h verinfo.h
  566. $(CC) $(CFLAGS) -c tests/dumatest.c -o $@
  567. dumatestpp.o: tests/dumatestpp.cpp duma.h duma_sem.h dumapp.h duma_config.h verinfo.h
  568. $(CXX) $(CPPFLAGS) -c tests/dumatestpp.cpp -o $@
  569. tstheap.o: tests/tstheap.c duma.h duma_config.h verinfo.h
  570. $(CC) $(CFLAGS) -c tests/tstheap.c -o $@
  571. testoperators.o: tests/testoperators.cpp duma.h duma_sem.h dumapp.h duma_config.h verinfo.h
  572. $(CXX) $(CPPFLAGS) -c tests/testoperators.cpp -o $@
  573. thread-test.o: tests/thread-test.c duma.h duma_config.h verinfo.h
  574. $(CC) $(CFLAGS) -c tests/thread-test.c -o $@
  575. testmt.o: tests/testmt.c duma.h duma_config.h verinfo.h
  576. $(CC) $(CFLAGS) -c tests/testmt.c -o $@
  577. #
  578. # default rules
  579. #
  580. #.c.o:
  581. # $(CC) $(CFLAGS) -c $< -o $@
  582. #
  583. #.cpp.o:
  584. # $(CXX) $(CPPFLAGS) -c $< -o $@
  585. #
  586. .PHONY: check test installcheck install uninstall clean distclean realclean clobber dos2unix printvars printuk printmod FORCE
  587. FORCE: