Joey Armstrong | 4960ec9 | 2023-07-19 09:04:20 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 518f357 | 2024-02-11 07:56:25 -0500 | [diff] [blame] | 3 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 4960ec9 | 2023-07-19 09:04:20 -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 | |
Joey Armstrong | cb89660 | 2023-07-21 16:38:42 -0400 | [diff] [blame] | 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 |
Joey Armstrong | 4960ec9 | 2023-07-19 09:04:20 -0400 | [diff] [blame] | 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 | ## ----------------------------------------------------------------------- |
Joey Armstrong | cb89660 | 2023-07-21 16:38:42 -0400 | [diff] [blame] | 45 | lint-doc8-excl := $(foreach dir,$(onf-excl-dirs),--ignore-path "$(dir)") |
| 46 | lint-doc8: lint-doc8-cmd-version |
Joey Armstrong | 4960ec9 | 2023-07-19 09:04:20 -0400 | [diff] [blame] | 47 | |
Joey Armstrong | cb89660 | 2023-07-21 16:38:42 -0400 | [diff] [blame] | 48 | $(call banner-enter,Target $@) |
Joey Armstrong | 4960ec9 | 2023-07-19 09:04:20 -0400 | [diff] [blame] | 49 | $(activate) && doc8 --version |
| 50 | @echo |
Joey Armstrong | cb89660 | 2023-07-21 16:38:42 -0400 | [diff] [blame] | 51 | $(activate) && doc8 $(lint-doc8-excl) |
| 52 | $(call banner-enter,Target $@) |
Joey Armstrong | 4960ec9 | 2023-07-19 09:04:20 -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] |