[U-Boot-Users] [PATCH] Fix/workaround broken dependency handling with make 3.81
Haavard Skinnemoen
hskinnemoen at atmel.com
Mon Aug 28 16:22:47 CEST 2006
This patch fixes the following problem:
make[1]: *** No rule to make target `hello_world.srec', needed by `all'.
The problem has been reported several times before, but so far no
patches have been accepted and no one has fixed make. In fact, I can't
even find any relevant bug reports against make.
This patch takes a slightly different approach than the other patches
I've seen on the mailing list, as it lists the targets explicitly
before each of the pattern rules for the elf-, srec- and bin-files.
The dependencies for each target are correctly specified, so we don't
end up depending on the build order (i.e. the ordering of prerequisites
for the `all' rule)
As an added bonus, this gets rid of some duplication as each
architecture, cpu, board, etc. only needs to add stuff to the ELF
variable. The SREC and BIN variables are calculated automatically
from the ELF variable.
Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
---
examples/Makefile | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/examples/Makefile b/examples/Makefile
index a342d75..8814f13 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -59,51 +59,45 @@ endif
include $(TOPDIR)/config.mk
-SREC = hello_world.srec
-BIN = hello_world.bin hello_world
+ELF = hello_world
ifeq ($(CPU),mpc8xx)
-SREC = test_burst.srec
-BIN = test_burst.bin test_burst
+ELF = test_burst
endif
ifeq ($(ARCH),i386)
-SREC += 82559_eeprom.srec
-BIN += 82559_eeprom.bin 82559_eeprom
+ELF += 82559_eeprom
endif
ifeq ($(ARCH),ppc)
-SREC += sched.srec
-BIN += sched.bin sched
+ELF += sched
endif
ifeq ($(ARCH),blackfin)
-SREC += smc91111_eeprom.srec
-BIN += smc91111_eeprom.bin smc91111_eeprom
+ELF += smc91111
endif
# The following example is pretty 8xx specific...
ifeq ($(CPU),mpc8xx)
-SREC += timer.srec
-BIN += timer.bin timer
+ELF += timer
endif
# The following example is 8260 specific...
ifeq ($(CPU),mpc8260)
-SREC += mem_to_mem_idma2intr.srec
-BIN += mem_to_mem_idma2intr.bin mem_to_mem_idma2intr
+ELF += mem_to_mem_idma2intr
endif
# Utility for resetting i82559 EEPROM
ifeq ($(BOARD),oxc)
-SREC += eepro100_eeprom.srec
-BIN += eepro100_eeprom.bin eepro100_eeprom
+ELF += eepro100_eeprom
endif
ifeq ($(BIG_ENDIAN),y)
EX_LDFLAGS += -EB
endif
+SREC = $(addsuffix .srec,$(ELF))
+BIN = $(addsuffix .bin,$(ELF))
OBJS = $(SREC:.srec=.o)
LIB = libstubs.a
@@ -128,14 +122,14 @@ ########################################
$(LIB): .depend $(LIBOBJS)
$(AR) crv $@ $(LIBOBJS)
-%: %.o $(LIB)
+$(ELF): %: %.o $(LIB)
$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
-o $@ -e $(<:.o=) $< $(LIB) \
-L$(gcclibdir) -lgcc
-%.srec: %
+$(SREC): %.srec: %
$(OBJCOPY) -O srec $< $@ 2>/dev/null
-%.bin: %
+$(BIN): %.bin: %
$(OBJCOPY) -O binary $< $@ 2>/dev/null
#########################################################################
--
1.4.1.1
More information about the U-Boot
mailing list