Merge branch 'minimize-rebuild' of git://git.code.sf.net/u/bsomervi/hamlib

pull/425/head
Michael Black W9MDB 2020-10-17 17:15:07 -05:00
commit d066243a00
1 zmienionych plików z 23 dodań i 12 usunięć

Wyświetl plik

@ -4,7 +4,7 @@
# AUTOMAKE_OPTIONS = dejagnu
# DEJATOOL = testfreq testbcd testloc rigctl
BUILT_SOURCES = hamlibdatetime.h
BUILT_SOURCES = $(builddir)/hamlibdatetime.h
DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum hamlibdatetime.h
@ -28,7 +28,7 @@ rigsmtr_SOURCES = rigsmtr.c
rigmem_SOURCES = rigmem.c memsave.c memload.c memcsv.c sprintflst.c sprintflst.h
# include generated include files ahead of any in sources
rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_srcdir) $(AM_CPPFLAGS)
rigctl_CPPFLAGS = -I$(builddir)/tests -I$(srcdir) $(AM_CPPFLAGS)
# all the programs need this
LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la $(DL_LIBS)
@ -98,17 +98,28 @@ testloc.sh:
echo './testloc EM79UT96LW 5' > testloc.sh
chmod +x ./testloc.sh
# If we have a .git directory then we will generate the hamlibdate.h
# file. If not, then copy the placeholder. Either way copy the result
# to the build directory for inclusion in compiles, which avoids race
# conditions with parallel builds.
# If we have a .git directory then we will generate the hamlibdate.h
# file and replace it if it is different. Fall back to a copy of a
# generic hamlibdatetime.h.in in the source tree. Build looks in build
# directory before the source directory for the hamlibdatetime.h
# header.
hamlibdatetime.h: FORCE
echo "SHA=$(SHA)"
test ! -x $(top_srcdir)/.git || echo "/* This date time is from the last non-merge commit to Hamlib. */" > $(top_srcdir)/tests/hamlibdatetime.h
test ! -x $(top_srcdir)/.git || echo "#define HAMLIBDATETIME "\"$$(TZ=UTC git --git-dir=$(top_srcdir)/.git log --no-merges --date='format-local:%a %b %d %H:%M:%S %Y %z SHA=' --format='%cd' -n 1)$$(git --git-dir=$(top_srcdir)/.git log --no-merges | grep commit | head -n 1 | cut -c8-13)\" >> $(top_srcdir)/tests/hamlibdatetime.h
test -f $(top_srcdir)/tests/hamlibdatetime.h || cp $(top_srcdir)/tests/hamlibdatetime.h.in $(top_srcdir)/tests/hamlibdatetime.h
test $(top_srcdir) == $(top_builddir) || cp $(top_srcdir)/tests/hamlibdatetime.h $(top_builddir)/tests/;
@if test -x $(top_srcdir)/.git ; then \
echo "/* This date time is from the last non-merge commit to Hamlib. */" > $(builddir)/$(@F).tmp ;\
echo "#define HAMLIBDATETIME "\"$$(TZ=UTC git --git-dir=$(top_srcdir)/.git log --no-merges --date='format-local:%a %b %d %H:%M:%S %Y %z SHA=' --format='%cd' -n 1)$$(git --git-dir=$(top_srcdir)/.git log --no-merges | grep commit | head -n 1 | cut -c8-13)\" >> $(builddir)/$(@F).tmp ;\
diff -qN $(builddir)/$(@F).tmp $(builddir)/$(@F) ; test $$? -eq 0 || { echo "Generating SCS header \"$(builddir)/$(@F)\"" ; mv -f $(builddir)/$(@F).tmp $(builddir)/$(@F) ; } ;\
rm -f $(builddir)/$(@F).tmp ;\
else \
test -f $(srcdir)/$(@F) || cp $(srcdir)/$(@F).in $(srcdir)/$(@F) ;\
fi
FORCE: ;
FORCE:
# If we are making a distribution out-of-source and we have generated
# a hamlibdatetime.h; then copy it to the tests directory of the
# source tarball so that downstream builds pick up the version
# information we know about.
dist-hook:
test ./ -ef $(srcdir)/ || test ! -f hamlibdatetime.h || cp -f hamlibdatetime.h $(srcdir)/
CLEANFILES = testrig.sh testfreq.sh testbcd.sh testloc.sh