linux_dsm_epyc7002/arch
Masahiro Yamada 54b8ae66ae kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj)
Kbuild provides per-file compiler flag addition/removal:

  CFLAGS_<basetarget>.o
  CFLAGS_REMOVE_<basetarget>.o
  AFLAGS_<basetarget>.o
  AFLAGS_REMOVE_<basetarget>.o
  CPPFLAGS_<basetarget>.lds
  HOSTCFLAGS_<basetarget>.o
  HOSTCXXFLAGS_<basetarget>.o

The <basetarget> is the filename of the target with its directory and
suffix stripped.

This syntax comes into a trouble when two files with the same basename
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 the ncurses flags.

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>

At first, I attempted to replace $(basetarget) with $*. The $* variable
is replaced with the stem ('%') part in a pattern rule. This works with
most of cases, but does not for explicit rules.

For example, arch/ia64/lib/Makefile reuses rule_as_o_S in its own
explicit rules, so $* will be empty, resulting in ignoring the per-file
AFLAGS.

I introduced a new variable, target-stem, which can be used also from
explicit rules.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Marc Zyngier <maz@kernel.org>
2019-09-04 23:12:50 +09:00
..
alpha kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
arc kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC 2019-09-04 10:01:17 +09:00
arm kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) 2019-09-04 23:12:50 +09:00
arm64 kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
c6x Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2019-07-10 21:42:03 -07:00
csky treewide: add "WITH Linux-syscall-note" to SPDX tag of uapi headers 2019-07-25 11:05:10 +02:00
h8300 h8300 update for 5.3 2019-07-17 09:36:38 -07:00
hexagon hexagon: switch to generic version of pte allocation 2019-07-21 09:53:00 -07:00
ia64 kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
m68k kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
microblaze clone3-v5.3 2019-07-11 10:09:44 -07:00
mips kbuild: add $(BASH) to run scripts with bash-extension 2019-09-04 22:54:13 +09:00
nds32 treewide: add "WITH Linux-syscall-note" to SPDX tag of uapi headers 2019-07-25 11:05:10 +02:00
nios2 nios2 update for v5.3-rc1 2019-07-12 15:38:05 -07:00
openrisc dma-mapping updates for Linux 5.3 2019-07-12 15:13:55 -07:00
parisc kbuild: rebuild modules when module linker scripts are updated 2019-08-21 21:05:21 +09:00
powerpc kbuild: add $(BASH) to run scripts with bash-extension 2019-09-04 22:54:13 +09:00
riscv kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
s390 kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
sh treewide: add "WITH Linux-syscall-note" to SPDX tag of uapi headers 2019-07-25 11:05:10 +02:00
sparc kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
um kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
unicore32 Kconfig updates for v5.3 2019-07-12 16:06:27 -07:00
x86 kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) 2019-09-04 23:12:50 +09:00
xtensa xtensa: fix build for cores with coprocessors 2019-07-24 17:44:42 -07:00
.gitignore
Kconfig kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00