Makefile 3.2 KB

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