pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christoph Berg <christoph.berg@credativ.de>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well
Date: Fri, 1 Feb 2019 12:42:36 +0900
Message-ID: <20190201034236.GG2179@paquier.xyz> (raw)
In-Reply-To: <20190131021911.GG16781@paquier.xyz>
References: <20190122201923.3iaz7lxs3ckibzwo@alap3.anarazel.de>
	<201901222111.ki5n27j2e5cf@alvherre.pgsql>
	<20190123004722.GE3873@paquier.xyz>
	<20190129151846.GI9860@msg.credativ.de>
	<20190130015127.hciz36lpmu7prrx2@alap3.anarazel.de>
	<20190130134100.GD4383@msg.credativ.de>
	<20190131004451.GE16781@paquier.xyz>
	<17488.1548897511@sss.pgh.pa.us>
	<20190131021911.GG16781@paquier.xyz>

On Thu, Jan 31, 2019 at 11:19:11AM +0900, Michael Paquier wrote:
> Ah yes, good point about CFLAGS and LDFLAGS.  It would be better to
> add a comment about that and document the difference, aka "prepend" or
> "append" the flag values.
> 
> CXXFLAGS applies to compiler options like -g -O2 which you would like
> to enforce for the C++ compiler, so it seems to me that like CFLAGS
> the custom values should be added at the end and not at the beginning,
> no?

Attached is a patch doing that.  Thoughts?
--
Michael

Attachments:

  [text/x-diff] pgxs-add-flags-michael.patch (2.2K, ../20190201034236.GG2179@paquier.xyz/2-pgxs-add-flags-michael.patch)
  download | inline diff:
diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
index a6b77c1cfe..b5e59d542a 100644
--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -1353,7 +1353,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 d214cb9cf2..909a49f5be 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -52,7 +52,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
@@ -119,6 +122,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
 

  [application/pgp-signature] signature.asc (832B, ../20190201034236.GG2179@paquier.xyz/3-signature.asc)
  download

view thread (31+ messages)  latest in thread

Message-ID: <20190201034236.GG2179@paquier.xyz>
Permalink:  ../20190201034236.GG2179@paquier.xyz/
Also on:    postgresql.org/message-id/20190201034236.GG2179@paquier.xyz

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us, christoph.berg@credativ.de, andres@anarazel.de, alvherre@2ndquadrant.com, peter.eisentraut@2ndquadrant.com
  Subject: Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well
  In-Reply-To: <20190201034236.GG2179@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox