Build utils into their source directory equivalent in

the build tree.
Allow separate build tree for utils
Use separate build tree for utils in abuild

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5453 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Patrick Georgi 2010-04-16 22:48:57 +00:00
parent 83cce3e8de
commit a2acbc70a3
6 changed files with 43 additions and 41 deletions

View File

@ -36,7 +36,8 @@ export top := $(PWD)
export src := src export src := src
export srck := $(top)/util/kconfig export srck := $(top)/util/kconfig
export obj ?= build export obj ?= build
export objk := $(obj)/util/kconfig export objutil ?= $(obj)/util
export objk := $(objutil)/kconfig
export KERNELVERSION := 4.0 export KERNELVERSION := 4.0
@ -58,7 +59,7 @@ endif
endif endif
CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E
ROMCC:= $(obj)/romcc ROMCC:= $(objutil)/romcc/romcc
HOSTCC = gcc HOSTCC = gcc
HOSTCXX = g++ HOSTCXX = g++
HOSTCFLAGS := -I$(srck) -I$(objk) -g HOSTCFLAGS := -I$(srck) -I$(objk) -g
@ -145,14 +146,14 @@ $(obj)/config.h:
####################################################################### #######################################################################
# Build the tools # Build the tools
CBFSTOOL:=$(obj)/util/cbfstool/cbfstool CBFSTOOL:=$(objutil)/cbfstool/cbfstool
# needed objects that every mainboard uses # needed objects that every mainboard uses
# Creation of these is architecture and mainboard independent # Creation of these is architecture and mainboard independent
$(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(obj)/util/sconfig/sconfig $(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(objutil)/sconfig/sconfig
@printf " SCONFIG $(subst $(src)/,,$(<))\n" @printf " SCONFIG $(subst $(src)/,,$(<))\n"
mkdir -p $(obj)/mainboard/$(MAINBOARDDIR) mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
$(obj)/util/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR) $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR)
objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o
initobjs:= initobjs:=
@ -286,7 +287,7 @@ endif
prepare: prepare:
mkdir -p $(obj) mkdir -p $(obj)
mkdir -p $(obj)/util/kconfig/lxdialog $(obj)/util/cbfstool mkdir -p $(objutil)/kconfig/lxdialog $(objutil)/cbfstool $(objutil)/romcc $(objutil)/options
test -n "$(alldirs)" && mkdir -p $(alldirs) || true test -n "$(alldirs)" && mkdir -p $(alldirs) || true
$(obj)/build.h: .xcompile $(obj)/build.h: .xcompile
@ -355,7 +356,7 @@ endif
ifeq ($(_OS),CYGWIN_) ifeq ($(_OS),CYGWIN_)
STACK=-Wl,--stack,16384000 STACK=-Wl,--stack,16384000
endif endif
$(obj)/romcc: $(top)/util/romcc/romcc.c $(objutil)/romcc/romcc: $(top)/util/romcc/romcc.c
@printf " HOSTCC $(subst $(obj)/,,$(@)) (this may take a while)\n" @printf " HOSTCC $(subst $(obj)/,,$(@)) (this may take a while)\n"
@# Note: Adding -O2 here might cause problems. For details see: @# Note: Adding -O2 here might cause problems. For details see:
@# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html @# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html

View File

@ -65,7 +65,7 @@ $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.s: $(obj)/bootblock/bootblock.c
@printf " CC $(subst $(obj)/,,$(@))\n" @printf " CC $(subst $(obj)/,,$(@))\n"
$(CC) -MMD -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -I$(obj)/bootblock -include $(obj)/config.h -I. -I$(src) $< -o $@ $(CC) -MMD -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -I$(obj)/bootblock -include $(obj)/config.h -I. -I$(src) $< -o $@
$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(src)/arch/i386/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(obj)/romcc $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(src)/arch/i386/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(ROMCC)
@printf " ROMCC $(subst $(obj)/,,$(@))\n" @printf " ROMCC $(subst $(obj)/,,$(@))\n"
$(CC) -MM -MT$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc \ $(CC) -MM -MT$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc \
$< > $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc.d $< > $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc.d

View File

