Skip to contentSkip to conversation

Fix variable flavor in examples/standalone/Makefile

PATCH New Che-liang Chiou 2 participants 7 messages Feb 22, 2011 – May 13, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix variable flavor in examples/standalone/Makefile

GNU Makefile have two flavors of variables, recursively expanded that is defined by using '=', and simply expanded that is defined by using ':='.

The bug is caused by using recursively expanded flavor for BIN and SREC. As you can see below, they are prepended by $(obj) twice.

We can reproduce this bug with a simplified version of this Makefile:

$ cat > Makefile <<EOF
obj := /path/to/obj/
ELF := hello_world

BIN_rec = $(addsuffix .bin,$(ELF)) # recursively expanded
BIN_sim := $(addsuffix .bin,$(ELF)) # simply expanded

ELF := $(addprefix $(obj),$(ELF))
BIN_rec := $(addprefix $(obj),$(BIN_rec))
BIN_sim := $(addprefix $(obj),$(BIN_sim))

show:

    @echo BIN_rec=$(BIN_rec)
    @echo BIN_sim=$(BIN_sim)

.PHONY: show
EOF

$ make show
BIN_rec=/path/to/obj//path/to/obj/hello_world.bin
BIN_sim=/path/to/obj/hello_world.bin

---

 examples/standalone/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
examples/standalone/Makefile +2 -2
index c1dfdce..6fd9f5d 100644
@@ -45,8 +45,8 @@ ELF-oxc                          += eepro100_eeprom
 #
 ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)))
 
-SREC = $(addsuffix .srec,$(ELF))
-BIN  = $(addsuffix .bin,$(ELF))
+SREC := $(addsuffix .srec,$(ELF))
+BIN  := $(addsuffix .bin,$(ELF))
 
 COBJS  := $(ELF:=.o)
 
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/1 Fix variable flavor in examples/standalone/Makefile

Dear Che-liang Chiou,

Quoted 4 lines · In message <[email protected]> you…

GNU Makefile have two flavors of variables, recursively expanded that is defined by using '=', and simply expanded that is defined by using ':='.

The bug is caused by using recursively expanded flavor for BIN and SREC.

You wrote "The bug". How does this bug manifest in U-Boot? For which configuration do you see issues?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Anyone attempting to generate random numbers by deterministic  means
is, of course, living in a state of sin."          - John Von Neumann
#2 lore raw

PATCH 1/1 Fix variable flavor in examples/standalone/Makefile

Dear Wolfgang Denk,

Quoted 4 lines · Wolfgang Denk
Quoted 1 line · In message <[email protected]> you…

The bug is caused by using recursively expanded flavor for BIN and SREC.

You wrote "The bug". ?How does this bug manifest in U-Boot? ?For which configuration do you see issues?

The bug I refer to is that hello_world.bin and hello_world.srec are not built.

I can reproduce this bug in versatile_config, but I believe it is generally applicable to other configures as well since it is caused by Makefile syntax.

Here is how I found the bug:
------------------------------------------------------------

$ make O=/tmp/build distclean
$ make O=/tmp/build versatile_config
$ make O=/tmp/build -j8
$ ls /tmp/build/examples/standalone/
hello_world  hello_world.o  libstubs.o  smc91111_eeprom
smc91111_eeprom.o  stubs.o
------------------------------------------------------------
Notice that hello_world.bin and hello_world.srec are not found.

Regards,
Che-Liang

#3 lore raw

PATCH 1/1 Fix variable flavor in examples/standalone/Makefile

Dear Che-liang Chiou,

Quoted 15 lines · In message <[email protected]> you…
Quoted 4 lines · Wolfgang Denk
Quoted 1 line · In message <[email protected]>>…

The bug is caused by using recursively expanded flavor for BIN and SREC.

You wrote "The bug". How does this bug manifest in U-Boot? For which configuration do you see issues?

The bug I refer to is that hello_world.bin and hello_world.srec are not built.

I can reproduce this bug in versatile_config, but I believe it is generally applicable to other configures as well since it is caused by Makefile syntax.

Here is how I found the bug:
------------------------------------------------------------

Quoted 8 lines
$ make O=/tmp/build distclean
$ make O=/tmp/build versatile_config
$ make O=/tmp/build -j8
$ ls /tmp/build/examples/standalone/
hello_world  hello_world.o  libstubs.o  smc91111_eeprom
smc91111_eeprom.o  stubs.o
------------------------------------------------------------
Notice that hello_world.bin and hello_world.srec are not found.

Hm... which U-Boot version are you referring to? Because for some time "versatile" is broken and does not build at all...

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
One possible reason that things aren't going  according  to  plan  is
that there never was a plan in the first place.
#4 lore raw

