From patchwork Fri May 12 16:39:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 9724579 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 0814760348 for ; Fri, 12 May 2017 16:39:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E243528854 for ; Fri, 12 May 2017 16:39:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6BE02885E; Fri, 12 May 2017 16:39:36 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5E9728854 for ; Fri, 12 May 2017 16:39:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757751AbdELQjd (ORCPT ); Fri, 12 May 2017 12:39:33 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:34319 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932902AbdELQjT (ORCPT ); Fri, 12 May 2017 12:39:19 -0400 Received: by mail-wr0-f169.google.com with SMTP id l9so47370431wre.1 for ; Fri, 12 May 2017 09:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ih3nhi0cMTfQ66eVSOillz7S4mMI+I/u+V3kTALnjEQ=; b=Dy2+iO+xyyiJSJsJ5G3954P0CIHwL/qYLiaBEZEnNxf1v+6O7w6ckiMOxE+JDCD19X BA+3EcZuXEDpJpR3mafVZ0tpp6x44yMM3CVjVdhv1xmgHyCUkcXN0KRZlnZgffsK3kdC csG5g322EclVu4uVzRg0iQFNTAD7ycSHfEN8g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ih3nhi0cMTfQ66eVSOillz7S4mMI+I/u+V3kTALnjEQ=; b=OhK3nNjjrYhjoluausFgnEel8EmXt5ub+4UdVj5ubsuym6zGizxznLOc39Yr+HpeBs DcY9m3NypBrFRLaADmCM3N9ljYMw9AeABn1MarMqpyC9eoJnMekRywnv6JQrQSCiseXE Uqai9Q6waEGGm9cszdX7FLLg2tjtOtuE2MP24YYr4wVZ9F5m36Wq/oKvUdhboFhHZJD8 kkpwnsAVhRzx6daW7OcOndFVetMue7tA4+C+7SxbxFKvCY0X8+wQgox6LXhSuCT2fiZQ VnE7q5y0zeVl3SR34GyyIeAtIvegJcYa8mAAawVjHtwAUEQthK/4g+A6Nl+GcCJ9HVXg w+cw== X-Gm-Message-State: AODbwcBR1yvO99GM+e/JX8uzenOZNGsMSqcVafYiCgFojMXpx3YPKbRv hZOKEuceymoDVKYU X-Received: by 10.223.133.182 with SMTP id 51mr3791335wrt.86.1494607158033; Fri, 12 May 2017 09:39:18 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a73sm4387730wrc.58.2017.05.12.09.39.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 May 2017 09:39:16 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 69C973E0422; Fri, 12 May 2017 17:40:01 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: pbonzini@redhat.com Cc: drjones@redhat.com, kvm@vger.kernel.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [kvm-unit-tests PATCH v2 6/9] Makefiles: fix up the x86 build dirs and include/link paths Date: Fri, 12 May 2017 17:39:58 +0100 Message-Id: <20170512164001.4117-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170512164001.4117-1-alex.bennee@linaro.org> References: <20170512164001.4117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We still need to tell the compiler the correct search path for finding headers and the like. This is slightly complicated by the "dynamic" asm search path which is in our build tree but (may be) symlinked to the right architectures headers. Also we explicitly include SRCDIR for the linking scripts as VPATH doesn't seem to find them well enough. Also update OBJDIRS to include lib/x86. Signed-off-by: Alex Bennée --- v2 - update OBJDIRS --- Makefile | 2 +- x86/Makefile.common | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 881bc78..af9695a 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ $(libcflat): $(cflatobjs) $(AR) rcs $@ $^ include $(LIBFDT_srcdir)/Makefile.libfdt -$(LIBFDT_archive): CFLAGS += -ffreestanding -I lib -I lib/libfdt -Wno-sign-compare +$(LIBFDT_archive): CFLAGS += -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -Wno-sign-compare $(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS)) $(AR) rcs $@ $^ diff --git a/x86/Makefile.common b/x86/Makefile.common index ec50926..57e8e45 100644 --- a/x86/Makefile.common +++ b/x86/Makefile.common @@ -1,6 +1,6 @@ #This is a make file with common rules for both x86 & x86-64 -all: test_cases +all: directories test_cases cflatobjs += lib/pci.o cflatobjs += lib/pci-edu.o @@ -16,8 +16,10 @@ cflatobjs += lib/x86/isr.o cflatobjs += lib/x86/acpi.o cflatobjs += lib/x86/stack.o +OBJDIRS += lib/x86 + $(libcflat): LDFLAGS += -nostdlib -$(libcflat): CFLAGS += -ffreestanding -I lib +$(libcflat): CFLAGS += -ffreestanding -I $(SRCDIR)/lib -I lib CFLAGS += -m$(bits) CFLAGS += -O1 @@ -31,8 +33,8 @@ libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) .PRECIOUS: %.elf %.o FLATLIBS = lib/libcflat.a $(libgcc) -%.elf: %.o $(FLATLIBS) x86/flat.lds $(cstart.o) - $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,x86/flat.lds \ +%.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o) + $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,$(SRCDIR)/x86/flat.lds \ $(filter %.o, $^) $(FLATLIBS) %.flat: %.elf @@ -52,14 +54,16 @@ ifdef API tests-common += api/api-sample tests-common += api/dirty-log tests-common += api/dirty-log-perf + +OBJDIRS += api endif test_cases: $(tests-common) $(tests) -$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I lib -I lib/x86 +$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/x86 -I lib $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o - $(CC) -m32 -nostdlib -o $@ -Wl,-T,$(TEST_DIR)/realmode.lds $^ + $(CC) -m32 -nostdlib -o $@ -Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^ $(TEST_DIR)/realmode.o: bits = 32