mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 18:13:49 +01:00
dist/tools: add doxygen as a tool for CI
This commit is contained in:
parent
f54d012534
commit
9cd4964024
4
Makefile
4
Makefile
@ -6,11 +6,11 @@ all: welcome
|
|||||||
@echo ""
|
@echo ""
|
||||||
@exit 1
|
@exit 1
|
||||||
|
|
||||||
doc doc-man doc-latex:
|
doc doc-man doc-latex doc-ci:
|
||||||
@./dist/tools/features_yaml2mx/features_yaml2mx.py \
|
@./dist/tools/features_yaml2mx/features_yaml2mx.py \
|
||||||
features.yaml \
|
features.yaml \
|
||||||
--output-md doc/doxygen/src/feature_list.md
|
--output-md doc/doxygen/src/feature_list.md
|
||||||
"$(MAKE)" -BC doc/doxygen $@
|
"$(MAKE)" -C doc/doxygen $@
|
||||||
|
|
||||||
docclean:
|
docclean:
|
||||||
"$(MAKE)" -BC doc/doxygen clean
|
"$(MAKE)" -BC doc/doxygen clean
|
||||||
|
|||||||
3
dist/tools/doxygen/.gitignore
vendored
Normal file
3
dist/tools/doxygen/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
doxygen
|
||||||
|
doxygen-*
|
||||||
|
doxygen-*/
|
||||||
106
dist/tools/doxygen/Makefile
vendored
Normal file
106
dist/tools/doxygen/Makefile
vendored
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
# This tool package is meant to be used by the `doc-ci` command
|
||||||
|
# to download and (if necessary) compile the specified Doxygen version.
|
||||||
|
# Depending on the distribution, it is quite difficult to obtain recent
|
||||||
|
# package versions.
|
||||||
|
#
|
||||||
|
# The script will try to download the binary release files for `Linux x86_64`
|
||||||
|
# systems and compile from source for every other system.
|
||||||
|
#
|
||||||
|
# The Doxygen version that will be fetched is saved in the $(PKG_VERSION)
|
||||||
|
# environment variable and has to be set by the caller.
|
||||||
|
# Accepted values for $(PKG_VERSION) are either version numbers such as
|
||||||
|
# `1.13.2` or `latest` to build the latest master source.
|
||||||
|
|
||||||
|
PKG_NAME=doxygen
|
||||||
|
PKG_LICENSE=GPL-2.0
|
||||||
|
|
||||||
|
# optionally add the "clean" target to delete the binary and force a rebuild
|
||||||
|
REBUILD=
|
||||||
|
|
||||||
|
# the PKG_VERSION is defined by the doc/doxygen/Makefile
|
||||||
|
ifeq (,$(filter clean distclean,$(MAKECMDGOALS)))
|
||||||
|
ifeq (,$(PKG_VERSION))
|
||||||
|
$(error Doxygen version undefined!)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# If the requested and installed version mismatch, force a rebuild
|
||||||
|
# by deleting the binary. `latest` will always force a rebuild.
|
||||||
|
ifneq (,$(shell test -f $(CURDIR)/doxygen && echo exists))
|
||||||
|
ifneq ($(PKG_VERSION),$(shell $(CURDIR)/doxygen --version | cut -d ' ' -f1))
|
||||||
|
REBUILD=clean
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Try to download the binary if the platform is 'Linux x86_64' to avoid
|
||||||
|
# unnecessarily building Doxygen for CI.
|
||||||
|
ifeq (Linux x86_64,$(shell uname -m -s))
|
||||||
|
# always build from source for the 'latest' version
|
||||||
|
ifeq (latest,$(PKG_VERSION))
|
||||||
|
BUILD_METHOD=build_source
|
||||||
|
else
|
||||||
|
# The URL has the following format (for version 1.13.2):
|
||||||
|
# https://github.com/doxygen/doxygen/releases/download/Release_1_13_2/
|
||||||
|
# doxygen-1.13.2.linux.bin.tar.gz
|
||||||
|
BIN_PKG_URL=https://github.com/doxygen/doxygen/releases/download/Release_
|
||||||
|
BIN_PKG_EXT=linux.bin.tar.gz
|
||||||
|
BIN_PKG_TAR=$(PKG_NAME)-$(PKG_VERSION).$(BIN_PKG_EXT)
|
||||||
|
BIN_PKG_DOWNLOAD_URL=$(BIN_PKG_URL)$(subst .,_,$(PKG_VERSION))/$(BIN_PKG_TAR)
|
||||||
|
|
||||||
|
BIN_AVAILABLE := $(shell curl --head --silent --fail $(BIN_PKG_DOWNLOAD_URL) \
|
||||||
|
>/dev/null 2>&1 && echo yes || echo no)
|
||||||
|
ifeq (yes,$(BIN_AVAILABLE))
|
||||||
|
BUILD_METHOD=download_binary
|
||||||
|
else
|
||||||
|
BUILD_METHOD=build_source
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# fallback to building from source by default
|
||||||
|
BUILD_METHOD?=build_source
|
||||||
|
|
||||||
|
ifeq (build_source,$(BUILD_METHOD))
|
||||||
|
PKG_URL=https://github.com/doxygen/doxygen
|
||||||
|
PKG_EXT=
|
||||||
|
else
|
||||||
|
PKG_URL=$(BIN_PKG_URL)
|
||||||
|
PKG_EXT=$(BIN_PKG_EXT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: clean distclean
|
||||||
|
|
||||||
|
all: $(CURDIR)/doxygen
|
||||||
|
|
||||||
|
$(CURDIR)/doxygen: $(REBUILD)
|
||||||
|
@$(MAKE) $(BUILD_METHOD)
|
||||||
|
|
||||||
|
download_binary: distclean
|
||||||
|
@echo "[INFO] Downloading Doxygen binary..."
|
||||||
|
@wget -q -O $(CURDIR)/$(BIN_PKG_TAR) $(BIN_PKG_DOWNLOAD_URL) || \
|
||||||
|
{ echo "[ERROR] Failed to download binary"; exit 1; }
|
||||||
|
@echo "[INFO] Unpacking Doxygen..."
|
||||||
|
@tar -xf $(CURDIR)/$(BIN_PKG_TAR)
|
||||||
|
@cp $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/bin/doxygen $(CURDIR)
|
||||||
|
|
||||||
|
build_source: distclean
|
||||||
|
@echo "[INFO] Cloning and building Doxygen from source..."
|
||||||
|
@if [ "$(PKG_VERSION)" = "latest" ]; then \
|
||||||
|
git clone --depth=1 $(PKG_URL).git $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION); \
|
||||||
|
else \
|
||||||
|
git ls-remote --tags $(PKG_URL).git | grep -q "refs/tags/Release_$(subst .,_,$(PKG_VERSION))$$" || \
|
||||||
|
{ echo "[ERROR] Specified version tag 'Release_$(subst .,_,$(PKG_VERSION))'" \
|
||||||
|
"does not exist!"; exit 1; }; \
|
||||||
|
git clone --branch Release_$(subst .,_,$(PKG_VERSION)) --depth=1 \
|
||||||
|
$(PKG_URL).git $(CURDIR)/$(PKG_NAME); \
|
||||||
|
fi
|
||||||
|
@cd $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION) && mkdir build && cd build && \
|
||||||
|
cmake -G "Unix Makefiles" .. && \
|
||||||
|
$(MAKE) --no-print-directory && \
|
||||||
|
cp bin/doxygen $(CURDIR)
|
||||||
|
|
||||||
|
distclean:: clean
|
||||||
|
@rm -rf $(CURDIR)/$(PKG_NAME)*
|
||||||
|
|
||||||
|
clean::
|
||||||
|
@rm -rf $(PKG_NAME)
|
||||||
@ -1,5 +1,7 @@
|
|||||||
RIOTBASE = $(shell git rev-parse --show-toplevel)
|
RIOTBASE ?= $(shell git rev-parse --show-toplevel)
|
||||||
RIOTMAKE ?= $(RIOTBASE)/makefiles
|
RIOTMAKE ?= $(RIOTBASE)/makefiles
|
||||||
|
RIOTTOOLS ?= $(RIOTBASE)/dist/tools
|
||||||
|
|
||||||
|
|
||||||
# Generate list of quoted absolute include paths. Evaluated in riot.doxyfile.
|
# Generate list of quoted absolute include paths. Evaluated in riot.doxyfile.
|
||||||
export STRIP_FROM_INC_PATH_LIST=$(shell \
|
export STRIP_FROM_INC_PATH_LIST=$(shell \
|
||||||
@ -22,11 +24,19 @@ endif
|
|||||||
# Check that the doxygen version is not too old to avoid
|
# Check that the doxygen version is not too old to avoid
|
||||||
# certain bugs that were fixed in later revisions. Especially
|
# certain bugs that were fixed in later revisions. Especially
|
||||||
# Debian-based distributions tend to have very old versions.
|
# Debian-based distributions tend to have very old versions.
|
||||||
DOXYGEN_MIN_VERSION = 1.14.0
|
DOXYGEN_MIN_VERSION = 1.13.2
|
||||||
|
|
||||||
|
# Set the Doxygen binary if not already set
|
||||||
|
DOXYGEN ?= doxygen
|
||||||
|
|
||||||
# Strip the commit hash that is sometimes present after the
|
# Strip the commit hash that is sometimes present after the
|
||||||
# version number.
|
# version number.
|
||||||
DOXYGEN_VERSION = $(shell doxygen --version | cut -d ' ' -f1)
|
DOXYGEN_CUR_VERSION = $(shell $(DOXYGEN) --version | cut -d ' ' -f1)
|
||||||
|
|
||||||
|
# for the `doc-ci` target, we can choose which Doxygen version should be built.
|
||||||
|
# If nothing has been chosen, select the minimum version.
|
||||||
|
# Valid options are `latest` and version numbers such as `1.13.2`.
|
||||||
|
DOXYGEN_VERSION ?= $(DOXYGEN_MIN_VERSION)
|
||||||
|
|
||||||
# include color echo macros
|
# include color echo macros
|
||||||
include $(RIOTMAKE)/utils/ansi.mk
|
include $(RIOTMAKE)/utils/ansi.mk
|
||||||
@ -34,27 +44,32 @@ include $(RIOTMAKE)/color.inc.mk
|
|||||||
|
|
||||||
.PHONY: doc doc-man doc-latex
|
.PHONY: doc doc-man doc-latex
|
||||||
doc doc-man doc-latex: $(DOCUMENTATION_FORMAT)
|
doc doc-man doc-latex: $(DOCUMENTATION_FORMAT)
|
||||||
@if [ "`{ echo "$(DOXYGEN_MIN_VERSION)"; echo "$(DOXYGEN_VERSION)"; } | \
|
@if [ "`{ echo "$(DOXYGEN_MIN_VERSION)"; echo "$(DOXYGEN_CUR_VERSION)"; } | \
|
||||||
sort -V | head -n1`" != "$(DOXYGEN_MIN_VERSION)" ]; then \
|
sort -V | head -n1`" != "$(DOXYGEN_MIN_VERSION)" ]; then \
|
||||||
$(COLOR_ECHO) "$(COLOR_RED)Warning: Doxygen version $(DOXYGEN_VERSION) is too old." \
|
$(COLOR_ECHO) "$(COLOR_RED)Warning: Doxygen version $(DOXYGEN_CUR_VERSION) is too old." \
|
||||||
"It is recommended to use at least version $(DOXYGEN_MIN_VERSION)" \
|
"It is recommended to use at least version $(DOXYGEN_MIN_VERSION)" \
|
||||||
"to avoid incorrectly formatted output.$(COLOR_RESET)"; \
|
"to avoid incorrectly formatted output.$(COLOR_RESET)"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
.PHONY: doc-ci
|
||||||
|
doc-ci: $(RIOTTOOLS)/doxygen/Makefile
|
||||||
|
@PKG_VERSION=$(DOXYGEN_VERSION) $(MAKE) -C $(RIOTTOOLS)/doxygen all --no-print-directory
|
||||||
|
@$(MAKE) -BC $(CURDIR) DOXYGEN=$(RIOTTOOLS)/doxygen/doxygen doc
|
||||||
|
|
||||||
# by marking html as phony we force make to re-run Doxygen even if the directory exists.
|
# by marking html as phony we force make to re-run Doxygen even if the directory exists.
|
||||||
.PHONY: html
|
.PHONY: html
|
||||||
html: src/changelog.md src/coc.md src/governance.md
|
html: src/changelog.md src/coc.md src/governance.md
|
||||||
( cat riot.doxyfile ; echo "GENERATE_HTML = yes" ) | doxygen -
|
( cat riot.doxyfile ; echo "GENERATE_HTML = yes" ) | $(DOXYGEN) -
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "RIOT documentation successfully generated at file://$(RIOTBASE)/doc/doxygen/html/index.html"
|
@echo "RIOT documentation successfully generated at file://$(RIOTBASE)/doc/doxygen/html/index.html"
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: src/changelog.md src/coc.md src/governance.md
|
check: src/changelog.md src/coc.md src/governance.md
|
||||||
( cat riot.doxyfile) | doxygen -
|
( cat riot.doxyfile) | $(DOXYGEN) -
|
||||||
|
|
||||||
.PHONY: man
|
.PHONY: man
|
||||||
man: src/changelog.md src/coc.md src/governance.md
|
man: src/changelog.md src/coc.md src/governance.md
|
||||||
( cat riot.doxyfile ; echo "GENERATE_MAN = yes" ) | doxygen -
|
( cat riot.doxyfile ; echo "GENERATE_MAN = yes" ) | $(DOXYGEN) -
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "RIOT documentation successfully generated at file://$(RIOTBASE)/doc/doxygen/man/man3"
|
@echo "RIOT documentation successfully generated at file://$(RIOTBASE)/doc/doxygen/man/man3"
|
||||||
|
|
||||||
@ -76,9 +91,10 @@ src/governance.md: ../../GOVERNANCE.md
|
|||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
latex: src/changelog.md src/coc.md src/governance.md
|
latex: src/changelog.md src/coc.md src/governance.md
|
||||||
( cat riot.doxyfile ; echo "GENERATE_LATEX= yes" ) | doxygen -
|
( cat riot.doxyfile ; echo "GENERATE_LATEX= yes" ) | $(DOXYGEN) -
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "RIOT documentation successfully generated at file://$(RIOTBASE)/doc/doxygen/latex/index.tex"
|
@echo "RIOT documentation successfully generated at file://$(RIOTBASE)/doc/doxygen/latex/index.tex"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-@rm -rf latex man html doxygen_objdb_*.tmp doxygen_entrydb_*.tmp src/changelog.md src/coc.md src/governance.md
|
-@rm -rf latex man html doxygen_objdb_*.tmp doxygen_entrydb_*.tmp src/changelog.md src/coc.md src/governance.md
|
||||||
|
@$(MAKE) -C $(RIOTTOOLS)/doxygen clean
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user