Makefile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 prerequsite. 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 -o -print)
  30. $(BLD_DIR_DOC): sdk release-notes $(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. @for i in $? ; do asciidoc $$i ; done
  46. @mv release-notes/*.html $@/
  47. @echo "--- Generated $@"
  48. .PHONY: sdk
  49. sdk: $(BLD_DIR_DOC)/sdk/sdk.html
  50. $(BLD_DIR_DOC)/sdk/sdk.html: $(shell find sdk -type f)
  51. @echo '--- Generating sdk doc at $@'
  52. @mkdir -p $(@D)
  53. @cp sdk/*.png $(@D)
  54. @cp docbook.css $(@D)
  55. @# This is somewhat heinous, but works fine and avoids the need
  56. @# to install markdown on developer systems, or depend on building
  57. @# out the virtual env to build sdk docs
  58. @PYTHONPATH=$(DESKTOP_DIR)/core/ext-py/markdown:$(DESKTOP_DIR)/core/ext-py/elementtree \
  59. $(DESKTOP_DIR)/core/ext-py/markdown/bin/markdown \
  60. sdk/sdk.md -x toc > $@
  61. @echo "--- Generated $@"
  62. clean:
  63. @echo '--- Removing $(BLD_DIR_DOC)'
  64. @rm -rf $(BLD_DIR_DOC)