Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -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 := $(MAKE) |
| 18 | |
| 19 | make-check-args += --dry-run |
| 20 | make-check-args += --keep-going |
| 21 | make-check-args += --warn-undefined-variables |
| 22 | make-check-args += --no-print-directory |
| 23 | |
| 24 | # Quiet internal undef vars |
| 25 | make-check-args += DEBUG= |
| 26 | |
| 27 | ##-------------------## |
| 28 | ##---] TARGETS [---## |
| 29 | ##-------------------## |
| 30 | ifndef NO-LINT-MAKEFILE |
| 31 | lint : lint-make |
| 32 | endif |
| 33 | |
| 34 | ## ----------------------------------------------------------------------- |
| 35 | ## ----------------------------------------------------------------------- |
| 36 | lint-make: |
| 37 | $(HIDE)$(env-clean) $(make-check-find) \ |
| 38 | | $(xargs-n1-local) $(make-check) $(make-check-args) |
| 39 | |
| 40 | ## ----------------------------------------------------------------------- |
| 41 | ## ----------------------------------------------------------------------- |
| 42 | help :: |
| 43 | @echo ' lint-make Syntax check [Mm]akefile and *.mk' |
| 44 | |
| 45 | # [EOF] |