summaryrefslogtreecommitdiff
path: root/board/trab
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2006-09-01 19:49:50 +0200
committerMarian Balakowicz <m8@semihalf.com>2006-09-01 19:49:50 +0200
commitf93286397ed2a7084efb0362a43ee09f11702349 (patch)
tree11e0c11781ba0b867831eff47a4178a464cf00b3 /board/trab
parent24d3d3754634532ae262075484e7c1d00d447152 (diff)
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.
Diffstat (limited to 'board/trab')
-rw-r--r--board/trab/Makefile36
-rw-r--r--board/trab/config.mk2
2 files changed, 23 insertions, 15 deletions
diff --git a/board/trab/Makefile b/board/trab/Makefile
index 159404b269a..2b918f6397d 100644
--- a/board/trab/Makefile
+++ b/board/trab/Makefile
@@ -1,5 +1,5 @@
#
-# (C) Copyright 2000-2002
+# (C) Copyright 2000-2006
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
@@ -23,43 +23,51 @@
include $(TOPDIR)/config.mk
-LIB = lib$(BOARD).a
+LIB = $(obj)lib$(BOARD).a
-OBJS := trab.o flash.o vfd.o cmd_trab.o memory.o tsc2000.o auto_update.o
+COBJS := trab.o flash.o vfd.o cmd_trab.o memory.o tsc2000.o auto_update.o
SOBJS := lowlevel_init.o
+COBJS_FKT := trab_fkt.o rs485.o tsc2000.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) $(COBJS_FKT:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+OBJS_FKT := $(addprefix $(obj),$(COBJS_FKT))
+
gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
LOAD_ADDR = 0xc100000
#########################################################################
-all: $(LIB) trab_fkt.srec trab_fkt.bin
+all: $(LIB) $(obj)trab_fkt.srec $(obj)trab_fkt.bin
-$(LIB): $(OBJS) $(SOBJS)
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
$(AR) crv $@ $(OBJS) $(SOBJS)
-trab_fkt.srec: trab_fkt.o rs485.o tsc2000.o $(LIB)
- $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $^ $(LIB) \
- -L../../examples -lstubs \
- -L../../lib_generic -lgeneric \
+$(obj)trab_fkt.srec: $(OBJS_FKT) $(LIB)
+ $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e trab_fkt $^ $(LIB) \
+ -L$(obj)../../examples -lstubs \
+ -L$(obj)../../lib_generic -lgeneric \
-L$(gcclibdir) -lgcc
$(OBJCOPY) -O srec $(<:.o=) $@
-trab_fkt.bin: trab_fkt.srec
+$(obj)trab_fkt.bin: $(obj)trab_fkt.srec
$(OBJCOPY) -I srec -O binary $< $@
clean:
- rm -f $(SOBJS) $(OBJS)
+ rm -f $(SOBJS) $(OBJS) $(OBJS_FKT)
distclean: clean
rm -f $(LIB) core *.bak .depend
#########################################################################
-.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/trab/config.mk b/board/trab/config.mk
index f2411d009c6..800cc28a11d 100644
--- a/board/trab/config.mk
+++ b/board/trab/config.mk
@@ -19,7 +19,7 @@
# download areas is 0C80'0000
#
-sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
ifndef TEXT_BASE
TEXT_BASE = 0x0DF40000