autoconf
[Top][All Lists]
Advanced

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

Re: Automake


From: Brian Dessent
Subject: Re: Automake
Date: Wed, 03 Sep 2008 15:04:08 -0700

Lalit Seth wrote:

> I am trying to learn Autoconf and Automake tools. There are few queries I have

These are separate from gcc and each have their own list.  I've set the
reply-to list to autoconf@ since nothing below is really automake
specific.

> a) When compile happens it always have -g and -O2 option. How can I ignore 
> them.

Those are simply the defaults that autoconf provides if you don't
specify anything.  If you want something different you need to specify a
value.  See the autoconf manual for details on setting variables when
invoking configure:
<http://www.gnu.org/software/autoconf/manual/html_node/Compilers-and-Options.html>.

In your example, you'd probably be interested in CFLAGS (for C),
CXXFLAGS (for C++), and CPPFLAGS (for the preprocessor.)  For a complete
list, see
<http://www.gnu.org/software/autoconf/manual/html_node/Preset-Output-Variables.html>.

Note that you need to quote values that contain spaces, e.g.

$ path/to/configure CFLAGS="-x -y"

> b) How can I do Debug and Release build here I need to call set -g and -O2 
> accordingly.
> c) How can I specify output directories for debug - MyDebug/ and for release 
> - MyRelease. ie -o option of g++ should say g++ -o MyDebug/myapplication 1.o.

In the GNU build system the output dir is defined as the working
directory when you run configure; it is not explicitly specified
otherwise.  To force the output to a specific location that is not under
the control of the user would violate the GNU principles.  For example
if the user didn't have write permission to the source directory, and
the build system were to mandate an output dir that was a specific
subdir of the source directory, the user would be unable to build the
software.

This facility allows you to have one source directory with several
corresponding build directories, each configured differently.  To
achieve what you're talking about you might use something like:

$ mkdir build_debug
$ cd build_debug
$ ../configure CFLAGS="-g -O0" CPPFLAGS="-DSOME_EXTRA_DEBUG_FLAG"
$ make
$ make check # or whatever...
$ cd ..
$ mkdir build_release
$ cd build_release
$ ../configure CFLAGS="-O2"
$ make

There is no way for the author of the build system to force the above
sequence.  One of the principles of the GNU system is user choice.  You
can provide a small shell script that provides a suggested set of
commands such as the above, but the user is always free to configure
using whatever build directory layout they prefer, and with whatever
option overrides they deem necessary for their local system.  The GNU
philosophy is that the user always knows what's most appropriate for
their local system.

Brian




reply via email to

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