From: Henri M. <hen...@gm...> - 2020-06-30 23:03:53
|
Currently building the development version requires git to be installed to fetch the `last modified' date from the commit information. This is okay when building from a git clone, but fails when downloading a snapshot that does not contain the .git directory. To this end, I implemented a fallback which just uses the current date if git is not available. The old version had the advantage that `timestamp.h' would only be rebuilt when changing the git branch. If git is not available, this logic fails of course. Instead I made `timestamp.h' a phony target, i.e. it will be rebuilt unconditionally every time. The disadvantage here is that this will also trigger a rebuild of every file that depends on `timestamp.h' but as far as I can see this is only `version.c'. --- src/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 1b0d8136e..7eca23cfa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -107,12 +107,12 @@ endif DISTCLEANFILES = timestamp.h BUILT_SOURCES = timestamp.h -git_current := $(shell cut -c6- $(top_srcdir)/.git/HEAD) -timestamp.h: $(top_srcdir)/.git/${git_current} Makefile +.PHONY: timestamp.h +timestamp.h: Makefile @echo Making $@ @echo "#ifndef GNUPLOT_TIMEBASE_H_INCLUDED" >$@t @echo "#define GNUPLOT_TIMEBASE_H_INCLUDED" >>$@t - @echo "const char gnuplot_date[] = \"`git --git-dir '$(top_srcdir)/.git' log -1 --format=%ci | cut -b-11`\";" >>$@t + @echo "const char gnuplot_date[] = \"`git --git-dir '$(top_srcdir)/.git' log -1 --format=%cs || date +'%Y-%m-%d'`\";" >>$@t @echo "#endif /* GNUPLOT_TIMEBASE_H_INCLUDED */" >> $@t @if cmp -s $@ $@t; then rm -f $@t; else mv $@t $@; fi -- 2.27.0 |