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 administration.xml \ 122 usage.xml \ 123 database_tuning.xml \ 124 introduction.xml \ 125 performance_tips.xml \ 126 postgis.xml \ 127 reference_accessor.xml \ 128 reference_bbox.xml \ 129 reference_cluster.xml \ 130 reference_constructor.xml \ 131 reference_editor.xml \ 132 reference_exception.xml \ 133 reference_guc.xml \ 134 reference_input.xml \ 135 reference_lrs.xml \ 136 reference_management.xml \ 137 reference_measure.xml \ 138 reference_sfcgal.xml \ 139 reference_operator.xml \ 140 reference_output.xml \ 141 reference_overlay.xml \ 142 reference_processing.xml \ 143 reference_raster.xml \ 144 reference_relationship.xml \ 145 reference_srs.xml \ 146 reference_trajectory.xml \ 147 reference_transaction.xml \ 148 reference_transformation.xml \ 149 reference_troubleshooting.xml \ 150 reference_type.xml \ 151 reference_validation.xml \ 152 reference_version.xml \ 153 reference.xml \ 154 release_notes.xml \ 155 reporting.xml \ 156 using_postgis_app.xml \ 157 using_postgis_dataman.xml \ 158 using_postgis_query.xml \ 159 using_raster_dataman.xml 160 161XML_GENERATED_SOURCES = \ 162 postgis_aggs_mm.xml \ 163 postgis-out.xml \ 164 165XML_INPUTS = $(XML_SOURCES) $(XML_GENERATED_SOURCES) 166 167XML_INPUTS_POT = $(XML_SOURCES:%.xml=po/templates/%.xml.pot) 168 169.PHONY: $(XML_INPUTS_POT) 170$(XML_INPUTS_POT): po/templates/%.xml.pot: %.xml 171 @if test -f $@; then \ 172 $(XML2POT) $< > $@.tmp; \ 173 changed=`diff $@.tmp $@ | grep -v '^[<>] "POT-Creation-Date:' | wc -l`; \ 174 if expr $${changed} \> 3 >/dev/null; then \ 175 echo "$@ updated"; \ 176 mv $@.tmp $@; \ 177 else \ 178 echo "$@ unchanged"; \ 179 rm $@.tmp; \ 180 fi; \ 181 else \ 182 $(XML2POT) $< > $@; \ 183 fi; 184 185# Update translation templates 186update-pot: $(XML_INPUTS_POT) 187 188# Creates or updates translation files 189update-po: $(XML_INPUTS_POT) 190 @for lang in $(translations); do \ 191 echo "Creating po files for language $$lang..." ; \ 192 for pot in $(XML_INPUTS_POT); do \ 193 mkdir -p po/$$lang; \ 194 po=po/$$lang/`basename $$pot .pot`.po; \ 195 if test -f $$po; then \ 196 $(MSGMERGE) --update $$po $$pot; \ 197 else \ 198 cp $$pot $$po; \ 199 fi; \ 200 done; \ 201 done 202 203pull-tx: 204 tx pull --all 205 $(MAKE) update-po 206 207push-tx: 208 tx push -s -t --skip 209 210# Register transifex resources, run when adding a new .xml file 211update-tx: 212 for f in $(XML_INPUTS_POT); do \ 213 f=`basename $${f} .pot`; \ 214 res=`echo "$${f}" | sed 's/\.//g'`pot; \ 215 tx set --auto-local -r postgis.$${res} "po/<lang>/$${f}.po" \ 216 --source-lang en --source-file "po/templates/$${f}.pot" \ 217 --execute; \ 218 done 219 220 221ifeq ($(XSLTPROC),) 222postgis_aggs_mm.xml: requirements_not_met_xsltproc 223else 224postgis_aggs_mm.xml: ./xsl/postgis_aggs_mm.xml.xsl Makefile postgis-out.xml $(XML_SOURCES) 225 $(XSLTPROC) --novalid ./xsl/postgis_aggs_mm.xml.xsl postgis-out.xml > $@ 226endif 227 228postgis_comments.sql: ./xsl/postgis_comments.sql.xsl $(XML_INPUTS) 229 $(XSLTPROC) --novalid ./xsl/postgis_comments.sql.xsl postgis-out.xml > $@ 230 231postgis_cheatsheet.html: ./xsl/postgis_cheatsheet.html.xsl $(XML_INPUTS) 232 $(XSLTPROC) --novalid ./xsl/postgis_cheatsheet.html.xsl postgis-out.xml > $@ 233 234raster_comments.sql: ./xsl/raster_comments.sql.xsl $(XML_INPUTS) 235 $(XSLTPROC) --novalid ./xsl/raster_comments.sql.xsl postgis-out.xml > $@ 236 237raster_cheatsheet.html: ./xsl/raster_cheatsheet.html.xsl $(XML_INPUTS) 238 $(XSLTPROC) --novalid ./xsl/raster_cheatsheet.html.xsl postgis-out.xml > $@ 239 240topology_comments.sql: ./xsl/topology_comments.sql.xsl $(XML_INPUTS) 241 $(XSLTPROC) --novalid ./xsl/topology_comments.sql.xsl postgis-out.xml > $@ 242 243topology_cheatsheet.html: ./xsl/topology_cheatsheet.html.xsl $(XML_INPUTS) 244 $(XSLTPROC) --novalid ./xsl/topology_cheatsheet.html.xsl postgis-out.xml > $@ 245 246sfcgal_comments.sql: ./xsl/sfcgal_comments.sql.xsl $(XML_INPUTS) 247 $(XSLTPROC) --novalid ./xsl/sfcgal_comments.sql.xsl postgis-out.xml > $@ 248 249sfcgal_cheatsheet.html: ./xsl/sfcgal_cheatsheet.html.xsl $(XML_INPUTS) 250 $(XSLTPROC) --novalid ./xsl/sfcgal_cheatsheet.html.xsl postgis-out.xml > $@ 251 252tiger_geocoder_comments.sql: ./xsl/tiger_geocoder_comments.sql.xsl $(XML_INPUTS) 253 $(XSLTPROC) --novalid ./xsl/tiger_geocoder_comments.sql.xsl postgis-out.xml > $@ 254 255tiger_geocoder_cheatsheet.html: ./xsl/tiger_geocoder_cheatsheet.html.xsl $(XML_INPUTS) 256 $(XSLTPROC) --novalid ./xsl/tiger_geocoder_cheatsheet.html.xsl postgis-out.xml > $@ 257 258postgis-out.xml: postgis.xml Makefile 259 $(PERL) -lpe "s'@@LAST_RELEASE_VERSION@@'${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}'g;s'@@POSTGIS_DOWNLOAD_URL@@'${POSTGIS_DOWNLOAD_URL}'g;" $< > $@ 260 261chunked-html: postgis-out.xml Makefile images $(XML_INPUTS) 262 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 263 --output html/ \ 264 $(CHUNK_HTML_DOCBOOK_XSL) \ 265 $< 266 267chunked-html-web: postgis-out.xml Makefile images $(XML_INPUTS) 268 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 269 --output html/ \ 270 --stringparam html.script ga.js \ 271 $(CHUNK_HTML_DOCBOOK_XSL) \ 272 $< 273 274HTML_BITS = $(wildcard html/*.html) 275 276chunked-html-web-mobile: postgis-out.xml Makefile images $(XML_INPUTS) 277 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 278 --output html/ \ 279 --stringparam html.script ga.js \ 280 $(CHUNK_HTML_DOCBOOK_XSL) \ 281 $< 282 $(PERL) -pi -e 's/<head>/<head><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">/g' $(HTML_BITS) 283 284 285html: html/postgis$(DOCSUFFIX).html 286 287html-localized: 288 @for lang in $(translations); do \ 289 echo "Creating html for language $$lang..."; \ 290 $(MAKE) -C po/$$lang local-html; \ 291 done 292 293html/postgis$(DOCSUFFIX).html: postgis-out.xml Makefile images $(XML_INPUTS) 294 $(XSLTPROC) $(XSLTPROC_COMMONOPTS) \ 295 --output html/postgis$(DOCSUFFIX).html \ 296 $(HTML_DOCBOOK_XSL) \ 297 $< 298 299 300postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).pdf: postgis-out.xml images $(XML_INPUTS) 301 if test x"$(DBLATEX)" = x; then \ 302 echo "Error: dblatex not found, can't build pdf"; \ 303 echo " try installing dblatex and then re-run configure"; \ 304 false; \ 305 else \ 306 $(DBLATEX) -T native -t pdf \ 307 -I "${PWD}/html" \ 308 -P doc.collab.show=0 \ 309 -P figure.note="${PWD}/html/images/note" \ 310 -P figure.tip="${PWD}/html/images/tip" \ 311 -P figure.important="${PWD}/html/images/important" \ 312 -P figure.warning="${PWD}/html/images/warning" \ 313 -P figure.caution="${PWD}/html/images/caution" \ 314 -P latex.output.revhistory=0 \ 315 -s "${PWD}/texstyle.sty" \ 316 -o postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).pdf $<; \ 317 fi 318 319postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).epub: postgis-out.xml images $(XML_INPUTS) 320 if test x"$(DBTOEPUB)" = x; then \ 321 echo "Error: dbtoepub not found, can't build epub"; \ 322 echo " try installing dbtoepub"; \ 323 false; \ 324 else \ 325 $(DBTOEPUB) -c "${PWD}/html/style.css" \ 326 -o postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).epub \ 327 $<; \ 328 fi 329 330epub: postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).epub 331 332pdf: postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}$(DOCSUFFIX).pdf 333 334pdf-localized: 335 @for lang in $(translations); do \ 336 echo "Creating pdf for language $$lang..."; \ 337 $(MAKE) -C po/$$lang local-pdf; \ 338 done 339 340doxygen.cfg: doxygen.cfg.in 341 $(PERL) -lpe "s'@@LAST_RELEASE_VERSION@@'${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}'g" $< > $@ 342 343doxygen: doxygen.cfg 344 doxygen $< 345 346images: 347 $(MAKE) -C html/image_src images 348 349images-clean: 350 $(MAKE) -C html/image_src images-clean 351 352clean: 353 rm -f html/*.html 354 rm -f postgis-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_VERSION}.${POSTGIS_MICRO_VERSION}.pdf 355 rm -f *.epub 356 $(MAKE) -C html/image_src clean 357 rm -f $(XML_GENERATED_SOURCES) 358 rm -f postgis_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql 359 rm -f raster_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql 360 361distclean: clean 362 $(MAKE) -C html/image_src distclean 363 rm -f Makefile Makefile.comments html/image_src/Makefile 364 365maintainer-clean: clean images-clean 366 rm -f postgis_comments.sql raster_comments.sql topology_comments.sql tiger_geocoder_comments.sql sfcgal_comments.sql 367 368ifneq ($(CAN_BUILD_COMMENTS),yes) 369comments: 370else 371comments: postgis_comments.sql raster_comments.sql topology_comments.sql sfcgal_comments.sql tiger_geocoder_comments.sql 372endif 373 374cheatsheets: postgis_cheatsheet.html raster_cheatsheet.html topology_cheatsheet.html sfcgal_cheatsheet.html tiger_geocoder_cheatsheet.html 375 376ifneq ($(CAN_BUILD_COMMENTS),yes) 377comments-install: 378 if test -e postgis_comments.sql -a \ 379 -e raster_comments.sql -a \ 380 -e topology_comments.sql -a \ 381 -e sfcgal_comments.sql -a \ 382 -e tiger_geocoder_comments.sql; then \ 383 $(MAKE) -f Makefile.comments install; \ 384 fi 385else 386comments-install: comments 387 $(MAKE) -f Makefile.comments install 388endif 389 390comments-uninstall: 391 $(MAKE) -f Makefile.comments uninstall 392 393man-install: man/shp2pgsql.1 man/pgsql2shp.1 394 mkdir -p $(DESTDIR)$(PGSQL_MANDIR)/man1 395 $(INSTALL_DATA) man/pgsql2shp.1 $(DESTDIR)$(PGSQL_MANDIR)/man1/pgsql2shp.1 396 $(INSTALL_DATA) man/shp2pgsql.1 $(DESTDIR)$(PGSQL_MANDIR)/man1/shp2pgsql.1 397 398man-uninstall: 399 rm -f $(DESTDIR)$(PGSQL_MANDIR)/man1/shp2pgsql.1 400 rm -f $(DESTDIR)$(PGSQL_MANDIR)/man1/pgsql2shp.1 401 402docs-install: html/postgis.html html/style.css 403 mkdir -p $(DESTDIR)$(PGSQL_DOCDIR)/postgis/images 404 $(INSTALL_DATA) html/postgis.html $(DESTDIR)$(PGSQL_DOCDIR)/postgis/ 405 $(INSTALL_DATA) html/style.css $(DESTDIR)$(PGSQL_DOCDIR)/postgis/ 406 $(INSTALL_DATA) html/images/* $(DESTDIR)$(PGSQL_DOCDIR)/postgis/images/ 407 $(INSTALL_DATA) ../README.postgis $(DESTDIR)$(PGSQL_DOCDIR)/postgis/README.postgis 408 409docs-uninstall: 410 rm -f $(DESTDIR)$(PGSQL_DOCDIR)/postgis/postgis.html 411 rm -f $(DESTDIR)$(PGSQL_DOCDIR)/postgis/style.css 412 rm -rf $(DESTDIR)$(PGSQL_DOCDIR)/postgis/images 413 rm -f $(DESTDIR)$(PGSQL_DOCDIR)/postgis/README.postgis 414 415install: comments-install 416 417uninstall: comments-uninstall 418 419ifeq ($(XSLTPROC),) 420garden: requirements_not_met_xsltproc 421else 422garden: xsl/postgis_gardentest.sql.xsl $(XML_INPUTS) 423 $(XSLTPROC) -o postgis_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql xsl/postgis_gardentest.sql.xsl postgis-out.xml 424 $(XSLTPROC) -o raster_gardentest_${POSTGIS_MAJOR_VERSION}${POSTGIS_MINOR_VERSION}.sql xsl/raster_gardentest.sql.xsl postgis-out.xml 425endif 426 427 428 429check: check-unit 430check-regress: 431 432ifeq ($(XMLLINT),) 433check-unit: requirements_not_met_xmllint 434else 435check-unit: $(XML_INPUTS) 436 $(XMLLINT) --loaddtd --xinclude --valid postgis-out.xml > /dev/null 437endif 438 439check-localized: 440 @for lang in $(translations); do \ 441 echo "Creating html for language $$lang..."; \ 442 $(MAKE) -C po/$$lang local-check; \ 443 done 444 445 446requirements_not_met_xsltproc: 447 @echo 448 @echo "configure was unable to find 'xsltproc' which is required" 449 @echo "to build the documentation." 450 @echo "Install xsltproc and then re-run configure. Alternatively " 451 @echo "refer to online manual:" 452 @echo 453 @echo " http://postgis.net/documentation" 454 @echo 455 456requirements_not_met_xmllint: 457 @echo 458 @echo "configure was unable to find 'xmllint' which is required" 459 @echo "to test the documentation." 460 @echo "Install xmllint and then re-run configure. Alternatively " 461 @echo "refer to online manual:" 462 @echo 463 @echo " http://postgis.net/documentation" 464 @echo 465 466requirements_not_met_xslbase: 467 @echo 468 @echo "configure was unable to find the Docbook XSL stylesheet directory" 469 @echo "which is required to build the documentation." 470 @echo "Install the Docbook XSL stylesheets and/or re-run configure " 471 @echo "with the --with-xsldir option." 472 @echo "Alternatively refer to online manual:" 473 @echo 474 @echo " http://postgis.net/documentation" 475 @echo 476 477requirements_not_met_imagemagick: 478 @echo 479 @echo "configure was unable to find the ImageMagick's 'convert' utility program." 480 @echo "To build the documentation, install ImageMagick and then re-run configure. Alternatively " 481 @echo "refer to online manual:" 482 @echo 483 @echo " http://postgis.net/documentation" 484 @echo 485