From patchwork Mon Dec 21 09:06:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 41540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AAC99B6F05 for ; Mon, 21 Dec 2009 20:24:15 +1100 (EST) Received: from localhost ([127.0.0.1]:54888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMeUt-0005qh-FV for incoming@patchwork.ozlabs.org; Mon, 21 Dec 2009 04:24:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMeEJ-0005qu-HC for qemu-devel@nongnu.org; Mon, 21 Dec 2009 04:07:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMeEF-0005n0-SM for qemu-devel@nongnu.org; Mon, 21 Dec 2009 04:07:03 -0500 Received: from [199.232.76.173] (port=56370 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMeEF-0005me-Ka for qemu-devel@nongnu.org; Mon, 21 Dec 2009 04:06:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11797) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMeEF-0003sm-2O for qemu-devel@nongnu.org; Mon, 21 Dec 2009 04:06:59 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBL96vJs006781 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Dec 2009 04:06:57 -0500 Received: from localhost.localdomain (vpn2-10-119.ams2.redhat.com [10.36.10.119]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBL96uvj025302; Mon, 21 Dec 2009 04:06:56 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 21 Dec 2009 10:06:55 +0100 Message-Id: <1261386415-32704-1-git-send-email-pbonzini@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Andreas Faerber , Juan Quintela Subject: [Qemu-devel] [PATCH] Use vpath directive X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The vpath directive has two advantages over the VPATH variable: 1) it allows to skip searching of .o files; 2) the default semantics are to append to the vpath, so there is no confusion between "VPATH=xyz" and "VPATH+=xyz". Since "vpath %.c %.h PATH" is not valid, I'm introducing a wrapper macro to append one or more directories to the vpath. Signed-off-by: Paolo Bonzini Acked-by: Juan Quintela --- This one also fixes the same race (by building cutils.o twice). However, it is nicer in that it fixes the wrong occurrence of "vpath %.c %.h PATH" (sorry for missing that on my review of Kirill's patch). Makefile | 2 +- Makefile.hw | 2 +- Makefile.target | 11 +++++++---- Makefile.user | 6 +----- pc-bios/optionrom/Makefile | 3 ++- rules.mak | 2 ++ tests/Makefile | 3 ++- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index ec52ee2..645ec82 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ configure: ; .PHONY: all clean cscope distclean dvi html info install install-doc \ recurse-all speed tar tarbin test build-all -VPATH=$(SRC_PATH):$(SRC_PATH)/hw +$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw) LIBS+=-lz $(LIBS_TOOLS) diff --git a/Makefile.hw b/Makefile.hw index bd252f5..781c006 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -7,7 +7,7 @@ include $(SRC_PATH)/rules.mak .PHONY: all -VPATH=$(SRC_PATH):$(SRC_PATH)/hw +$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw) QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu diff --git a/Makefile.target b/Makefile.target index 0504d3b..92c2027 100644 --- a/Makefile.target +++ b/Makefile.target @@ -9,7 +9,7 @@ include config-target.mak include $(SRC_PATH)/rules.mak TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw +$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw) QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H ifdef CONFIG_USER_ONLY @@ -87,7 +87,8 @@ signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS) ifdef CONFIG_LINUX_USER -VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) +$(call set-vpath, $(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)) + QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \ elfload.o linuxload.o uaccess.o gdbstub.o @@ -115,7 +116,8 @@ endif #CONFIG_LINUX_USER ifdef CONFIG_DARWIN_USER -VPATH+=:$(SRC_PATH)/darwin-user +$(call set-vpath, $(SRC_PATH)/darwin-user) + QEMU_CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) # Leave some space for the regular program loading zone @@ -137,7 +139,8 @@ endif #CONFIG_DARWIN_USER ifdef CONFIG_BSD_USER -VPATH+=:$(SRC_PATH)/bsd-user +$(call set-vpath, $(SRC_PATH)/bsd-user) + QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ diff --git a/Makefile.user b/Makefile.user index 7daedef..5df114f 100644 --- a/Makefile.user +++ b/Makefile.user @@ -6,11 +6,7 @@ include $(SRC_PATH)/rules.mak .PHONY: all -# Do not take %.o from $(SRC_PATH), only %.c and %.h -# All %.o for user targets should be built with -fpie, when -# configured with --enable-user-pie, so we don't want to -# take %.o from $(SRC_PATH), since they built without -fpie -vpath %.c %.h $(SRC_PATH) +$(call set-vpath, $(SRC_PATH)) QEMU_CFLAGS+=-I.. diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index 54db882..b4be31e 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -5,7 +5,8 @@ all: build-all include ../../config-host.mak include $(SRC_PATH)/rules.mak -VPATH=$(SRC_PATH)/pc-bios/optionrom +$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom) + .PHONY : all clean build-all CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin diff --git a/rules.mak b/rules.mak index 5d9f684..9cd67f0 100644 --- a/rules.mak +++ b/rules.mak @@ -39,6 +39,8 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ >/dev/null 2>&1 && echo OK), $2, $3) +set-vpath = $(if $1,$(foreach PATTERN,%.c %.h %.S, $(eval vpath $(PATTERN) $1))) + # Generate timestamp files for .h include files %.h: %.h-timestamp diff --git a/tests/Makefile b/tests/Makefile index 69092e5..ff7f787 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,5 +1,6 @@ -include ../config-host.mak -VPATH=$(SRC_PATH)/tests + +$(call set-vpath, $(SRC_PATH)/tests) CFLAGS=-Wall -O2 -g -fno-strict-aliasing #CFLAGS+=-msse2