lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | |
| 2 | include $(ZTE_PS_LINK_SCRIPT) |
| 3 | -include $(OUTPUT_DIR)/sys_type.mk |
| 4 | |
| 5 | .PHONY: help all allclean app appclean lib libclean check |
| 6 | |
| 7 | help: check |
| 8 | @echo "=========================Make help start=========================" |
| 9 | @echo "make [help] this help" |
| 10 | @echo "make all[clean] compile all, include recovery and normal system" |
| 11 | @echo "make normal[clean] compile normal system,include kernel uClibc lib and app" |
| 12 | @echo "make normal2 continue to compile normal system" |
| 13 | @echo "make normal_rootfs make rootfs for normal system" |
| 14 | @echo "make normal_copybin copy bins to project for normal system" |
| 15 | @echo "make rootfs make rootfs for normal or recovery automatically based on config" |
| 16 | @echo "make copybin copy bins to project for normal or recovery automatically based on config" |
| 17 | @echo "make lib[clean] compile lib" |
| 18 | @echo "make app[clean] compile app" |
| 19 | @echo "=========================Make help end=========================" |
| 20 | |
| 21 | check: |
| 22 | ifeq ($(PRJ_NAME),) |
| 23 | $(error ONLY execute the make command in the project/CHIP_NAME/prj_xxx/build directory) |
| 24 | endif |
| 25 | bash $(BUILD_DIR)/env_check.sh |
| 26 | |
| 27 | normal_check: |
| 28 | ifneq ($(AP_BUILD_TYPE),normal) |
| 29 | $(error current config is not normal,make normal first) |
| 30 | endif |
| 31 | |
| 32 | all: |
| 33 | make AP_BUILD_TYPE=normal normal |
| 34 | |
| 35 | allclean: normalclean |
| 36 | |
| 37 | sys: check |
| 38 | make lib |
| 39 | make app |
| 40 | @echo "all modules build done" |
| 41 | |
| 42 | sysclean: check |
| 43 | make libclean |
| 44 | make appclean |
| 45 | -@rm -fr $(OUTPUT_DIR) |
| 46 | @echo "all modules clean done" |
| 47 | |
| 48 | app: |
| 49 | mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin |
| 50 | make -C app |
| 51 | |
| 52 | appclean: |
| 53 | make -C app clean |
| 54 | |
| 55 | lib: |
| 56 | mkdir -p $(ROOTFS_DIR)/bin $(ROOTFS_DIR)/sbin $(ROOTFS_DIR)/lib $(ROOTFS_DIR)/recovery/bin |
| 57 | make -C lib |
| 58 | |
| 59 | libclean: |
| 60 | make -C lib clean |
| 61 | |
| 62 | normal_conf: |
| 63 | mkdir -p $(OUTPUT_DIR) |
| 64 | mkdir -p $(IMAGE_DIR) |
| 65 | echo "AP_BUILD_TYPE = normal" > $(OUTPUT_DIR)/sys_type.mk |
| 66 | echo "AP_BUILD_PRJ = $(PRJ_NAME)" >> $(OUTPUT_DIR)/sys_type.mk |
| 67 | |
| 68 | normal: |
| 69 | make AP_BUILD_TYPE=normal sysclean |
| 70 | make AP_BUILD_TYPE=normal normal_conf |
| 71 | make AP_BUILD_TYPE=normal sys |
| 72 | make AP_BUILD_TYPE=normal normal_rootfs |
| 73 | make AP_BUILD_TYPE=normal normal_copybin |
| 74 | |
| 75 | normal2: sys normal_rootfs normal_copybin |
| 76 | |
| 77 | normalclean: |
| 78 | -make AP_BUILD_TYPE=normal sysclean |
| 79 | make normal_conf |
| 80 | make AP_BUILD_TYPE=normal sysclean |
| 81 | |
| 82 | rootfs: |
| 83 | make normal_rootfs |
| 84 | |
| 85 | copybin: |
| 86 | |
| 87 | make normal_copybin |
| 88 | |
| 89 | normal_rootfs: normal_check |
| 90 | mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs |
| 91 | rm -fr $(ROOTFS_DIR)/etc_rw |
| 92 | cp -afvp $(PRJ_PRODUCT_DIR)/fs/normal/rootfs/* $(ROOTFS_DIR)/ |
| 93 | #cp -v $(PRJ_BIN_DIR)/allbins/ap_userdata.img $(ROOTFS_DIR)/etc_ro/ |
| 94 | chmod -R a+r $(ROOTFS_DIR)/etc_ro |
| 95 | #find $(ROOTFS_DIR)/bin -type f | xargs chmod a+x |
| 96 | #-find $(ROOTFS_DIR)/sbin -type f | xargs chmod a+x |
| 97 | chmod a+x $(ROOTFS_DIR)/etc/rc |
| 98 | #@cd $(BUILD_DIR); bash ./install_libc.sh $(ROOTFS_DIR) |
| 99 | find $(ROOTFS_DIR)/ -type d -name '.gitkeep' -print0 | xargs -0 rm -fr |
| 100 | find $(ROOTFS_DIR)/ -type d -name '.git' -print0 | xargs -0 rm -fr |
| 101 | find $(ROOTFS_DIR)/ -name '.gitignore' -print0 | xargs -0 rm -fr |
| 102 | |
| 103 | ifeq ($(ROOT_FS_TYPE),ubifs) |
| 104 | bash $(BUILD_DIR)/ubifs.sh rootfs $(ROOTFS_SIZE) $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img |
| 105 | else |
| 106 | ifeq ($(ROOT_FS_TYPE),jffs2) |
| 107 | ifeq ($(PRJ_IS_MIN),yes) |
| 108 | bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzma |
| 109 | else |
| 110 | bash $(BUILD_DIR)/jffs2_lzma.sh $(ROOTFS_DIR) $(IMAGE_DIR)/rootfs.img lzo |
| 111 | endif |
| 112 | endif |
| 113 | endif |
| 114 | |
| 115 | (cd $(ROOTFS_DIR) && find . -type f -printf '"/%P" Regular 14 %04m:%4U:%4G\n' > ../rootfs_attr.txt) |
| 116 | (cd $(ROOTFS_DIR) && find . -type l -printf '"/%P" SymLink 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt) |
| 117 | (cd $(ROOTFS_DIR) && find . -type d -printf '"/%P" Regular 14 %04m:%4U:%4G\n' >> ../rootfs_attr.txt) |
| 118 | (cd $(ROOTFS_DIR)/../ && tar -zcvf $(PRJ_BIN_DIR)/allbins/rootfs.tgz rootfs rootfs_attr.txt) |
| 119 | @rm $(ROOTFS_DIR)/../rootfs_attr.txt |
| 120 | |
| 121 | normal_copybin: normal_check |
| 122 | mkdir -p $(PRJ_BIN_DIR)/allbins $(PRJ_BIN_DIR)/elfs/normalelfs |
| 123 | cp -v $(IMAGE_DIR)/rootfs.img $(PRJ_BIN_DIR)/allbins/ap_rootfs.img |
| 124 | find $(APP_DIR)/ -name *.elf -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \; |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 125 | find $(LIB_DIR)/ -name "l*.so*" -type f ! -path "*/.libs/*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \; |
| 126 | find $(STAGEDIR)/libc/lib -type f -name "*.so*" -exec cp {} $(PRJ_BIN_DIR)/elfs/normalelfs \; |