blob: 8ebe9c3adfb3c08bc9694058ab58a0e6c58747be [file] [log] [blame]
Joey Armstrong3f575f72023-01-15 23:49:19 -05001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
4# -----------------------------------------------------------------------
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 'vendor' -prune
14make-check-find += -o \( -iname makefile -o -name '*.mk' \)
15make-check-find += -type f -print0
16
17make-check := $(MAKE)
18
19make-check-args += --dry-run
20make-check-args += --keep-going
21make-check-args += --warn-undefined-variables
22make-check-args += --no-print-directory
23
24# Quiet internal undef vars
25make-check-args += DEBUG=
26
27##-------------------##
28##---] TARGETS [---##
29##-------------------##
30ifndef NO-LINT-MAKEFILE
31 lint : lint-make
32endif
33
34## -----------------------------------------------------------------------
35## -----------------------------------------------------------------------
36lint-make:
37 $(HIDE)$(env-clean) $(make-check-find) \
38 | $(xargs-n1-local) $(make-check) $(make-check-args)
39
40## -----------------------------------------------------------------------
41## -----------------------------------------------------------------------
42help ::
43 @echo ' lint-make Syntax check [Mm]akefile and *.mk'
44
45# [EOF]