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 | |
Joey Armstrong | 6fdded6 | 2023-11-30 12:47:50 -0500 | [diff] [blame] | 18 | $(if $(DEBUG),$(eval LINT_DOC8_DEBUG=1)) |
| 19 | |
| 20 | $(if $(LINT_DOC8_DEBUG),$(warning ENTER)) |
| 21 | |
Joey Armstrong | ad7bd3f | 2023-10-02 16:55:59 -0400 | [diff] [blame] | 22 | ##-------------------## |
| 23 | ##---] GLOBALS [---## |
| 24 | ##-------------------## |
| 25 | .PHONY: lint-doc8 lint-doc8-all lint-doc8-modified |
| 26 | |
| 27 | have-doc8-files := $(if $(strip $(DOC8_SOURCE)),true) |
| 28 | DOC8_SOURCE ?= $(error DOC8_SOURCE= is required) |
| 29 | |
| 30 | # ----------------------------------------------------------------------- |
| 31 | # Well that is annoying. Cannot pass two --config switches, doc8 will |
| 32 | # use only one. Repos have more special exclusions so pass onf-make |
| 33 | # doc8 config as command line args so local makefiles to use --config |
| 34 | # ----------------------------------------------------------------------- |
| 35 | # lint-doc8-args += --config $(ONF_MAKEDIR)/lint/doc8/doc8.ini |
| 36 | |
| 37 | ## ----------------------------------------------------------------------- |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | ifndef NO-LINT-DOC8 |
| 40 | lint-doc8-mode := $(if $(have-doc8-files),mod,all) |
| 41 | lint : lint-doc8-$(lint-doc8-mode) |
| 42 | endif# NO-LINT-DOC8 |
| 43 | |
| 44 | ## ----------------------------------------------------------------------- |
| 45 | # Support consistent lint target names across makefiles |
| 46 | # Clone logic makefiles/lint/shellcheck/shellcheck.mk deps |
| 47 | # *-{mod, src} targets and exclusiosn. |
| 48 | ## ----------------------------------------------------------------------- |
| 49 | lint-doc8-all : lint-doc8 |
| 50 | lint-doc8-mod : lint-doc8 |
| 51 | lint-doc8-src : lint-doc8 |
| 52 | |
| 53 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 6fdded6 | 2023-11-30 12:47:50 -0500 | [diff] [blame] | 54 | ## Intent: Morph exclusion strings into command line arguments. |
| 55 | ## NOTE: Do not double-quote argument: -ignore-path "$(dir)" |
| 56 | ## Single quotes surrounding exclusion strings added in doc8/excl.mk |
| 57 | ## will become part of exclusion string and fail pattern matching. |
Joey Armstrong | ad7bd3f | 2023-10-02 16:55:59 -0400 | [diff] [blame] | 58 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 6fdded6 | 2023-11-30 12:47:50 -0500 | [diff] [blame] | 59 | ## [TODO] - move lint-doc8-excl into doc8.ini (autogenerate) |
| 60 | ## ----------------------------------------------------------------------- |
| 61 | lint-doc8-excl := $(strip \ |
| 62 | $(foreach dir,$(onf-excl-dirs) $(lint-doc8-excl-raw),\ |
| 63 | $(if $(LINT_DOC8_DEBUG),$(info ** linux-doc8-excl += [$(dir)]))\ |
| 64 | --ignore-path $(dir))\ |
| 65 | ) |
| 66 | |
| 67 | ## ----------------------------------------------------------------------- |
| 68 | ## Usage: make lint-doc8 LINT_DOC8_DEBUG=1 |
| 69 | ## ----------------------------------------------------------------------- |
Joey Armstrong | ad7bd3f | 2023-10-02 16:55:59 -0400 | [diff] [blame] | 70 | lint-doc8: lint-doc8-cmd-version |
| 71 | |
| 72 | $(call banner-enter,Target $@) |
| 73 | $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args) |
| 74 | $(call banner-enter,Target $@) |
| 75 | |
Joey Armstrong | 6fdded6 | 2023-11-30 12:47:50 -0500 | [diff] [blame] | 76 | $(if $(LINT_DOC8_DEBUG),$(warning LEAVE)) |
| 77 | |
Joey Armstrong | ad7bd3f | 2023-10-02 16:55:59 -0400 | [diff] [blame] | 78 | # [EOF] |