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. --- fs/Makefile | 4 ++-- fs/cramfs/Makefile | 16 +++++++++------- fs/ext2/Makefile | 18 +++++++++++------- fs/fat/Makefile | 15 +++++++-------- fs/fdos/Makefile | 17 +++++++++++------ fs/jffs2/Makefile | 16 +++++++++------- fs/reiserfs/Makefile | 18 +++++++++++------- 7 files changed, 60 insertions(+), 44 deletions(-) (limited to 'fs') diff --git a/fs/Makefile b/fs/Makefile index 79cbdeaa7a..273d90e011 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2000, 2001 +# (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -24,6 +24,6 @@ SUBDIRS := jffs2 cramfs fdos fat reiserfs ext2 -.depend all: +$(obj).depend all: @for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir $@ ; done diff --git a/fs/cramfs/Makefile b/fs/cramfs/Makefile index 54a475ef85..1a6f4b7d00 100644 --- a/fs/cramfs/Makefile +++ b/fs/cramfs/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2000, 2001 +# (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -23,25 +23,27 @@ include $(TOPDIR)/config.mk -LIB = libcramfs.a +LIB = $(obj)libcramfs.a AOBJS = COBJS = cramfs.o uncompress.o -OBJS = $(AOBJS) $(COBJS) + +SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) #CPPFLAGS += all: $(LIB) $(AOBJS) -$(LIB): .depend $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(AR) crv $@ $(OBJS) ######################################################################### -.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) - $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### diff --git a/fs/ext2/Makefile b/fs/ext2/Makefile index 3b193684f5..2e420d536b 100644 --- a/fs/ext2/Makefile +++ b/fs/ext2/Makefile @@ -1,4 +1,7 @@ # +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# # (C) Copyright 2003 # Pavel Bartusek, Sysgo Real-Time Solutions AG, pba@sysgo.de # @@ -24,25 +27,26 @@ include $(TOPDIR)/config.mk -LIB = libext2fs.a +LIB = $(obj)libext2fs.a AOBJS = COBJS = ext2fs.o dev.o -OBJS = $(AOBJS) $(COBJS) + +SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) #CPPFLAGS += all: $(LIB) $(AOBJS) -$(LIB): .depend $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(AR) crv $@ $(OBJS) - ######################################################################### -.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) - $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### diff --git a/fs/fat/Makefile b/fs/fat/Makefile index e4627577b7..2fa428c4dc 100644 --- a/fs/fat/Makefile +++ b/fs/fat/Makefile @@ -19,28 +19,27 @@ # MA 02111-1307 USA # -TOPDIR=../../ - include $(TOPDIR)/config.mk -LIB = libfat.a +LIB = $(obj)libfat.a AOBJS = COBJS = fat.o file.o -OBJS = $(AOBJS) $(COBJS) +SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) all: $(LIB) $(AOBJS) -$(LIB): .depend $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(AR) crv $@ $(OBJS) ######################################################################### -.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) - $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### diff --git a/fs/fdos/Makefile b/fs/fdos/Makefile index c25e744b92..e55ac8abbd 100644 --- a/fs/fdos/Makefile +++ b/fs/fdos/Makefile @@ -1,4 +1,7 @@ # +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# # (C) Copyright 2002 # Stäubli Faverges - # Pierre AUBERT p.aubert@staubli.com @@ -25,25 +28,27 @@ include $(TOPDIR)/config.mk -LIB = libfdos.a +LIB = $(obj)libfdos.a AOBJS = COBJS = fat.o vfat.o dev.o fdos.o fs.o subdir.o -OBJS = $(AOBJS) $(COBJS) + +SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) #CPPFLAGS += all: $(LIB) $(AOBJS) -$(LIB): .depend $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(AR) crv $@ $(OBJS) ######################################################################### -.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) - $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile index f28b17a414..82436bbfec 100644 --- a/fs/jffs2/Makefile +++ b/fs/jffs2/Makefile @@ -1,5 +1,5 @@ # -# (C) Copyright 2000, 2001 +# (C) Copyright 2000-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -23,26 +23,28 @@ include $(TOPDIR)/config.mk -LIB = libjffs2.a +LIB = $(obj)libjffs2.a AOBJS = COBJS = jffs2_1pass.o compr_rtime.o compr_rubin.o compr_zlib.o mini_inflate.o COBJS += compr_lzo.o compr_lzari.o -OBJS = $(AOBJS) $(COBJS) + +SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) #CPPFLAGS += all: $(LIB) $(AOBJS) -$(LIB): .depend $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(AR) crv $@ $(OBJS) ######################################################################### -.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) - $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### diff --git a/fs/reiserfs/Makefile b/fs/reiserfs/Makefile index 98a9a8d30e..45028cb15e 100644 --- a/fs/reiserfs/Makefile +++ b/fs/reiserfs/Makefile @@ -1,4 +1,7 @@ # +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# # (C) Copyright 2003 # Pavel Bartusek, Sysgo Real-Time Solutions AG, pba@sysgo.de # @@ -24,25 +27,26 @@ include $(TOPDIR)/config.mk -LIB = libreiserfs.a +LIB = $(obj)libreiserfs.a AOBJS = COBJS = reiserfs.o dev.o mode_string.o -OBJS = $(AOBJS) $(COBJS) + +SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) #CPPFLAGS += all: $(LIB) $(AOBJS) -$(LIB): .depend $(OBJS) +$(LIB): $(obj).depend $(OBJS) $(AR) crv $@ $(OBJS) - ######################################################################### -.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c) - $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@ +# defines $(obj).depend target +include $(SRCTREE)/rules.mk -sinclude .depend +sinclude $(obj).depend ######################################################################### -- cgit v1.2.1