Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. export ROOT := $(realpath ..)
  19. include $(ROOT)/Makefile.vars.priv
  20. .PHONY: default docs
  21. default: docs
  22. docs: $(BLD_DIR_DOC)
  23. # Option for a2x
  24. NO_TOC := --xsltproc-opts='--stringparam generate.toc ""'
  25. #
  26. # Being lazy/loose with the prerequisite. Include all files except sdk and
  27. # release notes, which are handled separately below.
  28. #
  29. DOC_FILES := $(shell find . -name sdk -prune -o -name release-notes -name user-guide -name admin-manual -o -print)
  30. $(BLD_DIR_DOC): sdk release-notes user-guide admin-manual $(DOC_FILES)
  31. @echo '--- Generating doc at $@'
  32. @mkdir -p $@
  33. @a2x $(NO_TOC) --icons --icons-dir=images --format=xhtml --stylesheet=docbook.css -D $@ index.txt
  34. @rm -f index.xml
  35. @cp docbook.css $@
  36. @cp images/favicon.ico $@
  37. @# Remove intermediate file
  38. @rsync -a images $@/
  39. .PHONY: release-notes
  40. release-notes: $(BLD_DIR_DOC)/release-notes
  41. $(BLD_DIR_DOC)/release-notes: $(wildcard release-notes/*.txt)
  42. @echo '--- Generating release notes at $@'
  43. @mkdir -p $@
  44. @cp docbook.css $@
  45. @cp docbook.css release-notes/
  46. @for i in $? ; do \
  47. a2x --format=xhtml --stylesheet=docbook.css $$i ; \
  48. rm -f $$i.xml ; \
  49. done;
  50. @rm release-notes/docbook.css
  51. @mv release-notes/*.html $@/
  52. @echo "--- Generated $@"
  53. .PHONY: admin-manual
  54. admin-manual: $(BLD_DIR_DOC)/admin-manual
  55. $(BLD_DIR_DOC)/admin-manual: $(wildcard admin-manual/*.md)
  56. @echo '--- Generating admin-manual doc at $@'
  57. @mkdir -p $@
  58. @cp docbook.css $@
  59. @cp bootplus.css $@
  60. @PYTHONPATH=$(DESKTOP_DIR)/core/ext-py/markdown:$(DESKTOP_DIR)/core/ext-py/elementtree \
  61. $(DESKTOP_DIR)/core/ext-py/markdown/bin/markdown \
  62. admin-manual/manual.md -x toc > $@/manual.html
  63. @echo "--- Generated $@"
  64. .PHONY: user-guide
  65. user-guide: $(BLD_DIR_DOC)/user-guide
  66. $(BLD_DIR_DOC)/user-guide: $(wildcard user-guide/*.md)
  67. @echo '--- Generating user-guide doc at $@'
  68. @mkdir -p $@
  69. @cp -r user-guide/images $@
  70. @cp docbook.css $@
  71. @cp bootplus.css $@
  72. @for x in $? ; do PYTHONPATH=$(DESKTOP_DIR)/core/ext-py/markdown:$(DESKTOP_DIR)/core/ext-py/elementtree \
  73. $(DESKTOP_DIR)/core/ext-py/markdown/bin/markdown \
  74. $$x > $(BLD_DIR_DOC)/$$x -x toc ; done
  75. @(cd $@; for file in *.md; do mv $${file} $${file/\.md/.html}; done)
  76. @echo "--- Generated $@"
  77. .PHONY: sdk
  78. sdk: $(BLD_DIR_DOC)/sdk/sdk.html
  79. $(BLD_DIR_DOC)/sdk/sdk.html: $(shell find sdk -type f)
  80. @echo '--- Generating sdk doc at $@'
  81. @mkdir -p $(@D)
  82. @cp sdk/*.png $(@D)
  83. @cp docbook.css $(@D)
  84. @cp bootplus.css $(@D)
  85. @# This is somewhat heinous, but works fine and avoids the need
  86. @# to install markdown on developer systems, or depend on building
  87. @# out the virtual env to build sdk docs
  88. @PYTHONPATH=$(DESKTOP_DIR)/core/ext-py/markdown:$(DESKTOP_DIR)/core/ext-py/elementtree \
  89. $(DESKTOP_DIR)/core/ext-py/markdown/bin/markdown \
  90. sdk/sdk.md -x toc > $@
  91. @echo "--- Generated $@"
  92. clean:
  93. @echo '--- Removing $(BLD_DIR_DOC)'
  94. @rm -rf $(BLD_DIR_DOC)