On Sun, Jan 31, 2021 at 10:14:11PM +0000, Gavin Smith wrote:
> Another issue is how to record the results of tests from a a Makefile.
> With autoconf, autoconf variables are recorded with AC_CONFIG_FILES
> and AC_CONFIG_HEADERS. Presumably the same would have to be done,
> substituting in an output file with the values of these variables.
> However, there can be many hundreds of them (just look at a Makefile.in
> file). As far as I can tell, there isn't an easy way to export
> hundreds of Makefile variables to a process. Is there some feature or
> trick I'm missing?
I was mislead by the Make manual talking about communicating with
a sub-make: the .EXPORT_ALL_VARIABLES target appears to export
for any rule (although I didn't get the $(export) directive to work for
this). This could be used by a helper script to do substitution.
The "finish-configure" target in the following outputs "1 2 3":
.EXPORT_ALL_VARIABLES:
set-A:
$(eval A := $(shell echo 1))
set-B:
$(eval B := $(shell echo 2))
set-C:
$(eval C := $(shell echo 3))
finish-configure: set-A set-B set-C
echo $$A $$B $$C