From: Nick Bowler Date: Sat, 22 Nov 2014 17:11:56 +0000 (-0500) Subject: fix-gnulib: Fix order-only hack with FreeBSD make. X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/commitdiff_plain/75b1f18590fbb0893dd2b0632278681c3121d886 fix-gnulib: Fix order-only hack with FreeBSD make. 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. --- diff --git a/scripts/fix-gnulib.pl b/scripts/fix-gnulib.pl index 1f15078..b60bced 100755 --- a/scripts/fix-gnulib.pl +++ b/scripts/fix-gnulib.pl @@ -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)