-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (63 loc) · 1.62 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
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
include Defs.make
CC=gcc
CFLAGS+=$(DS_FLAGS)
LDLIBS= -lm -pg
TEST_FILE_DIRECTORY="$(PROJ_PATH)/test/src"
ifeq ($(SEGFAULT_BACKTRACE), true)
LDLIBS+=-rdynamic
endif
INCLUDES+=-I $(PROJ_PATH)/ds/inc
INCLUDES+=-I $(PROJ_PATH)/common/inc
INCLUDES+=-I $(PROJ_PATH)/test/inc
common_ARCHIVE=$(PROJ_PATH)/common/bin/common.a
ds_ARCHIVE=$(PROJ_PATH)/ds/bin/ds.a
algo_ARCHIVE=$(PROJ_PATH)/algo/bin/algo.a
test_ARCHIVE=$(PROJ_PATH)/test/bin/test.a
ifeq ($(MODULE), ds)
MODULE_ARCHIVES += $(ds_ARCHIVE)
endif
ifeq ($(MODULE), algo)
MODULE_ARCHIVES += $(algo_ARCHIVE)
endif
ifeq ($(MODULE), test)
MODULE_ARCHIVES += $(test_ARCHIVE)
MODULE_ARCHIVES += $(ds_ARCHIVE)
endif
ifeq ($(MODULE), all)
MODULE_ARCHIVES += $(test_ARCHIVE)
MODULE_ARCHIVES += $(ds_ARCHIVE)
MODULE_ARCHIVES += $(algo_ARCHIVE)
endif
MODULE_ARCHIVES += $(common_ARCHIVE)
export
all: $(MODULE_ARCHIVES)
@echo "All archives ($(MODULE_ARCHIVES)) created"
ifeq ($(BUILD_TYPE), executable)
$(CC) $(INCLUDES) $^ -o foo.out $(MODULE_ARCHIVES) $(LDLIBS) $(CFLAGS)
else ifeq ($(BUILD_TYPE), library)
$(CC) -shared -o $(LIB_NAME) $(MODULE_ARCHIVES) $(LDLIBS) $(CFLAGS)
endif
$(common_ARCHIVE) :
make -C common/ all
$(algo_ARCHIVE) :
make -C algo/ all
$(ds_ARCHIVE) :
make -C ds/ all
$(test_ARCHIVE) :
make -C test/ all
.PHONY: clean help
clean:
make -C test/ clean
make -C ds/ clean
find ${PROJ_PATH} -name "*.[ao]" -exec rm -v {} \;
find ${PROJ_PATH} -name "*.out" -exec rm -v {} \;
find ${PROJ_PATH} -name "*.so" -exec rm -v {} \;
help:
@echo "Available build options"
@echo "#> make <OPTIONS>"
@echo
@echo "OPTIONS:"
@echo "all"
@echo "ds"
@echo "algo"
@echo "test"