Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -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 makefile -o -name '*.mk' \) -type f -print0 |
| 14 | |
| 15 | make-check := $(env-clean) $(MAKE) |
| 16 | make-check-args += --dry-run |
| 17 | make-check-args += --keep-going |
| 18 | make-check-args += --warn-undefined-variables |
| 19 | make-check-args += --no-print-directory |
| 20 | |
| 21 | # Quiet internal undef vars |
| 22 | make-check-args += DEBUG= |
| 23 | |
| 24 | ##-------------------## |
| 25 | ##---] TARGETS [---## |
| 26 | ##-------------------## |
| 27 | ifndef NO-LINT-MAKEFILE |
| 28 | lint : lint-make |
| 29 | endif |
| 30 | |
| 31 | ## ----------------------------------------------------------------------- |
| 32 | ## ----------------------------------------------------------------------- |
| 33 | lint-make: |
| 34 | $(HIDE)$(env-clean) $(make-check-find) \ |
| 35 | | $(xargs-n1-local) $(make-check) $(make-check-args) |
| 36 | |
| 37 | ## ----------------------------------------------------------------------- |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | help :: |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 40 | @echo ' lint-make Syntax check [Mm]akefile and *.mk' |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 41 | |
| 42 | # [EOF] |