@@ -1494,6 +1494,26 @@ su - postgres
1494
1494
</variablelist>
1495
1495
</para>
1496
1496
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
+
1497
1517
<note>
1498
1518
<para>
1499
1519
When developing code inside the server, it is recommended to
@@ -1514,6 +1534,14 @@ su - postgres
1514
1534
<option>-O0</>. An easy way to do this is by passing an option
1515
1535
to <application>make</>: <command>make PROFILE=-O0 file.o</>.
1516
1536
</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>
1517
1545
</note>
1518
1546
</step>
1519
1547
0 commit comments