1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
# **********************************************************************
# *
# * PostGIS - Spatial Types for PostgreSQL
# * http://postgis.net
# *
# * Copyright 2008 Mark Cave-Ayland
# * Copyright (c) 2020-2022 Sandro Santilli <strk@kbt.io>
# *
# * This is free software; you can redistribute and/or modify it under
# * the terms of the GNU General Public Licence. See the COPYING file.
# *
# **********************************************************************
top_builddir = @top_builddir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
datarootdir = @datarootdir@
datadir = @datadir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
VPATH = $(srcdir)
CC=@CC@
CFLAGS= -I$(top_srcdir)/liblwgeom -I$(top_builddir)/liblwgeom @CPPFLAGS@ @CFLAGS@ @PICFLAGS@ @PROJ_CPPFLAGS@
SHELL = @SHELL@
LIBTOOL = @LIBTOOL@
LDFLAGS = @LDFLAGS@ @PROJ_LDFLAGS@ @GEOS_LDFLAGS@
# Filenames with extension as determined by the OS
POSTGIS-CLI=postgis
SHP2PGSQL-CLI=shp2pgsql@EXESUFFIX@
PGSQL2SHP-CLI=
SHP2PGSQL-GUI=
ifneq (@PG_CONFIG@,no)
PGSQL2SHP-CLI=pgsql2shp@EXESUFFIX@
ifneq (@GTK_BUILD@,)
SHP2PGSQL-GUI=shp2pgsql-gui@EXESUFFIX@
# We test this variable later to see if we're building the GUI
gtk_build = 1
endif
endif
# 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.la
LDFLAGS += $(LIBLWGEOM)
# 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@
LANGUAGES = fr
# 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.
#
# TODO: rely on DESTDIR instead
#
ifeq ($(REGRESS),1)
bindir=/bin
pkglibdir=/lib
datadir=/share
endif
# Common object files
SHPLIB_OBJS = shpopen.o dbfopen.o getopt.o shpcommon.o safileio.o
# The real parts of the Makefile
all: $(SHP2PGSQL-CLI) $(PGSQL2SHP-CLI) $(POSTGIS-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 shp2pgsql-core.h shpcommon.h
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
pgsql2shp-core.o: pgsql2shp-core.c pgsql2shp-core.h shpcommon.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $<
pgsql2shp-cli.o: pgsql2shp-cli.c pgsql2shp-core.h shpcommon.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $<
$(PGSQL2SHP-CLI): $(SHPLIB_OBJS) pgsql2shp-core.o pgsql2shp-cli.o $(LIBLWGEOM)
$(LIBTOOL) --mode=link \
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) $(GETTEXT_LDFLAGS) -o $@
$(POSTGIS-CLI): postgis.pl
cp $< $@; chmod +x $@
$(SHP2PGSQL-CLI): $(SHPLIB_OBJS) shp2pgsql-core.o shp2pgsql-cli.o $(LIBLWGEOM)
$(LIBTOOL) --mode=link \
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(GETTEXT_LDFLAGS) $(ICONV_LDFLAGS)
shp2pgsql-gui.o: shp2pgsql-gui.c shp2pgsql-core.h shpcommon.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(GTK_CFLAGS) $(PGSQL_FE_CPPFLAGS) -o $@ -c $<
$(SHP2PGSQL-GUI): $(SHPLIB_OBJS) shp2pgsql-core.o shp2pgsql-gui.o pgsql2shp-core.o $(LIBLWGEOM) $(GTK_WIN32_RES)
$(LIBTOOL) --mode=link \
$(CC) $(CFLAGS) $(GTK_WIN32_FLAGS) $^ -o $@ \
$(GTK_LIBS) $(LDFLAGS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) $(GETTEXT_LDFLAGS)
installdir:
@mkdir -p $(DESTDIR)$(bindir)
install-desktop: shp2pgsql-gui.desktop
ifdef gtk_build
mkdir -p $(DESTDIR)$(datadir)/applications
$(INSTALL_DATA) $^ $(DESTDIR)$(datadir)/applications/shp2pgsql-gui.desktop
endif
ICON_SIZES = 8x8 16x16 22x22 24x24 32x32 36x36 40x40 42x42 48x48 64x64
install-icons:
ifdef gtk_build
for size in $(ICON_SIZES); do \
mkdir -p $(DESTDIR)$(datadir)/icons/hicolor/$${size}/apps; \
$(INSTALL_DATA) $(srcdir)/icons/hicolor/$${size}/apps/shp2pgsql-gui.png $(DESTDIR)$(datadir)/icons/hicolor/$${size}/apps/shp2pgsql-gui.png; \
done
endif
install: installdir install-desktop install-icons
ifneq ($(SHP2PGSQL-GUI),)
$(LIBTOOL) --mode=install $(INSTALL) $(SHP2PGSQL-GUI) "$(DESTDIR)$(bindir)/$(SHP2PGSQL-GUI)"
endif
ifneq ($(PGSQL2SHP-CLI),)
$(LIBTOOL) --mode=install $(INSTALL) $(PGSQL2SHP-CLI) "$(DESTDIR)$(bindir)/$(PGSQL2SHP-CLI)"
endif
$(LIBTOOL) --mode=install $(INSTALL) $(SHP2PGSQL-CLI) "$(DESTDIR)$(bindir)/$(SHP2PGSQL-CLI)"
$(LIBTOOL) --mode=install $(INSTALL) $(POSTGIS-CLI) "$(DESTDIR)$(bindir)/$(POSTGIS-CLI)"
uninstall-desktop:
ifdef gtk_build
rm -f $(DESTDIR)$(datadir)/applications/shp2pgsql-gui.desktop
endif
uninstall-icons:
ifdef gtk_build
rm -f $(DESTDIR)$(datadir)/icons/hicolor/*/apps/shp2pgsql-gui.png
endif
uninstall: uninstall-desktop uninstall-icons
ifneq ($(PGSQL2SHP-CLI),)
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(bindir)/$(PGSQL2SHP-CLI)"
endif
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(bindir)/$(SHP2PGSQL-CLI)"
ifneq ($(SHP2PGSQL-GUI),)
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(bindir)/$(SHP2PGSQL-GUI)"
endif
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(bindir)/$(POSTGIS-CLI)"
# TODO: move here what's currently run from regress/loader and
# regress/dumper ?
check-regress:
check-unit:
$(MAKE) -C cunit check
clean:
rm -rf .libs
rm -f *.o $(SHP2PGSQL-CLI) $(PGSQL2SHP-CLI) $(GTK_WIN32_RES) $(SHP2PGSQL-GUI) $(POSTGIS-CLI)
$(MAKE) -C cunit clean
distclean: clean
$(MAKE) -C cunit distclean
rm -f Makefile
#
# 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
|