1c87c5fbaSopenharmony_ci# doc/Makefile.am
2c87c5fbaSopenharmony_ci#
3c87c5fbaSopenharmony_ci# Copyright (C) 2015-2018 Carsten Schoenert <c.schoenert@t-online.de>
4c87c5fbaSopenharmony_ci#               2018-2023 Jon Shallow <supjps-libcoap@jpshallow.com>
5c87c5fbaSopenharmony_ci#
6c87c5fbaSopenharmony_ci# SPDX-License-Identifier: BSD-2-Clause
7c87c5fbaSopenharmony_ci#
8c87c5fbaSopenharmony_ci# This file is part of the CoAP C library libcoap. Please see README and
9c87c5fbaSopenharmony_ci# COPYING for terms of use.
10c87c5fbaSopenharmony_ci
11c87c5fbaSopenharmony_ci
12c87c5fbaSopenharmony_ci# We can only perfom the targets in this directory if doxygen is present.
13c87c5fbaSopenharmony_ci
14c87c5fbaSopenharmony_ciCLEANFILES = \
15c87c5fbaSopenharmony_ci  doxygen_sqlite3.db
16c87c5fbaSopenharmony_ci
17c87c5fbaSopenharmony_ciEXTRA_DIST = \
18c87c5fbaSopenharmony_ci  docbook.local.css \
19c87c5fbaSopenharmony_ci  upgrade_4.2.1_4.3.0.txt \
20c87c5fbaSopenharmony_ci  upgrade_4.3.0_4.3.1.txt \
21c87c5fbaSopenharmony_ci  upgrade_4.3.1_4.3.2.txt \
22c87c5fbaSopenharmony_ci  upgrade_4.3.2_4.3.3.txt \
23c87c5fbaSopenharmony_ci  upgrade_4.3.3_4.3.4.txt \
24c87c5fbaSopenharmony_ci  main.md \
25c87c5fbaSopenharmony_ci  module_api_wrap.h
26c87c5fbaSopenharmony_ci
27c87c5fbaSopenharmony_ciif HAVE_DOXYGEN
28c87c5fbaSopenharmony_ci
29c87c5fbaSopenharmony_ciman-page-cleanup:
30c87c5fbaSopenharmony_ci	@rm -f $(top_builddir)/doc/DoxygenLayout.xml
31c87c5fbaSopenharmony_ci	@rm -rf $(top_builddir)/doc/man_tmp
32c87c5fbaSopenharmony_ci	@rm -rf $(top_builddir)/doc/man_html
33c87c5fbaSopenharmony_ci
34c87c5fbaSopenharmony_ciman-page-prepare: man-page-cleanup
35c87c5fbaSopenharmony_ci	@$(MKDIR_P) $(top_builddir)/doc/man_tmp
36c87c5fbaSopenharmony_ci	@$(MKDIR_P) $(top_builddir)/doc/man_html
37c87c5fbaSopenharmony_ci
38c87c5fbaSopenharmony_ciman-page-start: man-page-prepare
39c87c5fbaSopenharmony_ci	## Setup the man page tab
40c87c5fbaSopenharmony_ci	@echo '' > $(top_builddir)/doc/scratch_insert_file
41c87c5fbaSopenharmony_ci	@echo '    <tab type="usergroup" visible="yes" url="@ref manpage" title="Manual Pages">' > $(top_builddir)/doc/insert_file
42c87c5fbaSopenharmony_ci	@echo '     <tab  type="usergroup" visible="yes" url="@ref man_summary" title="Man Pages Summary">' >> $(top_builddir)/doc/insert_file
43c87c5fbaSopenharmony_ci	##
44c87c5fbaSopenharmony_ci	@echo '/** @page manpage Manual Pages' > $(top_builddir)/doc/man_tmp/manpage.dox
45c87c5fbaSopenharmony_ci	@echo '  Here are the libcoap API and Example manual pages:' >> $(top_builddir)/doc/man_tmp/manpage.dox
46c87c5fbaSopenharmony_ci	@echo '  <table class="directory">' >> $(top_builddir)/doc/man_tmp/manpage.dox
47c87c5fbaSopenharmony_ci	@echo "   <tr>" >> $(top_builddir)/doc/man_tmp/manpage.dox
48c87c5fbaSopenharmony_ci	@echo "   <td class=\"entry\" align=\"left\"> @ref man_summary </td><td class=\"desc\" align=\"left\">Man Pages Summary</td>" >> $(top_builddir)/doc/man_tmp/manpage.dox
49c87c5fbaSopenharmony_ci	@echo "   </tr>" >> $(top_builddir)/doc/man_tmp/manpage.dox
50c87c5fbaSopenharmony_ci	@echo "   <tr class=\"even\">" >> $(top_builddir)/doc/man_tmp/manpage.dox
51c87c5fbaSopenharmony_ci	@echo "   <td class=\"entry\" align=\"left\"> @ref man_individual </td><td class=\"desc\" align=\"left\">Individual Man Pages</td>" >> $(top_builddir)/doc/man_tmp/manpage.dox
52c87c5fbaSopenharmony_ci	@echo "   </tr>" >> $(top_builddir)/doc/man_tmp/manpage.dox
53c87c5fbaSopenharmony_ci	@echo "  </table>" >> $(top_builddir)/doc/man_tmp/manpage.dox
54c87c5fbaSopenharmony_ci	@echo ' */' >> $(top_builddir)/doc/man_tmp/manpage.dox
55c87c5fbaSopenharmony_ci	##
56c87c5fbaSopenharmony_ci	@echo '/** @page man_summary Manual Pages Summary' > $(top_builddir)/doc/man_tmp/man_summary.dox
57c87c5fbaSopenharmony_ci	@echo '  Here are a list of libcoap API summary man pages, some of which have code examples, and Examples:' >> $(top_builddir)/doc/man_tmp/man_summary.dox
58c87c5fbaSopenharmony_ci	@echo '   <table class="directory">' >> $(top_builddir)/doc/man_tmp/man_summary.dox
59c87c5fbaSopenharmony_ci	##
60c87c5fbaSopenharmony_ci	@echo '/** @page man_individual Individual Manual Pages' > $(top_builddir)/doc/man_tmp/man_individual.dox
61c87c5fbaSopenharmony_ci	@echo '  Here are a list of libcoap API individual man pages, some of which have code examples:' >> $(top_builddir)/doc/man_tmp/man_individual.dox
62c87c5fbaSopenharmony_ci	@echo '   <table class="directory">' >> $(top_builddir)/doc/man_tmp/man_individual.dox
63c87c5fbaSopenharmony_ci	##
64c87c5fbaSopenharmony_ci	## Setup the upgrading tab
65c87c5fbaSopenharmony_ci	@echo '/** @page upgrading Upgrading' > $(top_builddir)/doc/man_tmp/upgrading.dox
66c87c5fbaSopenharmony_ci	@echo '  Upgrading between libcoap versions:' >> $(top_builddir)/doc/man_tmp/upgrading.dox
67c87c5fbaSopenharmony_ci	@echo '   <table class="directory">' >> $(top_builddir)/doc/man_tmp/upgrading.dox
68c87c5fbaSopenharmony_ci
69c87c5fbaSopenharmony_ciman-page-build: upg-page-build man-page-start
70c87c5fbaSopenharmony_ci	@MAN_FILES=`find $(top_srcdir)/man/ -type f -name "coap.txt.in" ; find $(top_srcdir)/man/ -type f -name "coap_*.in" | LC_ALL=C sort ; find $(top_srcdir)/man/ -type f -name "coap-*.in" | LC_ALL=C sort` ;\
71c87c5fbaSopenharmony_ci	MAN3_FILES=`find $(top_srcdir)/man/ -type f -name "coap_*.in" | LC_ALL=C sort` ;\
72c87c5fbaSopenharmony_ci	UPG_FILES=`find $(top_srcdir)/doc/ -type f -name "upgrade_*.txt" | LC_ALL=C sort` ;\
73c87c5fbaSopenharmony_ci	HTML_FILES=`find $(top_builddir)/man/ -type f -name "*.html"` ;\
74c87c5fbaSopenharmony_ci	COUNT_MAN_FILES=`echo $${MAN_FILES} | wc -w` ;\
75c87c5fbaSopenharmony_ci	COUNT_HTML_FILES=`echo $${HTML_FILES} | wc -w` ;\
76c87c5fbaSopenharmony_ci	## We need the HTML files from the Asciidoc source files, check if they around, otherwise build them.
77c87c5fbaSopenharmony_ci	if [ "$${COUNT_MAN_FILES}" != "$${COUNT_HTML_FILES}" ]; then \
78c87c5fbaSopenharmony_ci		$(MAKE) -C ../man ;\
79c87c5fbaSopenharmony_ci	fi ;\
80c87c5fbaSopenharmony_ci	##
81c87c5fbaSopenharmony_ci	## Build the summary man pages
82c87c5fbaSopenharmony_ci	##
83c87c5fbaSopenharmony_ci	for FILE in $${MAN_FILES} ; do \
84c87c5fbaSopenharmony_ci		BASE=`basename $${FILE} | cut -d. -f 1` ;\
85c87c5fbaSopenharmony_ci		MANUAL=`egrep -B 1 "^====" $${FILE} | head -1` ;\
86c87c5fbaSopenharmony_ci		SUMMARY=`egrep -B 2 "^SYNOPSIS" $${FILE} | ${SED} 's/coap-//g' | cut -d\- -f2 | cut -c2- | head -1` ;\
87c87c5fbaSopenharmony_ci		if [ -z "$${SUMMARY}" ] ; then \
88c87c5fbaSopenharmony_ci			SUMMARY=`egrep -B 2 "^DESCRIPTION" $${FILE} | ${SED} 's/coap-//g' | cut -d\- -f2 | cut -c2- | head -1` ;\
89c87c5fbaSopenharmony_ci		fi ;\
90c87c5fbaSopenharmony_ci		##
91c87c5fbaSopenharmony_ci		## Fix and copy .html file across
92c87c5fbaSopenharmony_ci		##
93c87c5fbaSopenharmony_ci		if [ -f $(top_builddir)/man/$${BASE}.html ]; then \
94c87c5fbaSopenharmony_ci			## Correct case sensitive Name and Synopsis on master (used later)
95c87c5fbaSopenharmony_ci			$(SED) -i 's^<h2>Name</h2>^<h2>NAME</h2>^g' $(top_builddir)/man/$${BASE}.html ;\
96c87c5fbaSopenharmony_ci			$(SED) -i 's^<h2>Synopsis</h2>^<h2>SYNOPSIS</h2>^g' $(top_builddir)/man/$${BASE}.html ;\
97c87c5fbaSopenharmony_ci			cp -f $(top_builddir)/man/$${BASE}.html $(top_builddir)/doc/man_html/$${BASE}.html ;\
98c87c5fbaSopenharmony_ci		else \
99c87c5fbaSopenharmony_ci			echo "ERROR: $(top_builddir)/man/$${BASE}.html not found!";\
100c87c5fbaSopenharmony_ci			exit 1 ;\
101c87c5fbaSopenharmony_ci		fi ;\
102c87c5fbaSopenharmony_ci		## Build the manual insert page
103c87c5fbaSopenharmony_ci		echo "/// @page man_$${BASE} $${MANUAL}" > $(top_builddir)/doc/man_tmp/$${MANUAL}.dox ;\
104c87c5fbaSopenharmony_ci		echo "/// @htmlinclude $${BASE}.html $${MANUAL}" >> $(top_builddir)/doc/man_tmp/$${MANUAL}.dox ;\
105c87c5fbaSopenharmony_ci		## Update insert_file (the list is sorted appropriately)
106c87c5fbaSopenharmony_ci		echo "      <tab type=\"user\" visible=\"yes\" url=\"@ref man_$${BASE}\" title=\"$${MANUAL} - $${SUMMARY}\" intro=\"\"/>" >> $(top_builddir)/doc/insert_file ;\
107c87c5fbaSopenharmony_ci		## Update the summary man page
108c87c5fbaSopenharmony_ci		echo "   <tr$${ROW_EVEN}>" >> $(top_builddir)/doc/man_tmp/man_summary.dox ;\
109c87c5fbaSopenharmony_ci		echo "   <td class=\"entry\" align=\"left\"> @ref man_$${BASE} </td><td class=\"desc\" align=\"left\">$${SUMMARY}</td>" >> $(top_builddir)/doc/man_tmp/man_summary.dox ;\
110c87c5fbaSopenharmony_ci		echo "   </tr>" >> $(top_builddir)/doc/man_tmp/man_summary.dox ;\
111c87c5fbaSopenharmony_ci		if [ -z "$${ROW_EVEN}" ] ; then \
112c87c5fbaSopenharmony_ci			ROW_EVEN=" class=\"even\"" ;\
113c87c5fbaSopenharmony_ci		else \
114c87c5fbaSopenharmony_ci			ROW_EVEN= ;\
115c87c5fbaSopenharmony_ci		fi \
116c87c5fbaSopenharmony_ci	done ;\
117c87c5fbaSopenharmony_ci	##
118c87c5fbaSopenharmony_ci	## Close off the man page summary file
119c87c5fbaSopenharmony_ci	##
120c87c5fbaSopenharmony_ci	echo '   </table>' >> $(top_builddir)/doc/man_tmp/man_summary.dox ;\
121c87c5fbaSopenharmony_ci	echo ' */' >> $(top_builddir)/doc/man_tmp/man_summary.dox ;\
122c87c5fbaSopenharmony_ci	echo '     </tab>' >> $(top_builddir)/doc/insert_file ;\
123c87c5fbaSopenharmony_ci	##
124c87c5fbaSopenharmony_ci	## Build the individual man pages
125c87c5fbaSopenharmony_ci	##
126c87c5fbaSopenharmony_ci	echo '     <tab  type="usergroup" visible="yes" url="@ref man_individual" title="Individual Man Pages">' >> $(top_builddir)/doc/insert_file ;\
127c87c5fbaSopenharmony_ci	for FILE in $${MAN3_FILES} ; do \
128c87c5fbaSopenharmony_ci		BASE=`basename $${FILE} | cut -d. -f 1` ;\
129c87c5fbaSopenharmony_ci		LIST=`${SED} -ne '/^NAME/,/^SYNOPSIS/p;/^SYNOPSIS/q' $${FILE} | ${SED} -ne '/coap_/{ s/ *, *//g ; p }' | egrep -v "^$${BASE}$$"` ;\
130c87c5fbaSopenharmony_ci		for ENTRY in $${LIST} ; do \
131c87c5fbaSopenharmony_ci			MANUAL="$${ENTRY}(3)" ;\
132c87c5fbaSopenharmony_ci			## Build the manual insert page
133c87c5fbaSopenharmony_ci			echo "/// @page man_$${ENTRY} $${MANUAL}" > $(top_builddir)/doc/man_tmp/$${MANUAL}.dox ;\
134c87c5fbaSopenharmony_ci			echo "/// @htmlinclude $${ENTRY}.html $${MANUAL}" >> $(top_builddir)/doc/man_tmp/$${MANUAL}.dox ;\
135c87c5fbaSopenharmony_ci			## Create html file
136c87c5fbaSopenharmony_ci			cat $(top_builddir)/man/$${BASE}.html | ${SED} "s/Function: $${ENTRY}(/<a class=\"anchor\" id=\"$${ENTRY}\"><\/a>\0/" > $(top_builddir)/doc/man_html/$${ENTRY}.html ;\
137c87c5fbaSopenharmony_ci			## Update scratch_insert_file for sorting later
138c87c5fbaSopenharmony_ci			echo "$${ENTRY}" >> $(top_builddir)/doc/scratch_insert_file ;\
139c87c5fbaSopenharmony_ci		done ;\
140c87c5fbaSopenharmony_ci	done ;\
141c87c5fbaSopenharmony_ci	##
142c87c5fbaSopenharmony_ci	## Process the (sorted) list of individual man pages
143c87c5fbaSopenharmony_ci	##
144c87c5fbaSopenharmony_ci	for ENTRY in `cat $(top_builddir)/doc/scratch_insert_file | LC_ALL=C sort -u` ; do \
145c87c5fbaSopenharmony_ci		## Update the individual man page
146c87c5fbaSopenharmony_ci		MANUAL="$${ENTRY}(3)" ;\
147c87c5fbaSopenharmony_ci		echo "      <tab type=\"user\" visible=\"yes\" url=\"@ref man_$${ENTRY}\" title=\"$${MANUAL}\" intro=\"\"/>" >> $(top_builddir)/doc/insert_file ;\
148c87c5fbaSopenharmony_ci		echo "   <tr$${ROW_EVEN}>" >> $(top_builddir)/doc/man_tmp/man_individual.dox ;\
149c87c5fbaSopenharmony_ci		echo "   <td class=\"entry\" align=\"left\"> @ref man_$${ENTRY} </td><td class=\"desc\" align=\"left\"></td>" >> $(top_builddir)/doc/man_tmp/man_individual.dox ;\
150c87c5fbaSopenharmony_ci		echo "   </tr>" >> $(top_builddir)/doc/man_tmp/man_individual.dox ;\
151c87c5fbaSopenharmony_ci		if [ -z "$${ROW_EVEN}" ] ; then \
152c87c5fbaSopenharmony_ci			ROW_EVEN=" class=\"even\"" ;\
153c87c5fbaSopenharmony_ci		else \
154c87c5fbaSopenharmony_ci			ROW_EVEN= ;\
155c87c5fbaSopenharmony_ci		fi \
156c87c5fbaSopenharmony_ci	done ;\
157c87c5fbaSopenharmony_ci	##
158c87c5fbaSopenharmony_ci	## Close off the individual man pages
159c87c5fbaSopenharmony_ci	##
160c87c5fbaSopenharmony_ci	echo '   </table>' >> $(top_builddir)/doc/man_tmp/man_individual.dox ;\
161c87c5fbaSopenharmony_ci	echo ' */' >> $(top_builddir)/doc/man_tmp/man_individual.dox ;\
162c87c5fbaSopenharmony_ci	echo '     </tab>' >> $(top_builddir)/doc/insert_file ;\
163c87c5fbaSopenharmony_ci	##
164c87c5fbaSopenharmony_ci	## Close off the man page top level
165c87c5fbaSopenharmony_ci	##
166c87c5fbaSopenharmony_ci	echo '    </tab>' >> $(top_builddir)/doc/insert_file ;\
167c87c5fbaSopenharmony_ci	##
168c87c5fbaSopenharmony_ci	## Add in the deprecated tab
169c87c5fbaSopenharmony_ci	##
170c87c5fbaSopenharmony_ci	echo '    <tab type="user" visible="yes" url="@ref deprecated" title="Deprecated Items" intro=""/>' >> $(top_builddir)/doc/insert_file ;\
171c87c5fbaSopenharmony_ci	##
172c87c5fbaSopenharmony_ci	## Start the upgrade tab
173c87c5fbaSopenharmony_ci	##
174c87c5fbaSopenharmony_ci	echo '    <tab type="usergroup" visible="yes" url="@ref upgrading" title="Upgrading">' >> $(top_builddir)/doc/insert_file ;\
175c87c5fbaSopenharmony_ci	for FILE in $${UPG_FILES} ; do \
176c87c5fbaSopenharmony_ci		BASE=`basename $${FILE} | $(SED) "s/\.txt$$//g"`; \
177c87c5fbaSopenharmony_ci		UPGRADE=`echo $${BASE} | $(SED) "s/^upgrade_//g"`; \
178c87c5fbaSopenharmony_ci		CUPGRADE=`echo $${UPGRADE} | $(SED) "s/\./-/g"`; \
179c87c5fbaSopenharmony_ci		SUMMARY=`head -1 $${FILE} | ${SED} 's/^= //g'` ;\
180c87c5fbaSopenharmony_ci		## Build the upgrade insert page
181c87c5fbaSopenharmony_ci		echo "/// @page upg_$${CUPGRADE} $${UPGRADE}" > $(top_builddir)/doc/man_tmp/$${UPGRADE}.dox ;\
182c87c5fbaSopenharmony_ci		echo "/// @htmlinclude $${BASE}.html $${UPGRADE}" >> $(top_builddir)/doc/man_tmp/$${UPGRADE}.dox ;\
183c87c5fbaSopenharmony_ci		## Update insert_file
184c87c5fbaSopenharmony_ci		echo "      <tab type=\"user\" visible=\"yes\" url=\"@ref upg_$${CUPGRADE}\" title=\"$${SUMMARY}\" intro=\"\"/>" >> $(top_builddir)/doc/insert_file ;\
185c87c5fbaSopenharmony_ci		## Update the upgrading page
186c87c5fbaSopenharmony_ci		echo "   <tr$${ROW_EVEN}>" >> $(top_builddir)/doc/man_tmp/upgrading.dox ;\
187c87c5fbaSopenharmony_ci		echo "   <td class=\"entry\" align=\"left\"> @ref upg_$${CUPGRADE} </td><td class=\"desc\" align=\"left\">$${SUMMARY}</td>" >> $(top_builddir)/doc/man_tmp/upgrading.dox ;\
188c87c5fbaSopenharmony_ci		echo "   </tr>" >> $(top_builddir)/doc/man_tmp/upgrading.dox ;\
189c87c5fbaSopenharmony_ci		if [ -z "$${ROW_EVEN}" ] ; then \
190c87c5fbaSopenharmony_ci			ROW_EVEN=" class=\"even\"" ;\
191c87c5fbaSopenharmony_ci		else \
192c87c5fbaSopenharmony_ci			ROW_EVEN= ;\
193c87c5fbaSopenharmony_ci		fi ;\
194c87c5fbaSopenharmony_ci		if [ -f $(top_builddir)/doc/$${BASE}.html ]; then \
195c87c5fbaSopenharmony_ci			cp -f $(top_builddir)/doc/$${BASE}.html $(top_builddir)/doc/man_html/$${BASE}.html ;\
196c87c5fbaSopenharmony_ci			## Correct case sensitive Name and Synopsis
197c87c5fbaSopenharmony_ci			$(SED) -i 's^<div class="toc"><p><strong>^<div class="section"><p><strong>^' $(top_builddir)/doc/man_html/$${BASE}.html ;\
198c87c5fbaSopenharmony_ci		else \
199c87c5fbaSopenharmony_ci			echo "ERROR: $(top_builddir)/doc/$${BASE}.html not found!";\
200c87c5fbaSopenharmony_ci			exit 1 ;\
201c87c5fbaSopenharmony_ci		fi \
202c87c5fbaSopenharmony_ci	done ;\
203c87c5fbaSopenharmony_ci	##
204c87c5fbaSopenharmony_ci	## Close off the upgrading tab
205c87c5fbaSopenharmony_ci	##
206c87c5fbaSopenharmony_ci	echo '   </table>' >> $(top_builddir)/doc/man_tmp/upgrading.dox ;\
207c87c5fbaSopenharmony_ci	echo ' */' >> $(top_builddir)/doc/man_tmp/upgrading.dox ;\
208c87c5fbaSopenharmony_ci	##
209c87c5fbaSopenharmony_ci	## Close off the insert file list
210c87c5fbaSopenharmony_ci	##
211c87c5fbaSopenharmony_ci	echo '    </tab>' >> $(top_builddir)/doc/insert_file ;\
212c87c5fbaSopenharmony_ci	##
213c87c5fbaSopenharmony_ci	## Create and Update the DoxygenLayout.xml file
214c87c5fbaSopenharmony_ci	##
215c87c5fbaSopenharmony_ci	$(DOXYGEN) -u > /dev/null 2>&1 ;\
216c87c5fbaSopenharmony_ci	$(DOXYGEN) -l ;\
217c87c5fbaSopenharmony_ci	$(SED) -i 's/<tab type="pages" visible="yes" /<tab type="pages" visible="no" /g' $(top_builddir)/doc/DoxygenLayout.xml ;\
218c87c5fbaSopenharmony_ci	$(SED) -i '/<tab type="examples" visible=.*/r insert_file' $(top_builddir)/doc/DoxygenLayout.xml ;\
219c87c5fbaSopenharmony_ci	##
220c87c5fbaSopenharmony_ci	## Fix up man html files, adding links
221c87c5fbaSopenharmony_ci	##
222c87c5fbaSopenharmony_ci	for FILE in $${MAN_FILES} `cat $(top_builddir)/doc/scratch_insert_file` ; do \
223c87c5fbaSopenharmony_ci		ENTRY=`basename $${FILE} | cut -d . -f1` ;\
224c87c5fbaSopenharmony_ci		## Functions defined in the body
225c87c5fbaSopenharmony_ci		$(SED) -i "s^\(<span class=\"strong\"><strong>\)\(coap[_-][0-9a-z_]*\)\(</strong></span>(\|(\)^\1<a class=\"st-desc\" href=\"man_\2.html#\2\" target=\"_self\">\2</a>\3^g" $(top_builddir)/doc/man_html/$${ENTRY}.html ;\
226c87c5fbaSopenharmony_ci		## Function definitions
227c87c5fbaSopenharmony_ci		$(SED) -i "s^\(<span class=\"strong\"><strong>Function: \)\(coap_[0-9a-z_]*\)\(</strong></span>(\|(\)^\1<a class=\"st-desc\" href=\"man_\2.html#\2\" target=\"_self\">\2</a>\3^g" $(top_builddir)/doc/man_html/$${ENTRY}.html ;\
228c87c5fbaSopenharmony_ci		## The SYNOPSIS entries
229c87c5fbaSopenharmony_ci		$(SED) -i "s^\(<p><span class=\"strong\"><strong>[a-z0-9_ \*]*\)\(coap_[0-9a-z_]*\)\([(;]\)^\1<a class=\"st-synopsis\" href=\"man_\2.html#\2\" target=\"_self\">\2</a>\3^g" $(top_builddir)/doc/man_html/$${ENTRY}.html ;\
230c87c5fbaSopenharmony_ci		## Function in NAME and Examples
231c87c5fbaSopenharmony_ci		$(SED) -i "s^\([ =,]\|[(!>]\|\^\)\(coap_[0-9a-z_]*\)\([(,]\| \-\| \xe2\x80\x94\)^\1<a href=\"man_\2.html#\2\" target=\"_self\">\2</a>\3^g" $(top_builddir)/doc/man_html/$${ENTRY}.html ;\
232c87c5fbaSopenharmony_ci		## Do for a second time in case of overlaps
233c87c5fbaSopenharmony_ci		$(SED) -i "s^\([ =,]\|[(!>]\|\^\)\(coap_[0-9a-z_]*\)\([(,]\| \-\| \xe2\x80\x94\)^\1<a href=\"man_\2.html#\2\" target=\"_self\">\2</a>\3^g" $(top_builddir)/doc/man_html/$${ENTRY}.html ;\
234c87c5fbaSopenharmony_ci	done ;\
235c87c5fbaSopenharmony_ci	##
236c87c5fbaSopenharmony_ci	## Do the highlighting
237c87c5fbaSopenharmony_ci	##
238c87c5fbaSopenharmony_ci	for ENTRY in `cat $(top_builddir)/doc/scratch_insert_file` ; do \
239c87c5fbaSopenharmony_ci		${SED} -i "s/\($${ENTRY}\)\([<(\*, ]\)/<span class=\"man-highlight\">\1<\/span>\2/g" $(top_builddir)/doc/man_html/$${ENTRY}.html ;\
240c87c5fbaSopenharmony_ci	done
241c87c5fbaSopenharmony_ci
242c87c5fbaSopenharmony_ciif BUILD_MANPAGES
243c87c5fbaSopenharmony_ciUPG_LIST = upgrade_4.2.1_4.3.0.txt upgrade_4.3.0_4.3.1.txt upgrade_4.3.1_4.3.2.txt upgrade_4.3.2_4.3.3.txt upgrade_4.3.3_4.3.4.txt
244c87c5fbaSopenharmony_ci
245c87c5fbaSopenharmony_ciupg-page-build:
246c87c5fbaSopenharmony_ci	@for FILE in $(UPG_LIST) ; do \
247c87c5fbaSopenharmony_ci		$(A2X) -d article --format xhtml -D $(top_builddir)/doc/ $(top_srcdir)/doc/$${FILE} ;\
248c87c5fbaSopenharmony_ci	done
249c87c5fbaSopenharmony_ci
250c87c5fbaSopenharmony_ciall: man-page-build
251c87c5fbaSopenharmony_ci	$(DOXYGEN) Doxyfile
252c87c5fbaSopenharmony_ci	@$(RM) $(top_builddir)/doc/insert_file $(top_builddir)/doc/scratch_insert_file
253c87c5fbaSopenharmony_ci	@cp -f $(top_srcdir)/doc/docbook.local.css $(top_builddir)/doc/html/docbook-xsl.css
254c87c5fbaSopenharmony_ci
255c87c5fbaSopenharmony_cielse
256c87c5fbaSopenharmony_ci#
257c87c5fbaSopenharmony_ci# Need to make sure the man directories are in place, but empty
258c87c5fbaSopenharmony_ciall: man-page-prepare
259c87c5fbaSopenharmony_ci	$(DOXYGEN) Doxyfile
260c87c5fbaSopenharmony_ciendif # BUILD_MANPAGES
261c87c5fbaSopenharmony_ci
262c87c5fbaSopenharmony_ciclean-local:
263c87c5fbaSopenharmony_ci	-rm -rf $(top_builddir)/doc/html $(top_builddir)/doc/man_tmp $(top_builddir)/doc/man_html $(top_builddir)/doc/DoxygenLayout.xml $(top_builddir)/doc/docbook-xsl.css $(top_builddir)/doc/*.html
264c87c5fbaSopenharmony_ci
265c87c5fbaSopenharmony_cidistclean-local: clean-local
266c87c5fbaSopenharmony_ci
267c87c5fbaSopenharmony_ciendif # HAVE_DOXYGEN
268c87c5fbaSopenharmony_ci
269c87c5fbaSopenharmony_ciinstall-data-hook:
270c87c5fbaSopenharmony_ciif HAVE_DOXYGEN
271c87c5fbaSopenharmony_ci	@if [ ! -d $(top_builddir)/doc/html ]; then \
272c87c5fbaSopenharmony_ci		echo ;\
273c87c5fbaSopenharmony_ci		echo "     No install data in '$(top_builddir)/doc/html' found! Please run 'make all' first." ;\
274c87c5fbaSopenharmony_ci		echo ;\
275c87c5fbaSopenharmony_ci		exit 1 ;\
276c87c5fbaSopenharmony_ci	fi
277c87c5fbaSopenharmony_ci	$(MKDIR_P) $(DESTDIR)$(htmldir)/html || exit 1
278c87c5fbaSopenharmony_ci	cp -a -f $(top_builddir)/doc/html $(DESTDIR)$(htmldir)
279c87c5fbaSopenharmony_ci	find $(DESTDIR)$(htmldir) -type f -name "*.md5" -delete
280c87c5fbaSopenharmony_ciendif # HAVE_DOXYGEN
281c87c5fbaSopenharmony_ciif BUILD_LICENSE_INSTALL
282c87c5fbaSopenharmony_ci	$(MKDIR_P) $(DESTDIR)$(docdir) || exit 1
283c87c5fbaSopenharmony_ci	$(INSTALL_DATA) $(top_srcdir)/LICENSE $(DESTDIR)$(docdir)
284c87c5fbaSopenharmony_ci	$(INSTALL_DATA) $(top_srcdir)/COPYING $(DESTDIR)$(docdir)
285c87c5fbaSopenharmony_ci	$(INSTALL_DATA) $(top_srcdir)/README $(DESTDIR)$(docdir)
286c87c5fbaSopenharmony_ciendif # BUILD_LICENSE_INSTALL
287c87c5fbaSopenharmony_ci
288c87c5fbaSopenharmony_ciuninstall-hook:
289c87c5fbaSopenharmony_ciif BUILD_LICENSE_INSTALL
290c87c5fbaSopenharmony_ci	@if [ -d $(DESTDIR)$(docdir) ] ; then \
291c87c5fbaSopenharmony_ci		(cd $(DESTDIR)$(docdir) ; rm -f LICENSE README COPYING) ; \
292c87c5fbaSopenharmony_ci	fi
293c87c5fbaSopenharmony_ciendif # BUILD_LICENSE_INSTALL
294c87c5fbaSopenharmony_ciif HAVE_DOXYGEN
295c87c5fbaSopenharmony_ci	-rm -rf $(DESTDIR)$(htmldir)/html
296c87c5fbaSopenharmony_ciendif # HAVE_DOXYGEN
297c87c5fbaSopenharmony_ci
298c87c5fbaSopenharmony_ci.PHONY: man-page-cleanup man-page-prepare man-page-start man-page-build
299