Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 3 | # Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 4 | # ----------------------------------------------------------------------- |
| 5 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 6 | ##-------------------## |
| 7 | ##---] GLOBALS [---## |
| 8 | ##-------------------## |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 9 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 10 | # Gather sources to check |
| 11 | # TODO: implement deps, only check modified files |
| 12 | shell-check-find := find . -name '*.sh' -type f -print0 |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 13 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 14 | # shell-check := $(env-clean) pylint |
| 15 | shell-check := shellcheck |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 16 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 17 | shell-check-args += -a |
| 18 | |
| 19 | ##-------------------## |
| 20 | ##---] TARGETS [---## |
| 21 | ##-------------------## |
| 22 | ifndef NO-LINT-SHELL |
| 23 | lint : lint-shell |
| 24 | endif |
| 25 | |
| 26 | ## ----------------------------------------------------------------------- |
| 27 | ## ----------------------------------------------------------------------- |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 28 | lint-shell: |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 29 | $(shell-check) -V |
| 30 | @echo |
| 31 | $(HIDE)$(env-clean) $(shell-check-find) \ |
| 32 | | $(xargs-n1) $(shell-check) $(shell-check-args) |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 33 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 34 | ## ----------------------------------------------------------------------- |
| 35 | ## ----------------------------------------------------------------------- |
| 36 | help :: |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 37 | @echo ' lint-shell Syntax check shell sources' |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 38 | |
| 39 | # [EOF] |