forked from LiteOS/LiteOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (74 loc) · 2.95 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
89
90
91
92
93
94
LITEOSTOPDIR = $(CURDIR)
export LITEOSTOPDIR
-include $(LITEOSTOPDIR)/config.mk
RM = rm -rf
MAKE = make
__LIBS = libs
LITEOS_TARGET = Huawei_LiteOS
LITEOS_LIBS_TARGET = libs_target
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help
all: $(OUT) $(BUILD) $(LITEOS_TARGET)
lib: $(OUT) $(BUILD) $(LITEOS_LIBS_TARGET)
debug:
$(HIDE)echo "=============== make a debug version ==============="
$(HIDE) $(MAKE) all
release:
ifeq ($(PLATFORM),)
$(HIDE)echo "=============== make a release version for platform $(PLATFORM) ==============="
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh $(PLATFORM)
else
$(HIDE)echo "================make a release version for all platform ==============="
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh
endif
#-----need move when make version-----#
##### make lib #####
$(__LIBS): $(OUT) $(CXX_INCLUDE)
$(LITEOS_TARGET): $(__LIBS) LITEOS_BUILD
$(OUT): $(LITEOS_MENUCONFIG_H)
$(HIDE)mkdir -p $(OUT)/lib
$(BUILD):
$(HIDE)mkdir -p $(BUILD)
$(LITEOS_LIBS_TARGET): $(__LIBS)
$(HIDE)for dir in $(LIB_SUBDIRS); \
do $(MAKE) -C $$dir all || exit 1; \
done
$(HIDE)echo "=============== make lib done ==============="
include tools/menuconfig/Makefile.kconfig
$(LITEOS_MENUCONFIG_H):
ifneq ($(LITEOS_PLATFORM_MENUCONFIG_H), $(wildcard $(LITEOS_PLATFORM_MENUCONFIG_H)))
$(HIDE)+make savemenuconfig
endif
LITEOS_BUILD: $(LITEOS_MENUCONFIG_H)
LITEOS_BUILD:
$(HIDE)echo $(LOSCFG_ENTRY_SRC)
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
do $(MAKE) -C $$dir all || \
if [ "$$?" != "0" ]; then \
echo "########################################################################################################"; \
echo "######## LiteOS build failed! ########"; \
echo "########################################################################################################"; \
exit 1; \
fi;\
done
$(LITEOS_TARGET):
ifeq ($(OS), Linux)
$(call update_from_baselib_file)
endif
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) $(LITEOS_DYNLDFLAGS) -Map=$(OUT)/[email protected] -o $(OUT)/[email protected] --start-group $(LITEOS_BASELIB) --end-group
$(OBJCOPY) -O binary $(OUT)/[email protected] $(OUT)/[email protected]
$(OBJDUMP) -t $(OUT)/[email protected] |sort >$(OUT)/[email protected]
$(OBJDUMP) -d $(OUT)/[email protected] >$(OUT)/[email protected]
$(SIZE) $(OUT)/[email protected]
$(HIDE)echo "########################################################################################################"
$(HIDE)echo "######## LiteOS build successfully! ########"
$(HIDE)echo "########################################################################################################"
clean:
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
do make -C $$dir clean|| exit 1; \
done
$(HIDE)$(RM) $(__OBJS) $(LITEOS_TARGET) $(OUT) $(BUILD) $(LITEOS_MENUCONFIG_H) *.bak *~
$(HIDE)$(RM) -rf $(LITEOS_PLATFORM_MENUCONFIG_H)
$(HIDE)echo "clean $(LITEOS_PLATFORM) finish"
cleanall:
$(HIDE)rm -rf $(LITEOSTOPDIR)/out
$(HIDE)echo "clean all"