[m-rev.] for review: improve handling of non-installed standard library

Simon Taylor stayl at cs.mu.OZ.AU
Thu Apr 18 01:30:47 AEST 2002


On 17-Apr-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> Estimated hours taken: 6
> Branches: main
> 
> Allow alternative locations for the standard library files 
> to be specified using options to the various Mercury scripts
> rather than environment variables.  This change is necessary
> to allow the compiler to be compiled using `mmc --make', because
> `mmc --make' does not support the environment variables.

I missed a spot.

Index: Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.65
diff -u -u -r1.65 Mmake.vars.in
--- Mmake.vars.in	12 Mar 2002 16:33:37 -0000	1.65
+++ Mmake.vars.in	17 Apr 2002 14:49:01 -0000
@@ -35,7 +35,7 @@
 # occurrence of $(patsubst ...), since GNU Make does not respect quotes.
 nullstring	=
 MMAKE_VPATH	= $(subst $(nullstring) ,:,$(strip \
-			$(MERCURY_EXTRA_INT_DIRS) $(MERCURY_INT_DIR)\
+			$(MERCURY_EXTRA_INT_DIRS) $(MERC_INT_DIR)\
 			$(MERCURY_EXTRA_INIT_DIRS)))
 VPATH		= $(MMAKE_VPATH) # do not remove the `:' from this comment!!!
 #			 the above comment works around a misfeature of
@@ -163,8 +163,10 @@
 MS_DOTNET_SDK_DIR=@MS_DOTNET_SDK_DIR@
 # The system libraries were once needed here, but are currently unnecessary.
 MS_CL_LIBS	= 
-MERC_C_INCL_DIR = @LIBDIR@/inc
-MERC_DLL_DIR    = @LIBDIR@/lib/ilc/@FULLARCH@
+
+# XXX handle the case where MERCURY_STDLIB_DIR is not set.
+MERC_C_INCL_DIR = $(MERCURY_STDLIB_DIR)/inc
+MERC_DLL_DIR    = $(MERCURY_STDLIB_DIR)/lib/ilc/@FULLARCH@
 
 # MS_ILASM is the Microsoft IL assembler, which turns IL assembly code
 # into bytecode.
Index: Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.115
diff -u -u -r1.115 Mmake.rules
--- Mmake.rules	19 Feb 2002 10:56:21 -0000	1.115
+++ Mmake.rules	17 Apr 2002 15:25:01 -0000
@@ -42,6 +42,19 @@
 endif
 
 #-----------------------------------------------------------------------------#
+#
+# Find the directory containing the interface files for the standard library.
+#
+ifdef MERCURY_INT_DIR
+    MERC_INT_DIR = $(MERCURY_INT_DIR)
+else
+    ifdef MERCURY_STDLIB_DIR
+        export MERCURY_STDLIB_DIR
+        MERC_INT_DIR = $(MERCURY_STDLIB_DIR)/ints
+    endif
+endif
+
+#-----------------------------------------------------------------------------#
 
 .PRECIOUS: $(date0s_subdir)%.date0
 .PRECIOUS: $(dates_subdir)%.date
Index: mmake.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mmake.in,v
retrieving revision 1.37
diff -u -u -r1.37 mmake.in
--- mmake.in	15 Feb 2002 09:25:07 -0000	1.37
+++ mmake.in	17 Apr 2002 14:52:27 -0000
@@ -34,6 +34,12 @@
 	#--target il:
 	#	Compile via IL, rather than going via C or assembler.
 Help="$Help
+	--mercury-standard-library-directory <directory>
+	--mercury-stdlib-dir <directory>:
+		The directory containing the installed Mercury standard
+		library.
+	--no-mercury-standard-library-directory, --no-mercury-stdlib-dir:
+		Don't use an installed Mercury standard library.
 	-s, --save-makefile:
 		Save the generated makefile to \`Mmake.makefile'.
 		This is useful for tracking down syntax errors in
@@ -71,11 +77,8 @@
 		dependency files, and executables.
 "
 
+MERCURY_STDLIB_DIR=${MERCURY_STDLIB_DIR=@LIBDIR@}
 MMAKE_MAKE=${MMAKE_MAKE=@GNU_MAKE@}
-MMAKE_DIR=${MMAKE_DIR=@LIBDIR@/mmake}
-MMAKE_VARS=${MMAKE_VARS=$MMAKE_DIR/Mmake.vars}
-MMAKE_RULES=${MMAKE_RULES=$MMAKE_DIR/Mmake.rules}
-MERCURY_INT_DIR=${MERCURY_INT_DIR=@LIBDIR@/ints}
 MERCURY_DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
 MKTEMP=@MKTEMP@
 TMPDIR=${TMPDIR=/tmp}
@@ -156,6 +159,14 @@
 			shift
 			shift
 			;;
+
+		--mercury-standard-library-directory|--mercury-stdlib-dir)
+			MERCURY_STDLIB_DIR="$2"
+			shift
+			;;
+		--no-mercury-standard-library-directory|--no-mercury-stdlib-dir)
+			unset MERCURY_STDLIB_DIR ;;
+
 		--)	
 			MMAKE="$MMAKE $1"
 			shift
@@ -167,6 +178,22 @@
 	esac
 done
 
+if [ "$MERCURY_STDLIB_DIR" != "" ]
+then
+	MMAKE_DIR=${MMAKE_DIR=$MERCURY_STDLIB_DIR/mmake}
+fi
+
+case "$MMAKE_DIR" in
+	"")
+		echo "mmake: MMAKE_DIR not set"
+		exit 1
+		;;
+	*)
+		MMAKE_VARS=${MMAKE_VARS=$MMAKE_DIR/Mmake.vars}
+		MMAKE_RULES=${MMAKE_RULES=$MMAKE_DIR/Mmake.rules}
+		;;
+esac
+
 if [ -f Mmakefile ]; then
 	mmake="Mmakefile"
 else
@@ -282,8 +309,6 @@
 	echo export MMAKE_MAKE_CMD
 	echo MMAKE_USE_SUBDIRS=$MMAKE_USE_SUBDIRS
 	echo export MMAKE_USE_SUBDIRS
-	echo MERCURY_INT_DIR=$MERCURY_INT_DIR
-	echo export MERCURY_INT_DIR
 	echo MERCURY_DEFAULT_GRADE=$MERCURY_DEFAULT_GRADE
 	echo export MERCURY_DEFAULT_GRADE
 	echo cat ${MMAKE_VARS} $dvs $ds $include_makefile $mmake $deps \
@@ -293,7 +318,6 @@
 export MMAKE
 export MMAKE_MAKE_CMD
 export MMAKE_USE_SUBDIRS
-export MERCURY_INT_DIR
 export MERCURY_DEFAULT_GRADE
 # XXX The $dvs and $ds variables can be so long as to overflow the
 # command line size limits, so we use xargs.  However echo doesn't quote

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list