1# 2# PostGIS - Spatial Types for PostgreSQL 3# http://www.postgis.net 4# 5# This is free software; you can redistribute and/or modify it under 6# the terms of the GNU General Public Licence. See the COPYING file. 7# 8# PostGIS documentation build Makefile 9# 10# Copyright 2003-2012 Sandro Santilli <strk@kbt.io> 11# Copyright 2004-2012 Paul Ramsey <pramsey@cleverelephant.ca> 12# Copyright 2009-2011 Regina Obe <lr@pcorp.us> 13# Copyright 2008-2010 Mark Cave-Ayland 14# Copyright 2008-2010 Kevin Neufeld <kneufeld.ca@gmail.com> 15# Copyright 2009-2010 Olivier Courtin <olivier.courtin@camptocamp.com> 16# Copyright 2005-2006 Markus Schaber <markus@schabi.de> 17# 18# NOTE: We don't use a standard PGXS Makefile here since the DOCS target 19# only allows files to be stored within contrib/ and we currently 20# store documentation under contrib/postgis due to the possibility 21# that we could produce a large number of files (think chunked HTML) 22# 23 24translations = it_IT pt_BR fr es pl ko_KR de ja 25 26POSTGIS_MAJOR_VERSION=@POSTGIS_MAJOR_VERSION@ 27POSTGIS_MINOR_VERSION=@POSTGIS_MINOR_VERSION@ 28POSTGIS_MICRO_VERSION=@POSTGIS_MICRO_VERSION@ 29 30ifneq (,$(findstring dev,$(POSTGIS_MICRO_VERSION))) 31 POSTGIS_DOWNLOAD_URL=http://postgis.net/stuff 32else 33 POSTGIS_DOWNLOAD_URL=http://download.osgeo.org/postgis/source 34endif 35 36INSTALL=@INSTALL@ 37INSTALL_DATA=@INSTALL_DATA@ 38 39XSLTPROC=@XSLTPROC@ 40XSLBASE=@XSLBASE@ 41XMLLINT=@XMLLINT@ 42CAN_BUILD_COMMENTS=@CAN_BUILD_COMMENTS@ 43PERL=@PERL@ 44 45# To allow network access use: 46# 47# $(MAKE) html XSLTPROCFLAGS= 48# 49ifeq ($(XSLTPROCFLAGS),) 50 XSLTPROCFLAGS=--nonet 51endif 52 53XSLTPROC_COMMONOPTS= \ 54 --param section.autolabel 1 \ 55 --param section.label.includes.component.label 1 \ 56 --param chunk.section.depth 0 \ 57 --param generate.section.toc.level 2 \ 58 --param funcsynopsis.style kr \ 59 --param admon.graphics 1 \ 60 --param admon.textlabel 0 \ 61 --param make.clean.html 1 \ 62 --param simplesect.in.toc 0 \ 63 --param use.id.as.filename 1 \ 64 --param chunk.quietly 1 \ 65 --param header.rule 0 \ 66 --param footer.rule 0 \ 67 --param table.borders.with.css 1 \ 68 --stringparam chunker.output.encoding UTF-8 \ 69 --stringparam chunker.output.indent no \ 70 --stringparam saxon.character.representation decimal \ 71 --stringparam html.stylesheet style.css \ 72 $(XSLTPROCFLAGS) 73 74 75HTML_DOCBOOK_XSL=$(XSLBASE)/html/docbook.xsl 76CHUNK_HTML_DOCBOOK_XSL=$(XSLBASE)/html/chunk.xsl 77 78# DBLatex's dblatex script for PDF generation from DocBook 79DBLATEX=@DBLATEX@ 80 81# Imagemagick's convert utility program for generated images used in the documentation 82IMAGEMAGICK=@IMAGEMAGICK@ 83 84# Gettext for translated documentation 85MSGMERGE=msgmerge 86 87# XML gettext tools 88XML2POT=xml2pot 89 90# DOCBOOK to EPUB 91DBTOEPUB=dbtoepub 92 93# Directories for postgresql subdirectories 94PGSQL_DOCDIR=@PGSQL_DOCDIR@ 95PGSQL_MANDIR=@PGSQL_MANDIR@ 96PGSQL_SHAREDIR=@PGSQL_SHAREDIR@ 97 98BUILD_TARGET = 99 100ifeq ($(CAN_BUILD_COMMENTS),yes) 101BUILD_TARGET += comments 102endif 103 104ifeq ($(CAN_BUILD_PDF),yes) 105BUILD_TARGET += pdf 106endif 107 108# TODO: add "html" to the BUILD_TARGET if it can be built 109 110all: $(BUILD_TARGET) 111 112XML_SOURCES = \ 113 extras_address_standardizer.xml \ 114 extras_historytable.xml \ 115 extras_tigergeocoder.xml \ 116 extras_topology.xml \ 117 extras.xml \ 118 faq_raster.xml \ 119 faq.xml \ 120 installation.xml \ 121 introduction.xml \ 122 performance_tips.xml \ 123 postgis.xml \ 124 reference_accessor.xml \ 125 reference_bbox.xml \ 126 reference_cluster.xml \ 127 reference_constructor.xml \ 128 reference_editor.xml \ 129 reference_exception.xml \ 130 reference_guc.xml \ 131 reference_input.xml \ 132 reference_lrs.xml \ 133 reference_management.xml \ 134 reference_measure.xml \ 135 reference_sfcgal.xml \ 136 reference_operator.xml \ 137 reference_output.xml \ 138 reference_processing.xml \ 139 reference_raster.xml \ 140 reference_relationship.xml \ 141 reference_srs.xml \ 142 reference_trajectory.xml \ 143 reference_transaction.xml \ 144 reference_transformation.xml \ 145 reference_troubleshooting.xml \ 146 reference_type.xml \ 147 reference_validation.xml \ 148 reference_version.xml \ 149 reference.xml \ 150 release_notes.xml \ 151 reporting.xml \ 152 using_postgis_app.xml \ 153 using_postgis_dataman.xml \ 154 using_raster_dataman.xml 155 156XML_GENERATED_SOURCES = \ 157 postgis_aggs_mm.xml \ 158 postgis-out.xml \ 159 160XML_INPUTS = $(XML_SOURCES) $(XML_GENERATED_SOURCES) 161 162XML_INPUTS_POT = $(XML_SOURCES:%.xml=po/templates/%.xml.pot) 163 164.PHONY: $(XML_INPUTS_POT) 165$(XML_INPUTS_POT): po/templates/%.xml.pot: %.xml 166 @if test -f $@; then \ 167 $(XML2POT) $< > $@.tmp; \ 168 changed=`diff $@.tmp $@ | grep -v '^[<>] "POT-Creation-Date:' | wc -l`; \ 169 if expr $${changed} \> 3 >/dev/null; then \ 170 echo "$@ updated"; \ 171 mv $@.tmp $@; \ 172 else \ 173 echo "$@ unchanged"; \ 174 rm $@.tmp; \ 175 fi; \ 176 else \ 177 $(XML2POT) $< > $@; \ 178 fi; 179 180# Update translation templates 181update-pot: $(XML_INPUTS_POT) 182 183# Creates or updates translation files 184update-po: $(XML_INPUTS_POT) 185 @for lang in $(translations); do \ 186 echo "Creating po files for language $$lang..." ; \ 187 for pot in $(XML_INPUTS_POT); do \ 188 mkdir -p po/$$lang; \ 189 po=po/$$lang/`basename $$pot .pot`.po; \ 190 if test -f $$po; then \ 191 $(MSGMERGE) --update $$po $$pot; \ 192 else \ 193 cp $$pot $$po; \ 194 fi; \ 195 done; \ 196 done 197 198pull-tx: 199 tx pull --all 200 $(MAKE) update-po 201 202push-tx: 203 tx push -s -t --skip 204 205# Register transifex resources, run when adding a new .xml file 206update-tx: 207 for f in $(XML_INPUTS_POT); do \ 208 f=`basename $${f} .pot`; \ 209 res=`echo "$${f}" | sed 's/\.//g'`pot; \ 210 tx set --auto-local -r postgis.$${res} "po/<lang>/$${f}.po" \ 211 --source-lang en --source-file "po/templates/$${f}.pot" \ 212 --execute; \ 213 done 214 215 216ifeq ($(XSLTPROC),) 217postgis_aggs_mm.xml: requirements_not_met_xsltproc 218else 219postgis_aggs_mm.xml: ./xsl/postgis_aggs_mm.xml.xsl Makefile postgis-out.xml $(XML_SOURCES) 220 $(XSLTPROC) --novalid ./xsl/postgis_aggs_mm.xml.xsl postgis-out.xml > $@ 221endif 222 223postgis_comments.sql: ./xsl/postgis_comments.sql.xsl $(XML_INPUTS) 224 $(XSLTPROC) --novalid ./xsl/postgis_comments.sql.xsl postgis-out.xml > $@ 225 226postgis_cheatsheet.html: ./xsl/postgis_cheatsheet.html.xsl $(XML_INPUTS) 227 $(XSLTPROC) --novalid ./xsl/postgis_cheatsheet.html.xsl postgis-out.xml > $@ 228 229raster_comments.sql: ./xsl/raster_comments.sql.xsl $(XML_INPUTS) 230 $(XSLTPROC) --novalid ./xsl/raster_comments.sql.xsl postgis-out.xml > $@ 231 232raster_cheatsheet.html: ./xsl/raster_cheatsheet.html.xsl $(XML_INPUTS) 233 $(XSLTPROC) --novalid ./xsl/raster_cheatsheet.html.xsl postgis-out.xml > $@ 234 235topology_comments.sql: ./xsl/topology_comments.sql.xsl $(XML_INPUTS) 236 $(XSLTPROC) --novalid ./xsl/topology_comments.sql.xsl postgis-out.xml > $@ 237 238topology_cheatsheet.html: ./xsl/topology_cheatsheet.html.xsl $(XML_INPUTS) 239 $(XSLTPROC) --novalid ./xsl/topology_cheatsheet.html.xsl postgis-out.xml > $@ 240 241sfcgal_comments.sql: ./xsl/sfcgal_comments.sql.xsl $(XML_INPUTS) 242 $(XSLTPROC) --novalid ./xsl/sfcgal_comments.sql.xsl postgis-out.xml > $@ 243 244sfcgal_cheatsheet.html: ./xsl/sfcgal_cheatsheet.html.xsl $(XML_INPUTS) 245 $(XSLTPROC) --novalid ./xsl/sfcgal_cheatsheet.html.xsl postgis-out.xml > $@ 246 247tiger_geocoder_comments.sql: ./xsl/tiger_geocoder_comments.sql.xsl $(XML_INPUTS) 248 $(XSLTPROC) --novalid ./xsl/tiger_geocoder_comments.sql.xsl postgis-out.xml > $@ 249 250tiger_geocoder_cheatsheet.html: ./xsl/tiger_geocoder_cheatsheet.html.xsl $(XML_INPUTS) 251 $(XSLTPROC) --novalid ./xsl/tiger_geocoder_cheatsheet.html.xsl postgis-out.xml > $@ 252 253postgis-out.xml: postgis.xml Makefile 254 $(PERL) -lpe "s'@@LAST_RELEASE_VERSION@@'${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}'g;s'@@POSTGIS_DOWNLOAD_URL@@'${POSTGIS_DOWNLOAD_URL}'g;" $< > $@ 255 256chunked-html: postgis-out.xml Makefile images $(XML_INPUTS) 257 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 258 --output html/ \ 259 $(CHUNK_HTML_DOCBOOK_XSL) \ 260 $< 261 262chunked-html-web: postgis-out.xml Makefile images $(XML_INPUTS) 263 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 264 --output html/ \ 265 --stringparam html.script ga.js \ 266 $(CHUNK_HTML_DOCBOOK_XSL) \ 267 $< 268 269HTML_BITS = $(wildcard html/*.html) 270 271chunked-html-web-mobile: postgis-out.xml Makefile images $(XML_INPUTS) 272 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 273 --output html/ \ 274 --stringparam html.script ga.js \ 275 $(CHUNK_HTML_DOCBOOK_XSL) \ 276 $< 277 $(PERL) -pi -e 's/<head>/<head><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">/g' $(HTML_BITS) 278 279 280html: html/postgis$(DOCSUFFIX).html 281 282html-localized: 283 @for lang in $(translations); do \ 284 echo "Creating html for language $$lang..."; \ 285 $(MAKE) -C po/$$lang local-html; \ 286 done 287 288html/postgis$(DOCSUFFIX).html: postgis-out.xml Makefile images $(XML_INPUTS) 289 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 290 --output html/postgis$(DOCSUFFIX).html \ 291 $(HTML_DOCBOOK_XSL) \ 292 $< 293 294 295postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).pdf: postgis-out.xml images $(XML_INPUTS) 296 if test x"$(DBLATEX)" = x; then \ 297 echo "Error: dblatex not found, can't build pdf"; \ 298 echo " try installing dblatex and then re-run configure"; \ 299 false; \ 300 else \ 301 $(DBLATEX) -T native -t pdf \ 302 -I "${PWD}/html" \ 303 -P doc.collab.show=0 \ 304 -P figure.note="${PWD}/html/images/note" \ 305 -P figure.tip="${PWD}/html/images/tip" \ 306 -P figure.important="${PWD}/html/images/important" \ 307 -P figure.warning="${PWD}/html/images/warning" \ 308 -P figure.caution="${PWD}/html/images/caution" \ 309 -P latex.output.revhistory=0 \ 310 -s "${PWD}/texstyle.sty" \ 311 -o postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).pdf $<; \ 312 fi 313 314postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).epub: postgis-out.xml images $(XML_INPUTS) 315 if test x"$(DBTOEPUB)" = x; then \ 316 echo "Error: dbtoepub not found, can't build epub"; \ 317 echo " try installing dbtoepub"; \ 318 false; \ 319 else \ 320 $(DBTOEPUB) -c "${PWD}/html/style.css" \ 321 -o postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).epub \ 322 $<; \ 323 fi 324 325epub: postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).epub 326 327pdf: postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).pdf 328 329pdf-localized: 330 @for lang in $(translations); do \ 331 echo "Creating pdf for language $$lang..."; \ 332 $(MAKE) -C po/$$lang local-pdf; \ 333 done 334 335doxygen.cfg: doxygen.cfg.in 336 $(PERL) -lpe "s'@@LAST_RELEASE_VERSION@@'${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}'g" $< > $@ 337 338doxygen: doxygen.cfg 339 doxygen $< 340 341images: 342 $(MAKE) -C html/image_src images 343 344images-clean: 345 $(MAKE) -C html/image_src images-clean 346 347clean: 348 rm -f html/*.html 349 rm -f postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}.pdf 350 rm -f *.epub 351 $(MAKE) -C html/image_src clean 352 rm -f $(XML_GENERATED_SOURCES) 353 rm -f postgis_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql 354 rm -f raster_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql 355 356distclean: clean 357 $(MAKE) -C html/image_src distclean 358 rm -f Makefile Makefile.comments html/image_src/Makefile 359 360maintainer-clean: clean images-clean 361 rm -f postgis_comments.sql raster_comments.sql topology_comments.sql tiger_geocoder_comments.sql sfcgal_comments.sql 362 363ifneq ($(CAN_BUILD_COMMENTS),yes) 364comments: 365else 366comments: postgis_comments.sql raster_comments.sql topology_comments.sql sfcgal_comments.sql tiger_geocoder_comments.sql 367endif 368 369cheatsheets: postgis_cheatsheet.html raster_cheatsheet.html topology_cheatsheet.html sfcgal_cheatsheet.html tiger_geocoder_cheatsheet.html 370 371ifneq ($(CAN_BUILD_COMMENTS),yes) 372comments-install: 373 if test -e postgis_comments.sql -a \ 374 -e raster_comments.sql -a \ 375 -e topology_comments.sql -a \ 376 -e sfcgal_comments.sql -a \ 377 -e tiger_geocoder_comments.sql; then \ 378 $(MAKE) -f Makefile.comments install; \ 379 fi 380else 381comments-install: comments 382 $(MAKE) -f Makefile.comments install 383endif 384 385comments-uninstall: 386 $(MAKE) -f Makefile.comments uninstall 387 388man-install: man/shp2pgsql.1 man/pgsql2shp.1 389 mkdir -p $(DESTDIR)$(PGSQL_MANDIR)/man1 390 $(INSTALL_DATA) man/pgsql2shp.1 $(DESTDIR)$(PGSQL_MANDIR)/man1/pgsql2shp.1 391 $(INSTALL_DATA) man/shp2pgsql.1 $(DESTDIR)$(PGSQL_MANDIR)/man1/shp2pgsql.1 392 393man-uninstall: 394 rm -f $(DESTDIR)$(PGSQL_MANDIR)/man1/shp2pgsql.1 395 rm -f $(DESTDIR)$(PGSQL_MANDIR)/man1/pgsql2shp.1 396 397docs-install: html/postgis.html html/style.css 398 mkdir -p $(DESTDIR)$(PGSQL_DOCDIR)/postgis/images 399 $(INSTALL_DATA) html/postgis.html $(DESTDIR)$(PGSQL_DOCDIR)/postgis/ 400 $(INSTALL_DATA) html/style.css $(DESTDIR)$(PGSQL_DOCDIR)/postgis/ 401 $(INSTALL_DATA) html/images/* $(DESTDIR)$(PGSQL_DOCDIR)/postgis/images/ 402 $(INSTALL_DATA) ../README.postgis $(DESTDIR)$(PGSQL_DOCDIR)/postgis/README.postgis 403 404docs-uninstall: 405 rm -f $(DESTDIR)$(PGSQL_DOCDIR)/postgis/postgis.html 406 rm -f $(DESTDIR)$(PGSQL_DOCDIR)/postgis/style.css 407 rm -rf $(DESTDIR)$(PGSQL_DOCDIR)/postgis/images 408 rm -f $(DESTDIR)$(PGSQL_DOCDIR)/postgis/README.postgis 409 410install: comments-install 411 412uninstall: comments-uninstall 413 414ifeq ($(XSLTPROC),) 415garden: requirements_not_met_xsltproc 416else 417garden: xsl/postgis_gardentest.sql.xsl $(XML_INPUTS) 418 $(XSLTPROC) -o postgis_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql xsl/postgis_gardentest.sql.xsl postgis-out.xml 419 $(XSLTPROC) -o raster_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql xsl/raster_gardentest.sql.xsl postgis-out.xml 420endif 421 422 423 424check: check-unit 425check-regress: 426 427ifeq ($(XMLLINT),) 428check-unit: requirements_not_met_xmllint 429else 430check-unit: $(XML_INPUTS) 431 $(XMLLINT) --loaddtd --xinclude --valid postgis-out.xml > /dev/null 432endif 433 434check-localized: 435 @for lang in $(translations); do \ 436 echo "Creating html for language $$lang..."; \ 437 $(MAKE) -C po/$$lang local-check; \ 438 done 439 440 441requirements_not_met_xsltproc: 442 @echo 443 @echo "configure was unable to find 'xsltproc' which is required" 444 @echo "to build the documentation." 445 @echo "Install xsltproc and then re-run configure. Alternatively " 446 @echo "refer to online manual:" 447 @echo 448 @echo " http://postgis.net/documentation" 449 @echo 450 451requirements_not_met_xmllint: 452 @echo 453 @echo "configure was unable to find 'xmllint' which is required" 454 @echo "to test the documentation." 455 @echo "Install xmllint and then re-run configure. Alternatively " 456 @echo "refer to online manual:" 457 @echo 458 @echo " http://postgis.net/documentation" 459 @echo 460 461requirements_not_met_xslbase: 462 @echo 463 @echo "configure was unable to find the Docbook XSL stylesheet directory" 464 @echo "which is required to build the documentation." 465 @echo "Install the Docbook XSL stylesheets and/or re-run configure " 466 @echo "with the --with-xsldir option." 467 @echo "Alternatively refer to online manual:" 468 @echo 469 @echo " http://postgis.net/documentation" 470 @echo 471 472requirements_not_met_imagemagick: 473 @echo 474 @echo "configure was unable to find the ImageMagick's 'convert' utility program." 475 @echo "To build the documentation, install ImageMagick and then re-run configure. Alternatively " 476 @echo "refer to online manual:" 477 @echo 478 @echo " http://postgis.net/documentation" 479 @echo 480 481