From 25872b133a9ad18c47da1309003cff28ad9d25bf Mon Sep 17 00:00:00 2001 From: Mihail Groza Date: Sat, 10 Dec 2016 22:19:29 +0000 Subject: [PATCH] Nicer handling of hand-generated files by build system --- lib/Makefile.am | 2 +- src/Makefile.am | 20 ++++++++++++++------ src/flags.def | 1 - 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index 3b6af33..a8c68c7 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -37,7 +37,7 @@ CLEANFILES = $(LCDFILES) ## Rules to make splint & the dumps SPLINT = $(top_builddir)/src/splint$(EXEEXT) -LCDGEN = @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \ +LCDGEN = @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \ $(SPLINT) +quiet -nof -nolib +impconj $^ -dump $@ $(SPLINT): diff --git a/src/Makefile.am b/src/Makefile.am index b1c1346..8e3ba08 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -550,7 +550,15 @@ EXTRA_DIST = \ ## Hand-generated $(INCDIR)/flag_codes.gen: flags.def - $(GREP) "FLG_" flags.def > $(INCDIR)/flag_codes.gen + @if $(AM_V_P); then set -x; else echo " GEN $@"; fi; \ + $(GREP) "FLG_" $^ > "$@.temp"; \ + if test -f "$@" && cmp -s "$@" "$@.temp"; then \ + echo "$@ is unchanged"; \ + rm -f "$@.temp"; \ + else \ + echo "updating $@"; \ + mv -f "$@.temp" "$@"; \ + fi; ############## @@ -615,22 +623,22 @@ RUNSPLINT = $(INTERCEPT) $(builddir)/splint \ .PHONY: splintme splintme: - $(RUNSPLINT) -dump lclint $(LINTSRC) + $(RUNSPLINT) -dump splint $(LINTSRC) .PHONY: splintme-bounds splintme-bounds: - $(RUNSPLINT) -dump lclint +bounds +impboundsconstraints $(LINTSRC) + $(RUNSPLINT) -dump splint +bounds +impboundsconstraints $(LINTSRC) .PHONY: splintme-supcounts splintme-supcounts: - $(RUNSPLINT) -dump lclint -unrecogcomments -supcounts $(LINTSRC) + $(RUNSPLINT) -dump splint -unrecogcomments -supcounts $(LINTSRC) .PHONY: splintme-bufchk splintme-bufchk: - $(RUNSPLINT) -dump lclint -unrecogcomments -supcounts +bounds -DLINTBUFFERCHECK $(LINTSRC) + $(RUNSPLINT) -dump splint -unrecogcomments -supcounts +bounds -DLINTBUFFERCHECK $(LINTSRC) # Example of a partial (one file) analysis .PHONY: splintme-some splintme-some: - $(RUNSPLINT) -load lclint -unrecogcomments -supcounts +partial lcllib.c + $(RUNSPLINT) -load splint -unrecogcomments -supcounts +partial lcllib.c diff --git a/src/flags.def b/src/flags.def index c33470b..01fdacf 100644 --- a/src/flags.def +++ b/src/flags.def @@ -4,7 +4,6 @@ ** ** This file is used to generate the flag header files. ** -** Don't forget to regenerate flag_codes.gen. (lost the Makefile...bleech!) */ /* spec idem global mode args */ /*@-namechecks@*/ -- 2.11.4.GIT