| 1 | # ********************************************************************** |
|---|
| 2 | # * $Id: Makefile.in |
|---|
| 3 | # * |
|---|
| 4 | # * PostGIS - Spatial Types for PostgreSQL |
|---|
| 5 | # * http://postgis.refractions.net |
|---|
| 6 | # * Copyright 2008 Mark Cave-Ayland |
|---|
| 7 | # * |
|---|
| 8 | # * This is free software; you can redistribute and/or modify it under |
|---|
| 9 | # * the terms of the GNU General Public Licence. See the COPYING file. |
|---|
| 10 | # * |
|---|
| 11 | # ********************************************************************** |
|---|
| 12 | |
|---|
| 13 | # PGXS information |
|---|
| 14 | # |
|---|
| 15 | # Note that PGXS currently doesn't handle building FE executables, but we need |
|---|
| 16 | # the INSTALL and DESTDIR variables so we can get the correct install paths. |
|---|
| 17 | # Hence we include the PGXS Makefile here, but ensure that we override the |
|---|
| 18 | # 'all' and 'install' targets with the ones we really want to use below. |
|---|
| 19 | PG_CONFIG = @PGCONFIG@ |
|---|
| 20 | PGXS := @PGXS@ |
|---|
| 21 | include $(PGXS) |
|---|
| 22 | |
|---|
| 23 | # Set CFLAGS afer PGXS, otherwise it will get overwritten with the PGXS |
|---|
| 24 | # version which is not what we want. |
|---|
| 25 | CC=@CC@ |
|---|
| 26 | CFLAGS=@ICONV_CFLAGS@ @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ |
|---|
| 27 | |
|---|
| 28 | # Filenames with extension as determined by the OS |
|---|
| 29 | PGSQL2SHP=pgsql2shp@EXESUFFIX@ |
|---|
| 30 | SHP2PGSQL=shp2pgsql@EXESUFFIX@ |
|---|
| 31 | SHP2PGSQL-GUI=shp2pgsql-gui@EXESUFFIX@ |
|---|
| 32 | SHP2PGSQL-CLI=shp2pgsql-cli@EXESUFFIX@ |
|---|
| 33 | |
|---|
| 34 | # PostgreSQL frontend CPPFLAGS and LDFLAGS (for compiling and linking with libpq) |
|---|
| 35 | PGSQL_FE_CPPFLAGS=@PGSQL_FE_CPPFLAGS@ |
|---|
| 36 | PGSQL_FE_LDFLAGS=@PGSQL_FE_LDFLAGS@ |
|---|
| 37 | |
|---|
| 38 | # iconv flags |
|---|
| 39 | ICONV_LDFLAGS=@ICONV_LDFLAGS@ |
|---|
| 40 | |
|---|
| 41 | # liblwgeom |
|---|
| 42 | LIBLWGEOM=../liblwgeom/liblwgeom.a |
|---|
| 43 | |
|---|
| 44 | # GTK includes and libraries |
|---|
| 45 | GTK_CFLAGS = @GTK_CFLAGS@ |
|---|
| 46 | GTK_LIBS = @GTK_LIBS@ |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | # The real parts of the Makefile |
|---|
| 50 | all: $(SHP2PGSQL) $(PGSQL2SHP) @GTK_BUILD@ |
|---|
| 51 | |
|---|
| 52 | gui: $(SHP2PGSQL-GUI) $(SHP2PGSQL-CLI) |
|---|
| 53 | |
|---|
| 54 | # liblwgeom.a dependency to allow "make install" in |
|---|
| 55 | # the loader/ subdirectory to work |
|---|
| 56 | $(LIBLWGEOM): |
|---|
| 57 | make -C ../liblwgeom |
|---|
| 58 | |
|---|
| 59 | pgsql2shp.o: pgsql2shp.c |
|---|
| 60 | $(CC) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $< |
|---|
| 61 | |
|---|
| 62 | $(PGSQL2SHP): shpopen.o dbfopen.o getopt.o pgsql2shp.o safileio.c $(LIBLWGEOM) |
|---|
| 63 | $(CC) $(CFLAGS) $^ $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm -o $@ |
|---|
| 64 | |
|---|
| 65 | $(SHP2PGSQL): shpopen.o dbfopen.o safileio.c getopt.o shp2pgsql.o $(LIBLWGEOM) |
|---|
| 66 | $(CC) $(CFLAGS) $^ $(ICONV_LDFLAGS) -lm -o $@ |
|---|
| 67 | |
|---|
| 68 | shp2pgsql-core-gui.o: shp2pgsql-core.c |
|---|
| 69 | $(CC) $(CFLAGS) $(ICONV_CFLAGS) -DPGUI -c -o $@ $^ |
|---|
| 70 | |
|---|
| 71 | shp2pgsql-gui.o: shp2pgsql-gui.c |
|---|
| 72 | $(CC) $(PGSQL_FE_CPPFLAGS) $(CFLAGS) $(GTK_CFLAGS) -o $@ -c shp2pgsql-gui.c |
|---|
| 73 | |
|---|
| 74 | $(SHP2PGSQL-GUI): stringbuffer.o shpopen.o dbfopen.o safileio.c shp2pgsql-core-gui.o shp2pgsql-gui.o $(LIBLWGEOM) |
|---|
| 75 | $(CC) $(CFLAGS) $^ -o $@ $(GTK_LIBS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm |
|---|
| 76 | |
|---|
| 77 | $(SHP2PGSQL-CLI): stringbuffer.o shpopen.o dbfopen.o safileio.c getopt.o shp2pgsql-core.o shp2pgsql-cli.o $(LIBLWGEOM) |
|---|
| 78 | $(CC) $(CFLAGS) $^ -o $@ $(ICONV_LDFLAGS) -lm |
|---|
| 79 | |
|---|
| 80 | install: all |
|---|
| 81 | @mkdir -p $(DESTDIR)$(bindir) |
|---|
| 82 | $(INSTALL) $(PGSQL2SHP) $(DESTDIR)$(bindir) |
|---|
| 83 | $(INSTALL) $(SHP2PGSQL) $(DESTDIR)$(bindir) |
|---|
| 84 | |
|---|
| 85 | uninstall: |
|---|
| 86 | @rm -f $(DESTDIR)$(bindir)/$(PGSQL2SHP) |
|---|
| 87 | @rm -f $(DESTDIR)$(bindir)/$(SHP2PGSQL) |
|---|
| 88 | |
|---|
| 89 | clean: |
|---|
| 90 | @rm -f *.o $(SHP2PGSQL) $(PGSQL2SHP) |
|---|