diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,6 +1,8 @@ # -*- make -*- # (C) 2016 by Eugeniy Mikhailov, <evgmik@gmail.com> +TOPDIR=. + include ./local.mk # this file is a bit complex since it tries to be general enough to use @@ -28,7 +30,7 @@ endif UPLOAD_STAMPS = .upload_stamps -lua_files = $(wildcard *.lua) +lua_files = $(wildcard *.lua) version.lua httpserver_lua_files = $(wildcard nodemcu-httpserver/httpserver*.lua) html_files = $(wildcard http/*) @@ -36,7 +38,7 @@ lua_files_upload_stamps = $(lua_files:%=$(UPLOAD_STAMPS)/%.uploaded) httpserver_files_upload_stamps = $(httpserver_lua_files:%=$(UPLOAD_STAMPS)/%.uploaded) html_files_upload_stamps = $(html_files:%=$(UPLOAD_STAMPS)/%.uploaded) -upload: $(UPLOAD_STAMPS) $(html_files_upload_stamps) $(lua_files_upload_stamps) $(httpserver_files_upload_stamps) +upload: $(UPLOAD_STAMPS) $(html_files_upload_stamps) version $(lua_files_upload_stamps) $(httpserver_files_upload_stamps) $(UPLOAD_STAMPS): mkdir -p $(UPLOAD_STAMPS) @@ -65,6 +67,13 @@ else ($(upload_cmd) --src $< --dest $<) && touch $@ endif +GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1), branch $(shell [ -f $(TOPDIR)/.git/HEAD ] && sed 's/ref: refs\/heads\/\(.*\)/\\\\\\"\1\\\\\\"/g' $(TOPDIR)/.git/HEAD || echo 'unknown'))" +VERSION:=$(shell git describe --tags --abbrev=0) + +version: version.lua + +version.lua: version.template $(lua_files%version.lua%) + sed s/__VERSION__/{$(GIT_VERSION)}/ < $< > $@ term: $(term_cmd) |