Generate patch level using git describe

Generate the patch level using `git describe` rather than relying on the
CVS $Revision$.  Need to use the `--tags` option, since currently there
are no annotated tags.  The `--long` option should be used so that the
output will always be in the 'tag-commits-hash' format rather than just
naming a tag when that would fully describe the current commit.

Since changes to the patchlevel could now be caused by changes to any
file, force the rule to be called every time that `make` is run.  Only
update the file when there are actually changes to prevent unnecessary
rebuilding of other build products (currently just `params.o` and
`zsh`).
This commit is contained in:
Aaron Schrab 2013-02-18 10:35:07 -05:00 committed by Frank Terbeck
parent b6f704a642
commit 07478c6bc3

View file

@ -39,10 +39,10 @@ params.o: patchlevel.h
version.h: $(sdir_top)/Config/version.mk zshcurses.h zshterm.h
echo '#define ZSH_VERSION "'$(VERSION)'"' > $@
patchlevel.h: $(sdir_top)/ChangeLog
sed -ne \
's/^\* *\$$''Revision: \(.*\) ''\$$/#define ZSH_PATCHLEVEL "\1"/p' \
$(sdir_top)/ChangeLog >patchlevel.h
patchlevel.h: FORCE
echo '#define ZSH_PATCHLEVEL "'`git describe --tags --long`'"' > $@.tmp
cmp $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@
FORCE:
zshcurses.h: ../config.h
@if test x$(ZSH_CURSES_H) != x; then \