使用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

@@ -71,7 +71,14 @@ GET_SRCS = $(wildcard $(1)/*.c) $(wildcard $(1)/*.cpp) $(wildcard $(1)/*.S)
# local .c
SRCS += $(call GET_SRCS, .)
# 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
SRCS += $(EXT_SRC)
# 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
@for d in $(SUB_DIRS); do\
if [ -e "$$d/Makefile" ]; then\
echo "enter $$d";\
$(MAKE) -C $$d || exit 1;\
if [ 2 -eq $(OUTPUT_TYPE) ];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
@for d in $(SUB_DIRS) ; do\
if [ -e "$$d/Makefile" ]; then\
echo "clean $$d";\
$(MAKE) -C $$d $@ ;\
fi;\
done
-$(RM) $(OUTDIR)
clobber:
@for d in $(SUB_DIRS); do\
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)
@echo clobber
# clean obj files only
clean_objs:
-$(RM) $(OBJECTS)
@for d in $(SUB_DIRS); do\
if [ -e "$$d/Makefile" ]; then\
echo "clean_objs $$d";\
$(MAKE) -C $$d $@ ;\
fi;\
done