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

Commit 365ee96

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 4e8b2fd commit 365ee96

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
@@ -1468,6 +1468,26 @@ su - postgres
14681468
</variablelist>
14691469
</para>
14701470

1471+
<para>
1472+
Sometimes it is useful to add compiler flags after-the-fact to the set
1473+
that were chosen by <filename>configure</>. An important example is
1474+
that <application>gcc</>'s <option>-Werror</> option cannot be included
1475+
in the <envar>CFLAGS</envar> passed to <filename>configure</>, because
1476+
it will break many of <filename>configure</>'s built-in tests. To add
1477+
such flags, include them in the <envar>COPT</envar> environment variable
1478+
while running <filename>make</>. The contents of <envar>COPT</envar>
1479+
are added to both the <envar>CFLAGS</envar> and <envar>LDFLAGS</envar>
1480+
options set up by <filename>configure</>. For example, you could do
1481+
<screen>
1482+
<userinput>make COPT='-Werror'</>
1483+
</screen>
1484+
or
1485+
<screen>
1486+
<userinput>export COPT='-Werror'</>
1487+
<userinput>make</>
1488+
</screen>
1489+
</para>
1490+
14711491
<note>
14721492
<para>
14731493
When developing code inside the server, it is recommended to
@@ -1488,6 +1508,14 @@ su - postgres
14881508
<option>-O0</>. An easy way to do this is by passing an option
14891509
to <application>make</>: <command>make PROFILE=-O0 file.o</>.
14901510
</para>
1511+
1512+
<para>
1513+
The <envar>COPT</> and <envar>PROFILE</> environment variables are
1514+
actually handled identically by the <productname>PostgreSQL</>
1515+
makefiles. Which to use is a matter of preference, but a common habit
1516+
among developers is to use <envar>PROFILE</> for one-time flag
1517+
adjustments, while <envar>COPT</> might be kept set all the time.
1518+
</para>
14911519
</note>
14921520
</step>
14931521

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)