madmurphy <madmurphy...@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 (ea...@eyrie.org)             <https://www.eyrie.org/~eagle/>

Reply via email to