2021-05-21 21:43:38 +00:00
|
|
|
.PHONY: shellcheck
|
|
|
|
shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
|
|
|
if HAVE_SHELLCHECK
|
2021-11-30 18:23:10 +00:00
|
|
|
[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck --format=gcc --exclude=SC1090,SC1091,SC2250 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") $(SHELLCHECK_OPTS) $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
2021-05-21 21:43:38 +00:00
|
|
|
else
|
|
|
|
@[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed"
|
|
|
|
endif
|
|
|
|
@set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done
|
2021-05-21 23:45:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
# command -v *is* specified by POSIX and every shell in existence supports it
|
|
|
|
.PHONY: checkbashisms
|
|
|
|
checkbashisms: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
|
|
|
if HAVE_CHECKBASHISMS
|
|
|
|
[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; ! if [ -z "$(SHELLCHECK_SHELL)" ]; then \
|
|
|
|
checkbashisms -npx $(SCRIPTS) $(SHELLCHECKSCRIPTS); else \
|
|
|
|
for f in $(SCRIPTS) $(SHELLCHECKSCRIPTS); do echo $$f >&3; { echo '#!/bin/$(SHELLCHECK_SHELL)'; cat $$f; } | checkbashisms -npx; done; \
|
|
|
|
fi 3>&2 2>&1 | grep -vFe "'command' with option other than -p" -e 'command -v' $(CHECKBASHISMS_IGNORE) >&2
|
|
|
|
else
|
|
|
|
@[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping checkbashisms of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because checkbashisms is not installed"
|
|
|
|
endif
|
|
|
|
@set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done
|