-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
55 lines (41 loc) · 1.03 KB
/
Makefile
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
ifeq ($(uname_S), Linux)
HMEMORY_ENABLE_CALLSTACK ?= y
else
HMEMORY_ENABLE_CALLSTACK := n
endif
tests-success-y = \
$(subst .c, , $(wildcard success-*.c))
tests-fail-y = \
$(subst .c, , $(filter-out fail-env.c, $(wildcard fail-*.c)))
target-y = \
${tests-success-y} \
$(addsuffix -debug, ${tests-success-y}) \
${tests-fail-y} \
$(addsuffix -debug, ${tests-fail-y})
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
define test-defaults
$1_files-y = \
$(addsuffix .c, $1)
$1_includes-y = \
../src
endef
define test-debug-defaults
$1_files-y = \
$(addsuffix .c, $(subst -debug, , $1)) \
../src/libhmemory.o
$1_cflags-y = \
-O1 \
-DHMEMORY_DEBUG=1 \
-include ../src/hmemory.h
$1_includes-y = \
../src
$1_ldflags-y += \
-lpthread
$1_ldflags-${HMEMORY_ENABLE_CALLSTACK} += \
-rdynamic \
-ldl \
-lbfd
endef
$(eval $(foreach T,$(target-y), $(eval $(call test-defaults,$T))))
$(eval $(foreach T,$(target-y), $(eval $(call test-debug-defaults,$(addsuffix -debug, $T)))))
include ../Makefile.lib