-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
executable file
·149 lines (124 loc) · 4.68 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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
export PROPERTIES_PROJECT_DIR := projects/properties_libs
ARMINO_DIR := $(shell pwd)
ARMINO_BOOTLOADER := $(ARMINO_DIR)/properties/modules/bootloader/aboot/monitor_bootloader/
ARMINO_TOOL := @$(ARMINO_DIR)/tools/build_tools/armino
ARMINO_TOOL_WRAPPER := @$(ARMINO_DIR)/tools/build_tools/build.sh
# 1. soc_targets contains all supported SoCs
# 2. cmake_supported_targets contains all targets that can directly
# passed to armino cmake build system
# 3. cmake_not_supported_targets contains all targets:
# 3.1> armino cmake doesn't support it, only implemented in this
# Makefile
# 3.2> armino cmake supports it, but has different target name
soc_targets := $(shell find middleware/soc/ -name "*.defconfig" -exec basename {} \; | cut -f1 -d ".")
properties_lib_targets := $(subst bk, libbk, $(soc_targets))
rel_targets := $(subst bk, relbk, $(soc_targets))
clean_targets := $(subst bk, cleanbk, $(soc_targets))
doc_targets := $(subst bk, docbk, $(soc_targets))
cmake_supported_targets := menuconfig doc
cmake_not_supported_targets = help clean
all_targets = cmake_not_supported_targets soc_targets cmake_supported_targets
export SOC_SUPPORTED_TARGETS := ${soc_targets}
export ARMINO_SOC := $(findstring $(MAKECMDGOALS), $(soc_targets))
export ARMINO_SOC_LIB := $(findstring $(MAKECMDGOALS), $(properties_lib_targets))
export CMD_TARGET := $(MAKECMDGOALS)
ifeq ("$(APP_VERSION)", "")
export APP_VERSION := unknow
else
export APP_VERSION := test
endif
ifeq ("$(PROJECT)", "")
ifneq ("$(INTERNAL)", "")
export PROJECT := $(INTERNAL)
export PROJECT_DIR := properties/projects/$(PROJECT)
export PROPERTIES_PROJECT_DIR := properties/projects/properties_libs
else
export PROJECT := app
endif
else
export PROJECT := $(PROJECT)
endif
ifeq ("$(PROJECT_LIBS)", "")
export PROJECT_LIBS := $(PROJECT)
else
export PROJECT_LIBS := $(PROJECT_LIBS)
endif
ifeq ("$(PROJECT_DIR)", "")
export PROJECT_DIR := projects/$(PROJECT)
else
export PROJECT_DIR := $(PROJECT_DIR)
endif
ifeq ("$(ARMINO_SOC)", "")
ifeq ("$(ARMINO_SOC_LIB)", "")
ARMINO_SOC := bk7231n
ARMINO_TARGET := $(MAKECMDGOALS)
endif
else
ARMINO_TARGET := build
endif
PROJECT_NAME := $(notdir $(PROJECT_DIR))
ifdef BUILD_DIR
PROJECT_BUILD_DIR := $(BUILD_DIR)
else
PROJECT_BUILD_DIR := build/$(PROJECT_NAME)
endif
# overwrite project config
-include $(ARMINO_DIR)/components/part_table/part_table.mk
-include $(ARMINO_DIR)/middleware/soc/$(ARMINO_SOC)/soc_config.mk
-include $(ARMINO_DIR)/$(PROJECT_DIR)/pj_config.mk
.PHONY: all_targets
help:
@echo ""
@echo " make bkxxx - build soc bkxxx"
@echo " make build - fast build last soc"
@echo " make all - build all soc"
@echo " make libbkxxx - build properties libs for soc bkxxx"
@echo " make liball - build all properties libs for all soc"
@echo " make menuconfig - confiure armino"
@echo " make clean - clean build"
@echo " make help - display this help info"
@echo " make doc - generate doc"
@echo ""
common:
@echo "ARMINO_SOC is set to $(ARMINO_SOC)"
@echo "ARMINO_TARGET is set to $(ARMINO_TARGET)"
@echo "armino project path=$(PROJECT_DIR)"
@echo "armino path=$(ARMINO_DIR)"
@echo "armino build path=$(ARMINO_DIR)/$(PROJECT_BUILD_DIR)"
@export ARMINO_PATH=$(ARMINO_DIR)
@export APP_NAME=$(APP_NAME)
has_lib_src := $(shell $(ARMINO_DIR)/tools/build_tools/detect_internal_lib_src.py)
build_dual_core := $(shell $(ARMINO_DIR)/tools/build_tools/detect_build_dual_core.py $(ARMINO_SOC) $(PROJECT))
$(info $$(PROJECT) is $(PROJECT))
bootloader:
ifeq ($(has_lib_src), 1)
ifneq ($(findstring $(ARMINO_SOC), $(PART_TABLE_SUPPORTED_TARGETS)),)
@$(ARMINO_TOOL_PART_TABLE) $(PARTITIONS_CSV_FILE) --to-json=$(BOOTLOADER_JSON) $(PARTITIONS_ARGS) $(BOOTLOADER_JSON_INSEQ)
@cp $(BOOTLOADER_JSON) $(BOOTLOADER_JSON_OLD)
endif
make clean -C ${ARMINO_BOOTLOADER}
make -C ${ARMINO_BOOTLOADER}
endif
ifeq ($(has_lib_src), 1)
$(properties_lib_targets): common
@$(ARMINO_TOOL_WRAPPER) $(ARMINO_DIR) $(PROJECT_DIR) $(PROJECT_BUILD_DIR) $@
endif
liball: $(properties_lib_targets)
$(soc_targets): ${PRE_BUILD_TARGET}
@$(ARMINO_TOOL_WRAPPER) $(ARMINO_DIR) $(PROJECT_DIR) $(PROJECT_BUILD_DIR) $@
all: $(soc_targets)
$(rel_targets):
@$(ARMINO_TOOL_WRAPPER) $(ARMINO_DIR) $(PROJECT_DIR) $(PROJECT_NAME) $@
relall: $(rel_targets)
$(cmake_supported_targets): common
@$(ARMINO_TOOL) -B ./$(PROJECT_BUILD_DIR) -P ./$(PROJECT_DIR) $@
$(clean_targets):
@$(ARMINO_TOOL_WRAPPER) $(ARMINO_DIR) $(PROJECT_DIR) $(PROJECT_NAME) $@
$(doc_targets):
@$(ARMINO_TOOL_WRAPPER) $(ARMINO_DIR) $(PROJECT_DIR) $(PROJECT_NAME) $@
clean:
@echo "rm all files generated by part_table_tool"
@$(ARMINO_TOOL_PART_TABLE) $(DEFAULT_CSV_FILE) $(PARTITIONS_ARGS) $(CLEAN_ALLFILE_INSEQ)
@echo "rm ./build"
@python3 tools/build_tools/armino_doc.py clean
@rm -rf ./build