
On Friday 06 November 2009 10:00:13 Premi, Sanjeev wrote:
From: Premi, Sanjeev
From: Wolfgang Denk
Sanjeev Premi wrote:
The variable ELF contains many leading spaces. This adds a 'fake' source file variable COBJS. It leads to build failure as below:
I read about the bug reports, but I cannot reproduce this on any system I'm running.
Also, why would any white space matter here?
I was surprised too. It is the first time ever I have seen this problem with any Makefile over years.
To debug I tried this:
--- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -42,7 +42,9 @@ ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) SREC = $(addsuffix .srec,$(ELF)) BIN = $(addsuffix .bin,$(ELF))
COBJS := $(ELF:=.o) +$(error *** COBJS evaluates to [$(COBJS)])
LIB = $(obj)libstubs.a
And the result is:
premi # make Makefile:47: *** *** COBJS evaluates to [hello_world.o smc911x_eeprom.o .o]. Stop.
Notice the "empty" .o in the output. This prompted me to use $(strip ...)
Just after pressing this "ENTER", I tried the following: [Moved $(ELF-y) to end of the assignment and kill trailing spaces]
-ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) +ELF := $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) $(ELF-y)
And it worked! The message for COBJS shows:
Makefile:47: *** *** COBJS evaluates to [ hello_world.o smc911x_eeprom.o]. Stop.
So, maybe "make v3.80" has problems with trailing spaces.
For the fix, I can resubmit with the change shown above OR we could keep the original. Let me know your thoughts.
i kind of prefer this method. if we go with the first method, it needs to have a comment there explaining why the strip exists: # we need the strip to workaround a bug in make-3.80 and whitespace/:= -mike