github.com/datadog/cilium@v1.6.12/Documentation/Makefile (about)

     1  # Minimal makefile for Sphinx documentation
     2  #
     3  include ../Makefile.quiet
     4  
     5  # You can set these variables from the command line.
     6  SPHINXOPTS    =
     7  SPHINXBUILD   = sphinx-build
     8  SPHINXPROJ    = Cilium
     9  IGNOREDWARNINGS := -e "tabs assets" -e "misspelled words" -e "RemovedInSphinx20Warning"
    10  SOURCEDIR     = .
    11  BUILDDIR      = _build
    12  CMDREFDIR     = cmdref
    13  CILIUMDIR     = ../cilium
    14  AGENTDIR      = ../daemon
    15  BUGTOOLDIR    = ../bugtool
    16  HEALTHDIR     = ../cilium-health
    17  OPERATORDIR   = ../operator
    18  SPELLING_LIST = spelling_wordlist.txt
    19  
    20  # Put it first so that "make" without argument is like "make help".
    21  help:
    22  	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
    23  
    24  PIP_REQUIREMENTS = $(shell grep -ve "^\#.*" requirements.txt | sed -e 's/==.*//g' -e 's/^.*\/\([^./]*\).*$$/"\1"/g' -e 's/_/-/g' -e 's/\n/ /g')
    25  
    26  check-requirements:
    27  	@set -e;								\
    28  	$(ECHO_CHECK) documentation dependencies...;				\
    29  	PYPKGS=$$(pip3 freeze);							\
    30  	for pkg in ${PIP_REQUIREMENTS}; do					\
    31  		echo $${PYPKGS} | grep -q $${pkg}				\
    32  		|| (echo "Documentation dependency '$${pkg}' not found.";	\
    33  		    echo "Run 'pip3 install --user -r Documentation/requirements.txt'";	\
    34  		    exit 2);							\
    35  	done
    36  
    37  cmdref:
    38  	$(QUIET) # We don't know what changed so recreate the directory
    39  	$(QUIET) -rm -rvf $(CMDREFDIR)/cilium*
    40  	@$(ECHO_GEN)cmdref/cilium
    41  	$(QUIET) ${CILIUMDIR}/cilium cmdref -d $(CMDREFDIR)
    42  	@$(ECHO_GEN)cmdref/cilium-bugtool
    43  	$(QUIET) ${BUGTOOLDIR}/cilium-bugtool cmdref -d $(CMDREFDIR)
    44  	@$(ECHO_GEN)cmdref/cilium-agent
    45  	$(QUIET) ${AGENTDIR}/cilium-agent --cmdref $(CMDREFDIR)
    46  	@$(ECHO_GEN)cmdref/cilium-health
    47  	$(QUIET) ${HEALTHDIR}/cilium-health --cmdref $(CMDREFDIR)
    48  	@$(ECHO_GEN)cmdref/cilium-operator
    49  	$(QUIET) ${OPERATORDIR}/cilium-operator --cmdref $(CMDREFDIR)
    50  
    51  # Touch "$@.ok" if the docs build succeeds. Fail if there are errors
    52  # or output other than those including the following phrases:
    53  # "tabs assets" - These are always printed by the spelling check.
    54  # "misspelled words" - These will be explicitly checked below.
    55  # Finally, fail out if we can't remove the file that marks success.
    56  check-build: check-requirements
    57  	@$(ECHO_CHECK) documentation build...
    58  	@mkdir -p $(BUILDDIR)
    59  	$(QUIET)($(SPHINXBUILD) -b spelling -d "$(BUILDDIR)/doctrees" "$(SOURCEDIR)" "$(BUILDDIR)/spelling" -q -E $(SPHINXOPTS) 2>&1 && touch $@.ok) > $(BUILDDIR)/warnings.txt
    60  	@if grep -q -v $(IGNOREDWARNINGS) $(BUILDDIR)/warnings.txt; then \
    61  		echo "Please fix the following documentation warnings:"; \
    62  		grep -v $(IGNOREDWARNINGS) "$(BUILDDIR)/warnings.txt"; \
    63  		exit 1; \
    64  	fi
    65  	@if [ "$$(wc -l < "$(BUILDDIR)/spelling/output.txt")" -ne "0" ]; then \
    66  		echo "Please fix the following spelling mistakes:"; \
    67  		sed 's/^/* Documentation\//' $(BUILDDIR)/spelling/output.txt; \
    68  		echo "If the words are not misspelled, add them to Documentation/$(SPELLING_LIST)."; \
    69  		exit 1; \
    70  	fi
    71  	@rm $@.ok 2>/dev/null
    72  
    73  # To use checklinks with `make render-docs`,
    74  # edit the line `%: Makefile check-requirements check-build checklinks`
    75  checklinks:
    76  	$(QUIET)$(SPHINXBUILD) -b linkcheck -d "$(BUILDDIR)/doctrees" "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
    77  
    78  .PHONY: help Makefile ../Makefile.quiet check-requirements cmdref
    79  
    80  # Catch-all target: route all unknown targets to Sphinx using the new
    81  # "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
    82  %: Makefile check-requirements check-build
    83  	@$(ECHO_GEN)_build/$@
    84  	$(QUIET)$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)