Joey Armstrong | ad7bd3f | 2023-10-02 16:55:59 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2017-2022 Open Networking Foundation |
| 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 | # Well that is annoying. Cannot pass two --config switches, doc8 will |
| 28 | # use only one. Repos have more special exclusions so pass onf-make |
| 29 | # doc8 config as command line args so local makefiles to use --config |
| 30 | # ----------------------------------------------------------------------- |
| 31 | # lint-doc8-args += --config $(ONF_MAKEDIR)/lint/doc8/doc8.ini |
| 32 | |
| 33 | ## ----------------------------------------------------------------------- |
| 34 | ## ----------------------------------------------------------------------- |
| 35 | ifndef NO-LINT-DOC8 |
| 36 | lint-doc8-mode := $(if $(have-doc8-files),mod,all) |
| 37 | lint : lint-doc8-$(lint-doc8-mode) |
| 38 | endif# NO-LINT-DOC8 |
| 39 | |
| 40 | ## ----------------------------------------------------------------------- |
| 41 | # Support consistent lint target names across makefiles |
| 42 | # Clone logic makefiles/lint/shellcheck/shellcheck.mk deps |
| 43 | # *-{mod, src} targets and exclusiosn. |
| 44 | ## ----------------------------------------------------------------------- |
| 45 | lint-doc8-all : lint-doc8 |
| 46 | lint-doc8-mod : lint-doc8 |
| 47 | lint-doc8-src : lint-doc8 |
| 48 | |
| 49 | ## ----------------------------------------------------------------------- |
| 50 | ## ----------------------------------------------------------------------- |
| 51 | ## [TODO] - move lint-doc8-excl into doc8.ini |
| 52 | lint-doc8-excl := $(foreach dir,$(onf-excl-dirs) $(lint-doc8-excl),--ignore-path "$(dir)") |
| 53 | lint-doc8: lint-doc8-cmd-version |
| 54 | |
| 55 | $(call banner-enter,Target $@) |
| 56 | $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args) |
| 57 | $(call banner-enter,Target $@) |
| 58 | |
| 59 | # [EOF] |