From patchwork Mon Mar 4 06:30:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 224595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C20162C029B for ; Mon, 4 Mar 2013 17:34:38 +1100 (EST) Received: from localhost ([::1]:54430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCOyp-0007UQ-Vi for incoming@patchwork.ozlabs.org; Mon, 04 Mar 2013 01:34:35 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCOxl-0006Nq-5v for qemu-devel@nongnu.org; Mon, 04 Mar 2013 01:33:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCOxg-0004q4-N6 for qemu-devel@nongnu.org; Mon, 04 Mar 2013 01:33:29 -0500 Received: from mail-pb0-f54.google.com ([209.85.160.54]:63607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCOxg-0004pz-Ea for qemu-devel@nongnu.org; Mon, 04 Mar 2013 01:33:24 -0500 Received: by mail-pb0-f54.google.com with SMTP id rr4so2892843pbb.13 for ; Sun, 03 Mar 2013 22:33:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state; bh=N3a0pk9A+oKPJFfB6NafdRGxqXa39zMMm3WIo8MU32E=; b=NkYHKi8pSuwdgWDzkD8TTaameMPGf2mTAEe+uex1EXQzuahiIBqf7pbKNn60E/WWW4 BuyuMzaF8h3V/g9QjnqFvqgbTGbH57Inm/lkuMGlqllVTmNiYlnjhfXvyk90hcebd4PV uSciTgW07q+dVpUR5Ml+jBH7Jy3FJryTbkexn0If+uY9/7niT3NZ/Rlg25VrlmV7Fbqh DxxxkHSTqRtTvnFdZWdUARODdeNNcIpdZq+76kQawxyfFFLii4tNomjC+kXf3jquEM7Q 5FCI83ENSk+fMwiaLg20K05S28VL0PiJsIRzFmIFh4S1QIlCXAsIzMio0wUxouPR/o49 3Q/A== X-Received: by 10.68.189.40 with SMTP id gf8mr26390942pbc.128.1362378803662; Sun, 03 Mar 2013 22:33:23 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPS id w2sm22728334pax.22.2013.03.03.22.33.21 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 03 Mar 2013 22:33:22 -0800 (PST) From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Mon, 4 Mar 2013 16:30:27 +1000 Message-Id: <59cd3e8a443a481749f4820a903fc26bc0a21f32.1362375919.git.peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQn2FStjHwbzVgjZst/e2MKKjpGa35aonWP9mjDAL277xUO5/FvTpMczN4NubjQcxq2pKupJ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.54 Cc: peter.maydell@linaro.org, Peter Crosthwaite , david.holsgrove@xilinx.com, agraf@suse.de, kraxel@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v3 3/3] configure/Make: Build libfdt from submodule DTC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Configure to use the DTC submodule to build libfdt when no system libfdt is found. Prompt to install the DTC submodule if --enable-fdt is set but no DTC can be found. DTC has no out-of-tree build capability, so the configure will symlink the Makefile and scripts directory in the out of tree build directory and pass in all the needed DTC arguments to make out of tree build happen. Ideally we fix the DTC make to support out of tree, but did it this way to avoid commits to DTC. Signed-off-by: David Holsgrove Signed-off-by: Peter Crosthwaite --- changed from v2: Fixed quoting of Make arguments (PMM review) Fixed comment styling and typos (PMM review) Makefile | 10 ++++++++++ configure | 29 +++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2262410..b126b31 100644 --- a/Makefile +++ b/Makefile @@ -136,6 +136,15 @@ pixman/Makefile: $(SRC_PATH)/pixman/configure $(SRC_PATH)/pixman/configure: (cd $(SRC_PATH)/pixman; autoreconf -v --install) +DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt +DTC_CFLAGS=$(CFLAGS) $(extra_cflags) -I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt + +subdir-dtc:dtc/libfdt dtc/tests + $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt,) + +dtc/%: + mkdir -p $@ + $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) @@ -253,6 +262,7 @@ distclean: clean rm -rf $$d || exit 1 ; \ done if test -f pixman/config.log; then make -C pixman distclean; fi + if test -f dtc/version_gen.h; then make $(DTC_MAKE_ARGS) clean; fi KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ ar de en-us fi fr-be hr it lv nl pl ru th \ diff --git a/configure b/configure index a1efa21..c589368 100755 --- a/configure +++ b/configure @@ -2418,11 +2418,28 @@ if test "$fdt" != "no" ; then int main(void) { return 0; } EOF if compile_prog "" "$fdt_libs" ; then + # system DTC is good - use it fdt=yes - else - if test "$fdt" = "yes" ; then - feature_not_found "fdt" + elif test -d ${source_path}/dtc/libfdt ; then + # have submodule DTC - use it + fdt=yes + dtc_internal="yes" + mkdir -p dtc + if [ "$source_path" != `pwd` ]; then + symlink "$source_path/dtc/Makefile" "dtc/Makefile" + symlink "$source_path/dtc/scripts" "dtc/scripts" fi + fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" + fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" + elif test "$fdt" = "yes" ; then + # have neither and want - prompt for system/submodule install + echo "ERROR: DTC not present. Your options:" + echo " (1) Preferred: Install the DTC devel package" + echo " (2) Fetch the DTC submodule, using:" + echo " git submodule update --init dtc" + exit 1 + else + # don't have and dont wan't fdt_libs= fdt=no fi @@ -3309,7 +3326,7 @@ if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then fi # add pixman flags after all config tests are done -QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags" +QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags" libs_softmmu="$libs_softmmu $pixman_libs" echo "Install prefix $prefix" @@ -4356,6 +4373,10 @@ if [ "$pixman" = "internal" ]; then echo "config-host.h: subdir-pixman" >> $config_host_mak fi +if [ "$dtc_internal" = "yes" ]; then + echo "config-host.h: subdir-dtc" >> $config_host_mak +fi + # build tree in object directory in case the source is not in the current directory DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"