Commit 333db8e12a06c4cbfcb797b3c164641c809857cb
1 parent
361f1e40
Rewrite documentation macro and Makefile
- only check if documentation tools are installed in acinclude.m4 - don't provide built documentation in dist tarball - simpler Makefile - display warning message and check result
Showing
4 changed files
with
74 additions
and
103 deletions
Makefile.am
acinclude.m4
| 1 | 1 | dnl ############################################################################## |
| 2 | -dnl # AC_LIBMODBUS_CHECK_DOC_BUILD # | |
| 2 | +dnl # AC_LIBMODBUS_CHECK_BUILD_DOC # | |
| 3 | 3 | dnl # Check whether to build documentation and install man-pages # |
| 4 | 4 | dnl ############################################################################## |
| 5 | -AC_DEFUN([AC_LIBMODBUS_CHECK_DOC_BUILD], [{ | |
| 5 | +AC_DEFUN([AC_LIBMODBUS_CHECK_BUILD_DOC], [{ | |
| 6 | 6 | # Allow user to disable doc build |
| 7 | 7 | AC_ARG_WITH([documentation], [AS_HELP_STRING([--without-documentation], |
| 8 | 8 | [disable documentation build even if asciidoc and xmlto are present [default=no]])]) |
| 9 | 9 | |
| 10 | 10 | if test "x$with_documentation" = "xno"; then |
| 11 | 11 | ac_libmodbus_build_doc="no" |
| 12 | - ac_libmodbus_install_man="no" | |
| 13 | 12 | else |
| 14 | 13 | # Determine whether or not documentation should be built and installed. |
| 15 | 14 | ac_libmodbus_build_doc="yes" |
| 16 | - ac_libmodbus_install_man="yes" | |
| 17 | 15 | # Check for asciidoc and xmlto and don't build the docs if these are not installed. |
| 18 | 16 | AC_CHECK_PROG(ac_libmodbus_have_asciidoc, asciidoc, yes, no) |
| 19 | 17 | AC_CHECK_PROG(ac_libmodbus_have_xmlto, xmlto, yes, no) |
| 20 | 18 | if test "x$ac_libmodbus_have_asciidoc" = "xno" -o "x$ac_libmodbus_have_xmlto" = "xno"; then |
| 21 | - ac_libmodbus_build_doc="no" | |
| 22 | - # Tarballs built with 'make dist' ship with prebuilt documentation. | |
| 23 | - if ! test -f doc/libmodbus.7; then | |
| 24 | - ac_libmodbus_install_man="no" | |
| 25 | - AC_MSG_WARN([You are building an unreleased version of libmodbus and asciidoc or xmlto are not installed.]) | |
| 26 | - AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.]) | |
| 27 | - fi | |
| 28 | - fi | |
| 29 | - | |
| 30 | - # Do not install man pages if on mingw | |
| 31 | - if test "x$ac_libmodbus_on_mingw32" = "xyes"; then | |
| 32 | - ac_libmodbus_install_man="no" | |
| 19 | + ac_libmodbus_build_doc="no" | |
| 33 | 20 | fi |
| 34 | 21 | fi |
| 35 | 22 | |
| 36 | 23 | AC_MSG_CHECKING([whether to build documentation]) |
| 37 | 24 | AC_MSG_RESULT([$ac_libmodbus_build_doc]) |
| 38 | - | |
| 39 | - AC_MSG_CHECKING([whether to install manpages]) | |
| 40 | - AC_MSG_RESULT([$ac_libmodbus_install_man]) | |
| 41 | - | |
| 25 | + if test "x$ac_libmodbus_build_doc" = "xno"; then | |
| 26 | + AC_MSG_WARN([The tools to build the documentation aren't installed]) | |
| 27 | + fi | |
| 42 | 28 | AM_CONDITIONAL(BUILD_DOC, test "x$ac_libmodbus_build_doc" = "xyes") |
| 43 | - AM_CONDITIONAL(INSTALL_MAN, test "x$ac_libmodbus_install_man" = "xyes") | |
| 44 | 29 | }]) | ... | ... |
configure.ac
| ... | ... | @@ -90,7 +90,7 @@ AC_CHECK_HEADERS([ \ |
| 90 | 90 | ]) |
| 91 | 91 | |
| 92 | 92 | # Check whether to build docs / install man pages |
| 93 | -AC_LIBMODBUS_CHECK_DOC_BUILD | |
| 93 | +AC_LIBMODBUS_CHECK_BUILD_DOC | |
| 94 | 94 | |
| 95 | 95 | # Cygwin defines IPTOS_LOWDELAY but can't handle that flag so it's necessary to |
| 96 | 96 | # workaround that problem and Cygwin doesn't define MSG_DONTWAIT. |
| ... | ... | @@ -130,8 +130,8 @@ AC_CONFIG_FILES([ |
| 130 | 130 | src/Makefile |
| 131 | 131 | src/modbus-version.h |
| 132 | 132 | src/win32/modbus.dll.manifest |
| 133 | - doc/Makefile | |
| 134 | 133 | tests/Makefile |
| 134 | + doc/Makefile | |
| 135 | 135 | libmodbus.pc |
| 136 | 136 | libmodbus.spec |
| 137 | 137 | ]) |
| ... | ... | @@ -149,4 +149,6 @@ AC_MSG_RESULT([ |
| 149 | 149 | compiler: ${CC} |
| 150 | 150 | cflags: ${CFLAGS} |
| 151 | 151 | ldflags: ${LDFLAGS} |
| 152 | + | |
| 153 | + documentation: ${ac_libmodbus_build_doc} | |
| 152 | 154 | ]) | ... | ... |
doc/Makefile.am
| 1 | -EXTRA_DIST = asciidoc.conf | |
| 2 | -CLEANFILES = | |
| 1 | +TXT3 = \ | |
| 2 | + modbus_close.txt \ | |
| 3 | + modbus_connect.txt \ | |
| 4 | + modbus_flush.txt \ | |
| 5 | + modbus_free.txt \ | |
| 6 | + modbus_get_byte_from_bits.txt \ | |
| 7 | + modbus_get_byte_timeout.txt \ | |
| 8 | + modbus_get_float.txt \ | |
| 9 | + modbus_get_float_dcba.txt \ | |
| 10 | + modbus_get_header_length.txt \ | |
| 11 | + modbus_get_response_timeout.txt \ | |
| 12 | + modbus_get_socket.txt \ | |
| 13 | + modbus_mapping_free.txt \ | |
| 14 | + modbus_mapping_new.txt \ | |
| 15 | + modbus_mask_write_register.txt \ | |
| 16 | + modbus_new_rtu.txt \ | |
| 17 | + modbus_new_tcp_pi.txt \ | |
| 18 | + modbus_new_tcp.txt \ | |
| 19 | + modbus_read_bits.txt \ | |
| 20 | + modbus_read_input_bits.txt \ | |
| 21 | + modbus_read_input_registers.txt \ | |
| 22 | + modbus_read_registers.txt \ | |
| 23 | + modbus_receive_confirmation.txt \ | |
| 24 | + modbus_receive.txt \ | |
| 25 | + modbus_reply_exception.txt \ | |
| 26 | + modbus_reply.txt \ | |
| 27 | + modbus_report_slave_id.txt \ | |
| 28 | + modbus_rtu_get_serial_mode.txt \ | |
| 29 | + modbus_rtu_set_serial_mode.txt \ | |
| 30 | + modbus_rtu_get_rts.txt \ | |
| 31 | + modbus_rtu_set_rts.txt \ | |
| 32 | + modbus_send_raw_request.txt \ | |
| 33 | + modbus_set_bits_from_bytes.txt \ | |
| 34 | + modbus_set_bits_from_byte.txt \ | |
| 35 | + modbus_set_byte_timeout.txt \ | |
| 36 | + modbus_set_debug.txt \ | |
| 37 | + modbus_set_error_recovery.txt \ | |
| 38 | + modbus_set_float.txt \ | |
| 39 | + modbus_set_float_dcba.txt \ | |
| 40 | + modbus_set_response_timeout.txt \ | |
| 41 | + modbus_set_slave.txt \ | |
| 42 | + modbus_set_socket.txt \ | |
| 43 | + modbus_strerror.txt \ | |
| 44 | + modbus_tcp_accept.txt \ | |
| 45 | + modbus_tcp_pi_accept.txt \ | |
| 46 | + modbus_tcp_listen.txt \ | |
| 47 | + modbus_tcp_pi_listen.txt \ | |
| 48 | + modbus_write_and_read_registers.txt \ | |
| 49 | + modbus_write_bits.txt \ | |
| 50 | + modbus_write_bit.txt \ | |
| 51 | + modbus_write_registers.txt \ | |
| 52 | + modbus_write_register.txt | |
| 53 | +TXT7 = libmodbus.txt | |
| 3 | 54 | |
| 4 | -MAN3 = \ | |
| 5 | - modbus_close.3 \ | |
| 6 | - modbus_connect.3 \ | |
| 7 | - modbus_flush.3 \ | |
| 8 | - modbus_free.3 \ | |
| 9 | - modbus_get_byte_from_bits.3 \ | |
| 10 | - modbus_get_byte_timeout.3 \ | |
| 11 | - modbus_get_float.3 \ | |
| 12 | - modbus_get_float_dcba.3 \ | |
| 13 | - modbus_get_header_length.3 \ | |
| 14 | - modbus_get_response_timeout.3 \ | |
| 15 | - modbus_get_socket.3 \ | |
| 16 | - modbus_mapping_free.3 \ | |
| 17 | - modbus_mapping_new.3 \ | |
| 18 | - modbus_mask_write_register.3 \ | |
| 19 | - modbus_new_rtu.3 \ | |
| 20 | - modbus_new_tcp_pi.3 \ | |
| 21 | - modbus_new_tcp.3 \ | |
| 22 | - modbus_read_bits.3 \ | |
| 23 | - modbus_read_input_bits.3 \ | |
| 24 | - modbus_read_input_registers.3 \ | |
| 25 | - modbus_read_registers.3 \ | |
| 26 | - modbus_receive_confirmation.3 \ | |
| 27 | - modbus_receive.3 \ | |
| 28 | - modbus_reply_exception.3 \ | |
| 29 | - modbus_reply.3 \ | |
| 30 | - modbus_report_slave_id.3 \ | |
| 31 | - modbus_rtu_get_serial_mode.3 \ | |
| 32 | - modbus_rtu_set_serial_mode.3 \ | |
| 33 | - modbus_rtu_get_rts.3 \ | |
| 34 | - modbus_rtu_set_rts.3 \ | |
| 35 | - modbus_send_raw_request.3 \ | |
| 36 | - modbus_set_bits_from_bytes.3 \ | |
| 37 | - modbus_set_bits_from_byte.3 \ | |
| 38 | - modbus_set_byte_timeout.3 \ | |
| 39 | - modbus_set_debug.3 \ | |
| 40 | - modbus_set_error_recovery.3 \ | |
| 41 | - modbus_set_float.3 \ | |
| 42 | - modbus_set_float_dcba.3 \ | |
| 43 | - modbus_set_response_timeout.3 \ | |
| 44 | - modbus_set_slave.3 \ | |
| 45 | - modbus_set_socket.3 \ | |
| 46 | - modbus_strerror.3 \ | |
| 47 | - modbus_tcp_accept.3 \ | |
| 48 | - modbus_tcp_pi_accept.3 \ | |
| 49 | - modbus_tcp_listen.3 \ | |
| 50 | - modbus_tcp_pi_listen.3 \ | |
| 51 | - modbus_write_and_read_registers.3 \ | |
| 52 | - modbus_write_bits.3 \ | |
| 53 | - modbus_write_bit.3 \ | |
| 54 | - modbus_write_registers.3 \ | |
| 55 | - modbus_write_register.3 | |
| 56 | -MAN7 = libmodbus.7 | |
| 55 | +EXTRA_DIST = asciidoc.conf $(TXT3) $(TXT7) | |
| 57 | 56 | |
| 58 | -MAN_DOC = $(MAN3) $(MAN7) | |
| 57 | +MAN3 = $(TXT3:%.txt=%.3) | |
| 58 | +MAN7 = $(TXT7:%.txt=%.7) | |
| 59 | 59 | |
| 60 | -MAN_TXT = $(MAN3:%.3=%.txt) | |
| 61 | -MAN_TXT += $(MAN7:%.7=%.txt) | |
| 62 | -MAN_HTML = $(MAN_TXT:%.txt=%.html) | |
| 63 | - | |
| 64 | -if INSTALL_MAN | |
| 65 | -dist_man_MANS = $(MAN_DOC) | |
| 66 | -doc: $(MAN_DOC) | |
| 67 | -endif | |
| 68 | - | |
| 69 | -EXTRA_DIST += $(MAN_TXT) | |
| 70 | 60 | if BUILD_DOC |
| 71 | -EXTRA_DIST += $(MAN_HTML) | |
| 72 | -html: $(MAN_HTML) | |
| 61 | +man3_MANS = $(MAN3) | |
| 62 | +man7_MANS = $(MAN7) | |
| 73 | 63 | endif |
| 74 | 64 | |
| 75 | -MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML) | |
| 65 | +HTML = $(TXT3:%.txt=%.html) $(TXT7:%.txt=%.html) | |
| 76 | 66 | |
| 77 | -dist-hook: $(MAN_DOC) $(MAN_HTML) | |
| 78 | - | |
| 79 | -if BUILD_DOC | |
| 80 | -SUFFIXES=.html .txt .xml .1 .3 .7 | |
| 67 | +htmldoc: $(HTML) | |
| 81 | 68 | |
| 82 | 69 | .txt.html: |
| 83 | 70 | asciidoc -d manpage -b xhtml11 -f asciidoc.conf \ |
| ... | ... | @@ -85,12 +72,9 @@ SUFFIXES=.html .txt .xml .1 .3 .7 |
| 85 | 72 | .txt.xml: |
| 86 | 73 | asciidoc -d manpage -b docbook -f asciidoc.conf \ |
| 87 | 74 | -alibmodbus_version=@LIBMODBUS_VERSION@ $< |
| 88 | -.xml.1: | |
| 89 | - xmlto man $< | |
| 90 | 75 | .xml.3: |
| 91 | - xmlto man $< | |
| 76 | + xmlto --skip-validation man $< | |
| 92 | 77 | .xml.7: |
| 93 | - xmlto man $< | |
| 78 | + xmlto --skip-validation man $< | |
| 94 | 79 | |
| 95 | -CLEANFILES += *.1 *.3 *.7 *.html | |
| 96 | -endif | |
| 80 | +CLEANFILES = *.3 *.7 *.html | ... | ... |