On Wed, Mar 31, 2010 at 9:04 AM, Manoj Rajagopalan <[email protected]> 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
