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.
#!/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
.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)