[U-Boot] [PATCH] Makefile : fix generation of cpu related asm-offsets.h
Stefano Babic
sbabic at denx.de
Wed Aug 17 12:12:14 CEST 2011
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 at 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
More information about the U-Boot
mailing list