linux-brain/drivers/gpu/drm/amd/display/dc/calcs
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
..
Makefile kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) 2019-09-04 23:12:50 +09:00
bw_fixed.c amdgpu/dc: allow inlining constant int to fixed a lot better. 2017-09-29 13:03:35 -04:00
calcs_logger.h drm/amd/display: Convert remaining loggers off dc_logger 2018-07-13 14:48:42 -05:00
custom_float.c drm/amd/display: get rid of 32.32 unsigned fixed point 2018-05-18 16:08:21 -05:00
dce_calcs.c drm/amd: drop use of drmp.h in os_types.h 2019-06-10 22:59:45 +02:00
dcn_calc_auto.c drm/amdgpu/display: fix compiler errors [-Werror,-Wparentheses-equality] 2019-02-06 13:29:19 -05:00
dcn_calc_auto.h drm/amd/display: make clk mgr soc specific 2019-05-31 10:39:29 -05:00
dcn_calc_math.c drm/amd/display: add some math functions for dcn_calc_math 2019-06-11 12:49:21 -05:00
dcn_calc_math.h drm/amd/display: add some math functions for dcn_calc_math 2019-06-11 12:49:21 -05:00
dcn_calcs.c drm/amd/display: Optimize bandwidth validation by adding early return 2019-06-22 09:34:09 -05:00