plugin_asciidoc.mk 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # AsciiDoc plugin.
  2. ASCIIDOC_CASES = build docs guide install manual
  3. ASCIIDOC_TARGETS = $(addprefix asciidoc-,$(ASCIIDOC_CASES))
  4. .PHONY: asciidoc $(ASCIIDOC_TARGETS)
  5. asciidoc: $(ASCIIDOC_TARGETS)
  6. asciidoc-build: build clean
  7. $i "Bootstrap a new OTP application named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  11. $i "Only enable man pages section 3"
  12. $t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
  13. $i "Run AsciiDoc"
  14. $t $(MAKE) -C $(APP) asciidoc $v
  15. $i "Check that no documentation was generated"
  16. $t test ! -e $(APP)/doc/guide.pdf
  17. $t test ! -e $(APP)/doc/html/
  18. $t test ! -e $(APP)/doc/man3/
  19. $i "Generate AsciiDoc documentation"
  20. $t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
  21. $t printf "%s\n" \
  22. "= Erlang.mk tests" "" \
  23. "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
  24. $t printf "%s\n" \
  25. "= erlang_mk(3)" "" \
  26. "== Name" "" \
  27. "erlang_mk - Erlang.mk test" "" \
  28. "== Description" "" \
  29. "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
  30. $i "Run AsciiDoc"
  31. $t $(MAKE) -C $(APP) asciidoc $v
  32. $i "Check that the documentation was generated"
  33. $t test -f $(APP)/doc/guide.pdf
  34. $t test -d $(APP)/doc/html/
  35. $t test -f $(APP)/doc/man3/erlang_mk.3.gz
  36. $i "Distclean the application"
  37. $t $(MAKE) -C $(APP) distclean $v
  38. $i "Check that the generated documentation was removed"
  39. $t test ! -e $(APP)/doc/guide.pdf
  40. $t test ! -e $(APP)/doc/html/
  41. $t test ! -e $(APP)/doc/man3/
  42. $i "Generate an invalid AsciiDoc file"
  43. $t printf "%s\n" \
  44. "= fail(3)" "" \
  45. "This will fail because the Name section is missing." > $(APP)/doc/src/manual/fail.asciidoc
  46. $i "Check that AsciiDoc errors out"
  47. $t ! $(MAKE) -C $(APP) asciidoc $v
  48. asciidoc-docs: build clean
  49. $i "Bootstrap a new OTP application named $(APP)"
  50. $t mkdir $(APP)/
  51. $t cp ../erlang.mk $(APP)/
  52. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  53. $i "Generate AsciiDoc documentation"
  54. $t mkdir -p $(APP)/doc/src/guide/
  55. $t printf "%s\n" \
  56. "= Erlang.mk tests" "" \
  57. "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
  58. $i "Check that AsciiDoc runs on 'make docs'"
  59. $t $(MAKE) -C $(APP) docs $v
  60. $t test -f $(APP)/doc/guide.pdf
  61. $t test -d $(APP)/doc/html/
  62. asciidoc-guide: build clean
  63. $i "Bootstrap a new OTP application named $(APP)"
  64. $t mkdir $(APP)/
  65. $t cp ../erlang.mk $(APP)/
  66. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  67. $i "Generate AsciiDoc documentation"
  68. $t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
  69. $t printf "%s\n" \
  70. "= Erlang.mk tests" "" \
  71. "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
  72. $t printf "%s\n" \
  73. "= erlang_mk(3)" "" \
  74. "== Name" "" \
  75. "erlang_mk - Erlang.mk test" "" \
  76. "== Description" "" \
  77. "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
  78. $i "Check that only the guide is generated on 'make asciidoc-guide'"
  79. $t $(MAKE) -C $(APP) asciidoc-guide $v
  80. $t test -f $(APP)/doc/guide.pdf
  81. $t test -d $(APP)/doc/html/
  82. $t test ! -e $(APP)/doc/man3/
  83. asciidoc-install: build clean
  84. $i "Bootstrap a new OTP application named $(APP)"
  85. $t mkdir $(APP)/
  86. $t cp ../erlang.mk $(APP)/
  87. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  88. $i "Only enable man pages section 3"
  89. $t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
  90. $i "Generate AsciiDoc documentation"
  91. $t mkdir -p $(APP)/doc/src/manual/
  92. $t printf "%s\n" \
  93. "= erlang_mk(3)" "" \
  94. "== Name" "" \
  95. "erlang_mk - Erlang.mk test" "" \
  96. "== Description" "" \
  97. "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
  98. $i "Build and install the man pages to $(APP)/installed/"
  99. $t $(MAKE) -C $(APP) install-docs MAN_INSTALL_PATH=installed/share $v
  100. $i "Check that the documentation was installed properly"
  101. $t test -f $(APP)/installed/share/man3/erlang_mk.3.gz
  102. asciidoc-manual: build clean
  103. $i "Bootstrap a new OTP application named $(APP)"
  104. $t mkdir $(APP)/
  105. $t cp ../erlang.mk $(APP)/
  106. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  107. $i "Only enable man pages section 3"
  108. $t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
  109. $i "Generate AsciiDoc documentation"
  110. $t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
  111. $t printf "%s\n" \
  112. "= Erlang.mk tests" "" \
  113. "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
  114. $t printf "%s\n" \
  115. "= erlang_mk(3)" "" \
  116. "== Name" "" \
  117. "erlang_mk - Erlang.mk test" "" \
  118. "== Description" "" \
  119. "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
  120. $i "Check that only the manual is generated on 'make asciidoc-manual'"
  121. $t $(MAKE) -C $(APP) asciidoc-manual $v
  122. $t test ! -e $(APP)/doc/guide.pdf
  123. $t test ! -e $(APP)/doc/html/
  124. $t test -f $(APP)/doc/man3/erlang_mk.3.gz