Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 9fadcbe | 2024-01-17 19:00:37 -0500 | [diff] [blame] | 3 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 4 | # |
| 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 | |
| 23 | have-doc8-files := $(if $(strip $(DOC8_SOURCE)),true) |
| 24 | DOC8_SOURCE ?= $(error DOC8_SOURCE= is required) |
| 25 | |
| 26 | ##--------------------## |
| 27 | ##---] INCLUDES [---## |
| 28 | ##--------------------## |
| 29 | # include $(ONF_MAKEDIR)/lint/doc8/help.mk |
| 30 | include $(ONF_MAKEDIR)/lint/doc8/install.mk |
| 31 | |
| 32 | ## ----------------------------------------------------------------------- |
| 33 | ## ----------------------------------------------------------------------- |
| 34 | ifndef NO-LINT-DOC8 |
| 35 | lint-doc8-mode := $(if $(have-doc8-files),modified,all) |
| 36 | lint : lint-doc8-$(lint-doc8-mode) |
| 37 | endif# NO-LINT-DOC8 |
| 38 | |
| 39 | # Consistent targets across lint makefiles |
| 40 | lint-doc8-all : lint-doc8 |
| 41 | lint-doc8-modified : lint-doc8 |
| 42 | |
| 43 | ## ----------------------------------------------------------------------- |
| 44 | ## ----------------------------------------------------------------------- |
| 45 | lint-doc8-excl := $(foreach dir,$(onf-excl-dirs),--ignore-path "$(dir)") |
| 46 | lint-doc8: lint-doc8-cmd-version |
| 47 | |
| 48 | $(call banner-enter,Target $@) |
| 49 | $(activate) && doc8 --version |
| 50 | @echo |
| 51 | $(activate) && doc8 $(lint-doc8-excl) |
Joey Armstrong | a527814 | 2023-06-28 16:56:54 -0400 | [diff] [blame] | 52 | $(call banner-enter,Target $@) |
Joey Armstrong | 04cdd9f | 2023-06-09 15:18:23 -0400 | [diff] [blame] | 53 | |
| 54 | ## ----------------------------------------------------------------------- |
| 55 | ## Intent: Display command usage |
| 56 | ## ----------------------------------------------------------------------- |
| 57 | help:: |
| 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] |