diff: --use-subdirs and Prolog

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Mar 28 00:10:03 AEDT 1998


Fix a bug where building NU-Prolog or SICStus Prolog executables with
MMAKE_USE_SUBDIRS set to `yes' did not work.

scripts/mnc.in:
scripts/msc.in:
	Add support for a `--use-subdirs' option.

scripts/Mmake.rules:
	If MMAKE_USE_SUBDIRS=yes, then add `--use-subdirs' to
	$(MNCFLAGS) and $(MSCFLAGS).

cvs diff  scripts/Mmake.rules scripts/mnc.in scripts/msc.in
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.56
diff -u -r1.56 Mmake.rules
--- Mmake.rules	1998/03/20 05:53:27	1.56
+++ Mmake.rules	1998/03/27 13:06:16
@@ -31,6 +31,8 @@
 ifeq ($(MMAKE_USE_SUBDIRS),yes)
 
 MCFLAGS += --use-subdirs
+MSCFLAGS += --use-subdirs
+MNCFLAGS += --use-subdirs
 MGNUCFLAGS += -I.
 
 endif
Index: scripts/mnc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mnc.in,v
retrieving revision 1.7
diff -u -r1.7 mnc.in
--- mnc.in	1997/07/27 15:09:38	1.7
+++ mnc.in	1998/03/27 12:55:18
@@ -18,9 +18,18 @@
 
 options=
 target=
+use_subdirs=${MMAKE_USE_SUBDIRS=no}
 
 while true; do
 	case "$1" in
+		--use-subdirs)
+			use_subdirs=yes
+			shift
+			;;
+		--no-use-subdirs)
+			use_subdirs=no
+			shift
+			;;
 		-F)	options="$options $1 $2"
 			shift; shift
 			;;
@@ -35,6 +44,12 @@
 	esac
 done
 
+case "$use_subdirs" in
+	yes)
+		[ -d Mercury/nos ] || mkdir -p Mercury/nos
+		;;
+esac
+
 for file in "$@"; do
 	dir=`dirname "$file"`
 	case "$file" in
@@ -59,7 +74,10 @@
 	nc -c $options $tmp.nl
 	rm $tmp.nl $tmp.ns
 	case "$target" in
-		"") mv $tmp.no "$rootname.no" ;;
-		*)  mv $tmp.no "$target" ;;
+	    "") case "$use_subdirs" in
+		    no)  mv $tmp.no "$dir/$base.no" ;;
+		    yes) mv $tmp.no "$dir/Mercury/nos/$base.no" ;;
+		esac
+	    *)  mv $tmp.no "$target" ;;
 	esac
 done
Index: scripts/msc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/msc.in,v
retrieving revision 1.8
diff -u -r1.8 msc.in
--- msc.in	1997/07/27 15:09:42	1.8
+++ msc.in	1998/03/27 13:00:46
@@ -18,6 +18,7 @@
 help=false
 compile_mode=compactcode
 target=
+use_subdirs=${MMAKE_USE_SUBDIRS=yes}
 
 while true; do
 	case "$1" in
@@ -25,6 +26,14 @@
 			help=true
 			break
 			;;
+		--use-subdirs)
+			use_subdirs=yes
+			shift
+			;;
+		--no-use-subdirs)
+			use_subdirs=no
+			shift
+			;;
 		-o|--output)
 			target="$2"
 			shift; shift
@@ -58,6 +67,8 @@
 Options:
 	-h, --help
 		Print this help message
+	--use-subdirs
+		Generate output files in subdirectories.
 	-o <target>, --output <target>
 		Name the output file <target>.
 	-m <compile-mode>, --mode <compile-mode>
@@ -69,6 +80,12 @@
 	exit 0
 fi
 
+case "$use_subdirs" in
+	yes)
+		[ -d Mercury/qls ] || mkdir -p Mercury/qls
+		;;
+esac
+
 for file in "$@"; do
 	echo "msc: compiling \`$file'"
 	dir="`dirname $file`"
@@ -77,7 +94,6 @@
 		*.nl)	base="`basename $file .nl`" ;;
 		*)	base="`basename $file`" ;;
 	esac
-	rootname="$dir/$base"
 	tmp=/tmp/msc$$
 	trap 'rm -f $tmp.pl $tmp.ql; exit 1' 1 2 3 13 15
 
@@ -105,7 +121,9 @@
 	$sicstus_compile $compile_mode $tmp.pl
 	rm $tmp.pl 
 	case "$target" in
-		"") mv $tmp.ql "$rootname.ql" ;;
-		*)  mv $tmp.ql "$target" ;;
+	    "") case "$use_subdirs" in
+		    no)  mv $tmp.ql "$dir/$base.ql" ;;
+		    yes) mv $tmp.ql "$dir/Mercury/qls/$base.ql" ;;
+	    *)  mv $tmp.ql "$target" ;;
 	esac
 done

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list