1# man/Makefile.am 2# 3# Copyright (C) 2018-2021 Jon Shallow <supjps-libcoap@jpshallow.com> 4# 5# This file is part of the CoAP C library libcoap. Please see README and 6# COPYING for terms of use. 7 8# picking up the default warning CFLAGS into AM_CFLAGS 9AM_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ 10 -I$(top_srcdir)/include/coap$(LIBCOAP_API_VERSION) \ 11 $(WARNING_CFLAGS) $(DTLS_CFLAGS) -std=c99 12 13# Build, not install 14noinst_PROGRAMS = examples-code-check 15 16# build manuals only if 'BUILD_MANPAGES' is defined 17if BUILD_MANPAGES 18 19# building the manpages 20 21TXT3 = coap_async.txt \ 22 coap_attribute.txt \ 23 coap_block.txt \ 24 coap_cache.txt \ 25 coap_context.txt \ 26 coap_endpoint_server.txt \ 27 coap_encryption.txt \ 28 coap_endpoint_client.txt \ 29 coap_handler.txt \ 30 coap_io.txt \ 31 coap_keepalive.txt \ 32 coap_logging.txt \ 33 coap_observe.txt \ 34 coap_pdu_access.txt \ 35 coap_pdu_setup.txt \ 36 coap_recovery.txt \ 37 coap_resource.txt \ 38 coap_session.txt \ 39 coap_string.txt \ 40 coap_tls_library.txt 41 42MAN3 = $(TXT3:%.txt=%.3) 43 44man3_MANS = $(MAN3) 45 46TXT5 = coap-client.txt \ 47 coap-rd.txt \ 48 coap-server.txt 49 50MAN5 = $(TXT5:%.txt=%.5) 51 52man5_MANS = $(MAN5) 53 54TXT7 = coap.txt 55 56MAN7 = $(TXT7:%.txt=%.7) 57 58man7_MANS = $(MAN7) 59 60.txt.3: 61 $(A2X) --doctype manpage --format manpage $< 62 $(A2X) --doctype manpage --format xhtml $< 63 64.txt.5: 65 $(A2X) --doctype manpage --format manpage $< 66 $(A2X) --doctype manpage --format xhtml $< 67 68.txt.7: 69 $(A2X) --doctype manpage --format manpage $< 70 $(A2X) --doctype manpage --format xhtml $< 71 72# Man pages built by a2x based on the NAMES section of the .txt file. 73# Note - this list includes all the defined entries, but a2x only builds the first 10. 74A2X_EXTRA_PAGES_3 = @DOLLAR_SIGN@(shell for fil in $(TXT3) ; do sed -ne '/^NAME/,/^SYNOPSIS/p;/^SYNOPSIS/q' $${fil} | \ 75 sed -ne '/coap_/{ s/ *, */\n/g; p }' | sed -ne 's/^\(coap_[a-zA-Z_0-9]\+\).*$$/\1.3/p' ; done) 76A2X_EXTRA_PAGES_5 = @DOLLAR_SIGN@(shell for fil in $(TXT5) ; do sed -ne '/^NAME/,/^SYNOPSIS/p;/^SYNOPSIS/q' $${fil} | \ 77 sed -ne '/coap-/{ s/ *, */\n/g; p }' | sed -ne 's/^\(coap-[a-zA-Z0-9-]\+\).*$$/\1.5/p' ; done) 78 79# a2x builds alternative .3 files up to a limit of 10 names from the 80# NAME section, so that 'man' works against the alternative different 81# function names. 82# 83# However, if there are more alternative names, they need to be defined 84# as per below 85# 86# Then all the alternative names as well as the extras defined below need 87# to be cleaned up in a 'make unistall'. 88install-man: install-man3 install-man5 install-man7 89 @echo ".so man3/coap_cache.3" > coap_cache_get_pdu.3 90 @echo ".so man3/coap_cache.3" > coap_cache_get_app_data.3 91 @echo ".so man3/coap_cache.3" > coap_cache_set_app_data.3 92 @echo ".so man3/coap_context.3" > coap_context_get_session_timeout.3 93 @echo ".so man3/coap_context.3" > coap_context_set_csm_timeout.3 94 @echo ".so man3/coap_context.3" > coap_context_get_csm_timeout.3 95 @echo ".so man3/coap_logging.3" > coap_endpoint_str.3 96 @echo ".so man3/coap_logging.3" > coap_session_str.3 97 @echo ".so man3/coap_pdu_access.3" > coap_option_filter_set.3 98 @echo ".so man3/coap_pdu_access.3" > coap_option_filter_unset.3 99 @echo ".so man3/coap_pdu_access.3" > coap_option_iterator_init.3 100 @echo ".so man3/coap_pdu_access.3" > coap_option_next.3 101 @echo ".so man3/coap_pdu_access.3" > coap_pdu_get_code.3 102 @echo ".so man3/coap_pdu_access.3" > coap_pdu_get_mid.3 103 @echo ".so man3/coap_pdu_access.3" > coap_pdu_get_token.3 104 @echo ".so man3/coap_pdu_access.3" > coap_pdu_get_type.3 105 @echo ".so man3/coap_pdu_setup.3" > coap_delete_optlist.3 106 @echo ".so man3/coap_pdu_setup.3" > coap_encode_var_safe.3 107 @echo ".so man3/coap_pdu_setup.3" > coap_encode_var_safe8.3 108 @echo ".so man3/coap_pdu_setup.3" > coap_add_optlist_pdu.3 109 @echo ".so man3/coap_pdu_setup.3" > coap_add_option.3 110 @echo ".so man3/coap_pdu_setup.3" > coap_add_data.3 111 @echo ".so man3/coap_pdu_setup.3" > coap_add_data_blocked_response.3 112 @echo ".so man3/coap_pdu_setup.3" > coap_send.3 113 @echo ".so man3/coap_pdu_setup.3" > coap_split_path.3 114 @echo ".so man3/coap_pdu_setup.3" > coap_split_query.3 115 @echo ".so man3/coap_pdu_setup.3" > coap_pdu_set_mid.3 116 @echo ".so man3/coap_pdu_setup.3" > coap_pdu_set_code.3 117 @echo ".so man3/coap_pdu_setup.3" > coap_pdu_set_type.3 118 @echo ".so man3/coap_resource.3" > coap_resource_get_userdata.3 119 @echo ".so man3/coap_resource.3" > coap_resource_release_userdata_handler.3 120 @echo ".so man3/coap_resource.3" > coap_resource_get_uri_path.3 121 @echo ".so man3/coap_session.3" > coap_session_get_context.3 122 @echo ".so man3/coap_session.3" > coap_session_get_ifindex.3 123 @echo ".so man3/coap_session.3" > coap_session_get_proto.3 124 @echo ".so man3/coap_session.3" > coap_session_get_psk_hint.3 125 @echo ".so man3/coap_session.3" > coap_session_get_psk_key.3 126 @echo ".so man3/coap_session.3" > coap_session_get_state.3 127 @echo ".so man3/coap_session.3" > coap_session_get_tls.3 128 @echo ".so man3/coap_session.3" > coap_session_get_type.3 129 @echo ".so man3/coap_string.3" > coap_delete_bin_const.3 130 @echo ".so man3/coap_string.3" > coap_make_str_const.3 131 @echo ".so man3/coap_string.3" > coap_string_equal.3 132 @echo ".so man3/coap_string.3" > coap_binary_equal.3 133 $(INSTALL_DATA) $(A2X_EXTRA_PAGES_3) "$(DESTDIR)$(man3dir)" 134 $(INSTALL_DATA) $(A2X_EXTRA_PAGES_5) "$(DESTDIR)$(man5dir)" 135 136# As well as removing the base 'man' pages, remove other .3 files built by 137# a2x, as well as build by install-man specials. 138uninstall-man: uninstall-man3 uninstall-man5 uninstall-man7 139 -(cd $(DESTDIR)$(man3dir) ; rm -f $(A2X_EXTRA_PAGES_3) $(A2X_EXTRA_PAGES_5) ) 140 141endif # BUILD_MANPAGES 142 143CLEANFILES = *.3 *.5 *.7 *.xml *.html docbook-xsl.css *.o examples-code-check 144 145clean-local: 146 -rm -rf tmp 147