blob: 23f7b0b51441012ffe7744af5492dc170a02a84d [file] [log] [blame]
Joey Armstrong4960ec92023-07-19 09:04:20 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong518f3572024-02-11 07:56:25 -05003# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrong4960ec92023-07-19 09:04:20 -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# -----------------------------------------------------------------------
17
18##-------------------##
19##---] GLOBALS [---##
20##-------------------##
21.PHONY: lint-doc8 lint-doc8-all lint-doc8-modified
22
Joey Armstrongcb896602023-07-21 16:38:42 -040023have-doc8-files := $(if $(strip $(DOC8_SOURCE)),true)
24DOC8_SOURCE ?= $(error DOC8_SOURCE= is required)
25
26##--------------------##
27##---] INCLUDES [---##
28##--------------------##
29# include $(ONF_MAKEDIR)/lint/doc8/help.mk
30include $(ONF_MAKEDIR)/lint/doc8/install.mk
Joey Armstrong4960ec92023-07-19 09:04:20 -040031
32## -----------------------------------------------------------------------
33## -----------------------------------------------------------------------
34ifndef NO-LINT-DOC8
35 lint-doc8-mode := $(if $(have-doc8-files),modified,all)
36 lint : lint-doc8-$(lint-doc8-mode)
37endif# NO-LINT-DOC8
38
39# Consistent targets across lint makefiles
40lint-doc8-all : lint-doc8
41lint-doc8-modified : lint-doc8
42
43## -----------------------------------------------------------------------
44## -----------------------------------------------------------------------
Joey Armstrongcb896602023-07-21 16:38:42 -040045lint-doc8-excl := $(foreach dir,$(onf-excl-dirs),--ignore-path "$(dir)")
46lint-doc8: lint-doc8-cmd-version
Joey Armstrong4960ec92023-07-19 09:04:20 -040047
Joey Armstrongcb896602023-07-21 16:38:42 -040048 $(call banner-enter,Target $@)
Joey Armstrong4960ec92023-07-19 09:04:20 -040049 $(activate) && doc8 --version
50 @echo
Joey Armstrongcb896602023-07-21 16:38:42 -040051 $(activate) && doc8 $(lint-doc8-excl)
52 $(call banner-enter,Target $@)
Joey Armstrong4960ec92023-07-19 09:04:20 -040053
54## -----------------------------------------------------------------------
55## Intent: Display command usage
56## -----------------------------------------------------------------------
57help::
58 @echo ' lint-doc8 Syntax check python using the doc8 command'
59 ifdef VERBOSE
60 @echo ' lint-doc8-all doc8 checking: exhaustive'
61 @echo ' lint-doc8-modified doc8 checking: only modified'
62 endif
63
64# [EOF]