-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (59 loc) · 2.35 KB
/
Copy pathMakefile
File metadata and controls
69 lines (59 loc) · 2.35 KB
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
## Includes ##
include vars.mk
include defs.mk
## Targets ##
.SUFFIXES:
.SUFFIXES: .c .o .h
.PHONY: all $(TARGETS)
.PHONY: $(TEST) install uninstall clean cleanall help
## Default Goal ##
all: $(TARGETS)
$(TARGETS):
$(MAKE) -C $@/c TARGET=$@ DIR_DATA=$(DIR_DATA)
@echo $(STR_BUILD_DONE) $(call STR_NAME,$@)
## Test Program ##
$(TEST):
$(MAKE) --always-make --directory=$(TEST) \
PROG=$(PROG) \
TESTCASE=$(TESTCASE) \
DIR_BIN=$(DIR_BIN)
## Auxiliary Tasks ##
install:
test -d $(DIR_BIN) || mkdir -p $(DIR_BIN)
test -d $(DIR_DATA)/$(HHSS) || mkdir -p $(DIR_DATA)/$(HHSS)
test -d $(DIR_MAN1) || mkdir -p $(DIR_MAN1)
test -d $(DIR_MAN7) || mkdir -p $(DIR_MAN7)
$(call TPL_INST_PROG,$(TARGETS),$(CMD_INSTALL_PROG))
$(call TPL_INST_PROG,$(HHSS_DATA),$(CMD_INSTALL_DATA))
$(call TPL_INST_MAN,$(TARGETS),$(CMD_INSTALL_MAN1),1)
$(call TPL_INST_MAN,$(PROJECT),$(CMD_INSTALL_MAN7),7)
uninstall:
rm -f $(foreach target,$(TARGETS),$(DIR_BIN)/$(target))
rm -rf $(DIR_DATA)/$(HHSS)
rm -f $(foreach target,$(TARGETS),$(DIR_MAN1)/$(target).1)
rm -f $(DIR_MAN7)/$(PROJECT).7
clean:
find . -name "*.o" -delete
find . -name "*.d" -delete
rm -f $(foreach target,$(TARGETS),$(target)/c/$(target))
cleanall: uninstall clean
$(MAKE) --directory=$(TEST) clean
help:
@echo The below are the list of available commands from this Makefile.
@echo
@echo $(call STR_HELP_GROUP,1. MAKING ACTIONS)
@echo " make builds every program."
@echo " make "$(call STR_HELP_CMDHL,program-names...)
@echo " builds mentioned program(s) only, e.g. make btn nsy"
@echo " make "$(call STR_HELP_CMDHL,install)" copies the executables of each program into $(DIR_BIN) directory."
@echo
@echo $(call STR_HELP_GROUP,2. CLEANING ACTIONS)
@echo " make "$(call STR_HELP_CMDHL,clean)" deletes all of the build artifacts."
@echo " make "$(call STR_HELP_CMDHL,uninstall)" deletes everything under $(DIR_BIN) directory."
@echo " make "$(call STR_HELP_CMDHL,cleanall)" clean + uninstall + some files in ./test"
@echo
@echo $(call STR_HELP_GROUP,3. MISCELLANEOUS)
@echo " make "$(call STR_HELP_CMDHL,test) \
$(call STR_HELP_ARGHL,PROG)=\"the name of a program to be tested\" $(call STR_HELP_ARGHL,TESTCASE)=\"the name of a testcase file\"
@echo " performs a test on the executable with the test file."
@echo " make "$(call STR_HELP_CMDHL,help)" prints this long manual on the screen that you are reading now."