[Top][All Lists]

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

adding specific C flags for a SINGLE source file

From: Bruce Allen
Subject: adding specific C flags for a SINGLE source file
Date: Wed, 8 Dec 2004 03:15:55 -0600 (CST)

Apologies if this is a FAQ: I've searched the mailing list and other
standard places but not found the answer.

I am working on a project which is 'stock' autoconf/automake but with one
twist. There is a single routine (that lives by itself in dhrystone.C)
which must ALWAYS be compiled to an object with -O3, regardless of the
user specified compilation options, CFLAGS, CPPFLAGS, etc.

One way to accomplish this is to put dhrystone.C into a separate subdir
with its down  But that's ugly.  Is there a better way?

Here is a more detailed description. Suppose I have an executable with
some simple .C source files:

bin_PROGRAMS = my_prog
my_prog_SOURCES =      \
    app.C              \
    app_control.C      \
    app_graphics.C     \

my_prog_CPPFLAGS = -I $(srcdir)/something $(AM_CPPFLAGS)

So everything is standard, except for one thing.  I want to ensure that
when dhrystone.C is compiled to an object file, it gets special
compilation CPPFLAGS.  How do I modify to make sure that the
construction of dhrystone.o from dhrystone.C is done using special flags?  
(I want to always add a -O3, regardless of users preferences for
CPPFLAGS).  For the other files (app.C, etc) I want to follow user
preferences in the standard way.

Replies copied to address@hidden would be appreciated: I'm not a
subscriber to this list.


reply via email to

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