-
Notifications
You must be signed in to change notification settings - Fork 34
/
make.def
51 lines (43 loc) · 985 Bytes
/
make.def
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
define add_install
INSTALL_DSTS:=$(sort $(INSTALL_DSTS) $(2))
INSTALL_DIRS:=$(sort $(INSTALL_DIRS) $(dir $(2)))
$(2): $(1)
$(INSTALL) -m $(3) $(1) $(2)
endef
define add_precious_install
INSTALL_DSTS:=$(sort $(INSTALL_DSTS) $(2))
INSTALL_DIRS:=$(sort $(INSTALL_DIRS) $(dir $(2)))
$(2): $(1)
if [ -f $(2) ]; then \
$(INSTALL) -m $(3) $(1) $(2).new; \
$(TOUCH) $(2); \
else \
$(INSTALL) -m $(3) $(1) $(2); \
fi
endef
define mk_install_dir
$(1):
mkdir -p $$@
endef
BUILD_TEST_PREVIOUS:=bin
define build_test
.PHONY: run_bin/$(1)
bin/$(1): obj/test/$(1).o $(LIB_DEPS)
$(CXX) -o $$@ $$< $(LXXFLAGS) $(SYS_LIBS)
run_bin/$(1): bin/$(1) $(BUILD_TEST_PREVIOUS)
bin/$(1)
TESTS_TO_RUN+=bin/$(1)
BUILD_TEST_PREVIOUS:=run_bin/$(1)
endef
define run_test
$(1)
endef
define build_tool
bin/$(1): obj/tool/$(1).o $(LIB_DEPS)
$(CXX) -o $$@ $$< $(LXXFLAGS) $(SYS_LIBS)
$(eval $(call add_install,bin/$(1),$(USR_PREFIX)/bin/$(1),775))
endef
define build_dir
$(1):
mkdir -p $(1)
endef