# TODO #2170: search for old/preceding protocol name AND number, and adapt # You can set these variables from the command line. SPHINXOPTS = -j auto -aE -n -W --keep-going SPHINXBUILD = poetry run sphinx-build SOURCEDIR = . TMPDOCDIR = /tmp/octezdoc BUILDDIR = _build TOPBUILDDIR = ../_build TOPBUILDDIR_ABS = $(abspath $(CURDIR)/$(TOPBUILDDIR)) DOCGENDIR = doc_gen DOCERRORDIR = $(DOCGENDIR)/errors P2PDOCEXE = $(TOPBUILDDIR)/default/docs/$(DOCGENDIR)/p2p_doc.exe RPCDOCEXE = $(TOPBUILDDIR)/default/docs/$(DOCGENDIR)/rpc_doc.exe ERRDOCEXE = $(TOPBUILDDIR)/default/docs/$(DOCERRORDIR)/error_doc.exe NAMED_PROTOS = oxford paris PROTOCOLS = $(NAMED_PROTOS) alpha # The following variables names are lowercase, so their names can be computed # from the names of the corresponding protocol directories paris_long = PtParisAeco71sYvYgfnVPb4rRJe6zgzYRDS5U8t5ednSRPUFN5 oxford_long = ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH alpha_long = ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK paris_short = PtParisA oxford_short = Proxford alpha_short = alpha SCRIPTSDIR = scripts CHECKXREFS = $(SCRIPTSDIR)/check_proto_xrefs.py # Build all documentation (with CLI manuals and odoc) but without old PROTOCOLS all: odoc-lite # Html needs the API pages for OCaml modules, generated by odoc, because of # the :package: custom roles in RST files; so run html *after* odoc ${MAKE} html # Build the full documentation including archived protocols; for publishing only full: odoc # Same ordering constraint: html *after* odoc (see target "all") ${MAKE} html # Build html without odoc (if odoc already ran or if not checking custom roles) html: octez-gen docexes-gen ${MAKE} sphinx # Build the manuals for a given protocol %/octez-client.html: @../octez-client -protocol $($(@D)_long) man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > $@ %/octez-baker.html: @../octez-baker-$($(@D)_short) man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > $@ %/octez-accuser.html: @../octez-accuser-$($(@D)_short) man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > $@ %/octez-smart-rollup-node.html: @../octez-smart-rollup-node-$($(@D)_short) man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > $@ manuals: \ $(PROTOCOLS:%=%/octez-client.html) \ $(PROTOCOLS:%=%/octez-baker.html) \ $(PROTOCOLS:%=%/octez-accuser.html) \ $(PROTOCOLS:%=%/octez-smart-rollup-node.html) # generic @../octez-admin-client man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > api/octez-admin-client.html @../octez-signer man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > api/octez-signer.html @../octez-codec man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > api/octez-codec.html @../octez-snoop man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > api/octez-snoop.html @ ../octez-dac-node man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > api/octez-dac-node.html @ ../octez-dac-client man -verbosity 3 -format html | sed "s#${HOME}#\$$HOME#g" > api/octez-dac-client.html @../octez-node --help | grep -v '^Octez-node' | grep -v 'OCTEZ-NODE(1)' | \ ./scripts/man2txt.py -r > api/octez-node.txt @../octez-proxy-server --help | grep -v '^Octez-proxy-server' | grep -v 'OCTEZ-PROXY-SERVER(1)' | \ ./scripts/man2txt.py -r > api/octez-proxy-server.txt @../octez-smart-rollup-node man -verbosity 3 -format html | \ sed "s#${HOME}#\$$HOME#g" > api/octez-smart-rollup-node.html @../octez-dal-node --help | grep -v '^Octez-dal-node' | grep -v 'OCTEZ-DAL-NODE(1)' | \ ./scripts/man2txt.py -r > api/octez-dal-node.txt @../octez-dal-node config init --help | grep -v '^Octez-dal-node' | grep -v 'OCTEZ-DAL-NODE(1)' | \ ./scripts/man2txt.py > api/octez-dal-node-config-init.txt .PHONY: odoc odoc: cd $$(pwd)/.. ; dune build @doc >docs/odoc.log 2>&1; \ RESULT=$$?; (grep -B1 '^Error:' docs/odoc.log || true); exit $$RESULT @rm -rf $$(pwd)/_build/api/odoc @mkdir -p $$(pwd)/_build/api @cp -r $$(pwd)/../_build/default/_doc $$(pwd)/_build/api/odoc @rm -rf $(CURDIR)/_build/api/odoc/_odocls odoc-lite: rm -rf $(TMPDOCDIR)/ mkdir -p $(TMPDOCDIR)/ rsync --recursive --links --perms --exclude=target \ ../scripts ../script-inputs ../src ../tezt ../irmin ../vendors ../dune ../dune-project ../dune-workspace $(TMPDOCDIR)/ cd $(TMPDOCDIR)/ && ./scripts/remove-old-protocols.sh @echo "Running odoc in $(TMPDOCDIR), with build directory $(TOPBUILDDIR_ABS) and outputs in $(TMPDOCDIR)/odoc.log" ODOC_WARN_ERROR=true dune build @doc --build-dir=$(TOPBUILDDIR_ABS) --root=$(TMPDOCDIR) >$(TMPDOCDIR)/odoc.log 2>&1; \ RESULT=$$?; \ (grep -B1 '^Error:' $(TMPDOCDIR)/odoc.log || true) ; \ exit $$RESULT rm -rf $(CURDIR)/_build/api/odoc mkdir -p $(CURDIR)/_build/api cp -r $(TOPBUILDDIR_ABS)/default/_doc $(CURDIR)/_build/api/odoc rm -rf $(CURDIR)/_build/api/odoc/_odocls .PHONY: linkcheck # Run this after make html linkcheck: @echo "Running linkcheck, outputs messages to $(BUILDDIR)/output.txt" @$(SPHINXBUILD) -b linkcheck "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) >$@;\ RESULT=$$?; cat $(BUILDDIR)/output.txt; exit $$RESULT .PHONY: fixlinkcheck fixlinkcheck: @scripts/update_links.sh .PHONY: redirectcheck # Run this after make html redirectcheck: @cd $$(pwd)/.. ; ./scripts/lint.sh --check-redirects # xrefs should be checked: # - on the active protocol using its numeric name (not the "active" symlink) # - on each other protocol including alpha, also checking label defs (option -l) xrefscheck: $(CHECKXREFS) paris $(CHECKXREFS) oxford $(CHECKXREFS) -l alpha installcheck: scripts/test_install_scripts.sh install-bin-focal scripts/test_install_scripts.sh install-bin-jammy scripts/test_install_scripts.sh install-bin-fedora37 scripts/test_install_scripts.sh install-bin-fedora38 scripts/test_install_scripts.sh install-bin-rc-focal scripts/test_install_scripts.sh install-bin-rc-jammy scripts/test_install_scripts.sh install-bin-rc-fedora37 scripts/test_install_scripts.sh install-bin-rc-fedora38 scripts/test_install_scripts.sh install-opam-scratch scripts/test_install_scripts.sh install-opam-focal scripts/test_install_scripts.sh compile-release-sources-bullseye scripts/test_install_scripts.sh compile-sources-bullseye scripts/test_install_scripts.sh compile-sources-mantic # build dune targets together to avoid concurrent dunes docexes: cd .. && dune build docs/$(DOCERRORDIR)/error_doc.exe docs/$(DOCGENDIR)/rpc_doc.exe docs/$(DOCGENDIR)/p2p_doc.exe developer/metrics.csv: ../octez-node dump-metrics > developer/metrics.csv $(ERRDOCEXE): docexes $(RPCDOCEXE): docexes $(P2PDOCEXE): docexes api/errors.rst: $(ERRDOCEXE) $(ERRDOCEXE) > api/errors.rst shell/rpc.rst: $(RPCDOCEXE) $(RPCDOCEXE) index shell /shell/rpc_introduction.rst.inc > $@ %/rpc.rst: $(RPCDOCEXE) $(RPCDOCEXE) index $(@D) $($(@D)_long) /include/rpc_introduction.rst.inc > $@ user/default-acl.json: $(RPCDOCEXE) $(RPCDOCEXE) acl > $@ rpc: user/default-acl.json shell/rpc.rst \ alpha/rpc.rst # To be triggered manually when needed rpc-protocols: $(NAMED_PROTOS:%=%/rpc.rst) p2p: $(P2PDOCEXE) shell/p2p_usage.rst.inc @$(P2PDOCEXE) < shell/p2p_usage.rst.inc > shell/p2p_api.rst .PHONY: install-dependencies install-dependencies: @poetry install user/node-config.json: user/node-config.sh cd ..; ./docs/user/node-config.sh >docs/$@ # Pages generated by running Octez binaries octez-gen: developer/metrics.csv user/node-config.json manuals # Pages generated by the generators under docs/doc_gen/ docexes-gen: api/errors.rst p2p rpc # Run Sphinx, assuming all generated pages have been built previously sphinx: install-dependencies (echo ':orphan:'; echo ''; cat ../CHANGES.rst) > CHANGES-dev.rst @$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) @ln -s active "$(BUILDDIR)/oxford" || true # pylint does not support pyproject.toml configuration for now # It is configured by ./.pylint.rc # In pylint, we ignore the following additional errors: # - C0330: pylint is wrong (https://github.com/psf/black/issues/48) PYLINTRC?=../.pylintrc PYLINT=PYLINTRC=${PYLINTRC} poetry run pylint # pycodestyle does not support pyproject.toml configuration for now # https://github.com/PyCQA/pydocstyle/issues/447 # # In pycodestyle we ignore the following additional errors w.r.t to defaults # (i.e. E121,E123,E126,E226,E24,E704,W503) # - E203 :: pycodestyle is wrong (https://github.com/psf/black/issues/315) # and black takes care of it # - E231 :: same as E203 # # Other error codes are detailed at https://www.flake8rules.com/ PYCODESTYLE=poetry run pycodestyle PYCODESTYLE_OPTIONS=\ --ignore=E121,E123,E126,E226,E24,E704,W503,E203,E231 \ --max-line-length=80 TYPECHECK=poetry run mypy BLACK=poetry run black PYTHON_SRCS?=conf.py _extensions/*.py scripts/*.py pylint: @echo "Linting with pylint, version:" @poetry run pylint --version | sed 's/^/ /' $(PYLINT) $(PYTHON_SRCS) lint_black: @echo "Running black formatter as style checker" $(BLACK) --check $(PYTHON_SRCS) pycodestyle: @echo "Linting with pycodestyle version `poetry run pycodestyle --version` (`poetry run which pycodestyle`)" $(PYCODESTYLE) $(PYCODESTYLE_OPTIONS) $(PYTHON_SRCS) typecheck: @echo "Typechecking with mypy version `poetry run mypy --version`" $(TYPECHECK) $(PYTHON_SRCS) lint: pylint pycodestyle lint_black typecheck # black options are set in pyproject.toml black: @echo "Running black formatter" $(BLACK) $(PYTHON_SRCS) fmt: black clean: @-rm -Rf "$(BUILDDIR)" linkcheck odoc.log @-rm -f $(ERRDOCEXE) $(RPCDOCEXE) $(P2PDOCEXE) @-rm -Rf api/errors.rst developer/metrics.csv user/node-config.json alpha/rpc.rst shell/rpc.rst shell/p2p_api.rst user/default-acl.json CHANGES-dev.rst @-rm -Rf api/octez-*.html api/octez-*.txt oxford/octez-*.html paris/octez-*.html alpha/octez-*.html