Re: To Michael Paquier 2019-01-07 <20190107091734.ga1...@msg.credativ.de> > Updated patch attached.
Here's another revision that doesn't add an extra CXXOPT variable but just extends CXXFLAGS whenever COPT or PROFILE are set, which seems more usable. It also updates the documentation. Christoph -- Senior Berater, Tel.: +49 2166 9901 187 credativ GmbH, HRB Mönchengladbach 12080, USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer Unser Umgang mit personenbezogenen Daten unterliegt folgenden Bestimmungen: https://www.credativ.de/datenschutz
>From 5abf37ae89e1680359e899de46e7ed709fc37125 Mon Sep 17 00:00:00 2001 From: Christoph Berg <christoph.b...@credativ.de> Date: Tue, 13 Nov 2018 11:35:26 +0100 Subject: [PATCH] Add more flexibility for passing custom compiler flags The existing machinery for extending CFLAGS and LDFLAGS via COPT and PROFILE neglected to extend CXXFLAGS as well, causing third party extensions written in C++ not to get the extra flags. Also add PG_CFLAGS, PG_CXXFLAGS, and PG_LDFLAGS variables to pgxs.mk which will append to the corresponding make variables. --- doc/src/sgml/installation.sgml | 2 +- src/Makefile.global.in | 2 ++ src/makefiles/pgxs.mk | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 3c9544cc27..98af5d6f56 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -1536,7 +1536,7 @@ su - postgres it will break many of <filename>configure</filename>'s built-in tests. To add such flags, include them in the <envar>COPT</envar> environment variable while running <filename>make</filename>. The contents of <envar>COPT</envar> - are added to both the <envar>CFLAGS</envar> and <envar>LDFLAGS</envar> + are added to both the <envar>CFLAGS</envar>, <envar>CXXFLAGS</envar>, and <envar>LDFLAGS</envar> options set up by <filename>configure</filename>. For example, you could do <screen> <userinput>make COPT='-Werror'</userinput> diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 41c131412e..665923d9c3 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -676,11 +676,13 @@ endif # ifdef COPT CFLAGS += $(COPT) + CXXFLAGS += $(COPT) LDFLAGS += $(COPT) endif ifdef PROFILE CFLAGS += $(PROFILE) + CXXFLAGS += $(PROFILE) LDFLAGS += $(PROFILE) endif diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk index d214cb9cf2..56a8b26183 100644 --- a/src/makefiles/pgxs.mk +++ b/src/makefiles/pgxs.mk @@ -53,6 +53,9 @@ # 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_CFLAGS -- will be added to CFLAGS +# PG_CXXFLAGS -- will be added to CXXFLAGS +# PG_LDFLAGS -- will be added 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 @@ -119,6 +122,15 @@ endif ifdef PG_CPPFLAGS override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS) endif +ifdef PG_CFLAGS +override CFLAGS := $(PG_CFLAGS) $(CFLAGS) +endif +ifdef PG_CXXFLAGS +override CXXFLAGS := $(PG_CXXFLAGS) $(CXXFLAGS) +endif +ifdef PG_LDFLAGS +override LDFLAGS := $(PG_LDFLAGS) $(LDFLAGS) +endif # logic for HEADERS_* stuff -- 2.19.2