|
From: | address@hidden |
Subject: | Re: multiple assignments on one line? |
Date: | Thu, 18 Jan 2007 19:45:55 GMT |
Help
> I'm using a $(shell ...)-ed command to generate some variable
> assignments. I want to have these assignments evaluated by a Makefile.
> Unfortunately $(shell ...) is stripping out the newlines and
> making the multiple assignments - one per line - into one single
> assignment with a very long right-hand side.
I have done something similar by replacing the spaces with an unused character and then substituting back the space. I am retyping the my lines from memory, so I may not have the correct syntax but it should give you the idea.
In the Makefile
empty:=
space:=${empty} ${empty}
# empty has a newline after the = character and there is a single space between the two empty macros
$(foreach var $(shell branding_vars),$(eval $(subst @,${space},${var})))
In the shell script branding_vars (simplified version)
echo "OS:=AIX"
echo "address@hidden"
The foreach takes each argument which is a complete Makefile command with no spaces and replaces the @ character with a space and then executes the var argument.
Norman Abramovitz
[Prev in Thread] | Current Thread | [Next in Thread] |