public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Makefile : fix generation of cpu related asm-offsets.h
@ 2011-08-17 10:12 Stefano Babic
  2011-08-17 13:02 ` Matthias Weißer
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Stefano Babic @ 2011-08-17 10:12 UTC (permalink / raw)
  To: u-boot

commit 0edf8b5b2fa0d210ebc4d6da0fd1aceeb7e44e47 breaks
building on a different directory with the O= parameter.
The patch wil fix this issue, generating always asm-offsets.h before
the other targets.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---

Note: the patch fixes the issue, however I generate an empty asm-offsets.c
for boards that do not have one. Is there a better way to reach the goal ?

 Makefile |   19 ++++++++++++++++++-
 rules.mk |   10 ----------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index f8ae883..10b2498 100644
--- a/Makefile
+++ b/Makefile
@@ -460,7 +460,8 @@ updater:
 # parallel sub-makes creating .depend files simultaneously.
 depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
 		$(obj)include/autoconf.mk \
-		$(obj)include/generated/generic-asm-offsets.h
+		$(obj)include/generated/generic-asm-offsets.h \
+		$(obj)include/asm/arch/asm-offsets.h
 		for dir in $(SUBDIRS) $(CPUDIR) $(dir $(LDSCRIPT)) ; do \
 			$(MAKE) -C $$dir _depend ; done
 
@@ -519,6 +520,22 @@ $(obj)lib/asm-offsets.s:	$(obj)include/autoconf.mk.dep \
 		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
 		-o $@ $(src)lib/asm-offsets.c -c -S
 
+$(obj)include/asm/arch/asm-offsets.h:	$(obj)include/autoconf.mk.dep \
+	$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
+	@echo Generating $@
+	tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
+
+$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s:	$(obj)include/autoconf.mk.dep check_cpu_asm_offsets
+	@mkdir -p $(obj)$(CPUDIR)/$(SOC)
+	$(CC) -DDO_DEPS_ONLY \
+		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
+		-o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S
+
+#	$(src)$(CPUDIR)/$(SOC)/asm-offsets.c
+check_cpu_asm_offsets:
+	if [ ! -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
+        touch $(src)$(CPUDIR)/$(SOC)/asm-offsets.c;fi
+
 #########################################################################
 else	# !config.mk
 all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
diff --git a/rules.mk b/rules.mk
index 5fd12a0..c2860e5 100644
--- a/rules.mk
+++ b/rules.mk
@@ -42,14 +42,4 @@ $(HOSTOBJS): $(obj)%.o: %.c
 $(NOPEDOBJS): $(obj)%.o: %.c
 	$(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c
 
-$(TOPDIR)/include/asm/arch/asm-offsets.h:	$(TOPDIR)/include/autoconf.mk.dep \
-	$(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.s
-	@echo Generating $@
-	$(TOPDIR)/tools/scripts/make-asm-offsets $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.s $@
-
-$(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.s:	$(TOPDIR)/include/autoconf.mk.dep \
-	$(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c
-	$(CC) -DDO_DEPS_ONLY \
-		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
-		-o $@ $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c -c -S
 #########################################################################
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-09-07 19:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17 10:12 [U-Boot] [PATCH] Makefile : fix generation of cpu related asm-offsets.h Stefano Babic
2011-08-17 13:02 ` Matthias Weißer
2011-08-17 13:15   ` Stefano Babic
2011-08-30 13:13 ` [U-Boot] [PATCH V2] " Stefano Babic
2011-08-30 17:49 ` [U-Boot] [PATCH V3] " Stefano Babic
2011-09-05 13:44   ` Wolfgang Denk
2011-09-05 13:52     ` Wolfgang Denk
2011-09-05 14:28       ` Stefano Babic
2011-09-05 14:32 ` [U-Boot] [PATCH V4] " Stefano Babic
2011-09-07 19:42   ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox