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
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
signature.asc
Description: PGP signature