From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13488C3A59E for ; Mon, 26 Aug 2019 09:18:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB64F22D6D for ; Mon, 26 Aug 2019 09:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566811094; bh=C9dY5NXFa/v/EYMH86lgRkodR1rXHtQrjVcO85WVSLg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=cK6kwMZMsci8afB9qA3NjBmVNgooGHQFQVnFam3vNNOIlxh3AIrcNUBLwUPtM9tvB ZwNoU/A+nPSsB8i+jJDG73coPpL4Hu40aeyFBSt51lKP4y5yPSQVSnHsD9yZON5ANo CC/qcez6WGcbu1pXkdqdwM8Mvjfc6Ioig1tgPO0I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730836AbfHZJSN (ORCPT ); Mon, 26 Aug 2019 05:18:13 -0400 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 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6DC111570; Mon, 26 Aug 2019 02:18:12 -0700 (PDT) Received: from big-swifty.misterjones.org (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E865A3F59C; Mon, 26 Aug 2019 02:17:27 -0700 (PDT) Date: Mon, 26 Aug 2019 10:17:22 +0100 Message-ID: <86sgpomgkd.wl-maz@kernel.org> From: Marc Zyngier 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 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> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/26 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: Approximate MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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.