-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
88 lines (69 loc) · 1.36 KB
/
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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
# The root makefile
#
OUTPUT_PATH=out
OUTPUT_NAME=test
# Path that includes all makefiles
MAKE_FILES_PATH = Environment/BuildSystem
#
# Detailed Compiling output
#
ifndef V
SILENCE = -s
else
SILENCE =
endif
# The cross compile if exists, otherwise uses the gcc
CROSS_COMPILE?=
#
# Source (.c) Files
#
SOURCE_FILES= \
Source/Test/test.c
#
# Header (.h) File Directories
#
# Bear in mind, include directories must have -I prefix
#
INCLUDE_DIRECTORIES= \
-IInclude/
#
# Project Definitions
#
# Bear in mind, definitions must have -D prefix
#
DEFINES= \
-DTEST_CONFIG=255
#
# All Flags
#
CFLAGS=${INCLUDE_DIRECTORIES} ${DEFINES}
#############################################
# Rules
#############################################
.PHONY: all rebuild test clean out run unittest check_all
# Rebuild
rebuild: clean all
#
# The main rule
#
all: test
# The test rule
test: out
${CROSS_COMPILE}gcc -g ${SOURCE_FILES} ${CFLAGS} -o ${OUTPUT_PATH}/${OUTPUT_NAME}
# The clean rule
clean:
rm -rf ${OUTPUT_PATH}
# The rule to create out path
out:
mkdir -p ${OUTPUT_PATH}
# The rule to run the output executable
run:
./${OUTPUT_PATH}/${OUTPUT_NAME}
unittest:
make -f $(MAKE_FILES_PATH)/execute_unittest.mk TEST_MODULE=$(TEST_MODULE) $(SILENCE)
#
# Builds and Runs all system validation objects.
#
check_all: clean all
make -f $(MAKE_FILES_PATH)/execute_systemcheck.mk $(SILENCE)