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

Commit 946430d

Browse files
committed
Add PG_CFLAGS, PG_CXXFLAGS, and PG_LDFLAGS variables to PGXS
Add PG_CFLAGS, PG_CXXFLAGS, and PG_LDFLAGS variables to pgxs.mk which will be appended or prepended to the corresponding make variables. Notably, there was previously no way to pass custom CXXFLAGS to third party extension module builds, COPT and PROFILE supporting only CFLAGS and LDFLAGS. Backpatch all the way down to ease integration with existing extensions. Author: Christoph Berg Reviewed-by: Andres Freund, Tom Lane, Michael Paquier Discussion: https://postgr.es/m/20181113104005.GA32154@msg.credativ.de Backpatch-through: 9.4
1 parent 9044136 commit 946430d

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

doc/src/sgml/extend.sgml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,34 @@ include $(PGXS)
13251325
<term><varname>PG_CPPFLAGS</varname></term>
13261326
<listitem>
13271327
<para>
1328-
will be added to <varname>CPPFLAGS</varname>
1328+
will be prepended to <varname>CPPFLAGS</varname>
1329+
</para>
1330+
</listitem>
1331+
</varlistentry>
1332+
1333+
<varlistentry>
1334+
<term><varname>PG_CFLAGS</varname></term>
1335+
<listitem>
1336+
<para>
1337+
will be appended to <varname>CFLAGS</varname>
1338+
</para>
1339+
</listitem>
1340+
</varlistentry>
1341+
1342+
<varlistentry>
1343+
<term><varname>PG_CXXFLAGS</varname></term>
1344+
<listitem>
1345+
<para>
1346+
will be appended to <varname>CXXFLAGS</varname>
1347+
</para>
1348+
</listitem>
1349+
</varlistentry>
1350+
1351+
<varlistentry>
1352+
<term><varname>PG_LDFLAGS</varname></term>
1353+
<listitem>
1354+
<para>
1355+
will be prepended to <varname>LDFLAGS</varname>
13291356
</para>
13301357
</listitem>
13311358
</varlistentry>

src/makefiles/pgxs.mk

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
# NO_INSTALLCHECK -- don't define an installcheck target, useful e.g. if
5050
# tests require special configuration, or don't use pg_regress
5151
# EXTRA_CLEAN -- extra files to remove in 'make clean'
52-
# PG_CPPFLAGS -- will be added to CPPFLAGS
52+
# PG_CPPFLAGS -- will be prepended to CPPFLAGS
53+
# PG_CFLAGS -- will be appended to CFLAGS
54+
# PG_CXXFLAGS -- will be appended to CXXFLAGS
55+
# PG_LDFLAGS -- will be prepended to LDFLAGS
5356
# PG_LIBS -- will be added to PROGRAM link line
5457
# PG_LIBS_INTERNAL -- same, for references to libraries within build tree
5558
# SHLIB_LINK -- will be added to MODULE_big link line
@@ -116,6 +119,15 @@ endif
116119
ifdef PG_CPPFLAGS
117120
override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
118121
endif
122+
ifdef PG_CFLAGS
123+
override CFLAGS := $(CFLAGS) $(PG_CFLAGS)
124+
endif
125+
ifdef PG_CXXFLAGS
126+
override CXXFLAGS := $(CXXFLAGS) $(PG_CXXFLAGS)
127+
endif
128+
ifdef PG_LDFLAGS
129+
override LDFLAGS := $(PG_LDFLAGS) $(LDFLAGS)
130+
endif
119131

120132
# logic for HEADERS_* stuff
121133

0 commit comments

Comments
 (0)