Added "make analyse" to run analysis tools on the source.

This commit is contained in:
Andrew Wood
2023-07-28 22:28:07 +01:00
parent cd9f057f15
commit 7f3924db77
4 changed files with 26 additions and 9 deletions
+2 -1
View File
@@ -34,7 +34,8 @@ debugging support to be built in, and the `--enable-profiling` option builds
in profiling support (see "`man gprof`"). Also note that running
"`make index`" will generate an HTML code index (using _ctags_ and
_cproto_); this index lists all files used, all functions defined, and all
TODOs marked in the code.
TODOs marked in the code. Finally, "`make analyse`" will run the "`splint`"
and "`flawfinder`" tools on all C files to generate analysis files ("`*.e`").
Author and acknowledgements
+5 -1
View File
@@ -2,7 +2,7 @@
# Compilation rules.
#
.SUFFIXES: .c .d .o
.SUFFIXES: .c .d .o .e
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@@ -11,6 +11,10 @@
sh $(srcdir)/autoconf/scripts/depend.sh \
$(CC) $< $(<:%.c=%) $(srcdir) $(CFLAGS) $(CPPFLAGS) > $@
.c.e:
-splint -badflag $(CPPFLAGS) $< > $@ 2>&1
-flawfinder $< >> $@ 2>&1
#
# Native language support
#
+14 -7
View File
@@ -2,8 +2,8 @@
# Rules for all phony targets.
#
.PHONY: all help make dep depend test check \
clean depclean indentclean distclean cvsclean svnclean \
.PHONY: all help make dep depend test check analyse \
clean depclean analysisclean indentclean distclean gitclean \
index manhtml indent update-po \
doc dist release \
install uninstall
@@ -22,11 +22,13 @@ help:
@echo
@echo ' make rebuild the Makefile (after adding new files)'
@echo ' dep / depend rebuild .d (dependency) files'
@echo ' clean remove .o (object) and .c~ (backup) files'
@echo ' analyse run analysis tools on all .c files'
@echo ' clean remove .o (object) files'
@echo ' depclean remove .d (dependency) files'
@echo ' analysisclean remove .e (analysis) files'
@echo ' indentclean remove files left over from "make indent"'
@echo ' distclean remove everything not distributed'
@echo ' cvsclean remove everything not in CVS/SVN'
@echo ' gitclean remove everything not in version control'
@echo
@echo ' index generate an HTML index of source code'
@echo ' manhtml output HTML man page to stdout'
@@ -54,12 +56,17 @@ dep depend: $(alldep)
cat $(alldep) >> $(srcdir)/autoconf/make/depend.mk~
sh ./config.status
analyse: $(allanalysis)
clean:
rm -f $(allobj)
depclean:
rm -f $(alldep)
analysisclean:
rm -f $(allanalysis)
indentclean:
cd $(srcdir) && for FILE in $(allsrc); do rm -f ./$${FILE}~; done
@@ -78,13 +85,13 @@ update-po: $(srcdir)/src/nls/$(PACKAGE).pot
fi; \
done
distclean: clean depclean
distclean: clean depclean analysisclean
rm -f $(alltarg) src/include/config.h
rm -rf $(package)-$(version).tar* $(package)-$(version)
rm -f *.html config.*
rm Makefile
cvsclean svnclean: distclean
gitclean: distclean
rm -f doc/lsm
rm -f doc/quickref.1
rm -f configure
@@ -94,7 +101,7 @@ cvsclean svnclean: distclean
echo > $(srcdir)/autoconf/make/modules.mk~
doc:
:
-true
index:
(cd $(srcdir); sh autoconf/scripts/index.sh $(srcdir)) > index.html
+5
View File
@@ -39,6 +39,7 @@ printf "%s" "Scanning for source files: "
allsrc=$("${FIND}" src -type f -name "*.c" -print)
allobj=$(echo "${allsrc}" | tr ' ' '\n' | sed 's/\.c$/.o/')
alldep=$(echo "${allsrc}" | tr ' ' '\n' | sed 's/\.c$/.d/')
allanalysis=$(echo "${allsrc}" | tr ' ' '\n' | sed 's/\.c$/.e/')
echo "$(echo "${allsrc}" | wc -w | tr -d ' ') found"
@@ -118,6 +119,10 @@ printf "%s" "alldep = "
echo "$alldep" | tr '\n' ' ' | sed -e 's/ $//;s/ / \\!/g' | tr '!' '\n'
echo
echo
printf "%s" "allanalysis = "
echo "$allanalysis" | tr '\n' ' ' | sed -e 's/ $//;s/ / \\!/g' | tr '!' '\n'
echo
echo
} >> "${listingsFile}"
echo >> "${linkingRulesFile}"