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

Commit 5e63df8

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 073afae commit 5e63df8

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
@@ -1190,7 +1190,34 @@ include $(PGXS)
11901190
<term><varname>PG_CPPFLAGS</varname></term>
11911191
<listitem>
11921192
<para>
1193-
will be added to <varname>CPPFLAGS</varname>
1193+
will be prepended to <varname>CPPFLAGS</varname>
1194+
</para>
1195+
</listitem>
1196+
</varlistentry>
1197+
1198+
<varlistentry>
1199+
<term><varname>PG_CFLAGS</varname></term>
1200+
<listitem>
1201+
<para>
1202+
will be appended to <varname>CFLAGS</varname>
1203+
</para>
1204+
</listitem>
1205+
</varlistentry>
1206+
1207+
<varlistentry>
1208+
<term><varname>PG_CXXFLAGS</varname></term>
1209+
<listitem>
1210+
<para>
1211+
will be appended to <varname>CXXFLAGS</varname>
1212+
</para>
1213+
</listitem>
1214+
</varlistentry>
1215+
1216+
<varlistentry>
1217+
<term><varname>PG_LDFLAGS</varname></term>
1218+
<listitem>
1219+
<para>
1220+
will be prepended to <varname>LDFLAGS</varname>
11941221
</para>
11951222
</listitem>
11961223
</varlistentry>

src/makefiles/pgxs.mk

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
# REGRESS -- list of regression test cases (without suffix)
4242
# REGRESS_OPTS -- additional switches to pass to pg_regress
4343
# EXTRA_CLEAN -- extra files to remove in 'make clean'
44-
# PG_CPPFLAGS -- will be added to CPPFLAGS
44+
# PG_CPPFLAGS -- will be prepended to CPPFLAGS
45+
# PG_CFLAGS -- will be appended to CFLAGS
46+
# PG_CXXFLAGS -- will be appended to CXXFLAGS
47+
# PG_LDFLAGS -- will be prepended to LDFLAGS
4548
# PG_LIBS -- will be added to PROGRAM link line
4649
# PG_LIBS_INTERNAL -- same, for references to libraries within build tree
4750
# SHLIB_LINK -- will be added to MODULE_big link line
@@ -98,6 +101,15 @@ endif
98101
ifdef PG_CPPFLAGS
99102
override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
100103
endif
104+
ifdef PG_CFLAGS
105+
override CFLAGS := $(CFLAGS) $(PG_CFLAGS)
106+
endif
107+
ifdef PG_CXXFLAGS
108+
override CXXFLAGS := $(CXXFLAGS) $(PG_CXXFLAGS)
109+
endif
110+
ifdef PG_LDFLAGS
111+
override LDFLAGS := $(PG_LDFLAGS) $(LDFLAGS)
112+
endif
101113

102114
all: $(PROGRAM) $(DATA_built) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .control, $(EXTENSION))
103115

0 commit comments

Comments
 (0)