From 409b6ea2ed34ff765b2faeaf9f487797564b4e8b Mon Sep 17 00:00:00 2001 From: David Griffith Date: Tue, 12 Feb 2019 11:55:32 -0800 Subject: [PATCH] Moving as much as I can into using export-subst. --- .gitattributes | 1 + Makefile | 22 +++++++++------------- src/common/git_hash.h | 5 ----- 3 files changed, 10 insertions(+), 18 deletions(-) delete mode 100644 src/common/git_hash.h diff --git a/.gitattributes b/.gitattributes index c101a7b..aa7add5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ .gitattributes export-ignore .gitlab-ci.yml export-ignore public export-ignore +Makefile export-subst diff --git a/Makefile b/Makefile index 0a5b777..4a5113c 100644 --- a/Makefile +++ b/Makefile @@ -122,8 +122,14 @@ ifneq ($(and $(wildcard $(GIT_DIR)),$(shell which git)),) GIT_HASH_SHORT = $(shell git rev-parse --short HEAD) GIT_TAG = $(shell git describe --abbrev=0 --tags) GIT_DATE = $(shell git show -s --format=%ci) +else + GIT_BRANCH = "$Format:%D$" + GIT_HASH = "$Format:%H$" + GIT_HASH_SHORT = "$Format:%h$" + GIT_TAG = none + GIT_DATE = "$Format:%ci$" endif -BUILD_DATE_TIME = $(shell date --rfc-3339 seconds) +BUILD_DATE = $(shell date --rfc-3339 seconds) export CFLAGS @@ -220,7 +226,7 @@ common_strings: $(COMMON_STRINGS) $(COMMON_STRINGS): @echo "** Generating $@" @echo "#include \"frotz.h\"" > $@ - @echo "const char build_timestamp[] = \"$(BUILD_DATE_TIME)\";" >> $@ + @echo "const char build_timestamp[] = \"$(BUILD_DATE)\";" >> $@ common_defines: $(COMMON_DEFINES) $(COMMON_DEFINES): @@ -268,13 +274,6 @@ endif hash: $(HASH) -ifneq ($(and $(wildcard $(GIT_DIR)),$(shell which git)),) - @echo "** Generating $@" - - - - -$(HASH_OLD): @echo "** Generating $@" @echo "#define GIT_BRANCH \"$(GIT_BRANCH)\"" > $@ @echo "#define GIT_HASH \"$(GIT_HASH)\"" >> $@ @@ -325,9 +324,6 @@ uninstall_all: uninstall_frotz uninstall_dfrotz uninstall_sfrotz dist: $(NAME)-$(GIT_TAG).tar frotz-$(GIT_TAG).tar: git archive --format=tar --prefix $(NAME)-$(GIT_TAG)/ HEAD | tar xf - - sed s"/GIT_BRANCH = none/GIT_BRANCH = \"$(GIT_BRANCH)\"/" -i $(NAME)-$(GIT_TAG)/Makefile - sed s"/GIT_HASH = none/GIT_HASH = \"$(GIT_HASH)\"/" -i $(NAME)-$(GIT_TAG)/Makefile - sed s"/GIT_HASH_SHORT = none/GIT_HASH_SHORT = \"$(GIT_HASH_SHORT)\"/" -i $(NAME)-$(GIT_TAG)/Makefile sed s"/GIT_TAG = none/GIT_TAG = \"$(GIT_TAG)\"/" -i $(NAME)-$(GIT_TAG)/Makefile tar zcf $(NAME)-$(GIT_TAG).tar.gz $(NAME)-$(GIT_TAG) rm -rf $(NAME)-$(GIT_TAG) @@ -338,7 +334,7 @@ clean: $(SUB_CLEAN) $(SRCDIR)/*.a \ $(COMMON_DEFINES) \ $(COMMON_STRINGS) \ -# $(HASH) \ + $(HASH) \ $(CURSES_DEFINES) \ $(NAME)*.tar.gz diff --git a/src/common/git_hash.h b/src/common/git_hash.h deleted file mode 100644 index 1fe2b90..0000000 --- a/src/common/git_hash.h +++ /dev/null @@ -1,5 +0,0 @@ -#define GIT_BRANCH "$Format: %D$" -#define GIT_TAG "$Format: %D$" -#define GIT_HASH "$Format: %H$" -#define GIT_HASH_SHORT "$Format: $h$" -#define GIT_DATE "$Format: $ci$" -- 2.34.1