make: keep HOSTCFLAGS clean from target cflags
HOSTCFLAGS are populated with CFLAGS if they are set from environment: CFLAGS=-O1 make But it turns out that =? operator, which sets variable iff it was unset previously - is recursive expanded operator. Which means that value of HOSTCFLAGS is evaluated every time it's used. Which is wrong with the current flaw in Makefile: 1. it assigns HOSTCFLAGS with CFLAGS from environment as recursive 2. it assigns target-related options to CFLAGS such as -march. 3. HOSTCFLAGS are used (with the current code - here they are expanded from CFLAGS). Which results in target-related options supplied to host objects building, which breaks cross-compilation. Fix by omitting recursive expansion for HOSTCFLAGS. Still we need to keep $(WARNINGS) and $(DEFINES) in HOSTCFLAGS. Link: https://lists.openvz.org/pipermail/criu/2017-April/037109.html Cc: Cyrill Gorcunov <gorcunov@openvz.org> Reported-by:"Brinkmann, Harald" <Harald.Brinkmann@bst-international.com> Reviewed-by:
Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by:
Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by:
Andrei Vagin <avagin@virtuozzo.com>
Showing
Please
register
or
sign in
to comment