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