@ -59,15 +59,15 @@ endif
####################################################################### #######################################################################
# i386 specific tools # i386 specific tools
$(obj)/option_table.h: $(obj)/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout $(obj)/option_table.h: $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
@printf " OPTION $(subst $(obj)/,,$(@))\n" @printf " OPTION $(subst $(obj)/,,$(@))\n"
$(obj)/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $(obj)/option_table.h $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $(obj)/option_table.h
$(obj)/option_table.c: $(obj)/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout $(obj)/option_table.c: $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
@printf " OPTION $(subst $(obj)/,,$(@))\n" @printf " OPTION $(subst $(obj)/,,$(@))\n"
$(obj)/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --option $(obj)/option_table.c $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --option $(obj)/option_table.c
$(obj)/build_opt_tbl: $(top)/util/options/build_opt_tbl.c $(top)/src/include/pc80/mc146818rtc.h $(top)/src/include/boot/coreboot_tables.h $(objutil)/options/build_opt_tbl: $(top)/util/options/build_opt_tbl.c $(top)/src/include/pc80/mc146818rtc.h $(top)/src/include/boot/coreboot_tables.h
@printf " HOSTCC $(subst $(obj)/,,$(@))\n" @printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(HOSTCFLAGS) $< -o $@ $(HOSTCC) $(HOSTCFLAGS) $< -o $@
@ -164,7 +164,7 @@ endif
ifeq ($(CONFIG_ROMCC),y) ifeq ($(CONFIG_ROMCC),y)
ROMCCFLAGS ?= -mcpu=p2 -O2 ROMCCFLAGS ?= -mcpu=p2 -O2
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(ROMCC) $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h
printf " ROMCC romstage.inc\n" printf " ROMCC romstage.inc\n"
$(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -I. $(INCLUDES) $< -o $@ $(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -I. $(INCLUDES) $< -o $@
else else

View File

@ -156,6 +156,7 @@ function create_config
[ "$update" = "true" ] && mv ${build_dir}/coreboot.rom coreboot.rom.tmp [ "$update" = "true" ] && mv ${build_dir}/coreboot.rom coreboot.rom.tmp
$MAKE distclean obj=${build_dir} $MAKE distclean obj=${build_dir}
mkdir -p ${build_dir} mkdir -p ${build_dir}
mkdir -p $TARGET/sharedutils
[ "$update" = "true" ] && mv coreboot.rom.tmp ${build_dir}/coreboot.rom [ "$update" = "true" ] && mv coreboot.rom.tmp ${build_dir}/coreboot.rom
if [ "$CONFIG" != "" ]; then if [ "$CONFIG" != "" ]; then
@ -204,8 +205,8 @@ function create_config
fi fi
fi fi
#yes "" | $MAKE oldconfig -j $cpus obj=${build_dir} &> ${build_dir}/config.log #yes "" | $MAKE oldconfig -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
yes "" | $MAKE oldconfig obj=${build_dir} &> ${build_dir}/config.log yes "" | $MAKE oldconfig obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
ret=$? ret=$?
mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
@ -264,7 +265,7 @@ function compile_target
CURR=$( pwd ) CURR=$( pwd )
#stime=`perl -e 'print time();' 2>/dev/null || date +%s` #stime=`perl -e 'print time();' 2>/dev/null || date +%s`
build_dir=$TARGET/${VENDOR}_${MAINBOARD} build_dir=$TARGET/${VENDOR}_${MAINBOARD}
eval $MAKE $silent -j $cpus obj=${build_dir} \ eval $MAKE $silent -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils \
&> ${build_dir}/make.log &> ${build_dir}/make.log
ret=$? ret=$?
mv .config ${build_dir}/config.build mv .config ${build_dir}/config.build

View File

@ -15,38 +15,38 @@ cbfsobj += cbfstool.o
CBFSTOOLFLAGS=-DCOMPACT -g CBFSTOOLFLAGS=-DCOMPACT -g
$(obj)/util/cbfstool: $(objutil)/cbfstool:
mkdir -p $@ mkdir -p $@
$(obj)/util/cbfstool/%.o: $(top)/util/cbfstool/%.c $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/%.c
printf " HOSTCC $(subst $(obj)/,,$(@))\n" printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
$(HOSTCC) $(CBFSTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $< $(HOSTCC) $(CBFSTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
$(obj)/util/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.cc $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.cc
printf " HOSTCXX $(subst $(obj)/,,$(@))\n" printf " HOSTCXX $(subst $(objutil)/,,$(@))\n"
$(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $< $(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $<
$(obj)/util/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Compress/LZMA/%.cpp $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Compress/LZMA/%.cpp
printf " HOSTCXX $(subst $(obj)/,,$(@))\n" printf " HOSTCXX $(subst $(objutil)/,,$(@))\n"
$(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $< $(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $<
$(obj)/util/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Compress/LZ/%.cpp $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Compress/LZ/%.cpp
printf " HOSTCXX $(subst $(obj)/,,$(@))\n" printf " HOSTCXX $(subst $(objutil)/,,$(@))\n"
$(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $< $(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $<
$(obj)/util/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Compress/RangeCoder/%.cpp $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Compress/RangeCoder/%.cpp
printf " HOSTCXX $(subst $(obj)/,,$(@))\n" printf " HOSTCXX $(subst $(objutil)/,,$(@))\n"
$(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $< $(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $<
$(obj)/util/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Common/%.cpp $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/7zip/Common/%.cpp
printf " HOSTCXX $(subst $(obj)/,,$(@))\n" printf " HOSTCXX $(subst $(objutil)/,,$(@))\n"
$(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $< $(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $<
$(obj)/util/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/Common/%.cpp $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/Common/%.cpp
printf " HOSTCXX $(subst $(obj)/,,$(@))\n" printf " HOSTCXX $(subst $(objutil)/,,$(@))\n"
$(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $< $(HOSTCXX) $(CBFSTOOLFLAGS) $(HOSTCXXFLAGS) -c -o $@ $<
$(obj)/util/cbfstool/cbfstool: $(obj)/util/cbfstool $(addprefix $(obj)/util/cbfstool/,$(cbfsobj)) $(objutil)/cbfstool/cbfstool: $(objutil)/cbfstool $(addprefix $(objutil)/cbfstool/,$(cbfsobj))
printf " HOSTCXX $(subst $(obj)/,,$(@)) (link)\n" printf " HOSTCXX $(subst $(objutil)/,,$(@)) (link)\n"
$(HOSTCXX) $(CBFSTOOLFLAGS) -o $@ $(addprefix $(obj)/util/cbfstool/,$(cbfsobj)) $(HOSTCXX) $(CBFSTOOLFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj))

View File

@ -2,10 +2,10 @@ sconfigobj :=
sconfigobj += lex.yy.o sconfigobj += lex.yy.o
sconfigobj += sconfig.tab.o sconfigobj += sconfig.tab.o
$(obj)/util/sconfig: $(objutil)/sconfig:
mkdir -p $@ mkdir -p $@
$(obj)/util/sconfig/%.o: $(obj)/util/sconfig/%.c $(objutil)/sconfig/%.o: $(objutil)/sconfig/%.c
printf " HOSTCC $(subst $(obj)/,,$(@))\n" printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $< $(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $<
@ -20,12 +20,12 @@ $(top)/util/sconfig/sconfig.tab.c_shipped: $(top)/util/sconfig/sconfig.y
endif endif
$(obj)/util/sconfig/lex.yy.o: $(obj)/util/sconfig/sconfig.tab.h $(objutil)/sconfig/lex.yy.o: $(objutil)/sconfig/sconfig.tab.h
$(obj)/util/sconfig/%: $(top)/util/sconfig/%_shipped $(objutil)/sconfig/%: $(top)/util/sconfig/%_shipped
mkdir -p $(dir $@) mkdir -p $(dir $@)
cp $< $@ cp $< $@
$(obj)/util/sconfig/sconfig: $(obj)/util/sconfig $(addprefix $(obj)/util/sconfig/,$(sconfigobj)) $(objutil)/sconfig/sconfig: $(objutil)/sconfig $(addprefix $(objutil)/sconfig/,$(sconfigobj))
printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n" printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n"
$(HOSTCC) $(SCONFIGFLAGS) -o $@ $(addprefix $(obj)/util/sconfig/,$(sconfigobj)) $(HOSTCC) $(SCONFIGFLAGS) -o $@ $(addprefix $(objutil)/sconfig/,$(sconfigobj))