blob: 61de008e5bfcfbbc4d30a3a32cfd886cec3c5623 [file] [log] [blame]
Joey Armstronge66eaaf2023-01-15 18:58:52 -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 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 ::
40 @echo ' lint-make Syntax check [Mm]akefile and *.mk'
41
42# [EOF]