blob: 7a2393f2650a794d255e5a544b9fbb9ac5f40165 [file] [log] [blame]
Joey Armstronga8205c22023-10-18 13:35:16 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrongdc04c932024-04-01 12:14:21 -04003# Copyright 2023-2024 Open Networking Foundation Contributors
Joey Armstronga8205c22023-10-18 13:35:16 -04004#
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#
Joey Armstrongdc04c932024-04-01 12:14:21 -04009# http:#www.apache.org/licenses/LICENSE-2.0
Joey Armstronga8205c22023-10-18 13:35:16 -040010#
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# -----------------------------------------------------------------------
Joey Armstrongdc04c932024-04-01 12:14:21 -040017# SPDX-FileCopyrightText: 2023-2024 Open Networking Foundation Contributors
18# SPDX-License-Identifier: Apache-2.0
19# -----------------------------------------------------------------------
20# Intent:
21# -----------------------------------------------------------------------
Joey Armstronga8205c22023-10-18 13:35:16 -040022
23##-------------------##
24##---] GLOBALS [---##
25##-------------------##
26.PHONY: lint-doc8-ini-tmp
27
28lint-doc8-ini-tmp = $(onf-mk-tmp)/doc8.ini
29.DELETE_ON_ERROR : $(lint-doc8-ini-tmp)
30.PHONY : lint-doc8-ini-tmp $(lint-doc8-ini-tmp)
31
32lint-doc8-ini-tmp : $(lint-doc8-ini-tmp)
33
34# -----------------------------------------------------------------------
35# Intent: Doc8(s) --config switch will only accept one argument and
36# configs/exclusions are needed from multiple sources.
37# This target will merge doc8.ini from onf-make/ and local/ for use.
38# -----------------------------------------------------------------------
39# repo:onf-make is special, MAKEDIR=makefiles/local does not exist.
40# -----------------------------------------------------------------------
41lint-doc8-ini-raw := $(ONF_MAKEDIR)/lint/doc8/doc8.ini
42ifneq ($(--repo-name--),onf-make)
43 lint-doc8-ini-raw += $(MAKEDIR)/lint/doc8/doc8.ini
44endif
45
46lint-doc8-ini-src = $(wildcard $(lint-doc8-ini-raw))
47$(lint-doc8-ini-tmp):
48
49 $(call banner,Target $@)
50
51 @echo "FILES: $(lint-doc8-ini-src)"
52 mkdir -p $(dir $@)
53
54 @echo "** [doc8.ini] Generate $@"
55 @echo '[doc8]' > $@
56
57 @echo '** [doc8.ini] Merge onf-make and local config options'
58 $(HIDE)grep -v --fixed-strings --no-filename \
59 -e '[doc8]' \
60 -e 'ignore-path' \
61 -e 'max-line-length' \
62 $(lint-doc8-ini-src) \
63 >> $@
64
65 @echo '** [doc8.ini] Construct ignore-path='
66 @echo -n 'ignore-path = ' >> $@
67 $(HIDE)awk -F'=' '/^ignore-path/ {print $$2}' $(lint-doc8-ini-src) \
68 | paste -sd ',' - \
69 >> $@
70
71# # Prefer local config setting
72 @echo '** [doc8.ini] Extract max-line-length'
73 $(HIDE)grep --fixed-strings --no-filename 'max-line-length' $(lint-doc8-ini-src) \
74 | tail -n 1 \
75 >> $@
76
77 $(if $(DEBUG),cat $@)
78
79# -----------------------------------------------------------------------
80# -----------------------------------------------------------------------
81clean ::
82 $(RM) $(lint-doc8-ini-tmp)
83
84# -----------------------------------------------------------------------
85# -----------------------------------------------------------------------
86lint-doc8-help ::
87 @printf ' %-25.25s %s\n' 'lint-doc8-ini-tmp' \
88 'Create doc8.ini from onf-make/ and local/'
89
90# [EOF]