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