Joey Armstrong | 695ba5c | 2023-01-20 11:17:49 -0500 | [diff] [blame^] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors |
| 4 | # ----------------------------------------------------------------------- |
| 5 | |
| 6 | ##-------------------## |
| 7 | ##---] GLOBALS [---## |
| 8 | ##-------------------## |
| 9 | xargs-n1-local := $(subst -t,$(null),$(xargs-n1))# inhibit cmd display |
| 10 | |
| 11 | # Gather sources to check |
| 12 | # TODO: implement deps, only check modified files |
| 13 | make-check-find := find . -name 'vendor' -prune |
| 14 | make-check-find += -o \( -iname makefile -o -name '*.mk' \) |
| 15 | make-check-find += -type f -print0 |
| 16 | |
| 17 | make-check := $(env-clean) $(MAKE) |
| 18 | make-check-args += --dry-run |
| 19 | make-check-args += --keep-going |
| 20 | make-check-args += --warn-undefined-variables |
| 21 | make-check-args += --no-print-directory |
| 22 | |
| 23 | # Quiet internal undef vars |
| 24 | make-check-args += DEBUG= |
| 25 | |
| 26 | ##-------------------## |
| 27 | ##---] TARGETS [---## |
| 28 | ##-------------------## |
| 29 | ifndef NO-LINT-MAKEFILE |
| 30 | lint : lint-make |
| 31 | endif |
| 32 | |
| 33 | ## ----------------------------------------------------------------------- |
| 34 | ## ----------------------------------------------------------------------- |
| 35 | lint-make: |
| 36 | $(HIDE)$(env-clean) $(make-check-find) \ |
| 37 | | $(xargs-n1-local) $(make-check) $(make-check-args) |
| 38 | |
| 39 | ## ----------------------------------------------------------------------- |
| 40 | ## ----------------------------------------------------------------------- |
| 41 | help :: |
| 42 | @echo ' lint-make Syntax check [Mm]akefile and *.mk' |
| 43 | |
| 44 | # [EOF] |