Don't override CFLAGS etc in configure-generated makefile

CPPFLAGS, CFLAGS, CXXFLAGS and LDFLAGS are supposed to be under
user-control and putting configure-determined options in them broke
something as simple as running "make CXXFLAGS=-Wno-some-extra-warning"
because this overrode the CXXFLAGS set by configure and required for
build.

Improve this by using WX_*FLAGS in the generated makefile and leaving
the user-controlled FLAGS alone. This is still not ideal as running
"configure CFLAGS=-DFOO" and then "make CFLAGS=-DBAR" will define both
FOO and BAR, as configure copies CFLAGS to WX_CFLAGS, and so setting it
on make command line won't override it, as it should, but this should be
a much more rare and also much less severe problem, so we should be able
to live with it for now.

Normally this commit shouldn't result in any user-visible changes, i.e.
it shouldn't break any previously working scenarios and only make some
previously broken ones work.
This commit is contained in:
Vadim Zeitlin
2020-02-02 01:57:11 +01:00
parent 13b0981eb9
commit ec091c9f2b
117 changed files with 1238 additions and 922 deletions

30
configure vendored
View File

@@ -639,11 +639,15 @@ GUIDIST
WXCONFIG_RESFLAGS
WXCONFIG_LDFLAGS_GUI
WXCONFIG_LDFLAGS
WX_LDFLAGS
WXCONFIG_RPATH
WXCONFIG_LIBS
WXCONFIG_CXXFLAGS
WX_CXXFLAGS
WXCONFIG_CFLAGS
WX_CFLAGS
WXCONFIG_CPPFLAGS
WX_CPPFLAGS
WX_CHARTYPE
WX_SUBVERSION
WX_VERSION
@@ -905,7 +909,6 @@ EXTRALIBS_MEDIA
EXTRALIBS_HTML
EXTRALIBS_XML
EXTRALIBS
CXXWARNINGS
USE_PLUGINS
MONOLITHIC
WXUNIV
@@ -3802,6 +3805,11 @@ wx_top_builddir="`pwd -W 2> /dev/null || pwd`"
USER_CPPFLAGS=$CPPFLAGS
USER_CFLAGS=$CFLAGS
USER_CXXFLAGS=$CXXFLAGS
USER_LDFLAGS=$LDFLAGS
USE_UNIX=1
USE_WIN32=0
@@ -37720,7 +37728,7 @@ CPPFLAGS=`echo $WXCONFIG_CPPFLAGS \
C_AND_CXX_FLAGS="$DEBUG_CFLAGS $PROFILE_FLAGS $OPTIMISE_CFLAGS"
CFLAGS=`echo $WXCONFIG_CFLAGS $CWARNINGS $C_AND_CXX_FLAGS $CFLAGS `
CXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $CXXFLAGS `
CXXFLAGS=`echo $WXCONFIG_CXXFLAGS $CXXWARNINGS $C_AND_CXX_FLAGS $CXXFLAGS `
OBJCFLAGS=`echo $WXCONFIG_CFLAGS $CWARNINGS $C_AND_CXX_FLAGS $OBJCFLAGS `
OBJCXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $OBJCXXFLAGS `
@@ -37876,7 +37884,6 @@ fi
TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[A-Z]' '[a-z]'`
@@ -40366,8 +40373,18 @@ case "${host}" in
;;
esac
CFLAGS="$CFLAGS $CFLAGS_VISIBILITY"
CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY"
WX_CPPFLAGS=$CPPFLAGS
WX_CFLAGS=$CFLAGS
WX_CXXFLAGS=$CXXFLAGS
WX_LDFLAGS=$LDFLAGS
CPPFLAGS=$USER_CPPFLAGS
CFLAGS=$USER_CFLAGS
CXXFLAGS=$USER_CXXFLAGS
LDFLAGS=$USER_LDFLAGS
WX_CFLAGS="$WX_CFLAGS $CFLAGS_VISIBILITY"
WX_CXXFLAGS="$WX_CXXFLAGS $CXXFLAGS_VISIBILITY"
OBJCFLAGS="$OBJCFLAGS $CFLAGS_VISIBILITY"
OBJCXXFLAGS="$OBJCXXFLAGS $CXXFLAGS_VISIBILITY"
@@ -40415,6 +40432,9 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq