automake
[Top][All Lists]
Advanced

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

CFLAGS per source


From: NightStrike
Subject: CFLAGS per source
Date: Tue, 18 Oct 2011 10:49:23 -0400

When using automake, I know how to set *FLAGS globally (ie,
AM_*FLAGS), and per binary/lib (ie bin_PROGRAMS=foo ; foo_*FLAGS =
...)  However, those flag variables apply to every source file for a
given primary.  What if I have multiple sources that are compiled
differently?

bin_PROGRAMS = a
a_SOURCES = x.c y.c

I want x.c compiled with -Option1 and y.c compiled with -Option2.

Section 27.8 of the manual, "Per-Object Flags Emulation", describes a
way to accomplish this using libraries, but is that really the ideal
solution?  It seems like a very hacky solution compared to supporting
some syntax for, say, x_c_CFLAGS variables (or something that works
with sources used multiple times.. perhaps a_x_c_CFLAGS), as in my
example above.  That would be much cleaner, I would think, compared to
requiring the user to create and link against useless intermediate
libraries.

Can this be considered for automake 1.12?

Also, has anyone verified that there really is no difference between
adding additional .o's to the link and .a's containing those .o's?
For instance, how does this interact with LTO (link time
optimization)?



reply via email to

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