Borrowing slightly from git.git, derive a VERSION-FILE from the current state of user's git working directory. The VERSION is derived relative to the latest git annotated tag object (using git-describe) and includable either in shell scripts or in Makefiles. The basic 'make dist' target generates a .tar.gz and a .zip file named by the detected version. Also include a basic clean target and dummy test target. Signed-off-by: Emil Sit <sit@emilsit.net>
34 lines
694 B
Makefile
34 lines
694 B
Makefile
#
|
|
# Makefile for todo.txt
|
|
#
|
|
|
|
# Dynamically detect/generate version file as necessary
|
|
# This file will define a variable called VERSION.
|
|
.PHONY: .FORCE-VERSION-FILE
|
|
VERSION-FILE: .FORCE-VERSION-FILE
|
|
@./GEN-VERSION-FILE
|
|
-include VERSION-FILE
|
|
|
|
# Maybe this will include the version in it.
|
|
todo.sh: VERSION-FILE
|
|
|
|
# For packaging
|
|
DISTFILES := README todo.cfg todo.sh
|
|
|
|
DISTNAME=todo.sh-$(VERSION)
|
|
dist: $(DISTFILES) todo.sh
|
|
mkdir -p $(DISTNAME)
|
|
cp -f $(DISTFILES) $(DISTNAME)/
|
|
tar cf $(DISTNAME).tar $(DISTNAME)/
|
|
gzip -f -9 $(DISTNAME).tar
|
|
zip -9r $(DISTNAME).zip $(DISTNAME)/
|
|
rm -r $(DISTNAME)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(DISTNAME).tar.gz $(DISTNAME).zip
|
|
|
|
.PHONY: test
|
|
test:
|
|
@echo "TBD!"
|