From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com ([217.140.110.172]:55088 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbfHZJSN (ORCPT ); Mon, 26 Aug 2019 05:18:13 -0400 Date: Mon, 26 Aug 2019 10:17:22 +0100 Message-ID: <86sgpomgkd.wl-maz@kernel.org> From: Marc Zyngier Subject: Re: [PATCH 1/2] kbuild: change *FLAGS_.o to take the path relative to $(obj) In-Reply-To: <20190825172833.5708-1-yamada.masahiro@socionext.com> References: <20190825172833.5708-1-yamada.masahiro@socionext.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , James Morse , Julien Thierry , Michal Marek , Russell King , Suzuki K Poulose , Thomas Gleixner , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, x86@kernel.org On Sun, 25 Aug 2019 18:28:32 +0100, Masahiro Yamada wrote: > > Kbuild provides per-file compiler flag addition/removal: > > CFLAGS_.o > CFLAGS_REMOVE_.o > AFLAGS_.o > AFLAGS_REMOVE_.o > CPPFLAGS_ > HOSTCFLAGS_.o > HOSTCXXFLAGS_.o > > The is the filename of the target without its suffix. > > This syntax comes into a trouble when two files with the same name > appear in one Makefile, for example: > > obj-y += foo.o > obj-y += dir/foo.o > CFLAGS_foo.o := > > Here, the applies to both foo.o and dir/foo.o > > The real world problem is: > > scripts/kconfig/util.c > scripts/kconfig/lxdialog/util.c > > Both files are compiled into scripts/kconfig/mconf, but only the > latter should be given with additional flags for ncurses. > > It is more sensible to use the relative path to the Makefile, like this: > > obj-y += foo.o > CFLAGS_foo.o := > obj-y += dir/foo.o > CFLAGS_dir/foo.o := > > The $* variable is replaced with the stem ('%') part in a pattern rule. > In other words, this only works for pattern rules. > > Signed-off-by: Masahiro Yamada > --- > > arch/arm/kvm/Makefile | 5 +++-- > arch/x86/entry/vdso/Makefile | 3 ++- > scripts/Makefile.host | 30 +++++++++++++++--------------- > scripts/Makefile.lib | 10 +++++----- > scripts/kconfig/Makefile | 8 ++++---- > 5 files changed, 29 insertions(+), 27 deletions(-) For the KVM/arm part: Acked-by: Marc Zyngier Thanks, M. -- Jazz is not dead, it just smells funny.