automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting libXXX_la_CPPFLAGS and libXXX_la_CFLAGS erases AM_CPPFLAGS a


From: Russ Allbery
Subject: Re: Setting libXXX_la_CPPFLAGS and libXXX_la_CFLAGS erases AM_CPPFLAGS and AM_CFLAGS
Date: Fri, 18 Nov 2022 13:57:01 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

madmurphy <madmurphy333@gmail.com> writes:

> However, if at the same time I set also the libfoo_la_CPPFLAGS variable (no
> matter the content), as in the following example,

> AM_CPPFLAGS = \
>        "-DLIBFOO_BUILD_MESSAGE=\"correctly defined via AM_CPPFLAGS\""

> ...

> libfoo_la_CPPFLAGS = \
>        "-DLIBFOO_DUMMY=\"This is just a dummy text\""

> the AM_CPPFLAGS variable will be completely overwritten by the
> libfoo_la_CPPFLAGS variable, and invoking libfoo_func() will print

> Message from the build system: undefined

While this is often confusing, this is the documented behavior of
Automake.  See:

https://www.gnu.org/software/automake/manual/automake.html#Program-and-Library-Variables

    In compilations with per-target flags, the ordinary ‘AM_’ form of the
    flags variable is not automatically included in the compilation
    (however, the user form of the variable is included). So for instance,
    if you want the hypothetical maude compilations to also use the value
    of AM_CFLAGS, you would need to write:

        maude_CFLAGS = … your flags … $(AM_CFLAGS)

    See Flag Variables Ordering, for more discussion about the interaction
    between user variables, ‘AM_’ shadow variables, and per-target
    variables.

and

https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering

-- 
Russ Allbery (eagle@eyrie.org)             <https://www.eyrie.org/~eagle/>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]