Skip to content

Commit

Permalink
Makefile.am: Add target 'shellcheck'.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5596 4ea69e1a-61f1-4043-bf83-b5c94c648137
  • Loading branch information
chrfranke committed Jan 23, 2024
1 parent 99fe1db commit 6af5903
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions smartmontools/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
$Id$

2024-01-23 Christian Franke <franke@computer.org>

Makefile.am: Add target 'shellcheck'.

2024-01-19 Christian Franke <franke@computer.org>

os_win32/installer.nsi: Avoid that code signing invalidates the
Expand Down
26 changes: 25 additions & 1 deletion smartmontools/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ EXTRA_DIST = \
$(examples_SCRIPTS)

CLEANFILES = \
cppcheck.txt \
shellcheck.txt \
smartd.8 \
smartd.1m \
smartd.8.html \
Expand Down Expand Up @@ -736,7 +738,7 @@ FIXHTML = sed -e '1s,^Content-type.*,,' \
-e '/^Time: [012][0-9]:[0-5][0-9]:[0-5][0-9] [^<]*$$/d'

# Avoid automake warning: '.PHONY was already defined in condition ...'
phony = htmlman pdfman
phony = cppcheck htmlman pdfman shellcheck
.PHONY: $(phony)

htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html update-smart-drivedb.8.html
Expand Down Expand Up @@ -792,6 +794,28 @@ cppcheck.txt: $(smartctl_SOURCES) $(EXTRA_smartctl_SOURCES) \
$(smartd_SOURCES) $(EXTRA_smartd_SOURCES)
$(srcdir)/cppcheck.sh $(CPPCHECKFLAGS) > $@

# Create shellcheck report
shellcheck: shellcheck.txt

SHELLCHECK=shellcheck

# Exclude "SC3043 (warning): In POSIX sh, 'local' is undefined."
# Virtually all relevant /bin/sh shells support 'local'
SHELLCHECKFLAGS=-S warning -e SC3043

SHELLSCRIPTS= \
$(srcdir)/autogen.sh \
$(srcdir)/cppcheck.sh \
$(srcdir)/do_release \
$(srcdir)/getversion.sh \
$(srcdir)/os_win32/pe32edit.sh \
smartd_warning.sh \
update-smart-drivedb

shellcheck.txt: $(SHELLSCRIPTS)
$(ECHO_V_GEN) ' $(SHELLCHECK) $(SHELLCHECKFLAGS) $(SHELLSCRIPTS) > $@'
@$(SHELLCHECK) $(SHELLCHECKFLAGS) $(SHELLSCRIPTS) > $@ || \
if [ $$? = 1 ]; then echo "$@: issues found"; else rm -f $@; exit 1; fi

if REPRODUCIBLE_BUILD
# The default 'dist-*' rules generated by automake allow to override the
Expand Down

0 comments on commit 6af5903

Please sign in to comment.