Skip to content
  • Philip Chimento's avatar
    build: Untangle (AM_) CFLAGS, CPPFLAGS, CXXFLAGS · 0f92f6be
    Philip Chimento authored
    In Automake, CPPFLAGS stands for C PreProcessor flags. C source files are
    compiled with CPPFLAGS and CFLAGS, while C++ source files are compiled
    with CPPFLAGS and CXXFLAGS. The exception to this naming convention is
    the PKG_CHECK_MODULES macro which substs a variable named <FOO>_CFLAGS
    which should properly be called <FOO>_CPPFLAGS.
    
    This untangles all the flags definitions so that -I and -D flags, which
    are preprocessor arguments, are put into CPPFLAGS variables, not into
    CFLAGS or CXXFLAGS. Otherwise they won't apply to both C and C++ source
    files.
    
    In addition, when using per-target flags, make sure to include the AM_
    prefixed variable as well, because otherwise per-target flags will
    override it. Conversely, if an assignment sets a per-target flags variable
    to only be the AM_ prefixed variable (e.g., "something_CFLAGS =
    $(AM_CFLAGS)") then it is redundant.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761072
    0f92f6be