plugin_asciidoc.mk 5.5 KB

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