postgis/loader/Makefile.in

158 lines
4.7 KiB
Makefile

# **********************************************************************
# * $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-CLI=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
LIBICONV=@LIBICONV@
LTLIBICONV=@LTLIBICONV@
# GTK includes and libraries
GTK_CFLAGS = @GTK_CFLAGS@ @IGE_MAC_CFLAGS@
GTK_LIBS = @GTK_LIBS@ @IGE_MAC_LIBS@
GTK_WIN32_FLAGS = @GTK_WIN32_FLAGS@
GTK_WIN32_RES = @GTK_WIN32_RES@
# GetText includes and libraries
GETTEXT_CFLAGS = @GETTEXT_CFLAGS@
GETTEXT_LDFLAGS = @GETTEXT_LDFLAGS@ @LIBINTL@
nls_build = @USE_NLS@
ifdef nls_build
localedir = $(shell $(PG_CONFIG) --localedir)
CFLAGS += -DUSE_NLS
CFLAGS += -DLOCALEDIR=\"$(localedir)\"
LANGUAGES = fr
endif
# Built out CFLAGS with ICONV and GETTEXT
CFLAGS += $(GETTEXT_CFLAGS) $(ICONV_CFLAGS)
# 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
# We test this variable later to see if we're building the GUI
gtk_build = @GTK_BUILD@
# The real parts of the Makefile
all: $(SHP2PGSQL-CLI) $(PGSQL2SHP-CLI) @GTK_BUILD@
gui: $(SHP2PGSQL-GUI) $(SHP2PGSQL-CLI) @GTK_WIN32_RES@
shp2pgsql-gui.res: shp2pgsql-gui.rc shp2pgsql-gui.ico
windres $< -O coff -o $@
# 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) -c $<
pgsql2shp-core.o: pgsql2shp-core.c
$(CC) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $<
pgsql2shp-cli.o: pgsql2shp-cli.c
$(CC) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $<
$(PGSQL2SHP-CLI): shpopen.o dbfopen.o getopt.o pgsql2shp-core.o shpcommon.o pgsql2shp-cli.o safileio.o $(LIBLWGEOM)
$(CC) $(CFLAGS) $^ $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) $(GETTEXT_LDFLAGS) -lm -o $@
$(SHP2PGSQL-CLI): shpopen.o dbfopen.o getopt.o shp2pgsql-core.o shpcommon.o shp2pgsql-cli.o safileio.o $(LIBLWGEOM)
$(CC) $(CFLAGS) $^ -o $@ $(GETTEXT_LDFLAGS) $(ICONV_LDFLAGS) -lm
structure.o: structure.c
$(CC) $(CFLAGS) $(GTK_CFLAGS) -o $@ -c structure.c
shp2pgsql-gui.o: shp2pgsql-gui.c
$(CC) $(CFLAGS) $(GTK_CFLAGS) $(PGSQL_FE_CPPFLAGS) -o $@ -c shp2pgsql-gui.c
$(SHP2PGSQL-GUI): shpopen.o dbfopen.o shp2pgsql-core.o shpcommon.o shp2pgsql-gui.o getopt.o structure.o safileio.o $(LIBLWGEOM) $(GTK_WIN32_RES)
$(CC) $(CFLAGS) $(GTK_WIN32_FLAGS) $^ -o $@ $(GTK_LIBS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) $(GETTEXT_LDFLAGS) -lm
installdir:
@mkdir -p $(DESTDIR)$(bindir)
install: installdir
ifdef gtk_build
$(INSTALL) $(SHP2PGSQL-GUI) $(DESTDIR)$(bindir)
endif
$(INSTALL) $(PGSQL2SHP-CLI) $(DESTDIR)$(bindir)
$(INSTALL) $(SHP2PGSQL-CLI) $(DESTDIR)$(bindir)
uninstall:
@rm -f $(DESTDIR)$(bindir)/$(PGSQL2SHP-CLI)
@rm -f $(DESTDIR)$(bindir)/$(SHP2PGSQL-CLI)
check:
ifdef gtk_build
make -C cunit check
endif
clean:
@rm -f *.o $(SHP2PGSQL-CLI) $(PGSQL2SHP-CLI) $(GTK_WIN32_RES)
#
# Internationalization targets. These are going to need some work and
# love to land the files in the right places in all platforms.
#
pot:
xgettext -k_ shp2pgsql-core.c shp2pgsql-cli.c shp2pgsql-gui.c -o po/shp2pgsql.pot
xgettext -k_ pgsql2shp-core.c pgsql2shp-cli.c -o po/pgsql2shp.pot
mo:
for lang in $(LANGUAGES); do \
msgfmt -o po/shp2pgsql_$$lang.mo po/shp2pgsql_$$lang.po ; \
done
install-mo:
ifneq (,$(LANGUAGES))
for lang in $(LANGUAGES); do \
$(INSTALL_DATA) po/shp2pgsql_$$lang.mo '$(localedir)'/$$lang/LC_MESSAGES/shp2pgsql.mo || exit 1; \
done
endif