aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorGabriel A. Devenyi <[email protected]>2020-07-09 23:04:49 -0400
committerGitHub <[email protected]>2020-07-09 20:04:49 -0700
commitd2bce6d036b38893b8d46fb3cd97fc8183967c34 (patch)
treecab2c93def5ee50382bbb475a3649e52dbcb4ef3 /Makefile.am
parenta2ec738c75a11bb225b1a01cb6019cc360a6202c (diff)
Add Makefile command to run checkbashisms on all /bin/sh scripts
Based on the shellcheck make target, add a target which checks for violations of POSIX standards for shell scripts Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Gabriel A. Devenyi <[email protected]> Closes #10513
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am18
1 files changed, 17 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 74403019a..45474daa4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -114,7 +114,7 @@ endif
endif
PHONY += codecheck
-codecheck: cstyle shellcheck flake8 mancheck testscheck vcscheck
+codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck
PHONY += checkstyle
checkstyle: codecheck commitcheck
@@ -146,6 +146,22 @@ shellcheck:
echo "skipping shellcheck because shellcheck is not installed"; \
fi
+PHONY += checkbashisms
+checkbashisms:
+ @if type checkbashisms > /dev/null 2>&1; then \
+ checkbashisms -n -p -x \
+ $$(find ${top_srcdir} \
+ -name '.git' -prune \
+ -o -name 'build' -prune \
+ -o -name 'tests' -prune \
+ -o -name 'config' -prune \
+ -o -type f ! -name 'config*' \
+ ! -name 'libtool' \
+ -exec bash -c 'awk "NR==1 && /\#\!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
+ else \
+ echo "skipping checkbashisms because checkbashisms is not installed"; \
+ fi
+
PHONY += mancheck
mancheck:
@if type mandoc > /dev/null 2>&1; then \