Messages in this thread | | | Date | Mon, 26 Aug 2019 10:17:22 +0100 | From | Marc Zyngier <> | Subject | Re: [PATCH 1/2] kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) |
| |
On Sun, 25 Aug 2019 18:28:32 +0100, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > Kbuild provides per-file compiler flag addition/removal: > > CFLAGS_<basetarget>.o > CFLAGS_REMOVE_<basetarget>.o > AFLAGS_<basetarget>.o > AFLAGS_REMOVE_<basetarget>.o > CPPFLAGS_<basetarget> > HOSTCFLAGS_<basetarget>.o > HOSTCXXFLAGS_<basetarget>.o > > The <basetarget> 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 := <some-flags> > > Here, the <some-flags> 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 := <some-flags> > obj-y += dir/foo.o > CFLAGS_dir/foo.o := <other-flags> > > 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 <yamada.masahiro@socionext.com> > --- > > 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 <maz@kernel.org>
Thanks,
M.
-- Jazz is not dead, it just smells funny.
| |