Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. left := (
  40. right := )
  41. manpages:
  42. $(MAKE) $(subst $(left),\$(left),$(subst $(right),\$(right),$(MANPAGES)))
  43. .PHONY: manpages
  44. define build
  45. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  46. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  47. $(PYTHON) ./build_$(1).py $(2)
  48. endef
  49. define build_topics
  50. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  51. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  52. $(PYTHON) ./build_topics.py $(HTMLDIR)
  53. endef
  54. define build_keywords
  55. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  56. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  57. $(PYTHON) ./build_keywords.py $(HTMLDIR)
  58. endef
  59. define build_graphical_index
  60. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  61. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  62. $(PYTHON) ./build_graphical_index.py $(HTMLDIR)
  63. endef
  64. define build_manual_gallery
  65. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  66. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  67. $(PYTHON) ./build_manual_gallery.py $(HTMLDIR)
  68. endef
  69. define build_pso
  70. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  71. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  72. $(PYTHON) ./parser_standard_options.py -t "$(GRASS_HOME)/lib/gis/parser_standard_options.c" \
  73. -f "grass" -o "$(HTMLDIR)/parser_standard_options.html" -p 'id="opts_table" class="scroolTable"'
  74. endef
  75. $(HTMLDIR)/topics.html: $(ALL_HTML)
  76. define build_class_graphical
  77. GISBASE="$(RUN_GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
  78. VERSION_NUMBER=$(GRASS_VERSION_NUMBER) VERSION_DATE=$(GRASS_VERSION_DATE) \
  79. $(PYTHON) ./build_class_graphical.py $(HTMLDIR)
  80. endef
  81. $(HTMLDIR)/topics.html: $(ALL_HTML) build_topics.py
  82. $(call build_topics)
  83. touch $@
  84. $(HTMLDIR)/full_index.html: $(ALL_HTML) build_full_index.py build_html.py
  85. $(call build,full_index)
  86. touch $@
  87. $(HTMLDIR)/index.html: build_index.py build_html.py
  88. $(call build,index)
  89. touch $@
  90. $(HTMLDIR)/keywords.html: $(ALL_HTML)
  91. $(call build_keywords)
  92. touch $@
  93. $(HTMLDIR)/graphical_index.html: $(ALL_HTML)
  94. $(call build_graphical_index)
  95. touch $@
  96. $(HTMLDIR)/manual_gallery.html: $(ALL_HTML)
  97. $(call build_manual_gallery)
  98. $(HTMLDIR)/parser_standard_options.html: $(ALL_HTML)
  99. $(call build_pso)
  100. touch $@
  101. # TODO: this should be done in the same way as category_rule
  102. $(HTMLDIR)/class_graphical.html: $(ALL_HTML)
  103. $(call build_class_graphical)
  104. touch $@
  105. define category_rule
  106. $$(HTMLDIR)/$(2).html: $$(wildcard $$(HTMLDIR)/$(1).*.html) build_class.py build_html.py
  107. $$(call build,class,$(1) $(2))
  108. touch $$@
  109. endef
  110. $(foreach cat,$(categories),$(eval $(call category_rule,$(firstword $(subst :, ,$(cat))),$(lastword $(subst :, ,$(cat))))))
  111. $(HTMLDIR)/grassdocs.css: grassdocs.css
  112. $(INSTALL_DATA) $< $@
  113. $(HTMLDIR)/grass_logo.png: grass_logo.png
  114. $(INSTALL_DATA) $< $@
  115. $(HTMLDIR)/grass_icon.png: grass_icon.png
  116. $(INSTALL_DATA) $< $@
  117. $(HTMLDIR)/jquery.fixedheadertable.min.js: jquery.fixedheadertable.min.js
  118. $(INSTALL_DATA) $< $@
  119. $(HTMLDIR)/parser_standard_options.js: parser_standard_options.js
  120. $(INSTALL_DATA) $< $@
  121. $(HTMLDIR)/parser_standard_options.css: parser_standard_options.css
  122. $(INSTALL_DATA) $< $@