Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | c227765 | 2023-01-11 17:41:36 -0500 | [diff] [blame] | 3 | # Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -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 | # Editor temp files |
| 42 | lint-license-gargs += --exclude='*.~' |
| 43 | lint-license-gargs += --exclude='*.swp' |
| 44 | |
| 45 | lint-license-gargs += --exclude-dir='.git' |
| 46 | |
| 47 | # TODO: Normalize into .venv for consistent filtering across projects. |
| 48 | lint-license-gargs += --exclude-dir='vst_venv' |
| 49 | lint-license-gargs += --exclude-dir='flog' |
| 50 | |
| 51 | lint-license-gargs += --exclude='*.json' |
| 52 | lint-license-gargs += --exclude='*.md' |
| 53 | lint-license-gargs += --exclude='*.out' |
| 54 | lint-license-gargs += --exclude='*.pyc' |
| 55 | lint-license-gargs += --exclude='*.xml' |
| 56 | |
| 57 | # [FILE(s)] |
| 58 | lint-license-gargs += --exclude='VERSION' |
| 59 | |
| 60 | # [GIT] |
| 61 | # lint-license-gargs += --exclude='.gitignore' |
| 62 | # lint-license-gargs += --exclude='.gitreview' |
| 63 | lint-license-gargs += --exclude='\.*' |
| 64 | |
| 65 | # [PYTHON] |
| 66 | lint-license-gargs += --exclude='requirements.txt' |
| 67 | |
| 68 | # [WIP] |
| 69 | lint-license-gargs += --exclude='patch' |
| 70 | |
| 71 | ## ----------------------------------------------------------------------- |
| 72 | ## ----------------------------------------------------------------------- |
| 73 | lint-license-new: |
| 74 | grep $(lint-license-gargs) $(dot) |
| 75 | |
| 76 | ## ----------------------------------------------------------------------- |
| 77 | ## Jenkins job checking logic. |
| 78 | ## ----------------------------------------------------------------------- |
| 79 | lint-license: |
| 80 | $(MAKEDIR)/lint/license/license-check.sh |
| 81 | |
| 82 | ## ----------------------------------------------------------------------- |
| 83 | ## ----------------------------------------------------------------------- |
| 84 | help :: |
| 85 | @echo " lint-license Verify sources contain a license block." |
| 86 | @echo " lint-license-new Grep driven replacement logic." |
| 87 | |
| 88 | # [EOF] |