From patchwork Thu Sep 5 10:20:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 272845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 641B12C00A7 for ; Thu, 5 Sep 2013 20:21:43 +1000 (EST) Received: from localhost ([::1]:57953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWh3-0005uV-86 for incoming@patchwork.ozlabs.org; Thu, 05 Sep 2013 06:21:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWgS-0005qR-2E for qemu-devel@nongnu.org; Thu, 05 Sep 2013 06:21:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHWgL-0002f6-UL for qemu-devel@nongnu.org; Thu, 05 Sep 2013 06:21:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWgL-0002es-LP for qemu-devel@nongnu.org; Thu, 05 Sep 2013 06:20:57 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r85AKt5Y017334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 5 Sep 2013 06:20:56 -0400 Received: from T430s.nay.redhat.com ([10.66.5.155]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r85AKm6r006725; Thu, 5 Sep 2013 06:20:53 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Thu, 5 Sep 2013 18:20:43 +0800 Message-Id: <1378376448-29036-2-git-send-email-famz@redhat.com> In-Reply-To: <1378376448-29036-1-git-send-email-famz@redhat.com> References: <1378376448-29036-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, mjt@tls.msk.ru, famz@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [RFC PATCH 1/6] make.rule: fix $(obj) to a real relative path 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 Makefile.target includes rule.mak and unnested common-obj-y, then prefix them with '../', this will ignore object specific QEMU_CFLAGS in subdir Makefile.objs: $(obj)/curl.o: QEMU_CFLAGS += $(CURL_CFLAGS) Because $(obj) here is './block', instead of '../block'. This doesn't hurt compiling because we basically build all .o from top Makefile, before entering Makefile.target, but it will affact arriving per-object libs support. The starting point of $(obj) is fixed before including ./Makefile.objs, to get consistency with nested Makefile rules in target rule and variable definition. Signed-off-by: Fam Zheng --- Makefile.target | 3 ++- rules.mak | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile.target b/Makefile.target index 9a49852..b35e7c1 100644 --- a/Makefile.target +++ b/Makefile.target @@ -144,12 +144,13 @@ endif # CONFIG_SOFTMMU %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) nested-vars += obj-y +obj := .. # This resolves all nested paths, so it must come last include $(SRC_PATH)/Makefile.objs all-obj-y = $(obj-y) -all-obj-y += $(addprefix ../, $(common-obj-y)) +all-obj-y += $(addprefix $(obj)/, $(common-obj-y)) ifndef CONFIG_HAIKU LIBS+=-lm diff --git a/rules.mak b/rules.mak index 4499745..5758137 100644 --- a/rules.mak +++ b/rules.mak @@ -103,7 +103,6 @@ clean: clean-timestamp # magic to descend into other directories -obj := . old-nested-dirs := define push-var @@ -119,9 +118,10 @@ endef define unnest-dir $(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) -$(eval obj := $(obj)/$1) +$(eval old-obj := $(obj)) +$(eval obj := $(if $(obj),$(obj)/$1,$1)) $(eval include $(SRC_PATH)/$1/Makefile.objs) -$(eval obj := $(patsubst %/$1,%,$(obj))) +$(eval obj := $(old-obj)) $(foreach var,$(nested-vars),$(call pop-var,$(var),$1/)) endef