[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automake's Per-Object Flags Emulation --- CFLAGS override or just pr
Re: automake's Per-Object Flags Emulation --- CFLAGS override or just prepend ?
Sat, 09 Mar 2013 17:58:54 +0100
On 03/09/2013 04:43 PM, Michele Martone wrote:
> I'm using the "Per-Object Flags Emulation" functionality of automake
> to build a single library (.a) file from two .a files, each made of .o
> files compiled with different flags.
> In order to apply the example of
> in my Makefile.am, I declare something similar to
> libfoo_a_CFLAGS = -some -other -flags
> expecting that libfoo.a will be compiled with -some -other -flags
> rather than CFLAGS.
> However in the resulting Makefile I see that something like the
> libfoo_a-foo.o: foo.c
> $(CC) ... $(libfoo_a_CFLAGS) $(CFLAGS) ...
> is being generated instead.
> In other words, CFLAGS is not being replaced by libfoo_a_CFLAGS: only
This is correct: CFLAGS is a user-reserved variable, so it should always
be honoured and should never be overridden by Automake rules (nor by
package developers). The correct developer-reserved variable to specify
extra C compilation flags is AM_CFLAGS -- and *that* is being correctly
> this does not seem neither what the documentation says nor
> what I need.
> Am I doing something wrong ?
If you are defining CFLAGS in your Makefile.am, yes. Use AM_CFLAGS