]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Fix variable flavor in examples/standalone/Makefile
authorChe-liang Chiou <clchiou@chromium.org>
Mon, 21 Feb 2011 21:07:00 +0000 (21:07 +0000)
committerWolfgang Denk <wd@denx.de>
Thu, 12 May 2011 20:25:16 +0000 (22:25 +0200)
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

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
examples/standalone/Makefile

index 66b5d24f032b812fac4ac65a080277ab47cd385b..b1e33fba73d084b03f41da6c1c68dd6fd60a191c 100644 (file)
@@ -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)