From patchwork Sat Feb 9 18:59:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: build: support disjoint build directory Date: Sat, 09 Feb 2013 08:59:59 -0000 From: Blue Swirl X-Patchwork-Id: 219428 Message-Id: <7ab841ebb4c7c5f6881d41c8ebe02fd6ded871b8.1360436392.git.blauwirbel@gmail.com> To: openbios@openbios.org Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org Support building in any directory, not just in-tree build. Use VPATH for non-Forth files. Forth compiler does not support explicit paths, so drop source path prefixes added by XML and rely on directories passed with -I flag. Signed-off-by: Blue Swirl --- .gitignore | 1 + Makefile | 3 +- Makefile.target | 5 +++- config/scripts/switch-arch | 47 +++++++++++++++++++++++++------------------ config/xml/dictionary.xsl | 3 +- config/xml/object.xsl | 1 - 6 files changed, 35 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index e6b5c59..38e6dd8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ obj-* .stgit-* +config-host.mak diff --git a/Makefile b/Makefile index 74e462c..3526b75 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ -ODIRS=$(wildcard obj-*) -TARGETS=$(subst obj-,,$(ODIRS)) +include config-host.mak all: requirements info build diff --git a/Makefile.target b/Makefile.target index 934b95a..913fb13 100644 --- a/Makefile.target +++ b/Makefile.target @@ -6,7 +6,6 @@ include config.mak ODIR := . -SRCDIR := .. HOSTCC := gcc HOSTCFLAGS+= -O2 -g -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS) @@ -38,6 +37,10 @@ AS_FLAGS+= -g quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) +VPATH_SUFFIXES = %.c %.h %.S %.fs +set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1))) +$(call set-vpath, $(SRCDIR)) + # # pre rules # diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch index a9c911b..b91af7c 100755 --- a/config/scripts/switch-arch +++ b/config/scripts/switch-arch @@ -117,21 +117,18 @@ config_set_boolean() echo "