PATCH 1/1 Fix variable flavor in examples/standalone/Makefile

Dear Wolfgang Denk,

I checked out the master of the git repo of that time (Feb 22?).

Regards,
Che-Liang

Quoted 41 lines · Wolfgang Denk

Dear Che-liang Chiou,

Quoted 15 lines · In message <[email protected]> you…
Quoted 4 lines · Wolfgang Denk
Quoted 1 line · In message <[email protected]>>…

The bug is caused by using recursively expanded flavor for BIN and SREC.

You wrote "The bug". How does this bug manifest in U-Boot? For which configuration do you see issues?

The bug I refer to is that hello_world.bin and hello_world.srec are not built.

I can reproduce this bug in versatile_config, but I believe it is generally applicable to other configures as well since it is caused by Makefile syntax.

Here is how I found the bug:
------------------------------------------------------------

Quoted 8 lines
$ make O=/tmp/build distclean
$ make O=/tmp/build versatile_config
$ make O=/tmp/build -j8
$ ls /tmp/build/examples/standalone/
hello_world ?hello_world.o ?libstubs.o ?smc91111_eeprom
smc91111_eeprom.o ?stubs.o
------------------------------------------------------------
Notice that hello_world.bin and hello_world.srec are not found.

Hm... which U-Boot version are you referring to? ?Because for some time "versatile" is broken and does not build at all...

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de One possible reason that things aren't going ?according ?to ?plan ?is that there never was a plan in the first place.

#5 lore raw

PATCH 1/1 Fix variable flavor in examples/standalone/Makefile

In reply to Che-liang Chiou

Dear Che-liang Chiou,

Quoted 28 lines · In message <[email protected]> you…

GNU Makefile have two flavors of variables, recursively expanded that is defined by using '=', and simply expanded that is defined by using ':='.

The bug is caused by using recursively expanded flavor for BIN and SREC. As you can see below, they are prepended by $(obj) twice.

We can reproduce this bug with a simplified version of this Makefile:

$ cat > Makefile <<EOF
obj := /path/to/obj/
ELF := hello_world

BIN_rec = $(addsuffix .bin,$(ELF)) # recursively expanded
BIN_sim := $(addsuffix .bin,$(ELF)) # simply expanded

ELF := $(addprefix $(obj),$(ELF))
BIN_rec := $(addprefix $(obj),$(BIN_rec))
BIN_sim := $(addprefix $(obj),$(BIN_sim))

show:

    @echo BIN_rec=$(BIN_rec)
    @echo BIN_sim=$(BIN_sim)

.PHONY: show
EOF

$ make show
BIN_rec=/path/to/obj//path/to/obj/hello_world.bin
BIN_sim=/path/to/obj/hello_world.bin
Quoted 5 lines

---

 examples/standalone/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It all seemed, he thought, to be rather a lot of  trouble  to  go  to
just sharpen a razor blade.  - Terry Pratchett, _The Light Fantastic_
#6 lore raw

PATCH 1/1 Fix variable flavor in examples/standalone/Makefile

Thanks, Wolfgang.

Quoted 50 lines · Wolfgang Denk

Dear Che-liang Chiou,

Quoted 28 lines · In message <[email protected]> you…

GNU Makefile have two flavors of variables, recursively expanded that is defined by using '=', and simply expanded that is defined by using ':='.

The bug is caused by using recursively expanded flavor for BIN and SREC. As you can see below, they are prepended by $(obj) twice.

We can reproduce this bug with a simplified version of this Makefile:

$ cat > Makefile <<EOF
obj := /path/to/obj/
ELF := hello_world

BIN_rec = $(addsuffix .bin,$(ELF)) ? ? ?# recursively expanded BIN_sim := $(addsuffix .bin,$(ELF)) ? ? # simply expanded

ELF := $(addprefix $(obj),$(ELF))
BIN_rec := $(addprefix $(obj),$(BIN_rec))
BIN_sim := $(addprefix $(obj),$(BIN_sim))

show:
? ? @echo BIN_rec=$(BIN_rec)
? ? @echo BIN_sim=$(BIN_sim)

.PHONY: show
EOF

$ make show
BIN_rec=/path/to/obj//path/to/obj/hello_world.bin
BIN_sim=/path/to/obj/hello_world.bin
Quoted 5 lines

---

?examples/standalone/Makefile | ? ?4 ++--
?1 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It all seemed, he thought, to be rather a lot of ?trouble ?to ?go ?to just sharpen a razor blade. ?- Terry Pratchett, _The Light Fantastic_