automake
[Top][All Lists]
Advanced

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

Re: Force -O0 flags, inhibit the default -O2 flags


From: Ralf Wildenhues
Subject: Re: Force -O0 flags, inhibit the default -O2 flags
Date: Thu, 29 Sep 2005 18:09:01 +0200
User-agent: Mutt/1.5.11

Hi Brian,

* Brian wrote on Thu, Sep 29, 2005 at 05:31:46PM CEST:
> I've been watching, but I still haven't seen an easy autosolution for simply
> having a few of my files not be optimized. It saves me 45 minutes..i've
> resorted to not optimizing the entire package on the mac mini but that's
> ridiculous. This isn't a matter of me providing flags really..i'd be happy
> if there just weren't any there.

Just so this discussion has an end:  The following will store the value
of CFLAGS at configure time and apply it to some but not all sources at
make time.  It preserves the knowledge of whether the user did or did
not set CFLAGS at all (and thus it also preserves the autoconf-provided
default), and still lets you override for _ALL_ sources at `make' time.

If you now want to know how to generalize this for some sources that
will be in one output: this is documented in the Automake manual
(Per-Object Flags, use a convenience lib for those sources).

HTH,
Ralf


echo 'int main() { return 0;}' > normal.c
cp normal.c donotoptimize.c
cat >Makefile.am <<\EOF
bin_PROGRAMS = normal donotoptimize
donotoptimize_CFLAGS =
EOF
cat >configure.ac <<\EOF
AC_INIT([override-user-test], [0.1], [/dev/null])
AM_INIT_AUTOMAKE([foreign])
AC_MSG_WARN([For normal operation, set CFLAGS at `configure' time])
AC_MSG_WARN([They will be applied to all sources except donotoptimize])
AC_MSG_WARN([To append other flags for _all_ sources, set CFLAGS at `make' 
time])

# the following needs to come before the expansion of AC_PROG_CC
cflags_were_set=false
if test "${CFLAGS+set}" = set; then
  AM_CFLAGS=$CFLAGS
  CFLAGS=
  cflags_were_set=:
fi
AC_PROG_CC
AM_PROG_CC_C_O

# the following needs to come after the expansion of AC_PROG_CC
if $cflags_were_set; then :; else
  AM_CFLAGS=$CFLAGS
  CFLAGS=
fi
AC_SUBST(AM_CFLAGS)

AC_CONFIG_FILES(Makefile)
AC_OUTPUT
EOF

autoreconf
./configure
make




reply via email to

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