[postgis-devel] [PostGIS] #237: loader makefile CFLAGS altered by PGXS

PostGIS trac at osgeo.org
Sat Aug 8 10:44:40 PDT 2009


#237: loader makefile CFLAGS altered by PGXS
-----------------------+----------------------------------------------------
 Reporter:  kyngchaos  |       Owner:  pramsey      
     Type:  defect     |      Status:  new          
 Priority:  medium     |   Milestone:  postgis 1.4.1
Component:  postgis    |     Version:  1.4.X        
 Keywords:             |  
-----------------------+----------------------------------------------------
 It looks like the pgxs include in the loader makefile is altering CFLAGS.
 On OSX, I use CFLAGS to insert arch flags for a multiarchitecture build
 (PPC+Intel).  PGXS separates compilation and linking flags from CFLAGS,
 and in it's own rules reinserts these where needed.  So, all the object
 files that don't have rules in the loader makefile (shpopen.o, dbfopen.o,
 getopt.o) are compiling with my arch flags.

 But the custom object rules in the makefile (ie pgsql2shp.o), and the
 program link rules don't get the benefit of PGXS' reinserting magic, and
 compile/link without my arch flags.

 For example, with a CFLAGS in the makefile:

 {{{
 CFLAGS=-Os -arch ppc -arch i386 -arch ppc64 -arch x86_64  \
 -fno-common -DPIC  -Wall -Wmissing-prototypes
 }}}

 make produces (I stripped out some flags to reduce clutter):

 {{{
 gcc -no-cpp-precomp -Os -D_FILE_OFFSET_BITS=64 [snip] -arch ppc -arch i386
 -arch ppc64 -arch x86_64
 [snip] -c -o shpopen.o shpopen.c
 gcc -no-cpp-precomp -Os -D_FILE_OFFSET_BITS=64 [snip] -arch ppc -arch i386
 -arch ppc64 -arch x86_64
 [snip] -c -o dbfopen.o dbfopen.c
 gcc -no-cpp-precomp -Os -D_FILE_OFFSET_BITS=64 [snip] -arch ppc -arch i386
 -arch ppc64 -arch x86_64
 [snip] -c -o getopt.o getopt.c
 gcc -no-cpp-precomp -Os -D_FILE_OFFSET_BITS=64 [snip] -arch ppc -arch i386
 -arch ppc64 -arch x86_64
 [snip] -c -o shp2pgsql.o shp2pgsql.c
 gcc -no-cpp-precomp -Os -D_FILE_OFFSET_BITS=64 [snip] [***arch flags
 missing here***]
 shpopen.o dbfopen.o getopt.o shp2pgsql.o ../liblwgeom/liblwgeom.a -liconv
 -lm -o shp2pgsql
 gcc -no-cpp-precomp -Os -D_FILE_OFFSET_BITS=64 [snip] [***arch flags
 missing here***]
 -I/usr/local/pgsql/include -c pgsql2shp.c
 gcc -no-cpp-precomp -Os -D_FILE_OFFSET_BITS=64 [snip] [***arch flags
 missing here***]
 shpopen.o dbfopen.o getopt.o pgsql2shp.o ../liblwgeom/liblwgeom.a -liconv
 -L/usr/local/pgsql/lib -lpq -lm -o pgsql2shp
 }}}

 (The FILE_OFFSET_BITS and warning flags (the snipped part) between the -Os
 flag and the arch flags is the result of PGXS separating and reinserting
 parts of CFLAGS, plus its own stuff.)

 If I move the CFLAGS line to after the include $(PGXS), CFLAGS is
 untouched and you get what was intended by the loader makefile.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/237>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS


More information about the postgis-devel mailing list