Move git submodule check and version generation to main Makefile

This commit is contained in:
Fred Sundvik 2016-08-08 11:19:29 +03:00
parent cc2df445ab
commit 60c6e79ecb
3 changed files with 14 additions and 16 deletions

View File

@ -262,6 +262,13 @@ $(SUBPROJECTS): %: %-allkm
.PHONY: % .PHONY: %
%: %:
cmp --version >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; cmp --version >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
git submodule status --recursive 2>/dev/null | \
while IFS= read -r x; do \
case "$$x" in \
\ *) ;; \
*) printf "$(MSG_SUBMODULE_DIRTY)";break;; \
esac \
done
$(eval $(call PARSE_RULE,$@)) $(eval $(call PARSE_RULE,$@))
$(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND)) $(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND))
@ -275,3 +282,8 @@ all-keyboards: allkb-allsp-allkm
.PHONY: all-keyboards-defaults .PHONY: all-keyboards-defaults
all-keyboards-defaults: allkb-allsp-default all-keyboards-defaults: allkb-allsp-default
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h)
$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h)

View File

@ -183,9 +183,4 @@ endif
include $(TMK_PATH)/rules.mk include $(TMK_PATH)/rules.mk
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\" OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(QUANTUM_PATH)/version.h)
$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(QUANTUM_PATH)/version.h)

View File

@ -267,15 +267,6 @@ sym: $(BUILD_DIR)/$(TARGET).sym
LIBNAME=lib$(TARGET).a LIBNAME=lib$(TARGET).a
lib: $(LIBNAME) lib: $(LIBNAME)
check_submodule:
git submodule status --recursive | \
while IFS= read -r x; do \
case "$$x" in \
\ *) ;; \
*) printf "$(MSG_SUBMODULE_DIRTY)";break;; \
esac \
done
# Display size of file. # Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
@ -337,7 +328,7 @@ gccversion :
$(eval CMD=$(AR) $@ $(OBJ) ) $(eval CMD=$(AR) $@ $(OBJ) )
@$(BUILD_CMD) @$(BUILD_CMD)
BEGIN = gccversion check_submodule sizebefore BEGIN = gccversion sizebefore
# Link: create ELF output file from object files. # Link: create ELF output file from object files.
.SECONDARY : $(BUILD_DIR)/$(TARGET).elf .SECONDARY : $(BUILD_DIR)/$(TARGET).elf
@ -443,6 +434,6 @@ $(shell mkdir $(KBOBJDIR) 2>/dev/null)
# Listing of phony targets. # Listing of phony targets.
.PHONY : all finish sizebefore sizeafter gccversion \ .PHONY : all finish sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff check_submodule \ build elf hex eep lss sym coff extcoff \
clean clean_list debug gdb-config show_path \ clean clean_list debug gdb-config show_path \
program teensy dfu flip dfu-ee flip-ee dfu-start program teensy dfu flip dfu-ee flip-ee dfu-start