[U-Boot-Users] [PATCH] sh: ms7750se: Fix "make O=" builds

Sakae OTAKI sakae_ohtaki at yokogawa-digital.com
Sat Jul 5 10:18:34 CEST 2008


When compiling ms7750se board with "make O=<some dir>", I got some errors.
I tuned some makefiles.
---
 Makefile                |    1 +
 board/ms7750se/Makefile |   13 ++++++++-----
 cpu/sh4/Makefile        |   16 ++++++++++------
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 8bfc891..8835ba6 100644
--- a/Makefile
+++ b/Makefile
@@ -2922,6 +2922,7 @@ ms7720se_config: unconfig
 ## sh4 (Renesas SuperH)
 #########################################################################
 ms7750se_config: unconfig
+	@mkdir -p $(obj)include
 	@echo "#define CONFIG_MS7750SE 1" > $(obj)include/config.h
 	@$(MKCONFIG) -a $(@:_config=) sh sh4 ms7750se
 
diff --git a/board/ms7750se/Makefile b/board/ms7750se/Makefile
index f81d56c..9350775 100644
--- a/board/ms7750se/Makefile
+++ b/board/ms7750se/Makefile
@@ -19,11 +19,15 @@
 #
 include $(TOPDIR)/config.mk
 
-LIB	= lib$(BOARD).a
+LIB	= $(obj)lib$(BOARD).a
 
-OBJS	:= ms7750se.o
+COBJS	:= ms7750se.o
 SOBJS	:= lowlevel_init.o
 
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
 $(LIB):	$(OBJS) $(SOBJS)
 	$(AR) crv $@ $(OBJS) $(SOBJS)
 
@@ -35,9 +39,8 @@ distclean:	clean
 
 #################################################################
 
-.depend:	Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
-	$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+include $(SRCTREE)/rules.mk
 
--include .depend
+sinclude $(obj).depend
 
 #################################################################
diff --git a/cpu/sh4/Makefile b/cpu/sh4/Makefile
index 1bb8bd7..1353dbb 100644
--- a/cpu/sh4/Makefile
+++ b/cpu/sh4/Makefile
@@ -29,18 +29,22 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(CPU).a
 
 START	= start.o
-OBJS	= cpu.o interrupts.o watchdog.o time.o cache.o
+COBJS	= cpu.o interrupts.o watchdog.o time.o cache.o
 
-all:	.depend $(START) $(LIB)
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
 
 $(LIB):	$(OBJS)
-	$(AR) crv $@ $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
 
 #########################################################################
 
-.depend:	Makefile $(START:.o=.S) $(OBJS:.o=.c)
-		$(CC) -M $(CFLAGS) $(START:.o=.S) $(OBJS:.o=.c) > $@
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
 
-sinclude .depend
+sinclude $(obj).depend
 
 #########################################################################
-- 
1.5.2.5





More information about the U-Boot mailing list