-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (35 loc) · 1009 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
44
45
46
47
48
49
export NPROC ?= $(shell (nproc))
export NJOB ?= $(shell expr '(' $(NPROC) + 1 ')')
.PHONY: default
default: release/all
# Common rule declaration
define common_rule
build_$(1)/Makefile:
@mkdir -p $$(@D) && cd $$(@D) && cmake -DCMAKE_BUILD_TYPE="$(1)" ../
$(1)/%: build_$(1)/Makefile
@make -j $(NJOB) --output-sync=target --no-print-directory -C build_$(1) $$*
$(1): $(1)/all
# @make -j $(NJOB) --output-sync=target --no-print-directory -C build_$(1) $$*
.PHONY: $(1)/clean
$(1)/clean:
@rm -rf build_$(1)
.PHONY: $(1)/test
$(1)/test: $(1)/all
@make -j $(NJOB) -C build_$(1) test
# Is not implemented now
#.PHONY: $(1)/coverage
#$(1)/coverage: $(1)/all
# @make -j $(NJOB) -C build_$(1) test
endef
# Debug and release build types definition
$(eval $(call common_rule,debug))
$(eval $(call common_rule,release))
#$(eval $(call common_rule,coverage))
.PHONY: all
all: release/all
.PHONY: clean
clean: release/clean
#.PHONY: coverage
#coverage: coverage/coverage
.PHONY: test
test: release/test