From 1f5c26102e228420fd954af1d73d3a89fc700d9d Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 15 Apr 2016 12:30:01 +0200 Subject: [PATCH] Fix generation of version_git.h for some versions of BSD make. In order to support VPATH builds, we have to use ${srcdir}/version.c as the target for the rule that depends on the generation of version_git.h. When not doing a VPATH build, ${srcdir} expands to ".", so the target will be "./version.c". However, on some BSDs, make does not understand that "./version.c" is the same as "version.c", and therefore it doesn't trigger generating version_git.h when trying to build version.o. (It works fine if you do a VPATH build, and OpenBSD's make does the right thing in all cases.) The trick is to have version.c depend on ${srcdir}/version.c. Of course, Linux's make knows this is nonsense and will complain about a circular dependency, so add this rule only on BSD platforms. --- src/Makefile.am | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index ef7c08d..f54b476 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,11 @@ version_git.h: version-stamp @-(cd $(srcdir) && git describe 2>/dev/null >/dev/null) && echo '#define GIT_DESCRIPTION "'`(cd $(srcdir) && git describe) | sed 's/release-//'`'"' >$@ ||: ${srcdir}/version.c: version_git.h +## Now a hack to appease some versions of BSD make that don't understand that "./foo" is the same as "foo". +if BSD +version.c: ${srcdir}/version.c +endif + if LINUX sbin_PROGRAMS += sptps_speed endif -- 2.25.1