From: Graeme Russ Date: Sun, 28 Aug 2011 23:03:11 +1000 Subject: [U-Boot] [PATCH 1/3] Makefile: Add generic build rules for include/asm/arch/asm-offsets.h In-Reply-To: <1314536593-14310-1-git-send-email-graeme.russ@gmail.com> References: <1314536593-14310-1-git-send-email-graeme.russ@gmail.com> Message-ID: <1314536593-14310-2-git-send-email-graeme.russ@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add three features to the top-level makefile: - Add include/asm/arch/asm-offsets.h as a dependency of the 'depend' target to eliminate 'file does not exist' errors during dependency building - Skip generation of include/asm/arch/asm-offsets.h if the source file ($(CPUDIR)/$(SOC)/asm-offsets.c) does not exist - Add removal of arch specific asm-offsets.s and asm-offsets.h files to the 'clean' target Signed-off-by: Graeme Russ --- Big Fat Note: I have not tested this on ARM which needs to be looked at closely as the SoC files are one level deeper than where sc520 sits under x86 Makefile | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 03d80b7..049b169 100644 --- 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/asm/arch/asm-offsets.h for dir in $(SUBDIRS) $(CPUDIR) $(dir $(LDSCRIPT)) ; do \ $(MAKE) -C $$dir _depend ; done @@ -527,6 +528,23 @@ $(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: $(TOPDIR)/include/autoconf.mk.dep \ + $(if $(wildcard $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c), \ + $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.s,) + @echo Generating $@ + $(if $(wildcard $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c), \ + tools/scripts/make-asm-offsets $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.s $@ \ + , at echo $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c does not exist - skipping) + +$(TOPDIR)$(CPUDIR)/$(SOC)/asm-offsets.s: $(TOPDIR)/include/autoconf.mk.dep \ + $(if $(wildcard $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c), \ + $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c,) + $(if $(wildcard $(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 \ + , at echo $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.c does not exist - skipping) + ######################################################################### else # !config.mk all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \ @@ -1019,7 +1037,9 @@ clean: $(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds \ $(obj)u-boot.lds \ $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ - $(obj)arch/blackfin/cpu/init.{lds,elf} + $(obj)arch/blackfin/cpu/init.{lds,elf} \ + $(TOPDIR)/$(CPUDIR)/$(SOC)/asm-offsets.s \ + $(TOPDIR)/include/asm/arch/asm-offsets.h @rm -f $(obj)include/bmp_logo.h @rm -f $(obj)lib/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} -- 1.7.5.2.317.g391b14