使用python脚本删除上次生成 加快编译速度

This commit is contained in:
2025-01-13 11:19:08 +08:00
parent 6c31c3d96f
commit b29b776229
4 changed files with 19 additions and 13 deletions

View File

@@ -50,10 +50,10 @@ export product_line=PLC
export PATH=/opt/kunlun2/bin/:$PATH export PATH=/opt/kunlun2/bin/:$PATH
set -o errexit set -o errexit
make -C .. clobber # make -j -C .. clobber
# clean phy lib etc. # clean phy lib etc.
make -C .. sbl_clean # make -j -C .. sbl_clean
# build klx ram # build klx ram
make -C .. sbl opt_build=1 make -j -C .. sbl opt_build=1

View File

@@ -13,6 +13,9 @@ if __name__ == "__main__":
cmd=f"{' '.join(sys.argv[1:])} > build_log.log" cmd=f"{' '.join(sys.argv[1:])} > build_log.log"
if not ('not_clean' in sys.argv[1:]): if not ('not_clean' in sys.argv[1:]):
os.system("python3 ../clear_output.py > /dev/null") os.system("python3 ../clear_output.py > /dev/null")
os.remove("../make_flags.txt")
os.remove("../python_script_log.log")
os.system("python3 ../praper_vscode.py clear >> ../python_script_log.log")
path="../tools/gen_img/customer" path="../tools/gen_img/customer"
if os.path.exists(path): if os.path.exists(path):
shutil.rmtree(path) shutil.rmtree(path)

View File

@@ -71,7 +71,14 @@ GET_SRCS = $(wildcard $(1)/*.c) $(wildcard $(1)/*.cpp) $(wildcard $(1)/*.S)
# local .c # local .c
SRCS += $(call GET_SRCS, .) SRCS += $(call GET_SRCS, .)
# every sub dir's .c # every sub dir's .c
SRCS += $(foreach dirname, $(SUB_DIRS), $(call GET_SRCS, $(dirname))) # 如果子文件夹包含makefile文件 则不包含这个目录的源文件
SRC_DIRS = $(shell for dir in $(SUB_DIRS); do \
if [ ! -f "$$dir/Makefile" ]; then \
echo "$$dir"; \
fi \
done)
SRCS += $(foreach dirname, $(SRC_DIRS), $(call GET_SRCS, $(dirname)))
# ext src # ext src
SRCS += $(EXT_SRC) SRCS += $(EXT_SRC)
# all the obj names # all the obj names
@@ -312,6 +319,7 @@ $(OUTPUT_FULL_NAME): $(OUTPUT_DIR) $(BIN_DIR)/.sub_dirs $(BIN_DIR)/.ext_src $(OB
@python3 $(TOPDIR)/praper_vscode.py $(TOPDIR)/make_flags.txt $@ >> $(TOPDIR)/python_script_log.log @python3 $(TOPDIR)/praper_vscode.py $(TOPDIR)/make_flags.txt $@ >> $(TOPDIR)/python_script_log.log
@for d in $(SUB_DIRS); do\ @for d in $(SUB_DIRS); do\
if [ -e "$$d/Makefile" ]; then\ if [ -e "$$d/Makefile" ]; then\
echo "enter $$d";\
$(MAKE) -C $$d || exit 1;\ $(MAKE) -C $$d || exit 1;\
if [ 2 -eq $(OUTPUT_TYPE) ];then\ if [ 2 -eq $(OUTPUT_TYPE) ];then\
if [ -e $(OUTPUT_FULL_NAME) ]; then \ if [ -e $(OUTPUT_FULL_NAME) ]; then \
@@ -402,27 +410,21 @@ clean:
-$(RM) $(OUTPUT_FULL_NAME) $(OBJECTS) $(DEPS) $(BIN_DIR)/.sub_dirs $(BIN_DIR)/.ext_src -$(RM) $(OUTPUT_FULL_NAME) $(OBJECTS) $(DEPS) $(BIN_DIR)/.sub_dirs $(BIN_DIR)/.ext_src
@for d in $(SUB_DIRS) ; do\ @for d in $(SUB_DIRS) ; do\
if [ -e "$$d/Makefile" ]; then\ if [ -e "$$d/Makefile" ]; then\
echo "clean $$d";\
$(MAKE) -C $$d $@ ;\ $(MAKE) -C $$d $@ ;\
fi;\ fi;\
done done
-$(RM) $(OUTDIR) -$(RM) $(OUTDIR)
clobber: clobber:
@for d in $(SUB_DIRS); do\ @echo clobber
if [ -e "$$d/Makefile" ]; then\
$(MAKE) -C $$d $@ ;\
fi;\
done
@-$(RM) $(TOPDIR)/make_flags.txt
@-$(RM) $(TOPDIR)/python_script_log.log
@-python3 $(TOPDIR)/praper_vscode.py clear >> $(TOPDIR)/python_script_log.log
@-$(RM) $(OUTDIR)
# clean obj files only # clean obj files only
clean_objs: clean_objs:
-$(RM) $(OBJECTS) -$(RM) $(OBJECTS)
@for d in $(SUB_DIRS); do\ @for d in $(SUB_DIRS); do\
if [ -e "$$d/Makefile" ]; then\ if [ -e "$$d/Makefile" ]; then\
echo "clean_objs $$d";\
$(MAKE) -C $$d $@ ;\ $(MAKE) -C $$d $@ ;\
fi;\ fi;\
done done

View File

@@ -68,6 +68,7 @@ void start_boot(void)
int sbl_main(int fboot_flag) int sbl_main(int fboot_flag)
{ {
// 保存rom传递的快速启动标志
sbl_fastboot_flag_set((uint32_t)fboot_flag); sbl_fastboot_flag_set((uint32_t)fboot_flag);
start_boot(); start_boot();