# ********************************************************************** # * $Id: Makefile.in # * # * PostGIS - Spatial Types for PostgreSQL # * http://postgis.refractions.net # * Copyright 2008 Mark Cave-Ayland # * # * This is free software; you can redistribute and/or modify it under # * the terms of the GNU General Public Licence. See the COPYING file. # * # ********************************************************************** # PGXS information # # Note that PGXS currently doesn't handle building FE executables, but we need # the INSTALL and DESTDIR variables so we can get the correct install paths. # Hence we include the PGXS Makefile here, but ensure that we override the # 'all' and 'install' targets with the ones we really want to use below. PG_CONFIG = @PGCONFIG@ PGXS := @PGXS@ include $(PGXS) # Set CFLAGS afer PGXS, otherwise it will get overwritten with the PGXS # version which is not what we want. CC=@CC@ CFLAGS=@CFLAGS@ @PICFLAGS@ @WARNFLAGS@ # Filenames with extension as determined by the OS PGSQL2SHP=pgsql2shp@EXESUFFIX@ SHP2PGSQL-CLI=shp2pgsql@EXESUFFIX@ SHP2PGSQL-GUI=shp2pgsql-gui@EXESUFFIX@ # PostgreSQL frontend CPPFLAGS and LDFLAGS (for compiling and linking with libpq) PGSQL_FE_CPPFLAGS=@PGSQL_FE_CPPFLAGS@ PGSQL_FE_LDFLAGS=@PGSQL_FE_LDFLAGS@ # iconv flags ICONV_LDFLAGS=@ICONV_LDFLAGS@ ICONV_CFLAGS=@ICONV_CFLAGS@ # liblwgeom LIBLWGEOM=../liblwgeom/liblwgeom.a # GTK includes and libraries GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ # If REGRESS=1 passed as a parameter, change the default install paths # so that no prefix is included. This allows us to relocate to a temporary # directory for regression testing. ifeq ($(REGRESS),1) bindir=/bin pkglibdir=/lib datadir=/share endif # The real parts of the Makefile all: $(SHP2PGSQL-CLI) $(PGSQL2SHP) @GTK_BUILD@ gui: $(SHP2PGSQL-GUI) $(SHP2PGSQL-CLI) # liblwgeom.a dependency to allow "make install" in # the loader/ subdirectory to work $(LIBLWGEOM): make -C ../liblwgeom shp2pgsql-core.o: shp2pgsql-core.c $(CC) $(CFLAGS) $(ICONV_CFLAGS) -c $< pgsql2shp.o: pgsql2shp.c $(CC) $(CFLAGS) $(ICONV_CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $< $(PGSQL2SHP): shpopen.o dbfopen.o getopt.o pgsql2shp.o $(LIBLWGEOM) $(CC) $(CFLAGS) $^ $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm -o $@ $(SHP2PGSQL-CLI): stringbuffer.o shpopen.o dbfopen.o getopt.o shp2pgsql-core.o shp2pgsql-cli.o $(LIBLWGEOM) $(CC) $(CFLAGS) $^ -o $@ $(ICONV_LDFLAGS) -lm shp2pgsql-gui.o: shp2pgsql-gui.c $(CC) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) $(GTK_CFLAGS) -o $@ -c shp2pgsql-gui.c $(SHP2PGSQL-GUI): stringbuffer.o shpopen.o dbfopen.o shp2pgsql-core.o shp2pgsql-gui.o $(LIBLWGEOM) $(CC) $(CFLAGS) $^ -o $@ $(GTK_LIBS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm install: all @mkdir -p $(DESTDIR)$(bindir) $(INSTALL) $(PGSQL2SHP) $(DESTDIR)$(bindir) $(INSTALL) $(SHP2PGSQL-CLI) $(DESTDIR)$(bindir) uninstall: @rm -f $(DESTDIR)$(bindir)/$(PGSQL2SHP) @rm -f $(DESTDIR)$(bindir)/$(SHP2PGSQL-CLI) clean: @rm -f *.o $(SHP2PGSQL-CLI) $(PGSQL2SHP)