Document usage of COPT environment variable for adjusting configure flags.
authorTom Lane
Fri, 17 Feb 2017 21:11:03 +0000 (16:11 -0500)
committerTom Lane
Fri, 17 Feb 2017 21:11:03 +0000 (16:11 -0500)
Also add to the existing rather half-baked description of PROFILE,
which does exactly the same thing, but I think people use it differently.

Discussion: https://postgr.es/m/16461.1487361849@sss.pgh.pa.us

doc/src/sgml/installation.sgml
src/Makefile.global.in

index 94935ebe4394ee5b1c0d252f656c26bba19bf5ba..9fa8e88c325b95351fc53b84261a446e935ead3c 100644 (file)
@@ -1426,6 +1426,26 @@ su - postgres
      
     
 
+    
+     Sometimes it is useful to add compiler flags after-the-fact to the set
+     that were chosen by configure.  An important example is
+     that gcc's 
+     in the CFLAGS passed to configure, because
+     it will break many of configure's built-in tests.  To add
+     such flags, include them in the COPT environment variable
+     while running gmake.  The contents of COPT
+     are added to both the CFLAGS and LDFLAGS
+     options set up by configure.  For example, you could do
+
+gmake COPT='-Werror'
+
+     or
+
+export COPT='-Werror'
+gmake
+
+    
+
     
      
       When developing code inside the server, it is recommended to
@@ -1446,6 +1466,14 @@ su - postgres
       
       to make: gmake PROFILE=-O0 file.o.
      
+
+     
+      The COPT and PROFILE environment variables are
+      actually handled identically by the PostgreSQL
+      makefiles.  Which to use is a matter of preference, but a common habit
+      among developers is to use PROFILE for one-time flag
+      adjustments, while COPT might be kept set all the time.
+     
     
    
 
index 23ecaf435fdf3ed0294cc36b63750684f922b9da..057e9ec398eaa9540a8722f6a96cd29611b5c31a 100644 (file)
@@ -483,6 +483,11 @@ ifneq ($(CUSTOM_COPT),)
   COPT= $(CUSTOM_COPT)
 endif
 
+#
+# These variables are meant to be set in the environment of "make"
+# to add flags to whatever configure picked.  Unlike the ones above,
+# they are documented.
+#
 ifdef COPT
    CFLAGS += $(COPT)
    LDFLAGS += $(COPT)