aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-02-03 17:48:35 +0900
committerMichael Paquier <michael@paquier.xyz>2019-02-03 17:48:35 +0900
commit946430da6a0b91cac5607758264f506d25b3321f (patch)
treed0b36d4206e19c72b1458d38877e2093b20cc4d0
parent904413637f8b04aab02cbe03173a1a0bdadc2b6b (diff)
downloadpostgresql-946430da6a0b91cac5607758264f506d25b3321f.tar.gz
postgresql-946430da6a0b91cac5607758264f506d25b3321f.zip
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
-rw-r--r--doc/src/sgml/extend.sgml29
-rw-r--r--src/makefiles/pgxs.mk14
2 files changed, 41 insertions, 2 deletions
diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
index 695e07fb384..421e059e7bd 100644
--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -1325,7 +1325,34 @@ include $(PGXS)
<term><varname>PG_CPPFLAGS</varname></term>
<listitem>
<para>
- will be added to <varname>CPPFLAGS</varname>
+ will be prepended to <varname>CPPFLAGS</varname>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>PG_CFLAGS</varname></term>
+ <listitem>
+ <para>
+ will be appended to <varname>CFLAGS</varname>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>PG_CXXFLAGS</varname></term>
+ <listitem>
+ <para>
+ will be appended to <varname>CXXFLAGS</varname>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>PG_LDFLAGS</varname></term>
+ <listitem>
+ <para>
+ will be prepended to <varname>LDFLAGS</varname>
</para>
</listitem>
</varlistentry>
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index 74942b6e194..123bdffaa6a 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -49,7 +49,10 @@
# NO_INSTALLCHECK -- don't define an installcheck target, useful e.g. if
# tests require special configuration, or don't use pg_regress
# EXTRA_CLEAN -- extra files to remove in 'make clean'
-# PG_CPPFLAGS -- will be added to CPPFLAGS
+# PG_CPPFLAGS -- will be prepended to CPPFLAGS
+# PG_CFLAGS -- will be appended to CFLAGS
+# PG_CXXFLAGS -- will be appended to CXXFLAGS
+# PG_LDFLAGS -- will be prepended to LDFLAGS
# PG_LIBS -- will be added to PROGRAM link line
# PG_LIBS_INTERNAL -- same, for references to libraries within build tree
# SHLIB_LINK -- will be added to MODULE_big link line
@@ -116,6 +119,15 @@ endif
ifdef PG_CPPFLAGS
override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
endif
+ifdef PG_CFLAGS
+override CFLAGS := $(CFLAGS) $(PG_CFLAGS)
+endif
+ifdef PG_CXXFLAGS
+override CXXFLAGS := $(CXXFLAGS) $(PG_CXXFLAGS)
+endif
+ifdef PG_LDFLAGS
+override LDFLAGS := $(PG_LDFLAGS) $(LDFLAGS)
+endif
# logic for HEADERS_* stuff