summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-08-08 11:19:29 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-08-20 03:56:32 +0300
commit60c6e79ecb032e9726809a295ab3e0011e6b2fb4 (patch)
tree5166aafae25c204321c136d995be948c85a0d720 /Makefile
parentcc2df445ab3b0fd3998de7861b1c9ba0ad64aa8a (diff)
downloadqmk_firmware-60c6e79ecb032e9726809a295ab3e0011e6b2fb4.tar.gz
qmk_firmware-60c6e79ecb032e9726809a295ab3e0011e6b2fb4.zip
Move git submodule check and version generation to main Makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index fc61572094..caa8f2de1c 100644
--- a/Makefile
+++ b/Makefile
@@ -262,6 +262,13 @@ $(SUBPROJECTS): %: %-allkm
.PHONY: %
%:
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,$@))
$(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND))
@@ -275,3 +282,8 @@ all-keyboards: allkb-allsp-allkm
.PHONY: all-keyboards-defaults
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) \ No newline at end of file