]> oss.titaniummirror.com Git - repo_shell.git/blobdiff - Makefile
Add version option, derived from repository tags
[repo_shell.git] / Makefile
index b2e6998fc5fc9da221370c8bea799fddd51340df..dc3b5f843748e741739279838a459b6c8717e6f5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,24 @@
-repo_shell: repo_shell.c inih/ini.c
+PROGRAM := repo_shell
+# Git derives its version "prefix" from tags
+
+# Add TMI's mkversion to render files xxx.in -> xxx, updating __appVersion__
+# Massage the version coming back because setup.py build to exe only wants
+# versions of the form a.b.c.d.  We'll use this to our advantage to cause
+# setup.py to error if the VERSION is either dirty, or if git, not a tag.
+include mkversion.mk
+#$(warning VERSION $(VERSION))
+INFILES := $(shell ls *.in 2>/dev/null)
+INFILES := $(INFILES:%.in=%)
+#$(warning INFILES $(INFILES))
+
+repo_shell: repo_shell.c inih/ini.c version.c
        $(CC) -I inih $^ -o $@
+
+$(INFILES):%: %.in
+       @sed -e 's|__appVersion__|$(VERSION)|g' < $^ > $@-tmp
+       @diff -q $@-tmp $@ >/dev/null 2>&1 && rm -f $@-tmp || mv $@-tmp $@
+
+clean:
+       @rm -rf $(PROGRAM) $(INFILES)
+
+.PHONY: all clean $(INFILES)