2019-12-11 15:09:03 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
2019-02-25 18:26:34 +00:00
|
|
|
#
|
|
|
|
# Makefile for the 'dsc' sub-component of DAL.
|
|
|
|
|
2019-12-07 22:47:46 +00:00
|
|
|
ifdef CONFIG_X86
|
2019-10-16 23:02:07 +00:00
|
|
|
dsc_ccflags := -mhard-float -msse
|
2019-12-07 22:47:46 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CONFIG_PPC64
|
|
|
|
dsc_ccflags := -mhard-float -maltivec
|
|
|
|
endif
|
2019-07-12 09:37:00 +00:00
|
|
|
|
2019-10-16 23:02:07 +00:00
|
|
|
ifdef CONFIG_CC_IS_GCC
|
2019-10-16 23:02:08 +00:00
|
|
|
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
|
|
|
|
IS_OLD_GCC = 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-12-07 22:47:46 +00:00
|
|
|
ifdef CONFIG_X86
|
2019-10-16 23:02:08 +00:00
|
|
|
ifdef IS_OLD_GCC
|
|
|
|
# Stack alignment mismatch, proceed with caution.
|
|
|
|
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
|
|
|
|
# (8B stack alignment).
|
2019-10-16 23:02:07 +00:00
|
|
|
dsc_ccflags += -mpreferred-stack-boundary=4
|
2019-10-16 23:02:09 +00:00
|
|
|
else
|
2019-07-22 22:31:05 +00:00
|
|
|
dsc_ccflags += -msse2
|
|
|
|
endif
|
2019-12-07 22:47:46 +00:00
|
|
|
endif
|
2019-07-22 22:31:05 +00:00
|
|
|
|
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-08-30 04:34:01 +00:00
|
|
|
CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_ccflags)
|
2020-08-08 20:44:58 +00:00
|
|
|
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_rcflags)
|
2019-02-25 18:26:34 +00:00
|
|
|
|
|
|
|
DSC = dc_dsc.o rc_calc.o rc_calc_dpi.o
|
|
|
|
|
|
|
|
AMD_DAL_DSC = $(addprefix $(AMDDALPATH)/dc/dsc/,$(DSC))
|
|
|
|
|
|
|
|
AMD_DISPLAY_FILES += $(AMD_DAL_DSC)
|