blob: 9a9a0e9e11f0ba17ba618f91e3a247cb881da75c [file] [log] [blame]
include $(ZTE_PS_LINK_SCRIPT)
-include $(OUTPUT_DIR)/sys_type.mk
.PHONY: help all allclean app appclean lib libclean check
help: check
@echo "=========================Make help start========================="
@echo "make [help] this help"
@echo "make all[clean] compile all, include recovery and normal system"
@echo "make normal[clean] compile normal system,include kernel uClibc lib and app"
@echo "make normal2 continue to compile normal system"
@echo "make normal_rootfs make rootfs for normal system"
@echo "make normal_copybin copy bins to project for normal system"
@echo "make rootfs make rootfs for normal or recovery automatically based on config"
@echo "make copybin copy bins to project for normal or recovery automatically based on config"
@echo "make lib[clean] compile lib"
@echo "make app[clean] compile app"
@echo "=========================Make help end========================="
check:
ifeq ($(PRJ_NAME),)
$(error ONLY execute the make command in the project/CHIP_NAME/prj_xxx/build directory)
endif
bash $(BUILD_DIR)/env_check.sh
normal_check:
ifneq ($(AP_BUILD_TYPE),normal)
$(error current config is not normal,make normal first)
endif
all:
make AP_BUILD_TYPE=normal normal
allclean: normalclean
sys: check
make lib
make app
@echo "all modules build done"
sysclean: check
make libclean
make appclean
-@rm -fr $(OUTPUT_DIR)
@echo "all modules clean done"
app:
mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
make -C app
appclean:
make -C app clean
lib:
mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin
make -C lib
libclean:
make -C lib clean
normal_conf:
mkdir -p $(OUTPUT_DIR)
mkdir -p $(IMAGE_DIR)
echo "AP_BUILD_TYPE = normal" > $(OUTPUT_DIR)/sys_type.mk
echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk
normal:
make AP_BUILD_TYPE=normal sysclean
make AP_BUILD_TYPE=normal normal_conf
make AP_BUILD_TYPE=normal sys
make AP_BUILD_TYPE=normal normal_rootfs
make AP_BUILD_TYPE=normal normal_copybin
normal2: sys normal_rootfs normal_copybin
normalclean:
-make AP_BUILD_TYPE=normal sysclean
make normal_conf
make AP_BUILD_TYPE=normal sysclean
rootfs:
make normal_rootfs
copybin:
make normal_copybin
normal_rootfs: normal_check
mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs
rm -fr $(ROOTFS_DIR)/etc_rw
cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/rootfs/* $(ROOTFS_DIR)/
#cp -v $(PRJ_BIN_DIR)/allbins/ap_userdata.img $(ROOTFS_DIR)/etc_ro/
chmod -R a+r $(ROOTFS_DIR)/etc_ro
#find $(ROOTFS_DIR)/bin -type f | xargs chmod a+x
#-find $(ROOTFS_DIR)/sbin -type f | xargs chmod a+x
chmod a+x $(ROOTFS_DIR)/etc/rc
#@cd $(BUILD_DIR); bash ./install_libc.sh $(ROOTFS_DIR)
find $(ROOTFS_DIR)/ -type d -name '.gitkeep' -print0 | xargs -0 rm -fr
find $(ROOTFS_DIR)/ -type d -name '.git' -print0 | xargs -0 rm -fr
find $(ROOTFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr
ifeq ($(ROOT_FS_TYPE),ubifs)
bash $(BUILD_DIR)/ubifs.sh rootfs $(ROOTFS_SIZE) $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img
else
ifeq ($(ROOT_FS_TYPE),jffs2)
ifeq ($(PRJ_IS_MIN),yes)
bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzma
else
bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzo
endif
endif
endif
(cd $(ROOTFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../rootfs_attr.txt)
(cd $(ROOTFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
(cd $(ROOTFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt)
(cd $(ROOTFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/rootfs.tgz rootfs rootfs_attr.txt)
@rm $(ROOTFS_DIR)/../rootfs_attr.txt
normal_copybin: normal_check
mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/normalelfs
cp -v $(IMAGE_DIR)/rootfs.img $(PRJ_BIN_DIR)/allbins/ap_rootfs.img
find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
find $(LIB_DIR)/ -type f -name "lib*.so" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;
find $(STAGEDIR)/uClibc/lib -type f -name "*.so" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \;