Makefile 3.7 KB

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