-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
43 lines (28 loc) · 955 Bytes
/
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
export PROJ_ROOT=$(CURDIR)
export ARCH_BITS=$(shell getconf LONG_BIT)
SOURCE_DIRS = system core kstor ctl
BUILD_DIRS = bin lib obj
SOURCE_DIRS_CLEAN = $(addsuffix .clean,$(SOURCE_DIRS))
BUILD_DIRS_CLEAN = $(addsuffix .clean,$(BUILD_DIRS))
.PHONY: all check debug clean $(BUILD_DIRS) $(BUILD_DIRS_CLEAN) $(SOURCE_DIRS) $(SOURCE_DIRS_CLEAN)
all: export EXTRA_CFLAGS = -D__RELEASE__ -O2
all: export DEBUG = OFF
all: check $(BUILD_DIRS) $(SOURCE_DIRS)
debug: export EXTRA_CFLAGS = -D__DEBUG__ -O1 -g3 -ggdb3 -fno-inline
debug: export DEBUG = ON
debug: check $(BUILD_DIRS) $(SOURCE_DIRS)
clean: $(BUILD_DIRS_CLEAN) $(SOURCE_DIRS_CLEAN)
check:
cppcheck --error-exitcode=22 -q . || exit 1
$(SOURCE_DIRS):
$(MAKE) -C $@
$(BUILD_DIRS):
mkdir -p $@
$(SOURCE_DIRS_CLEAN): %.clean:
$(MAKE) -C $* clean
$(BUILD_DIRS_CLEAN): %.clean:
rm -rf $*
core: $(BUILD_DIRS)
kstor: core $(BUILD_DIRS)
system: core kstor $(BUILD_DIRS)
ctl: system $(BUILD_DIRS)