From f93286397ed2a7084efb0362a43ee09f11702349 Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Fri, 1 Sep 2006 19:49:50 +0200 Subject: Add support for a saving build objects in a separate directory. Modifications are based on the linux kernel approach and support two use cases: 1) Add O= to the make command line 'make O=/tmp/build all' 2) Set environement variable BUILD_DIR to point to the desired location 'export BUILD_DIR=/tmp/build' 'make' The second approach can also be used with a MAKEALL script 'export BUILD_DIR=/tmp/build' './MAKEALL' Command line 'O=' setting overrides BUILD_DIR environent variable. When none of the above methods is used the local build is performed and the object files are placed in the source directory. --- board/integratorap/Makefile | 20 ++++++++++++-------- board/integratorap/config.mk | 6 ++++++ board/integratorap/split_by_variant.sh | 9 ++++++--- 3 files changed, 24 insertions(+), 11 deletions(-) (limited to 'board/integratorap') diff --git a/board/integratorap/Makefile b/board/integratorap/Makefile index 358df62..5b3729b 100644 --- a/board/integratorap/Makefile +++ b/board/integratorap/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2000-2004 +# (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # (C) Copyright 2004 @@ -27,13 +27,17 @@ include $(TOPDIR)/config.mk -LIB = lib$(BOARD).a +LIB = $(obj)lib$(BOARD).a -OBJS := integratorap.o flash.o +COBJS := integratorap.o flash.o SOBJS := lowlevel_init.o memsetup.o -$(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(AR) crv $@ $(OBJS) $(SOBJS) clean: rm -f $(SOBJS) $(OBJS) @@ -43,9 +47,9 @@ distclean: clean ######################################################################### -.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) - $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk --include .depend +sinclude $(obj).depend ######################################################################### diff --git a/board/integratorap/config.mk b/board/integratorap/config.mk index 25b79b3..e4c5c3b 100644 --- a/board/integratorap/config.mk +++ b/board/integratorap/config.mk @@ -3,3 +3,9 @@ # TEXT_BASE = 0x01000000 + +ifneq ($(OBJTREE),$(SRCTREE)) +# We are building u-boot in a separate directory, use generated +# .lds script from OBJTREE directory. +LDSCRIPT := $(OBJTREE)/board/$(BOARDDIR)/u-boot.lds +endif diff --git a/board/integratorap/split_by_variant.sh b/board/integratorap/split_by_variant.sh index 9f71bab..53b0d1e 100755 --- a/board/integratorap/split_by_variant.sh +++ b/board/integratorap/split_by_variant.sh @@ -103,14 +103,17 @@ then echo -n "#undef CONFIG_CM_TCRAM " >> tmp.fil echo " /* CM may not have TCRAM */" >> tmp.fil fi -mv tmp.fil ./include/config.h + +mkdir -p ${obj}include +mkdir -p ${obj}board/integratorap +mv tmp.fil ${obj}include/config.h # --------------------------------------------------------- # Ensure correct core object loaded first in U-Boot image # --------------------------------------------------------- -sed -r 's/CPU_FILE/cpu\/'$cpu'\/start.o/; s/#.*//' board/integratorap/u-boot.lds.template > board/integratorap/u-boot.lds +sed -r 's/CPU_FILE/cpu\/'$cpu'\/start.o/; s/#.*//' ${src}board/integratorap/u-boot.lds.template > ${obj}board/integratorap/u-boot.lds # --------------------------------------------------------- # Complete the configuration # --------------------------------------------------------- -./mkconfig -a integratorap arm $cpu integratorap; +$MKCONFIG -a integratorap arm $cpu integratorap; echo "Variant:: $variant with core $cpu" -- cgit v1.1