[LLVMdev] Setting TARGET_LLCFLAGS in the environment
bob.wilson at apple.com
Tue Jan 12 10:21:25 PST 2010
On Jan 11, 2010, at 3:50 PM, Jakob Stoklund Olesen wrote:
> Weird issue beyond my make-fu:
> When running the test-suite, this works fine:
> make TARGET_LLCFLAGS='-mcpu=cortex-a8 -mattr=+thumb2' TEST=nightly report
> But this fails:
> export TARGET_LLCFLAGS='-mcpu=cortex-a8 -mattr=+thumb2'
> make TEST=nightly report
> It looks like the following line from Makefile.rules is executed multiple times:
> TARGET_LLCFLAGS += -relocation-model=pic -disable-fp-elim
> This causes llc to complain about the -relocation-model and -disable-fp-elim options being given multiple times. (Sometime they are repeated three or four times).
> Clearly there is some make magic I don't understand here. Does anyone know what is going on?
The variables set on the command-line to make are passed along to recursive makes via $(MAKEFLAGS). If you set TARGET_LLCFLAGS on the command-line, every recursive invocation is going to get that same value and will add "-relocation-model=pic -disable-fp-elim" only once. But, if you don't set it on the command-line, make will pick up the value from the environment and add those extra options to whatever it finds. I bet it is then updating the environment value, so that a child make process will see the value that already has the extra options. If that child make also includes Makefile.rules, it will then add another copy of the extra options. Each level of recursive make will keep adding another copy. (The way that make interacts with the environment is confusing, so I'm not 100% sure this is what's happening but it matches the symptoms you are seeing.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev