Makefile : fix generation of cpu related asm-offsets.h
authorStefano Babic <sbabic@denx.de>
Mon, 5 Sep 2011 04:32:28 +0000 (04:32 +0000)
committerWolfgang Denk <wd@denx.de>
Wed, 7 Sep 2011 19:41:27 +0000 (21:41 +0200)
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>
CC: Matthias Weisser <weisserm@arcor.de>
CC: Wolfgang Denk <wd@denx.de>
13 files changed:
Makefile
arch/arm/cpu/arm1136/mx35/Makefile
arch/arm/cpu/arm926ejs/mb86r0x/Makefile
arch/arm/cpu/arm926ejs/mx25/Makefile
arch/arm/cpu/arm926ejs/mx27/Makefile
arch/arm/cpu/armv7/mx5/Makefile
arch/arm/cpu/armv7/mx5/lowlevel_init.S
arch/arm/include/asm/arch-mx25/macro.h
board/freescale/mx35pdk/lowlevel_init.S
board/logicpd/imx27lite/lowlevel_init.S
board/syteco/jadecpu/lowlevel_init.S
board/syteco/zmx25/lowlevel_init.S
rules.mk

index d5a1f0ac2dcdbc1b788f263dfd17ec0a84566647..ee05fb330a5c2077a068191908208f84557f0863 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -464,7 +464,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/generated/asm-offsets.h
                for dir in $(SUBDIRS) $(CPUDIR) $(dir $(LDSCRIPT)) ; do \
                        $(MAKE) -C $$dir _depend ; done
 
@@ -527,6 +528,21 @@ $(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/generated/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
+       @mkdir -p $(obj)$(CPUDIR)/$(SOC)
+       if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
+               $(CC) -DDO_DEPS_ONLY \
+               $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
+                       -o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
+       else \
+               touch $@; \
+       fi
+
 #########################################################################
 else   # !config.mk
 all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
@@ -939,6 +955,8 @@ clean:
               $(obj)arch/blackfin/cpu/init.{lds,elf}
        @rm -f $(obj)include/bmp_logo.h
        @rm -f $(obj)lib/asm-offsets.s
+       @rm -f $(obj)include/generated/asm-offsets.h
+       @rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
        @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
        @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
        @rm -f $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin}
index 284cdc50d175cae7d7234afc4e45a49729125a71..469397ca43058db2a2371393e92f70df9244e2dc 100644 (file)
@@ -39,8 +39,6 @@ all:  $(obj).depend $(LIB)
 $(LIB):        $(OBJS)
        $(call cmd_link_o_target, $(OBJS))
 
-$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h
-
 
 #########################################################################
 
index 974d0be0bc2b97b4d3f83b15303bebe87fa8e5d4..bab048bfd5f0b6cc66d94bf9b3001c15fc9158d8 100644 (file)
@@ -37,8 +37,6 @@ all:  $(obj).depend $(LIB)
 $(LIB):        $(OBJS)
        $(call cmd_link_o_target, $(OBJS))
 
-$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h
-
 #########################################################################
 
 # defines $(obj).depend target
index 9219c062b01f285aa798149aec8f047f04245236..3c2a65ed79e9949c7f6d0bc586222288b0929324 100644 (file)
@@ -34,8 +34,6 @@ all:  $(obj).depend $(LIB)
 $(LIB):        $(OBJS)
        $(call cmd_link_o_target, $(OBJS))
 
-$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h
-
 #########################################################################
 
 # defines $(obj).depend target
index 7ac1a214065626c9fd8857f686eafca20f819e4d..0e112b34f4d7a49b173a84662dc729165bffcd93 100644 (file)
@@ -34,8 +34,6 @@ all:  $(obj).depend $(LIB)
 $(LIB):        $(OBJS)
        $(call cmd_link_o_target, $(OBJS))
 
-$(OBJS) : $(TOPDIR)/include/asm/arch/asm-offsets.h
-
 #########################################################################
 
 # defines $(obj).depend target
index 6e13cc3e84c3642c296f844abba59f5e4e53c0dc..e8be9c9fabfa926de0f0ab30e3d8201005fad635 100644 (file)
@@ -45,6 +45,4 @@ include $(SRCTREE)/rules.mk
 
 sinclude $(obj).depend
 
-lowlevel_init.o : $(TOPDIR)/include/asm/arch/asm-offsets.h
-
 #########################################################################
index 6c66b42619901417b099c6052ec05e9f7a09e3b3..7e37221e03aafd20ace15f2df47e92771b31b81f 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <config.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/asm-offsets.h>
+#include <generated/asm-offsets.h>
 
 /*
  * L2CC Cache setup/invalidation/disable
index 276c71ccd67637e6cdfe5c312c123c6267d57d76..3b694daa19ae710c439afe9cd27be06d5b4abbd2 100644 (file)
@@ -31,7 +31,7 @@
 #ifdef __ASSEMBLY__
 
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/asm-offsets.h>
+#include <generated/asm-offsets.h>
 
 .macro init_aips
        write32 IMX_AIPS1_BASE + AIPS_MPR_0_7, 0x77777777
index 9fd04cbdb881e8a02a8b5e5ce4bca27521b3f24c..698c4cf0c511e7bf507a8f62549ca3de3a3703af 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <config.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/asm-offsets.h>
+#include <generated/asm-offsets.h>
 #include "mx35pdk.h"
 
 /*
index e2cdecb96bc8da67415f88de214ba102e3f0b760..873634f1da56d69433c8d7fcdf34c51d3d463b69 100644 (file)
@@ -26,7 +26,7 @@
 #include <version.h>
 #include <asm/macro.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/asm-offsets.h>
+#include <generated/asm-offsets.h>
 
 SOC_ESDCTL_BASE_W:     .word   IMX_ESD_BASE
 SOC_SI_ID_REG_W:       .word   IMX_SYSTEM_CTL_BASE
index 5ad4dceb92414659e1ffe828f74ae3b5655c340d..b01f087895b7b7c92525ac2d8240ff68868f3fc6 100644 (file)
@@ -30,7 +30,7 @@
 #include <version.h>
 #include <asm/macro.h>
 #include <asm/arch/mb86r0x.h>
-#include <asm/arch/asm-offsets.h>
+#include <generated/asm-offsets.h>
 
 /* Set up the platform, once the cpu has been initialized */
 .globl lowlevel_init
index 8e63de0a2d82b9dd5efc922286d9f079646d5964..1002674ca106aed77f7347c8226f3974eb3e02bd 100644 (file)
@@ -27,7 +27,7 @@
 #include <asm/macro.h>
 #include <asm/arch/macro.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch/asm-offsets.h>
+#include <generated/asm-offsets.h>
 
 /*
  * clocks
index a6bae626796fe0c59dba53867c0bbf33dfac0ac0..d79fcd3aa2ae799f92246e34a9dfe6038b242aea 100644 (file)
--- 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
 #########################################################################