@@ -1468,6 +1468,26 @@ su - postgres
1468
1468
</variablelist>
1469
1469
</para>
1470
1470
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
+
1471
1491
<note>
1472
1492
<para>
1473
1493
When developing code inside the server, it is recommended to
@@ -1488,6 +1508,14 @@ su - postgres
1488
1508
<option>-O0</>. An easy way to do this is by passing an option
1489
1509
to <application>make</>: <command>make PROFILE=-O0 file.o</>.
1490
1510
</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>
1491
1519
</note>
1492
1520
</step>
1493
1521
0 commit comments