[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request: per-file compilation flags
From: |
Jack Kelly |
Subject: |
Re: Feature request: per-file compilation flags |
Date: |
Wed, 31 Mar 2010 19:55:27 +1100 |
On Wed, Mar 31, 2010 at 9:04 AM, Manoj Rajagopalan <address@hidden> wrote:
> A typical use case for me is when one particular function that resides in a
> file by itself must be compiled without optimizations so that some
> machine-specific numerical information can be calculated accurately. With C++
> the volatile keyword pre-empts this requirement but C and FORTRAN lack this
> capability. So far my option is to create a convenience library for each file
> that requires special compilation flags.
C also has "volatile", with (I thought?) the same semantics: don't
optimise access.
Here's a way to do this in current automake, compiling foo.c into bar
and into baz, but with different flags:
bin_PROGRAMS = bar baz
...
bar_LDADD = libfoo_bar.a
baz_LDADD = libfoo_baz.a
noinst_LIBRARIES = libfoo_bar.a libfoo_baz.a
libfoo_bar_a_SOURCES = foo.c
libfoo_baz_a_SOURCES = foo.c
libfoo_bar_a_CFLAGS = -O3
libfoo_baz_a_CFLAGS = -O0
You'll also need AM_PROG_CC_C_O in configure.ac.
-- Jack