mirror of
https://github.com/qmk/qmk_firmware
synced 2024-11-18 09:55:48 +00:00
Speed up compilation by not using recusive make
The cleaning is done outside the targets, by checking the requested target name.
This commit is contained in:
parent
e8719e10c4
commit
b86b0480d5
1 changed files with 21 additions and 38 deletions
|
@ -271,23 +271,10 @@ ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
|
|||
ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
|
||||
|
||||
# Default target.
|
||||
all:
|
||||
@$(MAKE) begin
|
||||
@$(MAKE) gccversion
|
||||
@$(MAKE) sizebefore
|
||||
@$(MAKE) clean_list # force clean each time
|
||||
@$(MAKE) build
|
||||
@$(MAKE) sizeafter
|
||||
@$(MAKE) end
|
||||
all: build sizeafter
|
||||
|
||||
# Quick make that doesn't clean
|
||||
quick:
|
||||
@$(MAKE) begin
|
||||
@$(MAKE) gccversion
|
||||
@$(MAKE) sizebefore
|
||||
@$(MAKE) build
|
||||
@$(MAKE) sizeafter
|
||||
@$(MAKE) end
|
||||
quick: build sizeafter
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
build: elf hex
|
||||
|
@ -303,13 +290,7 @@ sym: $(BUILD_DIR)/$(TARGET).sym
|
|||
LIBNAME=lib$(TARGET).a
|
||||
lib: $(LIBNAME)
|
||||
|
||||
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
# the following magic strings to be generated by the compile job.
|
||||
begin:
|
||||
@$(SECHO) $(MSG_BEGIN)
|
||||
check_submodule:
|
||||
git submodule status --recursive | \
|
||||
while IFS= read -r x; do \
|
||||
case "$$x" in \
|
||||
|
@ -318,10 +299,6 @@ begin:
|
|||
esac \
|
||||
done
|
||||
|
||||
end:
|
||||
@$(SECHO) $(MSG_END)
|
||||
|
||||
|
||||
# Display size of file.
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||
#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
|
||||
|
@ -331,7 +308,7 @@ sizebefore:
|
|||
@if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
|
||||
2>/dev/null; $(SECHO); fi
|
||||
|
||||
sizeafter:
|
||||
sizeafter: $(BUILD_DIR)/$(TARGET).hex
|
||||
@if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
|
||||
2>/dev/null; $(SECHO); fi
|
||||
# test file sizes eventually
|
||||
|
@ -386,9 +363,9 @@ gccversion :
|
|||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
%.elf: gccversion sizebefore check_submodule $(OBJ)
|
||||
@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
|
||||
$(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
|
||||
$(eval CMD=$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS))
|
||||
@$(BUILD_CMD)
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
|
@ -429,14 +406,7 @@ $(OBJDIR)/%.o : %.S
|
|||
$(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list end
|
||||
|
||||
clean_list :
|
||||
@$(REMOVE) -r $(BUILD_DIR)
|
||||
@$(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR)
|
||||
@$(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR)
|
||||
@if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi
|
||||
@$(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR)
|
||||
clean:
|
||||
|
||||
show_path:
|
||||
@echo VPATH=$(VPATH)
|
||||
|
@ -496,6 +466,19 @@ all-keymaps-%:
|
|||
|
||||
all-keymaps: all-keymaps-all
|
||||
|
||||
GOAL=$(MAKECMDGOALS)
|
||||
ifeq ($(MAKECMDGOALS),)
|
||||
GOAL = all
|
||||
endif
|
||||
CLEANING_GOALS=clean clean_list all
|
||||
ifneq ($(findstring $(GOAL),$(CLEANING_GOALS)),)
|
||||
$(shell $(REMOVE) -r $(BUILD_DIR) 2>/dev/null)
|
||||
$(shell $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR))
|
||||
$(shell $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR))
|
||||
$(shell if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi)
|
||||
$(shell $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR))
|
||||
endif
|
||||
|
||||
# Create build directory
|
||||
$(shell mkdir $(BUILD_DIR) 2>/dev/null)
|
||||
|
||||
|
@ -508,7 +491,7 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
|
|||
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all quick begin finish end sizebefore sizeafter gccversion \
|
||||
.PHONY : all quick finish sizebefore sizeafter gccversion \
|
||||
build elf hex eep lss sym coff extcoff \
|
||||
clean clean_list debug gdb-config show_path \
|
||||
program teensy dfu flip dfu-ee flip-ee dfu-start \
|
||||
|
|
Loading…
Reference in a new issue