devtools: reset compilation flags for each target

Same idea than overriding PATH and PKG_CONFIG_PATH, it can be quite
useful to override compilation flags like CFLAGS, CPPFLAGS and LDFLAGS
for cross compilation or libraries that won't provide a pkg-config file.

Fixes: 2722367412 ("devtools: load target-specific compilation environment")

Signed-off-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
David Marchand 2019-10-02 18:55:47 +02:00 committed by Thomas Monjalon
parent 808b3fce7e
commit bd711af366

View File

@ -36,12 +36,18 @@ fi
default_path=$PATH
default_pkgpath=$PKG_CONFIG_PATH
default_cppflags=$CPPFLAGS
default_cflags=$CFLAGS
default_ldflags=$LDFLAGS
load_env () # <target compiler>
{
targetcc=$1
export PATH=$default_path
export PKG_CONFIG_PATH=$default_pkgpath
export CPPFLAGS=$default_cppflags
export CFLAGS=$default_cflags
export LDFLAGS=$default_ldflags
unset DPDK_MESON_OPTIONS
command -v $targetcc >/dev/null 2>&1 || return 1
DPDK_TARGET=$($targetcc -v 2>&1 | sed -n 's,^Target: ,,p')