automake
[Top][All Lists]
Advanced

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

Re: per-file compiler flags?


From: Guido Draheim
Subject: Re: per-file compiler flags?
Date: Mon, 23 Dec 2002 14:20:18 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826

Markus Werle wrote:
Hi!

Consider the following case:

File VeryImportant.C contains code that really needs some
optimization available. But all other files could (at least during development)
be compiled without optimization, for the sake of not drinking too much coffee
due to long compilation times.

Is there a convenient way to achieve the following behaviour:

If (gcc is the compiler)
   Add to compilation of VeryImportant.C
   the optimizer flags: CPPFLAGS+="-O9 -finline -funroll-loops"
else if(intel C++ is the compiler)
  Add the optimizer flags: CPPFLAGS+="-ip -unroll"
endif


This is a split question.
(a) per file compile flags:
   - it's an faq and later automake supports it natively by
     recognizing object_CFLAGS specification, in earlier
     versions you would write an explicit rule
     file.o : file.c
        $(COMPILE) .....
(b) special optimization flags
   - this should be adressed in an autoconf check within
     your configure.ac - push it into AC_SUBST(MYFLAGS)
     and add it to rule (a) like
          $(COMPILE) @MYFLAGS@

Supporting special compile switches for gcc vs. non-gcc compilers
has become an interesting topic in the autoconf-archive, there
are now a few of them prepackaged available.

For there were different approaches available to check for the
different styles of compilers, I'm currently testing a method
derived from the variants I've seen. Perhaps you want to take
it as a guideline for your own ac-macro - and perhaps you like
to have it added to the ac-archive as well.

http://ac-archive.sf.net/guidod/ax_cflags_warn_all.html
http://ac-archive.sf.net/guidod/ax_cflags_no_writable_strings.html

-- cheers, guido




reply via email to

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