forked from johnsonjh/duma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
693 lines (606 loc) · 20 KB
/
GNUmakefile
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# DUMA configuration:
#
# add "-DDUMA_NO_GLOBAL_MALLOC_FREE" (without quotes)
# for not defining malloc/free in global namespace
#
# add "-DDUMA_EXPLICIT_INIT" (without quotes)
# to do all the "risky" stuff getenv(), sem_init(), write() .. explicitly
# from main().
# you have to call duma_init() explicitly from main() this option also
# avoids leak error messages for allocations before duma_init() got called.
# this helps for leaky standard environments.
#
# add "-DDUMA_NO_THREAD_SAFETY" (without quotes)
# for not supporting multi-threading
#
# add "-DDUMA_SO_NO_CPP_SUPPORT" or "-DDUMA_LIB_NO_CPP_SUPPORT" (without quotes)
# for not directing new/delete to malloc/free
#
# add "-DDUMA_SO_NO_LEAKDETECTION" or "-DDUMA_LIB_NO_LEAKDETECTION" (without quotes)
# if you don't want support for leak detection
#
# add "-DDUMA_SO_PREFER_ATEXIT" or "-DDUMA_LIB_PREFER_ATEXIT" (without quotes)
# if you prefer atexit() over GNU Compiler's function attribute "destructor"
#
# add "-DDUMA_SO_PREFER_GETENV" or "-DDUMA_LIB_PREFER_GETENV" (without quotes)
# if you prefer standard C library getenv() over global char **environ
#
# add "-DDUMA_OLD_NEW_MACRO" (without quotes)
# if you want to use DUMA's old style NEW_ELEM() / NEW_ARRAY() macros.
# when not defining this option, a standard conform new syntax can get used.
# unfortunately you have to use DEL_ELEM/DEL_ARRAY further to utilize
# filename and linenumber of deallocation calls
#
# add "-DDUMA_SO_NO_HANG_MSG" or "-DDUMA_LIB_NO_HANG_MSG" (without quotes)
# set this if you want to suppress the extra messages around atexit().
#
# add "-DDUMA_NO_STRERROR" (without quotes)
# set this if you want to suppress calls to strerror() to avoid recursion
# on specific platforms.
#
########################################
#
# preprocessor flags for building the shared library (DUMA_SO_LIBRARY):
# - DUMA_SO_NO_CPP_SUPPORT
# - DUMA_SO_NO_LEAKDETECTION
# - DUMA_SO_PREFER_ATEXIT
# - DUMA_SO_PREFER_GETENV
# - DUMA_SO_NO_HANG_MSG
#
# preprocessor flags for building the static library:
# - DUMA_LIB_NO_CPP_SUPPORT
# - DUMA_LIB_NO_LEAKDETECTION
# - DUMA_LIB_PREFER_ATEXIT
# - DUMA_LIB_PREFER_GETENV
# - DUMA_LIB_NO_HANG_MSG
# - DUMA_NO_GLOBAL_MALLOC_FREE
# - DUMA_EXPLICIT_INIT
# - DUMA_NO_THREAD_SAFETY
# - DUMA_OLD_NEW_MACRO
# - DUMA_OLD_DEL_MACRO
# - DUMA_NO_STRERROR
#
########################################
# edit following line
DUMA_OPTIONS=
# no leak detection on any platform:
# use static library for finding leaks - with information memory was allocated
# i think leak-checking without further information is quite useless!
# additionaly too many platforms/environments are broken.
DUMA_OPTIONS += -DDUMA_SO_NO_LEAKDETECTION
# some test cases:
#DUMA_OPTIONS += -DDUMA_LIB_NO_LEAKDETECTION
#DUMA_OPTIONS += -DDUMA_NO_THREAD_SAFETY
#DUMA_OPTIONS += -DDUMA_NO_CPP_SUPPORT
PIC=-fPIC -DPIC
DUMA_SO_OPTIONS=$(PIC) -DDUMA_SO_LIBRARY
# for FreeBSD 5.4
# DUMA_OPTIONS += -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS
#
# for FreeBSD 5.4 if DUMA_EXPLICIT_INIT is not set
# DUMA_OPTIONS += -DDUMA_NO_LEAKDETECTION
#
# for cygwin environment on Windows
# DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
# also define 'WIN32'
# some defaults:
INSTALL=install
RM=rm
RMFORCE=rm -f
ECHO=echo
ECHOLF=echo .
CC=cc
CXX=c++
LD=ld
AR=ar
RANLIB=ranlib
INSTALL=install
ifndef $(OS)
OS=$(shell uname -s 2>/dev/null | tr '[:upper:]' '[:lower:]' 2>/dev/null || true)
endif
# dynamic dependencies
DUMA_DYN_DEPS=$(DUMASO) tstheap_so$(EXEPOSTFIX) dumatestpp_so$(EXEPOSTFIX)
# some OS specifics:
ifeq ($(OS), windows_nt)
ifeq ($(OSTYPE), msys)
$(info using settings for OS=Windows_NT, OSTYPE=msys)
# call mingw32-make OSTYPE=msys
# from Windows command prompt
# having added the PATH for MINGW/bin
# using explicit initialization to avoid leak report
# from __w32_sharedptr_initialize() function
BSWITCH=101
DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
RM=del
RMFORCE=del /F 2>nul
ECHO=echo
ECHOLF=echo .
CURPATH=
DUMA_DYN_DEPS=
DUMASO=
CFLAGS=-g -O0
CPPFLAGS=-g -O0
LIBS=
EXEPOSTFIX=.exe
endif
ifeq ($(OSTYPE), msys-sh)
$(info using settings for OS=Windows_NT, OSTYPE=msys-sh)
# call mingw32-make OSTYPE=msyssh
# from MSYS shell
# having added the PATH for MINGW/bin
# using explicit initialization to avoid leak report
# from __w32_sharedptr_initialize() function
BSWITCH=102
DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
CC=mingw32-gcc
CXX=mingw32-g++ -std=c++11
RM=rm
RMFORCE=rm -f
ECHO=echo
ECHOLF=echo
CURPATH=./
DUMA_DYN_DEPS=
DUMASO=
CFLAGS=-g -O0
CPPFLAGS=-g -O0
LIBS=
EXEPOSTFIX=.exe
endif
ifeq ($(OSTYPE), cygwin)
$(info using settings for OS=Windows_NT, OSTYPE=cygwin)
# call make OSTYPE=cygwin
BSWITCH=103
DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
CURPATH=./
DUMA_DYN_DEPS=
DUMASO=
CFLAGS=-g -O0 -DWIN32 -Wall -Wextra
CPPFLAGS=-g -O0 -DWIN32 -Wall -Wextra
LIBS=
EXEPOSTFIX=.exe
endif
ifndef BSWITCH
$(info using settings for OS=Windows_NT)
BSWITCH=100
DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
CURPATH=./
DUMA_DYN_DEPS=
DUMASO=
CFLAGS=-g -O0 -DWIN32
CPPFLAGS=-g -O0 -DWIN32
LIBS=
EXEPOSTFIX=.exe
endif
endif
ifeq ($(OS), darwin)
$(info using settings for OS=darwin)
# call: make OS=darwin
BSWITCH=210
DUMA_OPTIONS += -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS
DUMA_OPTIONS += -DDUMA_SO_PREFER_GETENV
# DUMA_OPTIONS += -DDUMA_LIB_NO_LEAKDETECTION
CURPATH=./
# DUMA_DYN_DEPS=
DUMASO=libduma.dylib
DUMASO_LINK1=libduma.dylib
CFLAGS=-g -O0
CPPFLAGS=-g -O0
LIBS=-lpthread
EXEPOSTFIX=
endif
ifeq ($(OS), freebsd)
$(info using settings for OS=freebsd)
BSWITCH=310
DUMA_OPTIONS += -DDUMA_NO_THREAD_SAFETY
DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
CURPATH=./
DUMA_DYN_DEPS=
DUMASO=
DUMASO_LINK1=
CFLAGS=-g -O0
CPPFLAGS=-g -O0
LIBS=-lpthread
EXEPOSTFIX=
endif
ifeq ($(OS), netbsd)
$(info using settings for OS=netbsd)
BSWITCH=320
CURPATH=./
DUMASO=libduma.so.0.0.0
DUMASO_LINK1=libduma.so.0
DUMASO_LINK2=libduma.so
CFLAGS=-g -O0
CPPFLAGS=-g -O0
LIBS=-lpthread
EXEPOSTFIX=
endif
ifeq ($(OS), solaris)
$(info using settings for OS=solaris)
BSWITCH=410
DUMA_OPTIONS += -DDUMA_NO_STRERROR
CURPATH=./
DUMA_DYN_DEPS=
DUMASO=libduma.so.0.0.0
DUMASO_LINK1=libduma.so.0
DUMASO_LINK2=libduma.so
CFLAGS=-g -O0
CPPFLAGS=-g -O0
LDFLAGS += -lgcc_s
LDOPTIONS += -lgcc_s
LIBS=-Wl,-R/opt/sfw/lib -lpthread
EXEPOSTFIX=
endif
ifeq ($(OS), linux)
ifeq ($(shell $(CXX) -v 2>&1 | grep -c "clang version"), 1)
COMPILERX := clang++
else
COMPILERX := g++ -std=c++11
endif
export COMPILERX
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
COMPILER := clang
else
COMPILER := gcc
endif
export COMPILER
CC=${COMPILER}
CXX=${COMPILERX}
$(info using CC=${COMPILER})
$(info using CXX=${COMPILERX})
ifeq ($(OSTYPE), pie)
$(info using settings for OS=linux, OSTYPE=pie)
# Linux PIE-mode with GNU compiler and GNU tools.
CC=${COMPILER} -fpie -fPIE
CXX=${COMPILERX} -fpie -fPIE
BSWITCH=510
else
$(info using settings for OS=linux)
CC=${COMPILER}
CXX=${COMPILERX}
BSWITCH=610
endif
CURPATH=./
DUMASO=libduma.so.0.0.0
DUMASO_LINK1=libduma.so.0
DUMASO_LINK2=libduma.so
CFLAGS=-g -O0 -Wall -Wextra
CPPFLAGS=-g -O0 -Wall -Wextra
LIBS=-lpthread
EXEPOSTFIX=
RM=rm
RMFORCE=rm -f
ECHO=echo
ECHOLF=printf '\n'
endif
ifndef BSWITCH
# default is generic full "UNIX"
BSWITCH=810
$(warning using default options. OS/OSTYPE not set or contain unknown values!)
CURPATH=./
DUMASO=libduma.so.0.0.0
DUMASO_LINK1=libduma.so.0
DUMASO_LINK2=libduma.so
CFLAGS=-g -O0 -Wall -Wextra
CPPFLAGS=-g -O0 -Wall -Wextra
LIBS=-lpthread
EXEPOSTFIX=
endif
ifndef HOST_CFLAGS
HOST_CFLAGS=$(CFLAGS)
endif
ifndef CC_FOR_BUILD
CC_FOR_BUILD=$(CC)
endif
############################################################
ifndef prefix
prefix=/usr
$(info using default prefix [$(prefix)])
endif
MAN_INSTALL_DIR=$(prefix)/share/man/man3
DOC_INSTALL_DIR=$(prefix)/share/doc/duma
ifndef srcdir
srcdir=.
$(info using default srcdir [$(srcdir)])
endif
ifndef exec_prefix
exec_prefix=$(prefix)
$(info using default exec_prefix [$(exec_prefix)])
endif
# The directory for installing executable programs that users can run.
ifndef bindir
bindir=$(exec_prefix)/bin
endif
# The directory for installing read-only architecture independent data files.
ifndef datadir
datadir=$(prefix)/share
endif
# The directory for installing read-only data files that pertain to a single machine--that is to say, files for configuring a host.
ifndef sysconfdir
sysconfdir=$(prefix)/etc
endif
# The directory for object files and libraries of object code.
ifndef libdir
libdir=$(exec_prefix)/lib
endif
# The directory for installing header files to be included by user programs with the C `#include' preprocessor directive.
ifndef includedir
includedir=$(prefix)/include
endif
PACKAGE_SOURCE=README.md CHANGELOG LICENSE COPYING-GPL COPYING-LGPL duma.3 GNUmakefile gdbinit.rc \
duma.h dumapp.h duma_sem.h paging.h print.h duma_hlp.h noduma.h \
duma.c dumapp.cpp sem_inc.c print.c \
tests/dumatest.c tests/tstheap.c tests/thread-test.c tests/testmt.c tests/dumatestpp.cpp tests/testoperators.cpp \
createconf.c make_git_source_version.sh
OBJECTS=dumapp.o duma.o sem_inc.o print.o
SO_OBJECTS=dumapp_so.o duma_so.o sem_inc_so.o print_so.o
# Make all the top-level targets the makefile knows about.
all: verinfo.h libduma.a $(DUMA_DYN_DEPS)
@ $(ECHO) "Build complete - you can now run make test."
# Perform self tests on the program this makefile builds.
check test: tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS)
@ $(ECHOLF)
@ $(ECHO) "Testing DUMA (static library):"
$(CURPATH)dumatest$(EXEPOSTFIX)
@ $(ECHOLF)
$(CURPATH)tstheap$(EXEPOSTFIX) 3072
@ $(ECHOLF)
$(CURPATH)testoperators$(EXEPOSTFIX)
@ $(ECHOLF)
@ $(ECHO) "DUMA static confidence test PASSED."
ifdef DUMASO
@ $(ECHOLF)
@ $(ECHO) "Testing DUMA (dynamic library)."
ifeq ($(OS), solaris)
LD_PRELOAD=./$(DUMASO) DYLD_INSERT_LIBRARIES=./$(DUMASO) DYLD_FORCE_FLAT_NAMESPACE=1 exec $(CURPATH)tstheap_so 3072
else
(export LD_PRELOAD=./$(DUMASO); export DYLD_INSERT_LIBRARIES=./$(DUMASO); export DYLD_FORCE_FLAT_NAMESPACE=1 ; exec $(CURPATH)tstheap_so 3072)
endif
@ $(ECHOLF)
@ $(ECHO) "DUMA dynamic confidence test PASSED."
@ $(ECHOLF)
@ $(ECHO) "You may now run make install and then installcheck"
@ $(ECHOLF)
endif
# Perform installation tests (if any).
# The user must build and install the program before running the tests.
installcheck:
ifdef DUMASO
@ $(ECHOLF)
@ $(ECHO) "Testing installed DUMA (dynamic library)."
@ $(bindir)/duma $(CURPATH)tstheap_so 3072
@ $(ECHOLF)
@ $(ECHO) "DUMA installcheck test PASSED."
@ $(ECHOLF)
endif
# Print variables of GNUmakefile
printvars:
@echo OS [$(OS)]
@echo OSTYPE [$(OSTYPE)]
@echo bswitch [$(BSWITCH)]
@echo srcdir [$(srcdir)]
@echo prefix [$(prefix)]
@echo exec_prefix [$(exec_prefix)]
@echo bindir [$(bindir)]
@echo datadir [$(datadir)]
@echo sysconfdir [$(sysconfdir)]
@echo libdir [$(libdir)]
@echo includedir [$(includedir)]
ifneq ($(oldincludedir),)
@echo oldincludedir [$(oldincludedir)]
else
@echo oldincludedir empty
endif
@echo MAN_INSTALL_DIR [$(MAN_INSTALL_DIR)]
@echo DOC_INSTALL_DIR [$(DOC_INSTALL_DIR)]
@echo MAKE [$(MAKE)]
@echo CC [$(CC)]
@echo CFLAGS [$(CFLAGS)]
@echo CXX [$(CXX)]
@echo CPPFLAGS [$(CPPFLAGS)]
@echo LD [$(LD)]
@echo AR [$(AR)]
@echo LIBS [$(LIBS)]
@echo RANLIB [$(RANLIB)]
@echo INSTALL [$(INSTALL)]
@echo RM [$(RM)]
@echo RMFORCE [$(RMFORCE)]
@echo ECHO [$(ECHO)]
@echo ECHOLF [$(ECHOLF)]
@echo PIC [$(PIC)]
@echo EXEPOSTFIX [$(EXEPOSTFIX)]
@echo CURPATH [$(CURPATH)]
@echo DUMA_OPTIONS [$(DUMA_OPTIONS)]
@echo DUMA_SO_OPTIONS [$(DUMA_SO_OPTIONS)]
@echo OBJECTS [$(OBJECTS)]
@echo SO_OBJECTS [$(SO_OBJECTS)]
@echo DUMASO [$(DUMASO)]
@echo DUMASO_LINK1 [$(DUMASO_LINK1)]
@echo DUMASO_LINK2 [$(DUMASO_LINK2)]
@echo DUMA_DYN_DEPS [$(DUMA_DYN_DEPS)]
@echo PACKAGE_SOURCE [$(PACKAGE_SOURCE)]
# Print filenames unknown to git
printuk:
- git status -s --untracked-files=all 2>/dev/null | grep '^? '
# Print filenames known to git but not "up-to-date" (modified)
printmod:
- git status -s 2>/dev/null |grep '^\ \?M '
# Copy the executable file into a directory that users typically search for
# commands; copy any auxiliary files that the executable uses into the
# directories where it will look for them.
install: libduma.a duma.3 $(DUMASO)
- mkdir -p $(DESTDIR)$(DOC_INSTALL_DIR)
$(INSTALL) -m 644 README.md $(DESTDIR)$(DOC_INSTALL_DIR)
- mkdir -p $(DESTDIR)$(includedir)
$(INSTALL) -m 644 noduma.h duma.h dumapp.h duma_sem.h duma_config.h $(DESTDIR)$(includedir)
- mkdir -p $(DESTDIR)$(bindir)
$(INSTALL) -m 755 duma.sh $(DESTDIR)$(bindir)/duma
- mkdir -p $(DESTDIR)$(libdir)
$(INSTALL) -m 644 libduma.a $(DESTDIR)$(libdir)
ifdef DUMASO
$(INSTALL) -m 755 $(DUMASO) $(DESTDIR)$(libdir)
endif
ifdef DUMASO_LINK1
- $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK1)
ln -s $(DUMASO) $(DESTDIR)$(libdir)/$(DUMASO_LINK1)
endif
ifdef DUMASO_LINK2
- $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK2)
ln -s $(DUMASO) $(DESTDIR)$(libdir)/$(DUMASO_LINK2)
endif
- mkdir -p $(DESTDIR)$(MAN_INSTALL_DIR)
$(INSTALL) -m 644 duma.3 $(DESTDIR)/$(MAN_INSTALL_DIR)/duma.3
# Delete all the installed files that the `install' target would create
uninstall:
- $(RMFORCE) $(DESTDIR)$(DOC_INSTALL_DIR)/README.md
- $(RMFORCE) $(DESTDIR)$(includedir)/noduma.h
- $(RMFORCE) $(DESTDIR)$(includedir)/duma.h
- $(RMFORCE) $(DESTDIR)$(includedir)/dumapp.h
- $(RMFORCE) $(DESTDIR)$(includedir)/duma_sem.h
- $(RMFORCE) $(DESTDIR)$(includedir)/duma_config.h
- $(RMFORCE) $(DESTDIR)$(bindir)/duma
- $(RMFORCE) $(DESTDIR)$(libdir)/libduma.a
ifdef DUMASO
- $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO)
endif
ifdef DUMASO_LINK1
- $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK1)
endif
ifdef DUMASO_LINK2
- $(RMFORCE) $(DESTDIR)$(libdir)/$(DUMASO_LINK2)
endif
- $(RMFORCE) $(DESTDIR)$(MAN_INSTALL_DIR)/duma.3
# Delete all files that are normally created by running make.
clean:
- $(RMFORCE) $(OBJECTS) $(SO_OBJECTS) tstheap.o dumatest.o thread-test.o testmt.o dumatestpp.o a.out \
tstheap_so.o dumatestpp_so.o testoperators.o \
tstheap$(EXEPOSTFIX) tstheap_so$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) dumatestpp_so$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) \
thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) \
libduma.a $(DUMASO) libduma.cat
# Any of these targets might be defined to delete more files than `clean' does.
# For example, this would delete configuration files or links that you would
# normally create as preparation for compilation, even if the makefile itself
# cannot create these files.
distclean realclean clobber: clean
- $(RMFORCE) duma_config.h verinfo.h createconf.o createconf$(EXEPOSTFIX)
roff:
nroff -man < duma.3 > duma.cat
libduma.a: duma_config.h verinfo.h $(OBJECTS)
- $(RMFORCE) libduma.a
$(AR) crv libduma.a $(OBJECTS)
$(RANLIB) libduma.a
verinfo.h: FORCE
- $(CURPATH)make_git_source_version.sh
$(shell touch verinfo.h || true)
duma_config.h:
$(MAKE) reconfig
reconfig: createconf$(EXEPOSTFIX) createconf.o createconf.c
- $(CURPATH)createconf$(EXEPOSTFIX)
dos2unix:
@ dos2unix --d2u $(PACKAGE_SOURCE)
createconf$(EXEPOSTFIX): createconf.o
- $(RMFORCE) createconf$(EXEPOSTFIX)
$(CC_FOR_BUILD) $(HOST_CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf$(EXEPOSTFIX)
tstheap$(EXEPOSTFIX): libduma.a tstheap.o
- $(RMFORCE) tstheap$(EXEPOSTFIX)
$(CC) $(CFLAGS) tstheap.o libduma.a -o tstheap$(EXEPOSTFIX) $(LIBS)
dumatest$(EXEPOSTFIX): libduma.a dumatest.o
- $(RMFORCE) dumatest$(EXEPOSTFIX)
$(CC) $(CFLAGS) dumatest.o libduma.a -o dumatest$(EXEPOSTFIX) $(LIBS)
dumatestpp$(EXEPOSTFIX): libduma.a dumatestpp.o duma_sem.h dumapp.h
- $(RMFORCE) dumatestpp$(EXEPOSTFIX)
$(CXX) $(CPPFLAGS) dumatestpp.o libduma.a -o dumatestpp$(EXEPOSTFIX) $(LIBS)
thread-test$(EXEPOSTFIX): libduma.a thread-test.o
- $(RMFORCE) thread-test$(EXEPOSTFIX)
$(CC) $(CFLAGS) thread-test.o libduma.a -o thread-test$(EXEPOSTFIX) $(LIBS)
testmt$(EXEPOSTFIX): libduma.a testmt.o
- $(RMFORCE) testmt$(EXEPOSTFIX)
$(CC) $(CFLAGS) testmt.o libduma.a -o testmt$(EXEPOSTFIX) $(LIBS)
testoperators$(EXEPOSTFIX): libduma.a testoperators.o duma_sem.h dumapp.h
- $(RMFORCE) testoperators$(EXEPOSTFIX)
$(CXX) $(CPPFLAGS) testoperators.o libduma.a -o testoperators$(EXEPOSTFIX) $(LIBS)
testmemlimit$(EXEPOSTFIX): libduma.a testmemlimit.o
- $(RMFORCE) testmemlimit$(EXEPOSTFIX)
$(CC) $(CFLAGS) testmemlimit.o libduma.a -o testmemlimit$(EXEPOSTFIX) $(LIBS)
tstheap_so$(EXEPOSTFIX): tstheap_so.o
- $(RMFORCE) tstheap_so$(EXEPOSTFIX)
$(CC) $(CFLAGS) tstheap_so.o -o tstheap_so$(EXEPOSTFIX) $(LIBS)
dumatestpp_so$(EXEPOSTFIX): dumatestpp_so.o
- $(RMFORCE) dumatestpp_so$(EXEPOSTFIX)
$(CXX) $(CPPFLAGS) dumatestpp_so.o -o dumatestpp_so$(EXEPOSTFIX) $(LIBS)
testmemlimit_so$(EXEPOSTFIX): testmemlimit_so.o
- $(RMFORCE) testmemlimit_so$(EXEPOSTFIX)
$(CC) $(CFLAGS) testmemlimit_so.o -o testmemlimit_so$(EXEPOSTFIX) $(LIBS)
$(OBJECTS) tstheap.o dumatest.o thread-test.o testmt.o dumatestpp.o: duma.h
ifeq ($(OS), windows_nt)
# do nothing
else
ifeq ($(OS), darwin)
$(DUMASO): duma_config.h verinfo.h $(SO_OBJECTS)
$(CXX) -g -dynamiclib -Wl -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
$(CXX) -g -dynamiclib -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
else
$(DUMASO): duma_config.h verinfo.h $(SO_OBJECTS)
$(CXX) -g -shared -Wl,-soname,$(DUMASO) -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
# $(CXX) -g -shared -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
endif
endif
#
# define rules how to build objects for createconf
#
createconf.o:
$(CC_FOR_BUILD) $(HOST_CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
#
# define rules how to build objects for shared library
#
dumapp_so.o: dumapp.cpp duma.h duma_sem.h dumapp.h
$(CXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c dumapp.cpp -o $@
duma_so.o: duma.c duma.h duma_config.h verinfo.h
$(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c duma.c -o $@
sem_inc_so.o: sem_inc.c duma_sem.h
$(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c sem_inc.c -o $@
print_so.o: print.c print.h
$(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c print.c -o $@
# DUMA_SO_OPTIONS needed cause duma.h is included explicitly
tstheap_so.o:
$(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tests/tstheap.c -o $@
dumatestpp_so.o:
$(CXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c tests/dumatestpp.cpp -o $@
testmemlimit_so.o:
$(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tests/testmemlimit.c -o $@
#
# define rules how to build objects for static library
#
dumapp.o: dumapp.cpp duma.h duma_sem.h dumapp.h
$(CXX) $(CPPFLAGS) -c dumapp.cpp -o $@
duma.o: duma.c duma.h duma_config.h verinfo.h
$(CC) $(CFLAGS) -c duma.c -o $@
sem_inc.o: sem_inc.c duma_sem.h
$(CC) $(CFLAGS) -c sem_inc.c -o $@
print.o: print.c print.h
$(CC) $(CFLAGS) -c print.c -o $@
#
# define rules how to build the test objects
#
dumatest.o: tests/dumatest.c duma.h duma_config.h verinfo.h
$(CC) $(CFLAGS) -c tests/dumatest.c -o $@
dumatestpp.o: tests/dumatestpp.cpp duma.h duma_sem.h dumapp.h duma_config.h verinfo.h
$(CXX) $(CPPFLAGS) -c tests/dumatestpp.cpp -o $@
tstheap.o: tests/tstheap.c duma.h duma_config.h verinfo.h
$(CC) $(CFLAGS) -c tests/tstheap.c -o $@
testoperators.o: tests/testoperators.cpp duma.h duma_sem.h dumapp.h duma_config.h verinfo.h
$(CXX) $(CPPFLAGS) -c tests/testoperators.cpp -o $@
thread-test.o: tests/thread-test.c duma.h duma_config.h verinfo.h
$(CC) $(CFLAGS) -c tests/thread-test.c -o $@
testmt.o: tests/testmt.c duma.h duma_config.h verinfo.h
$(CC) $(CFLAGS) -c tests/testmt.c -o $@
#
# default rules
#
#.c.o:
# $(CC) $(CFLAGS) -c $< -o $@
#
#.cpp.o:
# $(CXX) $(CPPFLAGS) -c $< -o $@
#
.PHONY: check test installcheck install uninstall clean distclean realclean clobber dos2unix printvars printuk printmod FORCE
FORCE: