Joey Armstrong | a527814 | 2023-06-28 16:56:54 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 098eedd | 2024-02-11 10:00:59 -0500 | [diff] [blame] | 3 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | a527814 | 2023-06-28 16:56:54 -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-mdl lint-mdl-all lint-mdl-modified |
| 22 | |
| 23 | have-rst-files := $(if $(strip $(RST_SOURCE)),true) |
| 24 | RST_SOURCE ?= $(error RST_SOURCE= is required) |
| 25 | |
| 26 | ## ----------------------------------------------------------------------- |
| 27 | ## ----------------------------------------------------------------------- |
| 28 | ifndef NO-LINT-MARKDOWN |
| 29 | lint-mdl-mode := $(if $(have-mdl-files),modified,all) |
| 30 | lint : lint-mdl-$(lint-mdl-mode) |
| 31 | endif# NO-LINT-MDL |
| 32 | |
| 33 | # Consistent targets across lint makefiles |
| 34 | lint-mdl-all : lint-mdl |
| 35 | lint-mdl-modified : lint-mdl |
| 36 | |
| 37 | # onf-excl-dirs |
| 38 | LINT_STYLE ?= mdl_strict.rb |
| 39 | |
| 40 | mdl-excludes := $(foreach path,$(onf-exclude-dirs),! -path "./$(path)/*") |
| 41 | |
| 42 | lint-mdl: |
| 43 | $(call banner-enter,Target $@) |
| 44 | @echo "markdownlint(mdl) version: `mdl --version`" |
| 45 | @echo "style config:" |
| 46 | @echo "---" |
| 47 | @cat $(LINT_STYLE) |
| 48 | @echo "---" |
| 49 | # mdl -s $(LINT_STYLE) `find -L $(SOURCEDIR) ! -path "./_$(venv-activate-script)/*" ! -path "./_build/*" ! -path "./repos/*" ! -path "*vendor*" -name "*.md"` |
| 50 | mdl -s $(LINT_STYLE) `find -L $(SOURCEDIR) $(mdl-excludes) -iname "*.md"` |
| 51 | |
| 52 | ## ----------------------------------------------------------------------- |
| 53 | ## Intent: Display command usage |
| 54 | ## ----------------------------------------------------------------------- |
| 55 | help:: |
| 56 | @echo ' lint-mdl Syntax check python using the mdl command' |
| 57 | ifdef VERBOSE |
| 58 | @echo ' lint-mdl-all mdl checking: exhaustive' |
| 59 | @echo ' lint-mdl-modified mdl checking: only modified' |
| 60 | endif |
| 61 | |
| 62 | # [EOF] |