forked from Ever-Never/Embedded-GUI-for-MT2523
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rule.mk
executable file
·127 lines (115 loc) · 3.5 KB
/
.rule.mk
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
OS_VERSION := $(shell uname)
ifneq ($(filter MINGW%,$(OS_VERSION)),)
$(DRV_CHIP_PATH)_EXTRA := -j1
$(MID_MBEDTLS_PATH)_EXTRA := -j1
endif
ifeq ($(MAKELEVEL),0)
M :=
else
M := -
endif
include $(SOURCE_DIR)/middleware/MTK/verno/module.mk
.PHONY: cleanlog
cleanlog:
ifeq ($(TARGET_PATH),)
rm -f $(OUTPATH)/*.log
else
@echo "trigger by build.sh, skip cleanlog"
endif
$(TARGET_LIB).a: $(C_OBJS) $(CXX_OBJS) $(S_OBJS)
@echo Gen $(TARGET_LIB).a
@echo Gen $(TARGET_LIB).a >>$(BUILD_LOG)
$(Q)if [ -e "$(OUTPATH)/$@" ]; then rm -f "$(OUTPATH)/$@"; fi
$(Q)if [ -e "$(OUTPATH)/lib/$@" ]; then rm -f "$(OUTPATH)/lib/$@"; fi
$(Q)$(M)$(AR) -r $(OUTPATH)/$@ $(C_OBJS) $(CXX_OBJS) $(S_OBJS) >>$(BUILD_LOG) 2>>$(ERR_LOG); \
if [ "$$?" != "0" ]; then \
echo "MODULE BUILD $@ FAIL"; \
echo "MODULE BUILD $@ FAIL" >> $(BUILD_LOG); \
exit 1;\
else \
echo "MODULE BUILD $@ PASS"; \
echo "MODULE BUILD $@ PASS" >> $(BUILD_LOG); \
fi;
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c
@mkdir -p $(dir $@)
@echo Build... $$(basename $@)
@echo Build... $@ >> $(BUILD_LOG)
@if [ -e "$@" ]; then rm -f "$@"; fi
@if [ -n "$(OVERRIDE_CFLAGS)" ]; then \
echo $(CC) $(OVERRIDE_CFLAGS) $@ >> $(BUILD_LOG); \
$(CC) $(OVERRIDE_CFLAGS) -c $< -o $@ 2>>$(ERR_LOG); \
else \
echo $(CC) $(CFLAGS) $@ >> $(BUILD_LOG); \
$(CC) $(CFLAGS) -c $< -o $@ 2>>$(ERR_LOG); \
fi; \
if [ "$$?" != "0" ]; then \
echo "Build... $$(basename $@) FAIL"; \
echo "Build... $@ FAIL" >> $(BUILD_LOG); \
else \
echo "Build... $$(basename $@) PASS"; \
echo "Build... $@ PASS" >> $(BUILD_LOG); \
fi;
$(BUILD_DIR)/%.d: $(SOURCE_DIR)/%.c
@mkdir -p $(dir $@)
@set -e; rm -f $@; \
export D_FILE="$@"; \
export B_NAME=`echo $$D_FILE | sed 's/\.d//g'`; \
if [ -n "$(OVERRIDE_CFLAGS)" ]; then \
$(CC) -MM $(OVERRIDE_CFLAGS) $< > $@.$$$$; \
else \
$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
fi; \
sed 's@\(.*\)\.o@'"$$B_NAME\.o $$B_NAME\.d"'@g' < $@.$$$$ > $@; \
rm -f $@.$$$$
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp
@mkdir -p $(dir $@)
@echo Build... $$(basename $@)
@echo Build... $@ >> $(BUILD_LOG)
@if [ -e "$@" ]; then rm -f "$@"; fi
@if [ -n "$(OVERRIDE_CFLAGS)" ]; then \
echo $(CXX) $(OVERRIDE_CFLAGS) $@ >> $(BUILD_LOG); \
$(CXX) $(OVERRIDE_CFLAGS) -c $< -o $@ 2>>$(ERR_LOG); \
else \
echo $(CXX) $(CXXFLAGS) $@ >> $(BUILD_LOG); \
$(CXX) $(CXXFLAGS) -c $< -o $@ 2>>$(ERR_LOG); \
fi; \
if [ "$$?" != "0" ]; then \
echo "Build... $$(basename $@) FAIL"; \
echo "Build... $@ FAIL" >> $(BUILD_LOG); \
else \
echo "Build... $$(basename $@) PASS"; \
echo "Build... $@ PASS" >> $(BUILD_LOG); \
fi;
$(BUILD_DIR)/%.d: $(SOURCE_DIR)/%.cpp
@mkdir -p $(dir $@)
@set -e; rm -f $@; \
export D_FILE="$@"; \
export B_NAME=`echo $$D_FILE | sed 's/\.d//g'`; \
if [ -n "$(OVERRIDE_CFLAGS)" ]; then \
$(CXX) -MM $(OVERRIDE_CFLAGS) $< > $@.$$$$; \
else \
$(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
fi; \
sed 's@\(.*\)\.o@'"$$B_NAME\.o $$B_NAME\.d"'@g' < $@.$$$$ > $@; \
rm -f $@.$$$$
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.s
@mkdir -p $(dir $@)
@echo Build... $$(basename $@)
@echo Build... $@ >> $(BUILD_LOG)
@if [ -e "$@" ]; then rm -f "$@"; fi
@if [ -n "$(OVERRIDE_CFLAGS)" ]; then \
$(CC) $(OVERRIDE_CFLAGS) -c $< -o $@; \
else \
$(CC) $(CFLAGS) -c $< -o $@; \
fi; \
if [ "$$?" != "0" ]; then \
echo "Build... $$(basename $@) FAIL"; \
echo "Build... $@ FAIL" >> $(BUILD_LOG); \
else \
echo "Build... $$(basename $@) PASS"; \
echo "Build... $@ PASS" >> $(BUILD_LOG); \
fi;
ifneq ($(MAKECMDGOALS),clean)
-include $(C_OBJS:.o=.d)
-include $(CXX_OBJS:.o=.d)
endif