summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Roe <duncan_roe@optusnet.com.au>2021-07-18 13:47:22 +1000
committerPablo Neira Ayuso <pablo@netfilter.org>2021-08-01 12:31:06 +0200
commit6041e3dc83229f4a8c903e5a3082b38c45d097d8 (patch)
tree4efde1cc439952098c323242fa3f2e46650ddfc4
parentcd0cafc7f75c97d44229a09e5fde11ca51a1bb6f (diff)
downloadlibmnl-6041e3dc83229f4a8c903e5a3082b38c45d097d8.tar.gz
build: doc: get rid of the need for manual updating of Makefile
There used to be 3 things in doxygen/Makefile.am that developers had to update: 1. The dependency list (i.e. all C sources) 2. The setgroup lines, which renamed each module man page to be the page for the first described function. setgroup also set the target for: 3. The add2group lines, which symlinked pages for other documented functions in the group. The new system eliminates all of the above. Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--doxygen.cfg.in1
-rw-r--r--doxygen/Makefile.am71
2 files changed, 32 insertions, 40 deletions
diff --git a/doxygen.cfg.in b/doxygen.cfg.in
index 1e42e44..ae31dbe 100644
--- a/doxygen.cfg.in
+++ b/doxygen.cfg.in
@@ -18,5 +18,6 @@ SEARCHENGINE = NO
GENERATE_LATEX = NO
LATEX_CMD_NAME = latex
GENERATE_MAN = YES
+MAN_LINKS = YES
HAVE_DOT = @HAVE_DOT@
DOT_TRANSPARENT = YES
diff --git a/doxygen/Makefile.am b/doxygen/Makefile.am
index e0598ab..29078de 100644
--- a/doxygen/Makefile.am
+++ b/doxygen/Makefile.am
@@ -1,10 +1,6 @@
if HAVE_DOXYGEN
-# Be sure to add new source files to this table
-doc_srcs = $(top_srcdir)/src/attr.c \
- $(top_srcdir)/src/callback.c \
- $(top_srcdir)/src/nlmsg.c \
- $(top_srcdir)/src/socket.c
+doc_srcs = $(shell find $(top_srcdir)/src -name '*.c')
doxyfile.stamp: $(doc_srcs) Makefile.am
rm -rf html man
@@ -20,43 +16,37 @@ doxyfile.stamp: $(doc_srcs) Makefile.am
[ ! -d ../src.distcheck ] || \
{ set -x; cd ..; rm src; mv src.distcheck src; }
-# Keep this command up to date after adding new functions and source files.
+# We need to use bash for its associative array facility
+# (`bash -p` prevents import of functions from the environment).
# The command has to be a single line so the functions work
+# and so `make` gives all lines to `bash -c`
# (hence ";\" at the end of every line but the last).
- main() { set -e; cd man/man3; rm -f _*;\
-setgroup attr mnl_attr_get_type;\
- add2group mnl_attr_get_len mnl_attr_get_payload_len mnl_attr_get_payload;\
- add2group mnl_attr_ok mnl_attr_next mnl_attr_type_valid mnl_attr_validate;\
- add2group mnl_attr_validate2 mnl_attr_parse mnl_attr_parse_nested;\
- add2group mnl_attr_parse_payload mnl_attr_get_u8 mnl_attr_get_u16;\
- add2group mnl_attr_get_u32 mnl_attr_get_u64 mnl_attr_get_str mnl_attr_put;\
- add2group mnl_attr_put_u8 mnl_attr_put_u16 mnl_attr_put_u32 mnl_attr_put_u64;\
- add2group mnl_attr_put_str mnl_attr_put_strz mnl_attr_nest_start;\
- add2group mnl_attr_put_check mnl_attr_put_u8_check mnl_attr_put_u16_check;\
- add2group mnl_attr_put_u32_check mnl_attr_put_u64_check;\
- add2group mnl_attr_put_str_check mnl_attr_put_strz_check;\
- add2group mnl_attr_nest_start_check mnl_attr_nest_end mnl_attr_nest_cancel;\
-setgroup batch mnl_nlmsg_batch_start;\
- add2group mnl_nlmsg_batch_stop mnl_nlmsg_batch_next mnl_nlmsg_batch_reset;\
- add2group mnl_nlmsg_batch_size mnl_nlmsg_batch_head mnl_nlmsg_batch_current;\
- add2group mnl_nlmsg_batch_is_empty;\
-setgroup callback mnl_cb_run;\
- add2group mnl_cb_run2;\
-setgroup nlmsg mnl_nlmsg_size;\
- add2group mnl_nlmsg_get_payload_len mnl_nlmsg_put_header;\
- add2group mnl_nlmsg_put_extra_header mnl_nlmsg_get_payload;\
- add2group mnl_nlmsg_get_payload_offset mnl_nlmsg_ok mnl_nlmsg_next;\
- add2group mnl_nlmsg_get_payload_tail mnl_nlmsg_seq_ok mnl_nlmsg_portid_ok;\
- add2group mnl_nlmsg_fprintf;\
-setgroup socket mnl_socket_get_fd;\
- add2group mnl_socket_get_portid mnl_socket_open mnl_socket_open2;\
- add2group mnl_socket_fdopen mnl_socket_bind mnl_socket_sendto;\
- add2group mnl_socket_recvfrom mnl_socket_close mnl_socket_setsockopt;\
- add2group mnl_socket_getsockopt;\
+ /bin/bash -p -c 'declare -A renamed_page;\
+main(){ set -e; cd man/man3; rm -f _*;\
+ count_real_pages;\
+ rename_real_pages;\
+ make_symlinks;\
};\
-setgroup() { mv $$1.3 $$2.3; BASE=$$2; };\
-add2group() { for i in $$@; do ln -sf $$BASE.3 $$i.3; done; };\
-main
+count_real_pages(){ page_count=0;\
+ for i in $$(ls -S);\
+ do head -n1 $$i | grep -E -q '^\.so' && break;\
+ page_count=$$(($$page_count + 1));\
+ done;\
+ first_link=$$(($$page_count + 1));\
+};\
+rename_real_pages(){ for i in $$(ls -S | head -n$$page_count);\
+ do for j in $$(ls -S | tail -n+$$first_link);\
+ do grep -E -q $$i$$ $$j && break;\
+ done;\
+ mv -f $$i $$j;\
+ renamed_page[$$i]=$$j;\
+ done;\
+};\
+make_symlinks(){ for j in $$(ls -S | tail -n+$$first_link);\
+ do ln -sf $${renamed_page[$$(cat $$j | cut -f2 -d/)]} $$j;\
+ done;\
+};\
+main'
touch doxyfile.stamp
@@ -67,7 +57,8 @@ clean-local:
rm -rf $(top_srcdir)/doxygen/man $(top_srcdir)/doxygen/html
install-data-local:
mkdir -p $(DESTDIR)$(mandir)/man3
- cp --no-dereference --preserve=links,mode,timestamps man/man3/*.3 $(DESTDIR)$(mandir)/man3/
+ cp --no-dereference --preserve=links,mode,timestamps man/man3/*.3\
+ $(DESTDIR)$(mandir)/man3/
# make distcheck needs uninstall-local
uninstall-local: