When you override CFLAGS on the configure command line, you give configure the opportunity to add more flags to the CFLAGS variable that are then passed on to make. On the other hand, when you modify CFLAGS on the make command line, you are overriding all settings provided to the Makefile by the configure script when the Makefile was built. For example, I have a (generated) Makefile that contains the following definition for CFLAGS: CFLAGS = -g -O2 -DLINUX -Wall -Werror -O3 The -g -O2 comes from the AC_PROG_CC macro in my configure.ac file. The -DLINUX comes from some hand-written script in that same configure.ac that determines my platform (based on host_os), while thet -Wall -Werror comes from some more script that determines which compiler I'm using. Finally, the -O3 is determined by yet another piece of script that determines based on --enable features specified how optimal I want the code to be. If you say "make CFLAGS=-g", you've just lost the definition for LINUX and the warning options defined in the configure script. Before you all flame me on this, let me say that I'm already aware that I should be passing the -D option in the CPPFLAGS, but I would argue that CFLAGS is the only viable place to pass the -W options, and that these options should probably be set by a configure script that can figure out which compiler you're using. I would also like to point out that this is a simple example - I know of projects that also much more carefully craft optimization flags - they pass a dozen or more -f flags based on compiler and platform characteristics. This means that, in general (IMHO), it's better to configure your build tree with the flags you want when running the configure script, and then just run make with no arguments (other than specific sub-targets when needed). This allows programmed configuration options (--enable, --with, etc) to affect CFLAGS as well - perhaps with esoteric -f options that you will never remember properly without lots of research right before you type make. :) I reserve setting CFLAGS on the make command line for when I absolutely need to specify the entire set of CFLAGS in a build - for instance, when I'm experimenting with something new. John
>>> Brian Dessent <[EMAIL PROTECTED]> 2/6/2006 9:09:19 pm >>> Harlan Stenn wrote: > That didn't used to be the case, as I remember from the docs. > > I do remember (perhaps incorrectly) that the difference was apparent > when running "config.status --recheck". I am sure there is more to it that I am not aware of. Otherwise, there would be no controversy. Maybe someone who actually knows something about autoconf can say for sure. But from what I can tell for setting CFLAGS, CXXFLAGS, LDFLAGS, and so on, either way of doing it should record the choice equally in generated files. There is also the the issue of overriding during make, such as "make CFLAGS=-O2" which from what I can tell sometimes works and sometimes is a bad idea. It also depends on your platform's make since I think there are differences in how these kind of overrides are handled. But that would be another route to try if you wanted to change the build without reconfiguring and without making separate build directories. Brian _______________________________________________ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf _______________________________________________ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf