blob: 6a428f8a9ecc6fedbbbc77b2955251baab4f4866 [file] [log] [blame]
Joey Armstronge66eaaf2023-01-15 18:58:52 -05001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong25589d82024-01-02 22:31:35 -05003# Copyright 2022-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstronge66eaaf2023-01-15 18:58:52 -05004# -----------------------------------------------------------------------
5
6##-------------------##
7##---] GLOBALS [---##
8##-------------------##
9xargs-n1-local := $(subst -t,$(null),$(xargs-n1))# inhibit cmd display
10
11# Gather sources to check
12# TODO: implement deps, only check modified files
13make-check-find := find . \( -name makefile -o -name '*.mk' \) -type f -print0
14
15make-check := $(env-clean) $(MAKE)
16make-check-args += --dry-run
17make-check-args += --keep-going
18make-check-args += --warn-undefined-variables
19make-check-args += --no-print-directory
20
21# Quiet internal undef vars
22make-check-args += DEBUG=
23
24##-------------------##
25##---] TARGETS [---##
26##-------------------##
27ifndef NO-LINT-MAKEFILE
28 lint : lint-make
29endif
30
31## -----------------------------------------------------------------------
32## -----------------------------------------------------------------------
33lint-make:
34 $(HIDE)$(env-clean) $(make-check-find) \
35 | $(xargs-n1-local) $(make-check) $(make-check-args)
36
37## -----------------------------------------------------------------------
38## -----------------------------------------------------------------------
39help ::
Joey Armstrong761579c2023-05-08 11:59:57 -040040 @echo ' lint-make Syntax check [Mm]akefile and *.mk'
Joey Armstronge66eaaf2023-01-15 18:58:52 -050041
42# [EOF]