From 2fe50ac9511469a587426b80501b2b5da770e3a0 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 1 Feb 2019 05:25:36 +0100 Subject: [PATCH] doxygen: enable cross referencing everywhere doxygen \ref cross-references to groups or files from other libraries only work when the .map file was present when the HTML was generated, and when that .map file was listed in TAGFILES in the Doxyfile. - Makefile.am: introduce a two-pass build for doxygen API docs. - First build pass makes sure the .tag files are present. - Second build pass picks up all the references, hence generates hyperlinks properly. - Add all libraries to TAGFILES of all other libraries, so we can from now on freely criss-cross reference from everywhere to everywhere. - Add all libraries' tag files as dependencies for all others. Example: in upcoming tdef.h, I would like to cross reference to tdef_vty.h, and vice versa, even though they are in libosmocore and libosmovty, respectively. This is now possible. We may still need to fix some problems with naming collisions, see for example stats.h, which exists twice with identical doxygen handle (different source dirs seems to not suffice for doxygen). Change-Id: Ib03d0b70d536c8f1386def666c89106a840f7363 --- Doxyfile.codec.in | 2 +- Doxyfile.coding.in | 2 +- Doxyfile.core.in | 2 +- Doxyfile.ctrl.in | 2 +- Doxyfile.gb.in | 2 +- Doxyfile.gsm.in | 2 +- Doxyfile.vty.in | 2 +- Makefile.am | 144 ++++++++++++++++++++++++++++++++++++++------- 8 files changed, 130 insertions(+), 28 deletions(-) diff --git a/Doxyfile.codec.in b/Doxyfile.codec.in index 037ef7a42..307e3e148 100644 --- a/Doxyfile.codec.in +++ b/Doxyfile.codec.in @@ -1485,7 +1485,7 @@ SKIP_FUNCTION_MACROS = YES # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = doc/libosmocore.tag=../../core/html +TAGFILES = doc/libosmocore.tag=../../core/html doc/libosmogsm.tag=../../gsm/html doc/libosmovty.tag=../../vty/html doc/libosmocoding.tag=../../coding/html doc/libosmoctrl.tag=../../ctrl/html doc/libosmogb.tag=../../gb/html # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. diff --git a/Doxyfile.coding.in b/Doxyfile.coding.in index 43c4f8227..d0e994255 100644 --- a/Doxyfile.coding.in +++ b/Doxyfile.coding.in @@ -1485,7 +1485,7 @@ SKIP_FUNCTION_MACROS = YES # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = doc/libosmocore.tag=../../core/html +TAGFILES = doc/libosmocore.tag=../../core/html doc/libosmogsm.tag=../../gsm/html doc/libosmovty.tag=../../vty/html doc/libosmocodec.tag=../../codec/html doc/libosmoctrl.tag=../../ctrl/html doc/libosmogb.tag=../../gb/html # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. diff --git a/Doxyfile.core.in b/Doxyfile.core.in index 7a3cce598..f83205ac2 100644 --- a/Doxyfile.core.in +++ b/Doxyfile.core.in @@ -1485,7 +1485,7 @@ SKIP_FUNCTION_MACROS = YES # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = +TAGFILES = doc/libosmogsm.tag=../../gsm/html doc/libosmovty.tag=../../vty/html doc/libosmocodec.tag=../../codec/html doc/libosmocoding.tag=../../coding/html doc/libosmoctrl.tag=../../ctrl/html doc/libosmogb.tag=../../gb/html # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. diff --git a/Doxyfile.ctrl.in b/Doxyfile.ctrl.in index eb363bb4f..5612a7410 100644 --- a/Doxyfile.ctrl.in +++ b/Doxyfile.ctrl.in @@ -1485,7 +1485,7 @@ SKIP_FUNCTION_MACROS = YES # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = doc/libosmocore.tag=../../core/html +TAGFILES = doc/libosmocore.tag=../../core/html doc/libosmogsm.tag=../../gsm/html doc/libosmovty.tag=../../vty/html doc/libosmocodec.tag=../../codec/html doc/libosmocoding.tag=../../coding/html doc/libosmogb.tag=../../gb/html # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. diff --git a/Doxyfile.gb.in b/Doxyfile.gb.in index e6b78263e..b3b2128d5 100644 --- a/Doxyfile.gb.in +++ b/Doxyfile.gb.in @@ -1485,7 +1485,7 @@ SKIP_FUNCTION_MACROS = YES # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = doc/libosmocore.tag=../../core/html +TAGFILES = doc/libosmocore.tag=../../core/html doc/libosmogsm.tag=../../gsm/html doc/libosmovty.tag=../../vty/html doc/libosmocodec.tag=../../codec/html doc/libosmocoding.tag=../../coding/html doc/libosmoctrl.tag=../../ctrl/html # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. diff --git a/Doxyfile.gsm.in b/Doxyfile.gsm.in index 27d14cc89..aae0e8970 100644 --- a/Doxyfile.gsm.in +++ b/Doxyfile.gsm.in @@ -1485,7 +1485,7 @@ SKIP_FUNCTION_MACROS = YES # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = doc/libosmocore.tag=../../core/html +TAGFILES = doc/libosmocore.tag=../../core/html doc/libosmovty.tag=../../vty/html doc/libosmocodec.tag=../../codec/html doc/libosmocoding.tag=../../coding/html doc/libosmoctrl.tag=../../ctrl/html doc/libosmogb.tag=../../gb/html # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. diff --git a/Doxyfile.vty.in b/Doxyfile.vty.in index 0e138eee6..fb1cabfc6 100644 --- a/Doxyfile.vty.in +++ b/Doxyfile.vty.in @@ -1485,7 +1485,7 @@ SKIP_FUNCTION_MACROS = YES # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. -TAGFILES = doc/libosmocore.tag=../../core/html +TAGFILES = doc/libosmocore.tag=../../core/html doc/libosmogsm.tag=../../gsm/html doc/libosmocodec.tag=../../codec/html doc/libosmocoding.tag=../../coding/html doc/libosmoctrl.tag=../../ctrl/html doc/libosmogb.tag=../../gb/html # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. diff --git a/Makefile.am b/Makefile.am index de5eb35d4..9e0888f59 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,38 +39,140 @@ $(html_DATA): $(top_builddir)/doc/core/html/index.html \ $(top_builddir)/doc/gb/html/index.html cd $(top_builddir)/doc && tar cf html.tar */html -$(top_builddir)/doc/core/html/index.html: $(SOURCES) Doxyfile.core - @rm -rf doc/core - mkdir -p doc/core +# Support doxygen cross references from each library to each other library: +# First generate the docs to make sure all .tag files are in place. +# In a second run, generate the content with proper referencing. +# For example, libosmocore references tags from libosmovty and vice versa, +# so both need to generate tag files first, and then do another run. +# +# Generate each docs tree, and touch a libosmofoo.tag.prep file when done. +# It means that a libosmofoo.tag file is up-to-date. +# Touch a separate "*.prep" target: libosmofoo.tag as target would create +# circular dependency: we would rebuild all every time 'make' is invoked. +# The .prep file also depends on all the source files for that library. + +$(top_builddir)/doc/libosmocore.tag.prep: $(top_builddir)/Doxyfile.core + rm -rf $(top_builddir)/doc/core; mkdir -p $(top_builddir)/doc/core + rm -rf $(top_builddir)/doc/libosmocore.map + -$(DOXYGEN) $(top_builddir)/Doxyfile.core + touch "$@" + +$(top_builddir)/doc/libosmogsm.tag.prep: $(top_builddir)/Doxyfile.gsm + rm -rf $(top_builddir)/doc/gsm; mkdir -p $(top_builddir)/doc/gsm + rm -rf $(top_builddir)/doc/libosmogsm.map + -$(DOXYGEN) $(top_builddir)/Doxyfile.gsm + touch "$@" + +$(top_builddir)/doc/libosmovty.tag.prep: $(top_builddir)/Doxyfile.vty + rm -rf $(top_builddir)/doc/vty; mkdir -p $(top_builddir)/doc/vty + rm -rf $(top_builddir)/doc/libosmovty.map + -$(DOXYGEN) $(top_builddir)/Doxyfile.vty + touch "$@" + +$(top_builddir)/doc/libosmocodec.tag.prep: $(top_builddir)/Doxyfile.codec + rm -rf $(top_builddir)/doc/codec; mkdir -p $(top_builddir)/doc/codec + rm -rf $(top_builddir)/doc/libosmocodec.map + -$(DOXYGEN) $(top_builddir)/Doxyfile.codec + touch "$@" + +$(top_builddir)/doc/libosmocoding.tag.prep: $(top_builddir)/Doxyfile.coding + rm -rf $(top_builddir)/doc/coding; mkdir -p $(top_builddir)/doc/coding + rm -rf $(top_builddir)/doc/libosmocoding.map + -$(DOXYGEN) $(top_builddir)/Doxyfile.coding + touch "$@" + +$(top_builddir)/doc/libosmoctrl.tag.prep: $(top_builddir)/Doxyfile.ctrl + rm -rf $(top_builddir)/doc/ctrl; mkdir -p $(top_builddir)/doc/ctrl + rm -rf $(top_builddir)/doc/libosmoctrl.map + -$(DOXYGEN) $(top_builddir)/Doxyfile.ctrl + touch "$@" + +$(top_builddir)/doc/libosmogb.tag.prep: $(top_builddir)/Doxyfile.gb + rm -rf $(top_builddir)/doc/gb; mkdir -p $(top_builddir)/doc/gb + rm -rf $(top_builddir)/doc/libosmogb.map + -$(DOXYGEN) $(top_builddir)/Doxyfile.gb + touch "$@" + +# Build for real once all depending .tag files are in place. +# Depend on the own .tag.prep file to avoid concurrent builds of the same doc +# tree, and to also depend on all the source files listed above. +# +# Each library should depend on all the tag.prep files of which it lists .tag +# files in Doxyfile under TAGFILES. +# +# In turn, include all .tag files in TAGFILES of libraries to which "\ref" +# references point. +# +# Easiest is to just depend on all tag.prep files all across everywhere. + +$(top_builddir)/doc/core/html/index.html: $(top_builddir)/doc/libosmocore.tag.prep \ + $(top_builddir)/doc/libosmogsm.tag.prep \ + $(top_builddir)/doc/libosmovty.tag.prep \ + $(top_builddir)/doc/libosmocodec.tag.prep \ + $(top_builddir)/doc/libosmocoding.tag.prep \ + $(top_builddir)/doc/libosmoctrl.tag.prep \ + $(top_builddir)/doc/libosmogb.tag.prep + rm -rf $(top_builddir)/doc/core; mkdir -p $(top_builddir)/doc/core $(DOXYGEN) Doxyfile.core -$(top_builddir)/doc/gsm/html/index.html: $(SOURCES) Doxyfile.gsm - @rm -rf doc/gsm - mkdir -p doc/gsm +$(top_builddir)/doc/gsm/html/index.html: $(top_builddir)/doc/libosmogsm.tag.prep \ + $(top_builddir)/doc/libosmocore.tag.prep \ + $(top_builddir)/doc/libosmovty.tag.prep \ + $(top_builddir)/doc/libosmocodec.tag.prep \ + $(top_builddir)/doc/libosmocoding.tag.prep \ + $(top_builddir)/doc/libosmoctrl.tag.prep \ + $(top_builddir)/doc/libosmogb.tag.prep + rm -rf $(top_builddir)/doc/gsm; mkdir -p $(top_builddir)/doc/gsm $(DOXYGEN) Doxyfile.gsm -$(top_builddir)/doc/vty/html/index.html: $(SOURCES) Doxyfile.vty - @rm -rf doc/vty/{html,latex} +$(top_builddir)/doc/vty/html/index.html: $(top_builddir)/doc/libosmovty.tag.prep \ + $(top_builddir)/doc/libosmocore.tag.prep \ + $(top_builddir)/doc/libosmogsm.tag.prep \ + $(top_builddir)/doc/libosmocodec.tag.prep \ + $(top_builddir)/doc/libosmocoding.tag.prep \ + $(top_builddir)/doc/libosmoctrl.tag.prep \ + $(top_builddir)/doc/libosmogb.tag.prep + rm -rf $(top_builddir)/doc/vty; mkdir -p $(top_builddir)/doc/vty $(DOXYGEN) Doxyfile.vty -$(top_builddir)/doc/codec/html/index.html: $(SOURCES) Doxyfile.codec - @rm -rf doc/codec - mkdir -p doc/codec +$(top_builddir)/doc/codec/html/index.html: $(top_builddir)/doc/libosmocodec.tag.prep \ + $(top_builddir)/doc/libosmocore.tag.prep \ + $(top_builddir)/doc/libosmogsm.tag.prep \ + $(top_builddir)/doc/libosmovty.tag.prep \ + $(top_builddir)/doc/libosmocoding.tag.prep \ + $(top_builddir)/doc/libosmoctrl.tag.prep \ + $(top_builddir)/doc/libosmogb.tag.prep + rm -rf $(top_builddir)/doc/codec; mkdir -p $(top_builddir)/doc/codec $(DOXYGEN) Doxyfile.codec -$(top_builddir)/doc/coding/html/index.html: Doxyfile.coding - @rm -rf doc/coding - mkdir -p doc/coding +$(top_builddir)/doc/coding/html/index.html: $(top_builddir)/doc/libosmocoding.tag.prep \ + $(top_builddir)/doc/libosmocore.tag.prep \ + $(top_builddir)/doc/libosmogsm.tag.prep \ + $(top_builddir)/doc/libosmovty.tag.prep \ + $(top_builddir)/doc/libosmocodec.tag.prep \ + $(top_builddir)/doc/libosmoctrl.tag.prep \ + $(top_builddir)/doc/libosmogb.tag.prep + rm -rf $(top_builddir)/doc/coding; mkdir -p $(top_builddir)/doc/coding $(DOXYGEN) Doxyfile.coding -$(top_builddir)/doc/ctrl/html/index.html: $(SOURCES) Doxyfile.ctrl - @rm -rf doc/ctrl - mkdir -p doc/ctrl +$(top_builddir)/doc/ctrl/html/index.html: $(top_builddir)/doc/libosmoctrl.tag.prep \ + $(top_builddir)/doc/libosmocore.tag.prep \ + $(top_builddir)/doc/libosmogsm.tag.prep \ + $(top_builddir)/doc/libosmovty.tag.prep \ + $(top_builddir)/doc/libosmocodec.tag.prep \ + $(top_builddir)/doc/libosmocoding.tag.prep \ + $(top_builddir)/doc/libosmogb.tag.prep + rm -rf $(top_builddir)/doc/ctrl; mkdir -p $(top_builddir)/doc/ctrl $(DOXYGEN) Doxyfile.ctrl -$(top_builddir)/doc/gb/html/index.html: $(SOURCES) Doxyfile.gb - @rm -rf doc/gb - mkdir -p doc/gb +$(top_builddir)/doc/gb/html/index.html: $(top_builddir)/doc/libosmogb.tag.prep \ + $(top_builddir)/doc/libosmocore.tag.prep \ + $(top_builddir)/doc/libosmogsm.tag.prep \ + $(top_builddir)/doc/libosmovty.tag.prep \ + $(top_builddir)/doc/libosmocodec.tag.prep \ + $(top_builddir)/doc/libosmocoding.tag.prep \ + $(top_builddir)/doc/libosmoctrl.tag.prep + rm -rf $(top_builddir)/doc/gb; mkdir -p $(top_builddir)/doc/gb $(DOXYGEN) Doxyfile.gb install-data-hook: @@ -79,7 +181,7 @@ install-data-hook: uninstall-hook: cd $(DESTDIR)$(htmldir) && rm -rf {core,gsm,vty,codec,coding,ctrl,gb} -DX_CLEAN = doc/{core,gsm,vty,codec,coding,ctrl,gb}/html/search/* doc/{core,gsm,vty,codec,coding,ctrl,gb}/{html,latex}/* doc/html.tar doc/{core,gsm,vty,codec,coding,ctrl,gb}/doxygen_sqlite3.db doc/*.tag +DX_CLEAN = doc/{core,gsm,vty,codec,coding,ctrl,gb}/html/search/* doc/{core,gsm,vty,codec,coding,ctrl,gb}/{html,latex}/* doc/html.tar doc/{core,gsm,vty,codec,coding,ctrl,gb}/doxygen_sqlite3.db doc/*.tag doc/*.tag.prep endif MOSTLYCLEANFILES = $(DX_CLEAN)