blob: 80a9876a759cf9245bb7d79a45448f7f72112f0a [file] [log] [blame]
Joey Armstrong96bcf1b2023-06-27 14:49:40 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong2c039362024-02-04 18:51:52 -05003# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrong96bcf1b2023-06-27 14:49:40 -04004#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
Zack Williams4b0ef4d2019-12-18 14:25:20 -070017
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040018$(if $(DEBUG),$(warning ENTER))
19
20##-------------------##
21##---] GLOBALS [---##
22##-------------------##
23TOP-docs ?=$(strip \
24 $(dir \
25 $(abspath $(lastword $(MAKEFILE_LIST)))\
26 )\
27)
28TOP-docs := $(subst /docs/,$(null),$(TOP-docs))
29
30##--------------------##
31##---] INCLUDES [---##
32##--------------------##
33include $(TOP-docs)/config.mk
34include $(TOP-docs)/makefiles/include.mk
35
36# Minimal makefile for Sphinx documentation
Matteo Scandolo9f619492019-10-25 13:11:58 -070037
38# You can set these variables from the command line.
39SPHINXOPTS =
40SPHINXBUILD = sphinx-build
41SOURCEDIR = source
42BUILDDIR = build
43
Zack Williams4b0ef4d2019-12-18 14:25:20 -070044.PHONY: help Makefile lint
Matteo Scandolo9f619492019-10-25 13:11:58 -070045
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040046## -----------------------------------------------------------------------
47## -----------------------------------------------------------------------
48clean ::
49 $(RM) -r build "$(venv-name)"
Matteo Scandolo9f619492019-10-25 13:11:58 -070050
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040051## -----------------------------------------------------------------------
52## Intent: Display target help
53## -----------------------------------------------------------------------
54help :: $(venv-activate-script)
55 $(activate) \
56 && $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Matteo Scandolo9f619492019-10-25 13:11:58 -070057
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040058# -----------------------------------------------------------------------
Matteo Scandolo9f619492019-10-25 13:11:58 -070059# Catch-all target: route all unknown targets to Sphinx using the new
60# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040061# -----------------------------------------------------------------------
62docs-targets += html
Zack Williams4b0ef4d2019-12-18 14:25:20 -070063
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040064$(docs-targets) : $(venv-activate-script) Makefile
65 $(call banner-enter,Target $@)
66 $(activate) \
67 && $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
68 $(call banner-leave,Target $@)
69
70# [EOF]