-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
executable file
·154 lines (124 loc) · 5.85 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
149
150
151
152
153
154
##########################################################################################
# help config
##########################################################################################
.PHONY: help
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GREEN="\e[32;1m"
NORMAL="\e[39m"
RED="\e[31m"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
help:
@echo -e ${GREEN}
@#cat script/Readme|less
@echo -e ${NORMAL}
##########################################################################################
# menuconfig config
##########################################################################################
.PHONY: menuconfig
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++
KCONFIG_PATH= build/scripts/kconfig/
KCONFIG_EXE = build/scripts/kconfig/mconf
KCONFIG_CFG = Kconfig
#++++++++++++++++++++++++++++++++++++++++++++++++++++
prepare_kconfig:
@if [ ! -f $(KCONFIG_EXE) ];then cd $(KCONFIG_PATH);make;cd -;fi
menuconfig: prepare_kconfig
@-chmod -Rf 777 $(KCONFIG_EXE)
$(if $(wildcard $(KCONFIG_EXE)), \
$(KCONFIG_EXE) $(KCONFIG_CFG), \
)
##########################################################################################
# compile config
##########################################################################################
export SDK_ROOT := $(shell pwd)
include $(SDK_ROOT)/build/base.mak
.PHONY: all clean distclean prepare
.PHONY: osdrv osdrv_clean osdrv_distclean
.PHONY: ndk ndk_clean ndk_distclean
.PHONY: middleware middleware_clean middleware_distclean
.PHONY: reference reference_clean reference_distclean
SDK_SUBDIR := $(OSDRV_ROOT) $(AMP_ROOT) $(OSAL_ROOT) $(MPP_ROOT) $(DRV_ROOT)
all: prepare osdrv drv ndk middleware reference success
clean: reference_clean middleware_clean ndk_clean drv_clean osdrv_clean
distclean: reference_distclean middleware_distclean ndk_distclean drv_distclean osdrv_distclean
success:
@echo -e "\e[0;32;1m--install '$(notdir $(SDK_ROOT))' finished\e[0;36;1m"
@echo -e "\e[0m"
sdk_prepare:
for comp in $(SDK_SUBDIR);do \
if [ -f $$comp/prepare.sh ];then cd $$comp;chmod +x ./prepare.sh;./prepare.sh $(CFG_CHIP_TYPE) $(LIBC_TYPE);cd -;fi;\
done
sdk_distclean:
for comp in $(SDK_SUBDIR);do \
if [ -f $$comp/prepare.sh ];then cd $$comp;chmod +x ./prepare.sh;./prepare.sh clean;cd -;fi;\
done
prepare: sdk_prepare middleware_prepare
@chmod +x $(SDK_ROOT)/build/*
@cd $(SDK_ROOT)/build && ./config_memory_$(CFG_CHIP_TYPE).sh .config;cd -
prepare_clean:
@chmod +x $(SDK_ROOT)/build/*
@cd $(SDK_ROOT)/build && ./config_memory_$(CFG_CHIP_TYPE).sh .config clean;cd -
#++++++++++++++++++++++++++++++++++++++++++++++++++++
# OSDRV Compile
#++++++++++++++++++++++++++++++++++++++++++++++++++++
osdrv: prepare
@chmod 777 $(OSDRV_ROOT)/* -R
@make OSDRV_CROSS=$(OSDRV_CROSS) $(OSDRV_COMPILE_OPT) all -C $(OSDRV_ROOT)||exit $?
osdrv_clean:
@make OSDRV_CROSS=$(OSDRV_CROSS) $(OSDRV_COMPILE_OPT) clean -C $(OSDRV_ROOT)||exit $?
osdrv_distclean:
@make OSDRV_CROSS=$(OSDRV_CROSS) $(OSDRV_COMPILE_OPT) distclean -C $(OSDRV_ROOT)||exit $?
#++++++++++++++++++++++++++++++++++++++++++++++++++++
# DRV Compile
#++++++++++++++++++++++++++++++++++++++++++++++++++++
drv: prepare
@chmod 777 $(DRV_ROOT)/* -R
@if [ -f $(DRV_EXTDRV_PATH_LINUX)/Makefile.board ];then make -C $(DRV_EXTDRV_PATH_LINUX) -f Makefile.board OSTYPE=linux||exit $?;fi
@if [ -f $(DRV_EXTDRV_PATH_LITEOS)/Makefile.board ];then make -C $(DRV_EXTDRV_PATH_LITEOS) -f Makefile.board OSTYPE=liteos||exit $?;fi
@if [ -d $(OSAL_LINUX_PATH)/linux/kernel ];then cd $(OSAL_LINUX_PATH)/linux/kernel; make||exit $?; cd -;fi
@if [ -d $(OSAL_LITEOS_PATH)/liteos/kernel ];then cd $(OSAL_LITEOS_PATH)/liteos/kernel; make||exit $?; cd -;fi
drv_clean:
@if [ -f $(DRV_EXTDRV_PATH_LINUX)/Makefile.board ];then make clean -C $(DRV_EXTDRV_PATH_LINUX) -f Makefile.board OSTYPE=linux||exit $?;fi
@if [ -f $(DRV_EXTDRV_PATH_LITEOS)/Makefile.board ];then make clean -C $(DRV_EXTDRV_PATH_LITEOS) -f Makefile.board OSTYPE=liteos||exit $?;fi
@if [ -d $(OSAL_LINUX_PATH)/linux/kernel ];then cd $(OSAL_LINUX_PATH)/linux/kernel; make clean||exit $?; cd -;fi
@if [ -d $(OSAL_LITEOS_PATH)/liteos/kernel ];then cd $(OSAL_LITEOS_PATH)/liteos/kernel; make clean||exit $?; cd -;fi
drv_distclean: drv_clean
#++++++++++++++++++++++++++++++++++++++++++++++++++++
# NDK Compile
#++++++++++++++++++++++++++++++++++++++++++++++++++++
ndk: middleware_prepare
@chmod 777 $(NDK_ROOT)/* -R
@make install -C $(NDK_ROOT) $(NDK_COMPILE_OPT) ||exit $?
ndk_clean:
@make clean -C $(NDK_ROOT) $(NDK_COMPILE_OPT)||exit $?
ndk_distclean:
@make clean -C $(NDK_ROOT) $(NDK_COMPILE_OPT)||exit $?
#++++++++++++++++++++++++++++++++++++++++++++++++++++
# MiddleWare Compile
#++++++++++++++++++++++++++++++++++++++++++++++++++++
middleware_prepare:
@cd $(MWARE_ROOT); if [ -f prepare.sh ];then chmod +x ./prepare.sh;./prepare.sh $(CFG_CHIP_TYPE) $(LIBC_TYPE);fi;cd -
middleware: middleware_prepare
@make install -C $(MWARE_ROOT) $(MW_COMPILE_OPT) ||exit $?
middleware_clean:
@make uninstall -C $(MWARE_ROOT)||exit $?
middleware_distclean:
@make uninstall -C $(MWARE_ROOT)||exit $?
#++++++++++++++++++++++++++++++++++++++++++++++++++++
# Reference Compile
#++++++++++++++++++++++++++++++++++++++++++++++++++++
ifeq ($(CONFIG_PQT_SUPPORT_ON), y)
pq_prepare:
@cd $(PQT_ROOT); if [ -f prepare.sh ];then chmod +x ./prepare.sh;./prepare.sh $(CFG_CHIP_TYPE) $(LIBC_TYPE);fi;tar -zxf Hi35*_PQ_V*.tgz;cd -
endif
ifeq ($(CONFIG_PQT_SUPPORT_ON), y)
reference: prepare pq_prepare
else
reference: prepare
endif
@make -C $(REF_ROOT)||exit $?
reference_clean:
@make clean -C $(REF_ROOT)||exit $?
reference_distclean:
@make distclean -C $(REF_ROOT)||exit $?