diff --git a/am/sourcescheck b/am/sourcescheck new file mode 100644 index 0000000000000000000000000000000000000000..d0d003aefcd93214ef295e41c803daf735b27a5e --- /dev/null +++ b/am/sourcescheck @@ -0,0 +1,45 @@ +# -*- Makefile -*- +# $Id$ + +sourcescheck: sourcescheck-recursive + +sourcescheck-am: $(SOURCES) $(HEADERS) $(sourcescheck_IGNORE) + @(for f in $^; do echo $$f; done) | \ + grep [hc][hc]$$ | sort > header_CHECK.install + @ls *.cc *.hh > header_CHECK.present + @RESULT=0; \ + if diff header_CHECK.* | grep ^[\<\>] -q; then \ + echo "==== ERROR ===="; \ + echo -n "Directory: "; pwd; \ + echo "Files present but not installed:"; \ + diff -u header_CHECK.install header_CHECK.present | \ + grep -v ^+++ | grep ^+; \ + echo "Files listed for install but not present:"; \ + diff -u header_CHECK.install header_CHECK.present | \ + grep -v ^--- | grep ^-; \ + echo "==== END ===="; \ + RESULT=1; \ + fi; \ + rm -f header_CHECK.install header_CHECK.present; \ + exit $$RESULT + +sourcescheck-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +.PHONY: sourcescheck sourcescheck-recursive diff --git a/bin/addsourcescheck b/bin/addsourcescheck new file mode 100755 index 0000000000000000000000000000000000000000..1acab8ce1bbd9e0db04cbf536fcdcfdcc472435f --- /dev/null +++ b/bin/addsourcescheck @@ -0,0 +1,39 @@ +#!/bin/bash + +# +# patch the include statement into all Makefile.am files +# + +set -e + +# always start in $top_srcdir +if ! test -f configure.ac; then + echo "Wrong Directory" + echo "run from \$top_srcdir" + exit 1 +fi + +# list of files to patch +FILES=`find . -name Makefile.am` +# snippet to patch into Makefile.am +SNIP='include $(top_srcdir)/am/sourcescheck' +# create the grep regexp from the snip +REGEXP="^$(echo $SNIP | sed -e 's/[\$\/\(\)]/./g')\$" +# enable / disable verbose mode +VERBOSE=0 + +for f in $FILES; do + # only patch files that don't have the patch yet + if ! grep -q "$REGEXP" $f; then + echo patching $f + # normalize end of file + while test "$(tail -1 $f)" != ""; do + echo >> $f + done + echo $SNIP >> $f + else + if test x$VERBOSE = x1; then + echo $f already patched + fi + fi +done