From patchwork Mon Apr 23 16:32:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 10357531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9EFB6601D3 for ; Mon, 23 Apr 2018 16:32:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E38725F3E for ; Mon, 23 Apr 2018 16:32:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81CF626E76; Mon, 23 Apr 2018 16:32:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4DC7125F3E for ; Mon, 23 Apr 2018 16:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=WNKffh4MSPmZ5gD1rp0xnPJXqP8yZR4u6urWbBTpp1k=; b=U7n od5LMMCwGixwjs3ct4GkYUEoFXhEln/2sRUhudW0NadQ0uFyZgJyFMvwxSVtAR0ptSsEBAluP7zo3 ltnQVTae1jLvD6qI4v/crqEHYeX8kYqq6hPCabQJvfZADuqoRpsXVNGl4fYxv5FvADf4QH2bEiClA bxR6MSPr+k62f5m0+4hpDysxDHZznqJRrpI32htEyyGD0RaYtI8zacBHkw/A1z6o+BGbzfD1SwYEV gNM5qYUfB7Bc6JC0VQzUeH23q2m4Vlu1TWyZbc/X07fENsKiz01gkt/1EqgOjfgkA4veoSQnLifNH vSeJdQUAJyOdlFBE9e8CpyC7Hrb+5vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fAeON-0002DF-Bg; Mon, 23 Apr 2018 16:32:39 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fAeOF-0002BU-DN for linux-arm-kernel@lists.infradead.org; Mon, 23 Apr 2018 16:32:35 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D52F315AD; Mon, 23 Apr 2018 09:32:19 -0700 (PDT) Received: from ostrya.cambridge.arm.com (ostrya.cambridge.arm.com [10.1.210.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1A3293F590; Mon, 23 Apr 2018 09:32:18 -0700 (PDT) From: Jean-Philippe Brucker To: mark.rutland@arm.com Subject: [PATCH boot-wrapper] Fix out-of-tree build Date: Mon, 23 Apr 2018 17:32:06 +0100 Message-Id: <20180423163206.17071-1-jean-philippe.brucker@arm.com> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180423_093231_500115_EF2E9BC2 X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dave.martin@arm.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Adding AArch32 support to the boot-wrapper changed the source layout and broke out-of-tree build. This patch allows to put all generated files into a separate directory again, and build multiple images in parallel: mkdir build/ && cd build/ ~/src/boot-wrapper-aarch64/configure ... make Make attempts to output object files into build/arch/aarchXX/, but fails because that folder doesn't exist in the build directory. Add mkdir as prerequisite for any *.o target in the arch folder. So that Make doesn't confuse the destination folder with the source, override VPATH to only affect .S and .c sources. And set $(ARCH_SRC) as order-only-prerequisite (after a '|'). Otherwise Make would rebuild all objects whenever the timestamp of $(ARCH_SRC) changes, which is every time an object is rebuilt... Signed-off-by: Jean-Philippe Brucker --- Makefile.am | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 49cfa84..d3b5188 100644 --- a/Makefile.am +++ b/Makefile.am @@ -118,7 +118,7 @@ CHOSEN_NODE := chosen { \ }; CPPFLAGS += $(INITRD_FLAGS) -CFLAGS += -Iinclude/ -I$(ARCH_SRC)/include/ +CFLAGS += -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/ CFLAGS += -Wall -fomit-frame-pointer CFLAGS += -ffunction-sections -fdata-sections LDFLAGS += --gc-sections @@ -126,6 +126,12 @@ LDFLAGS += --gc-sections OFILES += boot_common.o bakery_lock.o platform.o $(GIC) cache.o lib.o OFILES += $(addprefix $(ARCH_SRC),boot.o stack.o $(BOOTMETHOD) utils.o) +# Don't lookup all prerequisites in $(top_srcdir), only the source files. When +# building outside the source tree $(ARCH_SRC) needs to be created. +VPATH = +vpath %.c $(top_srcdir) +vpath %.S $(top_srcdir) + all: $(IMAGE) CLEANFILES = $(IMAGE) linux-system.axf xen-system.axf $(OFILES) model.lds fdt.dtb @@ -133,7 +139,10 @@ CLEANFILES = $(IMAGE) linux-system.axf xen-system.axf $(OFILES) model.lds fdt.dt $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(XEN_IMAGE) $(LD) $(LDFLAGS) $(OFILES) -o $@ --script=model.lds -%.o: %.S Makefile +$(ARCH_SRC): + $(MKDIR_P) $@ + +%.o: %.S Makefile | $(ARCH_SRC) $(CC) $(CPPFLAGS) -D__ASSEMBLY__ $(CFLAGS) $(DEFINES) -c -o $@ $< %.o: %.c Makefile