Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. MODULE_TOPDIR = ..
  2. include $(MODULE_TOPDIR)/include/Make/Other.make
  3. MANPAGES := $(patsubst $(HTMLDIR)/%.html,$(MANDIR)/%.$(MANSECT),$(wildcard $(HTMLDIR)/*.html))
  4. DSTFILES := \
  5. $(HTMLDIR)/grassdocs.css \
  6. $(HTMLDIR)/grass_logo.png \
  7. $(HTMLDIR)/grass_icon.png \
  8. $(HTMLDIR)/jquery.fixedheadertable.min.js \
  9. $(HTMLDIR)/parser_standard_options.css \
  10. $(HTMLDIR)/parser_standard_options.js
  11. categories = \
  12. d:display \
  13. db:database \
  14. g:general \
  15. i:imagery \
  16. m:miscellaneous \
  17. ps:postscript \
  18. r:raster \
  19. r3:raster3d \
  20. t:temporal \
  21. v:vector
  22. IDXCATS := $(foreach cat,$(categories),$(lastword $(subst :, ,$(cat))))
  23. IDXSRC = full_index index topics keywords graphical_index manual_gallery class_graphical parser_standard_options $(IDXCATS)
  24. INDICES := $(patsubst %,$(HTMLDIR)/%.html,$(IDXSRC))
  25. ALL_HTML := $(wildcard $(HTMLDIR)/*.*.html)
  26. ifneq (@(type sphinx-build2 > /dev/null),)
  27. SPHINXBUILD = sphinx-build2
  28. endif
  29. ifneq (@(type sphinx-build > /dev/null),)
  30. SPHINXBUILD = sphinx-build
  31. endif
  32. default: $(DSTFILES)
  33. @echo "Generating HTML manual pages index (help system)..."
  34. $(MAKE) $(INDICES)
  35. $(call build,check)
  36. $(MAKE) manpages
  37. # This must be a separate target so that evaluation of $(MANPAGES)
  38. # is delayed until the indices have been generated
  39. manpages:
  40. $(MAKE) $(MANPAGES)
  41. .PHONY: manpages
  42. define build
  43. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  44. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  45. $(PYTHON) ./build_$(1).py $(2)
  46. endef
  47. define build_topics
  48. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  49. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  50. $(PYTHON) ./build_topics.py $(HTMLDIR)
  51. endef
  52. define build_keywords
  53. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  54. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  55. $(PYTHON) ./build_keywords.py $(HTMLDIR)
  56. endef
  57. define build_graphical_index
  58. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  59. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  60. $(PYTHON) ./build_graphical_index.py $(HTMLDIR)
  61. endef
  62. define build_manual_gallery
  63. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  64. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  65. $(PYTHON) ./build_manual_gallery.py $(HTMLDIR)
  66. endef
  67. define build_pso
  68. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  69. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  70. $(PYTHON) ./parser_standard_options.py -t "$(GRASS_HOME)/lib/gis/parser_standard_options.c" \
  71. -f "grass" -o "$(HTMLDIR)/parser_standard_options.html" -p 'id="opts_table" class="scroolTable"'
  72. endef
  73. $(HTMLDIR)/topics.html: $(ALL_HTML)
  74. define build_class_graphical
  75. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  76. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  77. $(PYTHON) ./build_class_graphical.py $(HTMLDIR)
  78. endef
  79. $(HTMLDIR)/topics.html: $(ALL_HTML) build_topics.py
  80. $(call build_topics)
  81. touch $@
  82. $(HTMLDIR)/full_index.html: $(ALL_HTML) build_full_index.py build_html.py
  83. $(call build,full_index)
  84. touch $@
  85. $(HTMLDIR)/index.html: build_index.py build_html.py
  86. $(call build,index)
  87. touch $@
  88. $(HTMLDIR)/keywords.html: $(ALL_HTML)
  89. $(call build_keywords)
  90. touch $@
  91. $(HTMLDIR)/graphical_index.html: $(ALL_HTML)
  92. $(call build_graphical_index)
  93. touch $@
  94. $(HTMLDIR)/manual_gallery.html: $(ALL_HTML)
  95. $(call build_manual_gallery)
  96. $(HTMLDIR)/parser_standard_options.html: $(ALL_HTML)
  97. $(call build_pso)
  98. touch $@
  99. # TODO: this should be done in the same way as category_rule
  100. $(HTMLDIR)/class_graphical.html: $(ALL_HTML)
  101. $(call build_class_graphical)
  102. touch $@
  103. define category_rule
  104. $$(HTMLDIR)/$(2).html: $$(wildcard $$(HTMLDIR)/$(1).*.html) build_class.py build_html.py
  105. $$(call build,class,$(1) $(2))
  106. touch $$@
  107. endef
  108. $(foreach cat,$(categories),$(eval $(call category_rule,$(firstword $(subst :, ,$(cat))),$(lastword $(subst :, ,$(cat))))))
  109. $(HTMLDIR)/grassdocs.css: grassdocs.css
  110. $(INSTALL_DATA) $< $@
  111. $(HTMLDIR)/grass_logo.png: grass_logo.png
  112. $(INSTALL_DATA) $< $@
  113. $(HTMLDIR)/grass_icon.png: grass_icon.png
  114. $(INSTALL_DATA) $< $@
  115. $(HTMLDIR)/jquery.fixedheadertable.min.js: jquery.fixedheadertable.min.js
  116. $(INSTALL_DATA) $< $@
  117. $(HTMLDIR)/parser_standard_options.js: parser_standard_options.js
  118. $(INSTALL_DATA) $< $@
  119. $(HTMLDIR)/parser_standard_options.css: parser_standard_options.css
  120. $(INSTALL_DATA) $< $@