[Gllug] GNU make expert question: write variable value to a file

Nix nix at esperi.demon.co.uk
Tue Mar 11 21:17:33 UTC 2003


On Sat, 1 Mar 2003, rich at annexia.org stated:
> This is a tricky GNU make question.
> 
> How do I write the value of a makefile variable to a named file?
> 
> The variable has been defined with:
> 
> define foo
> ...
> ...
> endef
> 
> So it may contain newlines, quotes, etc. and I want those exactly
> preserved in the output of course. I want variables references to
> be expanded.

OK; your shell trick below seems the best method to use (except that
you meant $(foo), of course).

> #!/bin/sh
> cat <<EOF
> $foo
> EOF
> 
> This does work but isn't acceptable because the variable in question
> is very large, and so overflows the environment for this and every
> other process that the Makefile runs.
> 
> Ideas???

Use `unexport'; there's no need to pass big variables down at all.

(Somewhere, I have a patch that flips the default to do-not-export;
I needed it to build GCC-3.x on the notoriously-short-of-env-space-
and-command-line HP-UX 10.20...)

-- 
#ifdef USE_ISPTS_FLAG
		} else {	/* else pty, not pts */
#endif

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list