-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmakefile.rules
75 lines (63 loc) · 2.27 KB
/
makefile.rules
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
# *****************************************************************************
# The basic rules that apply to a default eCMD build
# *****************************************************************************
ifeq (${MAKEFILE_RULES},)
MAKEFILE_RULES := y
# The directory creation rule
# The if conditions make it so it only prints when it's creating missing directories
# This was done because the dir rule is called quite often and would look empty otherwise
dir:
@echo "==== Creating Dirs ===="
@if [ ! -d ${OBJPATH} ]; then mkdir -p ${OBJPATH}; echo mkdir -p ${OBJPATH}; fi
@if [ ! -d ${SRCPATH} ]; then mkdir -p ${SRCPATH}; echo mkdir -p ${SRCPATH}; fi
@if [ ! -d ${OUTBIN} ]; then mkdir -p ${OUTBIN}; echo mkdir -p ${OUTBIN}; fi
@if [ ! -d ${OUTLIB} ]; then mkdir -p ${OUTLIB}; echo mkdir -p ${OUTLIB}; fi
@if [ ! -d ${OUTPERL} ]; then mkdir -p ${OUTPERL}; echo mkdir -p ${OUTPERL}; fi
@if [ ! -d ${OUTPY} ]; then mkdir -p ${OUTPY}; echo mkdir -p ${OUTPY}; fi
@if [ ! -d ${OUTPY3} ]; then mkdir -p ${OUTPY3}; echo mkdir -p ${OUTPY3}; fi
@if [ ! -d ${OUTPYECMD} ]; then mkdir -p ${OUTPYECMD}; echo mkdir -p ${OUTPYECMD}; fi
# Runs the objclean rule in addition to removing generated source and binaries
clean: objclean
rm -rf ${SRCPATH}
rm -rf ${OUTPATH}
# Remove the obj_* dir for the system type you are building on
objclean:
@echo "==== Removing Dirs ===="
rm -rf ${OBJPATH}
# Only do the build test if enabled
ifeq (${TEST_BUILD},yes)
define run-all-test
@echo ""
@echo "==== Testing Build ===="
${VERBOSE}${MAKE} test ${MAKEFLAGS} --no-print-directory
endef
else
define run-all-test
endef
endif
# Only do the catch build test if enabled
ifeq (${CATCH_TEST_BUILD},yes)
define run-all-catch-test
@echo ""
@echo "==== Catch Testing Build ===="
${VERBOSE}${MAKE} catch_test ${MAKEFLAGS} --no-print-directory
endef
else
define run-all-catch-test
endef
endif
define run-all
${VERBOSE}${MAKE} dir ${MAKEFLAGS} --no-print-directory
@echo ""
@echo "==== Generating Source ===="
${VERBOSE}${MAKE} generate ${MAKEFLAGS} --no-print-directory
@echo ""
@echo "==== Building Source ===="
${VERBOSE}${MAKE} build ${MAKEFLAGS} --no-print-directory
${run-all-test}
endef
# Allows you to print any variable by doing this:
# make print-BUILD_TARGETS
print-%:
@echo $*=$($*)
endif