Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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=css/docbook.css -D $@ index.txt
  34. @rm -f index.xml
  35. @cp images/favicon.ico $@
  36. @# Remove intermediate file
  37. @rsync -a images $@/
  38. @rsync -a js $@/
  39. @rsync -a css $@/
  40. @rsync -a fonts $@/
  41. .PHONY: release-notes
  42. release-notes: $(BLD_DIR_DOC)/release-notes
  43. $(BLD_DIR_DOC)/release-notes: $(wildcard release-notes/*.txt)
  44. @echo '--- Generating release notes at $@'
  45. @mkdir -p $@
  46. @cp css/docbook.css release-notes/
  47. @for i in $? ; do \
  48. a2x $(NO_TOC) --format=xhtml --stylesheet=docbook.css $$i ; \
  49. rm -f $$i.xml ; \
  50. done;
  51. @mv release-notes/docbook.css $@/
  52. @mv release-notes/*.html $@/
  53. @echo "--- Generated $@"
  54. .PHONY: admin-manual
  55. admin-manual: $(BLD_DIR_DOC)/admin-manual
  56. $(BLD_DIR_DOC)/admin-manual: $(wildcard admin-manual/*.md)
  57. @echo '--- Generating admin-manual doc at $@'
  58. @mkdir -p $@
  59. @PYTHONPATH=$(DESKTOP_DIR)/core/ext-py/markdown:$(DESKTOP_DIR)/core/ext-py/elementtree \
  60. $(DESKTOP_DIR)/core/ext-py/markdown/bin/markdown \
  61. admin-manual/manual.md -x toc > $@/manual.html
  62. @echo "--- Generated $@"
  63. .PHONY: user-guide
  64. user-guide: $(BLD_DIR_DOC)/user-guide
  65. $(BLD_DIR_DOC)/user-guide: $(wildcard user-guide/*.md)
  66. @echo '--- Generating user-guide doc at $@'
  67. @mkdir -p $@
  68. @cp -r user-guide/images $@
  69. @for x in $? ; do PYTHONPATH=$(DESKTOP_DIR)/core/ext-py/markdown:$(DESKTOP_DIR)/core/ext-py/elementtree \
  70. $(DESKTOP_DIR)/core/ext-py/markdown/bin/markdown \
  71. $$x > $(BLD_DIR_DOC)/$$x -x toc ; done
  72. @(cd $@; for file in *.md; do mv $${file} $${file/\.md/.html}; done)
  73. @echo "--- Generated $@"
  74. .PHONY: sdk
  75. sdk: $(BLD_DIR_DOC)/sdk/sdk.html
  76. $(BLD_DIR_DOC)/sdk/sdk.html: $(shell find sdk -type f)
  77. @echo '--- Generating sdk doc at $@'
  78. @mkdir -p $(@D)
  79. @cp sdk/*.png $(@D)
  80. @# This is somewhat heinous, but works fine and avoids the need
  81. @# to install markdown on developer systems, or depend on building
  82. @# out the virtual env to build sdk docs
  83. @PYTHONPATH=$(DESKTOP_DIR)/core/ext-py/markdown:$(DESKTOP_DIR)/core/ext-py/elementtree \
  84. $(DESKTOP_DIR)/core/ext-py/markdown/bin/markdown \
  85. sdk/sdk.md -x toc > $@
  86. @echo "--- Generated $@"
  87. clean:
  88. @echo '--- Removing $(BLD_DIR_DOC)'
  89. @rm -rf $(BLD_DIR_DOC)