Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 57bd70f | 2023-01-12 05:25:51 -0500 | [diff] [blame] | 3 | # Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 83874cc | 2022-11-26 09:40:08 -0500 | [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 | JSON_FILES ?= $(error JSON_FILES= is required) |
| 19 | |
| 20 | .PHONY: lint-license |
| 21 | |
| 22 | ## ----------------------------------------------------------------------- |
| 23 | ## ----------------------------------------------------------------------- |
| 24 | lint : lint-license |
| 25 | |
| 26 | lint-license-gargs += --recursive |
| 27 | |
| 28 | # ignore: png, xlsx |
| 29 | # will utf8 be excluded(?) |
| 30 | lint-license-gargs += --binary-files=without-match |
| 31 | lint-license-gargs += --files-without-match |
| 32 | |
| 33 | # [TODO] license checking accepts either Copy or Apache. |
| 34 | # [TODO] At least Copyright should be required (both?) |
| 35 | lint-license-gargs += --extended-regexp |
| 36 | lint-license-gargs += -e 'Copyright[[:space:]]+[[:digit:]]{4}' |
| 37 | lint-license-gargs += -e 'Apache License' |
| 38 | |
| 39 | # [TODO] --strict, --strict-dates |
| 40 | |
| 41 | # TODO: Normalize into .venv for consistent filtering across projects. |
| 42 | lint-license-gargs += --exclude-dir='.git' |
| 43 | lint-license-gargs += --exclude-dir='vst_venv' |
| 44 | lint-license-gargs += --exclude-dir='flog' |
| 45 | |
| 46 | lint-license-gargs += --exclude='*.json' |
| 47 | lint-license-gargs += --exclude='*.md' |
| 48 | lint-license-gargs += --exclude='*.pyc' |
| 49 | lint-license-gargs += --exclude='*.xml' |
| 50 | |
| 51 | # [FILE(s)] |
| 52 | lint-license-gargs += --exclude='VERSION' |
| 53 | |
| 54 | # [GIT] |
| 55 | # lint-license-gargs += --exclude='.gitignore' |
| 56 | # lint-license-gargs += --exclude='.gitreview' |
| 57 | lint-license-gargs += --exclude='\.*' |
| 58 | |
| 59 | # [PYTHON] |
| 60 | lint-license-gargs += --exclude='requirements.txt' |
| 61 | |
| 62 | # [WIP] |
| 63 | lint-license-gargs += --exclude='patch' |
| 64 | |
| 65 | ## ----------------------------------------------------------------------- |
| 66 | ## ----------------------------------------------------------------------- |
| 67 | lint-license-new: |
| 68 | grep $(lint-license-gargs) $(dot) |
| 69 | |
| 70 | ## ----------------------------------------------------------------------- |
| 71 | ## Jenkins job checking logic. |
| 72 | ## ----------------------------------------------------------------------- |
| 73 | lint-license: |
| 74 | $(MAKEDIR)/lint/license/license-check.sh |
| 75 | |
| 76 | ## ----------------------------------------------------------------------- |
| 77 | ## ----------------------------------------------------------------------- |
| 78 | help:: |
| 79 | @echo " lint-license Verify sources contain a license block." |
| 80 | @echo " lint-license-new Grep driven replacement logic." |
| 81 | |
| 82 | # [EOF] |