[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Change a flag for a specific file
From: |
Ralf Wildenhues |
Subject: |
Re: Change a flag for a specific file |
Date: |
Wed, 11 Oct 2006 16:46:33 +0200 |
User-agent: |
Mutt/1.5.13 (2006-09-08) |
Hello Sylvestre,
* Sylvestre Ledru wrote on Wed, Oct 11, 2006 at 04:35:49PM CEST:
>
> Here is what I did :
> noinst_LTLIBRARIES = libdummy-lapack.la
> libdummy_lapack_la_SOURCES = dlamch.f
> libdummy_lapack_la_FFLAGS = -O0
>
> This solution gives me :
> /bin/sh ../../libtool --tag=F77 --mode=compile gfortran -O0 -O2 -g -Wall
> -I/home/sylvestre/dev/scilab5/modules/core/includes -c -o
> libdummy_lapack_la-dlamch.lo `test -f 'dlamch.f' || echo './'`dlamch.f
> libtool: compile: gfortran -O0 -O2 -g -Wall
> -I/home/sylvestre/dev/scilab5/modules/core/includes -c dlamch.f -fPIC
> -o .libs/libdummy_lapack_la-dlamch.o
>
> As you can see, there are to -O option with different values.
Yep, the one from $(libdummy_lapack_la_FFLAGS) and the one from
$(FFLAGS).
A good idea is to view the per-target flags as an override for the AM_*
flags, and view the unadorned flags as user-owned ("you" are the
developer, the person issuing ./configure is the user in this case).
You should never change the latter.
So, as a general rule, do not change
CFLAGS, FFLAGS, FCFLAGS, CXXFLAGS, ...
in a Makefile.am, but instead use
AM_CFLAGS, AM_FFLAGS, AM_FCFLAGS, AM_CXXFLAGS, ...
so that the user has a chance to override your choice. This is done
because usually there are lots of systems the developer cannot test on,
so the user needs a way to have the last word.
Whenever you need to override AM_*FLAGS, do that with per-target flags.
I should add that there is a bug in Automake 1.9.6 in that for linking,
these above-mentioned semantics are not coherent. This has been fixed
in 1.9b and will be fixed in Automake 1.10:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/automake/NEWS?rev=1.295&content-type=text/x-cvsweb-markup&cvsroot=automake
(If that bothers you in what you're trying to do, please report back.)
Further note that it often comes handy to compute some sensible value
for AM_FFLAGS from some configure tests. For that, you can do something
like
AM_FFLAGS=$some_value
AC_SUBST([AM_FFLAGS])
in the configure.ac file.
Cheers,
Ralf