Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a029d2c

Browse files
committed
Document usage of COPT environment variable for adjusting configure flags.
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
1 parent 39370e6 commit a029d2c

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

doc/src/sgml/installation.sgml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,26 @@ su - postgres
14941494
</variablelist>
14951495
</para>
14961496

1497+
<para>
1498+
Sometimes it is useful to add compiler flags after-the-fact to the set
1499+
that were chosen by <filename>configure</>. An important example is
1500+
that <application>gcc</>'s <option>-Werror</> option cannot be included
1501+
in the <envar>CFLAGS</envar> passed to <filename>configure</>, because
1502+
it will break many of <filename>configure</>'s built-in tests. To add
1503+
such flags, include them in the <envar>COPT</envar> environment variable
1504+
while running <filename>make</>. The contents of <envar>COPT</envar>
1505+
are added to both the <envar>CFLAGS</envar> and <envar>LDFLAGS</envar>
1506+
options set up by <filename>configure</>. For example, you could do
1507+
<screen>
1508+
<userinput>make COPT='-Werror'</>
1509+
</screen>
1510+
or
1511+
<screen>
1512+
<userinput>export COPT='-Werror'</>
1513+
<userinput>make</>
1514+
</screen>
1515+
</para>
1516+
14971517
<note>
14981518
<para>
14991519
When developing code inside the server, it is recommended to
@@ -1514,6 +1534,14 @@ su - postgres
15141534
<option>-O0</>. An easy way to do this is by passing an option
15151535
to <application>make</>: <command>make PROFILE=-O0 file.o</>.
15161536
</para>
1537+
1538+
<para>
1539+
The <envar>COPT</> and <envar>PROFILE</> environment variables are
1540+
actually handled identically by the <productname>PostgreSQL</>
1541+
makefiles. Which to use is a matter of preference, but a common habit
1542+
among developers is to use <envar>PROFILE</> for one-time flag
1543+
adjustments, while <envar>COPT</> might be kept set all the time.
1544+
</para>
15171545
</note>
15181546
</step>
15191547

src/Makefile.global.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,11 @@ ifneq ($(CUSTOM_COPT),)
582582
COPT= $(CUSTOM_COPT)
583583
endif
584584

585+
#
586+
# These variables are meant to be set in the environment of "make"
587+
# to add flags to whatever configure picked. Unlike the ones above,
588+
# they are documented.
589+
#
585590
ifdef COPT
586591
CFLAGS += $(COPT)
587592
LDFLAGS += $(COPT)

0 commit comments

Comments
 (0)