]> git.draconx.ca Git - dxcommon.git/commitdiff
fix-gnulib: Fix order-only hack with FreeBSD make.
authorNick Bowler <nbowler@draconx.ca>
Sat, 22 Nov 2014 17:11:56 +0000 (12:11 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sun, 19 Apr 2015 18:49:06 +0000 (14:49 -0400)
FreeBSD make does not work well when undefined variables are used in
nested expansions.  When such an expansion appears in the prerequisites
of a target, FreeBSD make exits with a fatal error.  For example:

  A = $(var$(B))
  foo : $(A)

  % make
  Error expanding embedded variable.

This causes the order-only hack to fail because FreeBSD make does not
define .FEATURES.  The workaround is simple: add another variable which
is assigned the value of .FEATURES.  That variable can be used in the
nested expansion to avoid the error.

scripts/fix-gnulib.pl

index 1f15078b7ceb593286762f0781a206a033430b5d..b60bced3cff01584df207d4190fe3221102134c5 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env perl
 #
-# Copyright © 2011-2012 Nick Bowler
+# Copyright © 2011-2014 Nick Bowler
 #
 # Prepare the Gnulib tree for inclusion into a non-recursive automake build.
 # While the output of gnulib-tool is "include"-able if the --makefile-name
@@ -139,7 +139,8 @@ m4_unquote(m4_argn([2], [
 .PHONY: # Automake code follows
 
 # This trick should define gnulib_orderonly to | iff we're using GNU make.
-gnulib_have_orderonly = $(findstring order-only,$(.FEATURES))
+gnulib_make_features = $(.FEATURES)
+gnulib_have_orderonly = $(findstring order-only,$(gnulib_make_features))
 gnulib_orderonly = $(gnulib_have_orderonly:order-only=|)
 gnulib_core_headers =
 gnulib_raw_headers = $(gnulib_core_headers)