[U-Boot-Users] [PATCH] Fix/workaround broken dependency handling with make 3.81

Haavard Skinnemoen hskinnemoen at atmel.com
Tue Aug 29 11:20:39 CEST 2006


On Mon, 28 Aug 2006 23:15:32 +0200
Wolfgang Denk <wd at denx.de> wrote:

> In message
> <1defaf580608281323n6ff6a04fh9369b68264374c1c at mail.gmail.com> you
> wrote:
> >
> > Anyway, I can make a new patch that assign the ELF, SREC and BIN
> > explicitly. Would that be acceptable?
> 
> You're trying to tenderize me, aren't you? ;-) Yes, probably I'd give
> in.

No, I'm trying to solve a problem. You said you were having a problem
with that particular aspect of the patch, so I'm offering to fix it.

The real problem I'm trying to fix is that make 3.81 fails to build
u-boot. I don't know whether that is caused by a bug in make or a bug
in the Makefile, but I think my patch has merit either way, as catch-all
rules may do unexpected things with earlier versions of make as well.

Updated patch below. I messed up the blackfin case in the previous
patch, so that has been fixed. I've also added $(ELF) to the list of
prerequisites for "all", as it was previously part of $(BIN).

> > When executing make, this is what happens (same result with make
> > 3.80 and 3.81):
> 
> Yes, and IMHO you can easily show more problems with make. To me it's
> really frightening to see so many issues with a tool in so  wide  use
> like GNU make.

IMHO many of the problems with GNU make are caused by the built-in
rules. That's probably part of the old make legacy, and is not possible
to fix without breaking lots of old Makefiles...

> > I'll send a mail to the make mailinglist tomorrow to see if anyone
> > can give an explanation.

I'll let you know when I receive a reply.

Haavard

From dec97c9028c2fd62d6c39af97ae45ac640fcc2fc Mon Sep 17 00:00:00 2001
From: Haavard Skinnemoen <hskinnemoen at atmel.com>
Date: Mon, 28 Aug 2006 16:17:58 +0200
Subject: [PATCH] Fix/workaround broken dependency handling with make 3.81

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)

Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
---
 examples/Makefile |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/examples/Makefile b/examples/Makefile
index a342d75..5f57761 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -59,45 +59,53 @@ endif
 
 include $(TOPDIR)/config.mk
 
+ELF	= hello_world
 SREC	= hello_world.srec
-BIN	= hello_world.bin hello_world
+BIN	= hello_world.bin
 
 ifeq ($(CPU),mpc8xx)
+ELF	= test_burst
 SREC	= test_burst.srec
-BIN	= test_burst.bin test_burst
+BIN	= test_burst.bin
 endif
 
 ifeq ($(ARCH),i386)
+ELF    += 82559_eeprom
 SREC   += 82559_eeprom.srec
-BIN    += 82559_eeprom.bin 82559_eeprom
+BIN    += 82559_eeprom.bin
 endif
 
 ifeq ($(ARCH),ppc)
+ELF    += sched
 SREC   += sched.srec
-BIN    += sched.bin sched
+BIN    += sched.bin
 endif
 
 ifeq ($(ARCH),blackfin)
+ELF	+= smc91111_eeprom
 SREC	+= smc91111_eeprom.srec
-BIN 	+= smc91111_eeprom.bin smc91111_eeprom
+BIN	+= smc91111_eeprom.bin
 endif
 
 # The following example is pretty 8xx specific...
 ifeq ($(CPU),mpc8xx)
+ELF    += timer
 SREC   += timer.srec
-BIN    += timer.bin timer
+BIN    += timer.bin
 endif
 
 # The following example is 8260 specific...
 ifeq ($(CPU),mpc8260)
+ELF    += mem_to_mem_idma2intr
 SREC   += mem_to_mem_idma2intr.srec
-BIN    += mem_to_mem_idma2intr.bin mem_to_mem_idma2intr
+BIN    += mem_to_mem_idma2intr.bin
 endif
 
 # Utility for resetting i82559 EEPROM
 ifeq ($(BOARD),oxc)
+ELF    += eepro100_eeprom
 SREC   += eepro100_eeprom.srec
-BIN    += eepro100_eeprom.bin eepro100_eeprom
+BIN    += eepro100_eeprom.bin
 endif
 
 ifeq ($(BIG_ENDIAN),y)
@@ -122,20 +130,20 @@ clibdir := $(shell dirname `$(CC) $(CFLA
 
 CPPFLAGS += -I..
 
-all:	.depend $(OBJS) $(LIB) $(SREC) $(BIN)
+all:	.depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
 
 #########################################################################
 $(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