From 333db8e12a06c4cbfcb797b3c164641c809857cb Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Wed, 29 Oct 2014 22:41:30 +0100 Subject: [PATCH] Rewrite documentation macro and Makefile --- Makefile.am | 2 +- acinclude.m4 | 27 ++++++--------------------- configure.ac | 6 ++++-- doc/Makefile.am | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------- 4 files changed, 74 insertions(+), 103 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8946597..cddb4b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,4 +8,4 @@ pkgconfig_DATA = libmodbus.pc EXTRA_DIST += libmodbus.pc.in CLEANFILES += libmodbus.pc -SUBDIRS = src doc tests +SUBDIRS = src tests doc diff --git a/acinclude.m4 b/acinclude.m4 index 0bf0b92..47c7971 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,44 +1,29 @@ dnl ############################################################################## -dnl # AC_LIBMODBUS_CHECK_DOC_BUILD # +dnl # AC_LIBMODBUS_CHECK_BUILD_DOC # dnl # Check whether to build documentation and install man-pages # dnl ############################################################################## -AC_DEFUN([AC_LIBMODBUS_CHECK_DOC_BUILD], [{ +AC_DEFUN([AC_LIBMODBUS_CHECK_BUILD_DOC], [{ # Allow user to disable doc build AC_ARG_WITH([documentation], [AS_HELP_STRING([--without-documentation], [disable documentation build even if asciidoc and xmlto are present [default=no]])]) if test "x$with_documentation" = "xno"; then ac_libmodbus_build_doc="no" - ac_libmodbus_install_man="no" else # Determine whether or not documentation should be built and installed. ac_libmodbus_build_doc="yes" - ac_libmodbus_install_man="yes" # Check for asciidoc and xmlto and don't build the docs if these are not installed. AC_CHECK_PROG(ac_libmodbus_have_asciidoc, asciidoc, yes, no) AC_CHECK_PROG(ac_libmodbus_have_xmlto, xmlto, yes, no) if test "x$ac_libmodbus_have_asciidoc" = "xno" -o "x$ac_libmodbus_have_xmlto" = "xno"; then - ac_libmodbus_build_doc="no" - # Tarballs built with 'make dist' ship with prebuilt documentation. - if ! test -f doc/libmodbus.7; then - ac_libmodbus_install_man="no" - AC_MSG_WARN([You are building an unreleased version of libmodbus and asciidoc or xmlto are not installed.]) - AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.]) - fi - fi - - # Do not install man pages if on mingw - if test "x$ac_libmodbus_on_mingw32" = "xyes"; then - ac_libmodbus_install_man="no" + ac_libmodbus_build_doc="no" fi fi AC_MSG_CHECKING([whether to build documentation]) AC_MSG_RESULT([$ac_libmodbus_build_doc]) - - AC_MSG_CHECKING([whether to install manpages]) - AC_MSG_RESULT([$ac_libmodbus_install_man]) - + if test "x$ac_libmodbus_build_doc" = "xno"; then + AC_MSG_WARN([The tools to build the documentation aren't installed]) + fi AM_CONDITIONAL(BUILD_DOC, test "x$ac_libmodbus_build_doc" = "xyes") - AM_CONDITIONAL(INSTALL_MAN, test "x$ac_libmodbus_install_man" = "xyes") }]) diff --git a/configure.ac b/configure.ac index 3cca6c4..bfbcb40 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,7 @@ AC_CHECK_HEADERS([ \ ]) # Check whether to build docs / install man pages -AC_LIBMODBUS_CHECK_DOC_BUILD +AC_LIBMODBUS_CHECK_BUILD_DOC # Cygwin defines IPTOS_LOWDELAY but can't handle that flag so it's necessary to # workaround that problem and Cygwin doesn't define MSG_DONTWAIT. @@ -130,8 +130,8 @@ AC_CONFIG_FILES([ src/Makefile src/modbus-version.h src/win32/modbus.dll.manifest - doc/Makefile tests/Makefile + doc/Makefile libmodbus.pc libmodbus.spec ]) @@ -149,4 +149,6 @@ AC_MSG_RESULT([ compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} + + documentation: ${ac_libmodbus_build_doc} ]) diff --git a/doc/Makefile.am b/doc/Makefile.am index ca49ea4..e51a046 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,83 +1,70 @@ -EXTRA_DIST = asciidoc.conf -CLEANFILES = +TXT3 = \ + modbus_close.txt \ + modbus_connect.txt \ + modbus_flush.txt \ + modbus_free.txt \ + modbus_get_byte_from_bits.txt \ + modbus_get_byte_timeout.txt \ + modbus_get_float.txt \ + modbus_get_float_dcba.txt \ + modbus_get_header_length.txt \ + modbus_get_response_timeout.txt \ + modbus_get_socket.txt \ + modbus_mapping_free.txt \ + modbus_mapping_new.txt \ + modbus_mask_write_register.txt \ + modbus_new_rtu.txt \ + modbus_new_tcp_pi.txt \ + modbus_new_tcp.txt \ + modbus_read_bits.txt \ + modbus_read_input_bits.txt \ + modbus_read_input_registers.txt \ + modbus_read_registers.txt \ + modbus_receive_confirmation.txt \ + modbus_receive.txt \ + modbus_reply_exception.txt \ + modbus_reply.txt \ + modbus_report_slave_id.txt \ + modbus_rtu_get_serial_mode.txt \ + modbus_rtu_set_serial_mode.txt \ + modbus_rtu_get_rts.txt \ + modbus_rtu_set_rts.txt \ + modbus_send_raw_request.txt \ + modbus_set_bits_from_bytes.txt \ + modbus_set_bits_from_byte.txt \ + modbus_set_byte_timeout.txt \ + modbus_set_debug.txt \ + modbus_set_error_recovery.txt \ + modbus_set_float.txt \ + modbus_set_float_dcba.txt \ + modbus_set_response_timeout.txt \ + modbus_set_slave.txt \ + modbus_set_socket.txt \ + modbus_strerror.txt \ + modbus_tcp_accept.txt \ + modbus_tcp_pi_accept.txt \ + modbus_tcp_listen.txt \ + modbus_tcp_pi_listen.txt \ + modbus_write_and_read_registers.txt \ + modbus_write_bits.txt \ + modbus_write_bit.txt \ + modbus_write_registers.txt \ + modbus_write_register.txt +TXT7 = libmodbus.txt -MAN3 = \ - modbus_close.3 \ - modbus_connect.3 \ - modbus_flush.3 \ - modbus_free.3 \ - modbus_get_byte_from_bits.3 \ - modbus_get_byte_timeout.3 \ - modbus_get_float.3 \ - modbus_get_float_dcba.3 \ - modbus_get_header_length.3 \ - modbus_get_response_timeout.3 \ - modbus_get_socket.3 \ - modbus_mapping_free.3 \ - modbus_mapping_new.3 \ - modbus_mask_write_register.3 \ - modbus_new_rtu.3 \ - modbus_new_tcp_pi.3 \ - modbus_new_tcp.3 \ - modbus_read_bits.3 \ - modbus_read_input_bits.3 \ - modbus_read_input_registers.3 \ - modbus_read_registers.3 \ - modbus_receive_confirmation.3 \ - modbus_receive.3 \ - modbus_reply_exception.3 \ - modbus_reply.3 \ - modbus_report_slave_id.3 \ - modbus_rtu_get_serial_mode.3 \ - modbus_rtu_set_serial_mode.3 \ - modbus_rtu_get_rts.3 \ - modbus_rtu_set_rts.3 \ - modbus_send_raw_request.3 \ - modbus_set_bits_from_bytes.3 \ - modbus_set_bits_from_byte.3 \ - modbus_set_byte_timeout.3 \ - modbus_set_debug.3 \ - modbus_set_error_recovery.3 \ - modbus_set_float.3 \ - modbus_set_float_dcba.3 \ - modbus_set_response_timeout.3 \ - modbus_set_slave.3 \ - modbus_set_socket.3 \ - modbus_strerror.3 \ - modbus_tcp_accept.3 \ - modbus_tcp_pi_accept.3 \ - modbus_tcp_listen.3 \ - modbus_tcp_pi_listen.3 \ - modbus_write_and_read_registers.3 \ - modbus_write_bits.3 \ - modbus_write_bit.3 \ - modbus_write_registers.3 \ - modbus_write_register.3 -MAN7 = libmodbus.7 +EXTRA_DIST = asciidoc.conf $(TXT3) $(TXT7) -MAN_DOC = $(MAN3) $(MAN7) +MAN3 = $(TXT3:%.txt=%.3) +MAN7 = $(TXT7:%.txt=%.7) -MAN_TXT = $(MAN3:%.3=%.txt) -MAN_TXT += $(MAN7:%.7=%.txt) -MAN_HTML = $(MAN_TXT:%.txt=%.html) - -if INSTALL_MAN -dist_man_MANS = $(MAN_DOC) -doc: $(MAN_DOC) -endif - -EXTRA_DIST += $(MAN_TXT) if BUILD_DOC -EXTRA_DIST += $(MAN_HTML) -html: $(MAN_HTML) +man3_MANS = $(MAN3) +man7_MANS = $(MAN7) endif -MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML) +HTML = $(TXT3:%.txt=%.html) $(TXT7:%.txt=%.html) -dist-hook: $(MAN_DOC) $(MAN_HTML) - -if BUILD_DOC -SUFFIXES=.html .txt .xml .1 .3 .7 +htmldoc: $(HTML) .txt.html: asciidoc -d manpage -b xhtml11 -f asciidoc.conf \ @@ -85,12 +72,9 @@ SUFFIXES=.html .txt .xml .1 .3 .7 .txt.xml: asciidoc -d manpage -b docbook -f asciidoc.conf \ -alibmodbus_version=@LIBMODBUS_VERSION@ $< -.xml.1: - xmlto man $< .xml.3: - xmlto man $< + xmlto --skip-validation man $< .xml.7: - xmlto man $< + xmlto --skip-validation man $< -CLEANFILES += *.1 *.3 *.7 *.html -endif +CLEANFILES = *.3 *.7 *.html -- libgit2 0.21.4