Commits

Faheem Mitha committed 208074f

Add check_files_uptodate script to check whether the files have been updated from their m4 templates.

Comments (0)

Files changed (2)

check_files_uptodate

+#!/bin/sh
+
+echo "One or more of debian/build_interface_databases.m4,
+debian/control.m4, and debian/rules.m4 is newer than rules,
+checking..."
+
+checkfiles ()
+{
+    echo "checking" $1"..."
+    m4 -DBOOTSTRAP=true debian/$1.m4 > debian/$1.BOOTSTRAPtrue.tmp
+    m4 -DBOOTSTRAP=false debian/$1.m4 > debian/$1.BOOTSTRAPfalse.tmp
+
+    trap 'rm -rf debian/$1.BOOTSTRAPtrue.tmp debian/$1.BOOTSTRAPfalse.tmp' EXIT
+
+    # if debian/FILENAME not the same as debian/FILENAME.BOOTSTRAPtrue.tmp
+    # and debian/FILENAME not the same as
+    # debian/FILENAME.BOOTSTRAPfalse.tmp, then exit
+
+    if ! { cmp -s debian/$1 debian/$1.BOOTSTRAPtrue.tmp || cmp -s debian/$1 debian/$1.BOOTSTRAPfalse.tmp; }
+    then
+	echo "'debian/$1' is out of date with respect to 'debian/$2.m4'. You need to run 'BOOTSTRAP=true ./genscripts' or 'BOOTSTRAP=false ./genscripts' inside the 'debian' directory"
+	exit 1
+    fi
+}
+
+checkfiles rules
+
+checkfiles control
+
+checkfiles build_interface_databases
 
 REV=$(shell svn info svn://svn.clozure.com/openmcl/$(CCL_WEB_PATH)/source | awk '/^Revision:/{print $$2}')
 
-# debian/rules: debian/rules.m4
-# 	$(HERE)/check_rules
+# Thanks to noshadow on #debian-mentors for suggesting this feature.
+debian/rules: debian/rules.m4 debian/control.m4 debian/build_interface_databases.m4
+	$(HERE)/check_files_uptodate
 
 get-orig-source:
 	export REV=$(REV) && export CCL_WEB_PATH=$(CCL_WEB_PATH) && $(HERE)/get-orig-source