]> git.cworth.org Git - obsolete/notmuch-old/commitdiff
configure: Support the capturing of CFLAGS and CXXFLAGS at configure time.
authorCarl Worth <cworth@cworth.org>
Fri, 4 Dec 2009 23:20:12 +0000 (15:20 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 4 Dec 2009 23:20:12 +0000 (15:20 -0800)
These variables can now be set via configure time via environment
variables like so:

CFLAGS=-g ./configure

and subsequent builds will remember these values. The values can
still be overridden at compile time by passing make variables:

      make CFLAGS=-O2

The CXXFLAGS variable is optional. If unset at either configure
time or at compile time, it will inherit its value from the
CFLAGS variable. (Though if explicitly set at configure time
it must be explicitly overriden at compile time---just overriding
CFLAGS will not override CXXFLAGS as well.)

Makefile
configure

index 889a78c9d1ed243c1019fcc35e272b92f6ec8e27..d112be6adf3c90d105398f3cc6d501419041d429 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,3 @@
-# Default FLAGS, (can be overridden by user such as "make CFLAGS=-g")
-CFLAGS=-O2
-
 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
 WARN_CFLAGS=$(WARN_CXXFLAGS) -Wmissing-declarations
 
index 488b3bd7965a57471c1fa187ffe7c4eb659a2e10..ff8baa5e52696686461d82d5cf9728e1c5448a0b 100755 (executable)
--- a/configure
+++ b/configure
@@ -2,6 +2,8 @@
 
 CC=${CC:-gcc}
 CXX=${CXX:-g++}
+CFLAGS=${CFLAGS:--O2}
+CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
 
 # defaults
 PREFIX=/usr/local
@@ -195,6 +197,12 @@ CC = ${CC}
 # The C++ compiler to use
 CXX = ${CXX}
 
+# Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
+CFLAGS = ${CFLAGS}
+
+# Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
+CXXFLAGS = ${CXXFLAGS}
+
 # The prefix to which notmuch should be installed
 prefix = ${PREFIX}