[MLton-devel] cvs commit: changed -host to -target

Stephen Weeks sweeks@users.sourceforge.net
Wed, 27 Aug 2003 14:13:34 -0700


sweeks      03/08/27 14:13:34

  Modified:    .        Makefile
               benchmark Makefile
               bin      add-cross mlton regression
               doc      changelog
               doc/user-guide cross-compiling.tex man-page.tex
               man      mlton.1
               mllex    Makefile
               mlprof   Makefile
               mlton    Makefile
               mlton/codegen/c-codegen c-codegen.fun
               mlton/codegen/x86-codegen x86-codegen.fun
                        x86-mlton-basic.fun x86.fun
               mlton/control control.sig control.sml
               mlton/elaborate elaborate-core.fun
               mlton/main compile.sml main.sml
               mlyacc   Makefile
               runtime  Makefile
  Log:
  

Revision  Changes    Path
1.96      +21 -21    mlton/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/Makefile,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- Makefile	26 Aug 2003 20:36:43 -0000	1.95
+++ Makefile	27 Aug 2003 21:13:28 -0000	1.96
@@ -1,6 +1,6 @@
-export HOST = self
-export HOST_ARCH = $(shell bin/host-arch)
-export HOST_OS = $(shell bin/host-os)
+export TARGET = self
+export TARGET_ARCH = $(shell bin/host-arch)
+export TARGET_OS = $(shell bin/host-os)
 ROOT = $(shell pwd)
 BUILD = $(ROOT)/build
 SRC = $(ROOT)
@@ -10,7 +10,7 @@
 RUN = $(SRC)/runtime
 MLTON = $(BIN)/mlton
 AOUT = mlton-compile
-HOSTMAP = $(LIB)/hostmap
+TARGETMAP = $(LIB)/target-map
 SPEC = $(SRC)/doc/mlton.spec
 LEX = mllex
 PROF = mlprof
@@ -32,7 +32,7 @@
 ifeq (other, $(shell if [ ! -x $(BIN)/mlton ]; then echo other; fi))
 	rm -f $(COMP)/$(AOUT)
 endif
-	$(MAKE) script runtime hostmap constants compiler world tools docs
+	$(MAKE) script runtime targetmap constants compiler world tools docs
 	@echo 'Build of MLton succeeded.'
 
 .PHONY: bootstrap-nj
@@ -66,7 +66,7 @@
 	@echo 'Creating constants file.'
 	$(BIN)/mlton -build-constants true >tmp.c
 	$(BIN)/mlton -output tmp tmp.c
-	./tmp >$(LIB)/$(HOST)/constants
+	./tmp >$(LIB)/$(TARGET)/constants
 	rm -f tmp tmp.c
 
 DEBSRC = mlton-$(VERSION).orig
@@ -106,7 +106,7 @@
 
 .PHONY: dirs
 dirs:
-	mkdir -p $(BIN) $(LIB)/$(HOST) $(LIB)/include
+	mkdir -p $(BIN) $(LIB)/$(TARGET) $(LIB)/include
 
 .PHONY: docs
 docs:
@@ -127,26 +127,26 @@
 
 #	rm -rf $(BSDSRC)
 
-.PHONY: hostmap
-hostmap:
-	touch $(HOSTMAP)
-	( sed '/$(HOST)/d' <$(HOSTMAP); 			\
-		echo '$(HOST) $(HOST_ARCH) $(HOST_OS)' ) 	\
-		>>$(HOSTMAP).tmp
-	mv $(HOSTMAP).tmp $(HOSTMAP)
+.PHONY: targetmap
+targetmap:
+	touch $(TARGETMAP)
+	( sed '/$(TARGET)/d' <$(TARGETMAP); 			\
+		echo '$(TARGET) $(TARGET_ARCH) $(TARGET_OS)' ) 	\
+		>>$(TARGETMAP).tmp
+	mv $(TARGETMAP).tmp $(TARGETMAP)
 
 .PHONY: nj-mlton
 nj-mlton:
 	$(MAKE) dirs
 	$(MAKE) -C $(COMP) nj-mlton
-	$(MAKE) script runtime hostmap constants
+	$(MAKE) script runtime targetmap constants
 	@echo 'Build of MLton succeeded.'
 
 .PHONY: nj-mlton-dual
 nj-mlton-dual:
 	$(MAKE) dirs	
 	$(MAKE) -C $(COMP) nj-mlton-dual
-	$(MAKE) script runtime hostmap constants
+	$(MAKE) script runtime targetmap constants
 	@echo 'Build of MLton succeeded.'
 
 TOPDIR = 'TOPDIR-unset'
@@ -167,9 +167,9 @@
 
 .PHONY: runtime
 runtime:
-	@echo 'Compiling MLton runtime system for $(HOST).'
+	@echo 'Compiling MLton runtime system for $(TARGET).'
 	$(MAKE) -C runtime
-	$(CP) $(RUN)/*.a $(LIB)/$(HOST)/
+	$(CP) $(RUN)/*.a $(LIB)/$(TARGET)/
 	$(CP) runtime/*.h include/*.h $(LIB)/include/
 
 .PHONY: script
@@ -211,7 +211,7 @@
 # puts them.
 DESTDIR = $(CURDIR)/install
 PREFIX = /usr
-ifeq ($(HOST_OS), sunos)
+ifeq ($(TARGET_OS), sunos)
 PREFIX = /usr/local
 endif
 prefix = $(PREFIX)
@@ -221,13 +221,13 @@
 TLIB = $(DESTDIR)$(prefix)/$(ULIB)
 TMAN = $(DESTDIR)$(prefix)$(MAN_PREFIX_EXTRA)/man/man1
 TDOC = $(DESTDIR)$(prefix)/share/doc/mlton
-ifeq ($(HOST_OS), sunos)
+ifeq ($(TARGET_OS), sunos)
 TDOC = $(DESTDIR)$(prefix)/doc/mlton
 endif
 TEXM = $(TDOC)/examples
 
 GZIP_MAN = true
-ifeq ($(HOST_OS), sunos)
+ifeq ($(TARGET_OS), sunos)
 GZIP_MAN = false
 endif
 



1.50      +2 -2      mlton/benchmark/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/benchmark/Makefile,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Makefile	8 Aug 2003 00:41:41 -0000	1.49
+++ Makefile	27 Aug 2003 21:13:29 -0000	1.50
@@ -3,8 +3,8 @@
 BIN = $(BUILD)/bin
 LIB = $(BUILD)/lib
 MLTON = mlton
-HOST = self
-FLAGS = -host $(HOST)
+TARGET = self
+FLAGS = -target $(TARGET)
 NAME = benchmark
 PATH = $(BIN):$(shell echo $$PATH)
 



1.12      +11 -11    mlton/bin/add-cross

Index: add-cross
===================================================================
RCS file: /cvsroot/mlton/mlton/bin/add-cross,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- add-cross	2 Jun 2003 19:10:46 -0000	1.11
+++ add-cross	27 Aug 2003 21:13:29 -0000	1.12
@@ -6,10 +6,10 @@
 #
 # It takes three arguments.
 #
-# 1. <crossHost>, will be used via the -b flag passed to the GCC
+# 1. <crossTarget>, will be used via the -b flag passed to the GCC
 # cross-compiler tools.  You must already have installed the GCC
 # cross-compiler tools.  This script does not do that, although you
-# may find the script build-cross-gcc helpful.  <crossHost> here
+# may find the script build-cross-gcc helpful.  <crossTarget> here
 # should be the same as target in build-cross-gcc.  Examples are
 # i386-pc-cygwin and sparc-sun-solaris.
 #
@@ -41,12 +41,12 @@
 }
 
 usage () {
-	die "usage: $name <crossHost> <crossArch> <crossOS> <machine>"
+	die "usage: $name <crossTarget> <crossArch> <crossOS> <machine>"
 }
 
 case "$#" in
 4)
-	crossHost="$1"
+	crossTarget="$1"
 	crossArch="$2"
 	crossOS="$3"
 	machine="$4"
@@ -72,26 +72,26 @@
 
 PATH=$src/build/bin:$PATH
 
-rm -rf "$lib/$crossHost"
+rm -rf "$lib/$crossTarget"
 
-mkdir -p "$lib/$crossHost/include" ||
+mkdir -p "$lib/$crossTarget/include" ||
 	die "Cannot write to $lib."
 
 echo 'Making runtime.' 
 cd $src/runtime
 make clean
-make gdtoa/arithchk.out HOST=$crossHost HOST_ARCH=$crossArch HOST_OS=$crossOS
+make gdtoa/arithchk.out TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS
 scp gdtoa/arithchk.out $machine:/tmp
 ssh $machine '/tmp/arithchk.out && rm -f /tmp/arithchk.out' >gdtoa/arith.h
-( cd $src && make HOST=$crossHost HOST_ARCH=$crossArch HOST_OS=$crossOS \
-	runtime hostmap ) ||
+( cd $src && make TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS \
+	runtime targetmap ) ||
 	die "Unable to make runtime.  See $src/runtime-log."
 
 exe='print-constants'
 echo 'Building print-constants executable.'
 (
 	mlton -build-constants true >$exe.c
-	mlton -output $original/$exe -host $crossHost $exe.c
+	mlton -output $original/$exe -target $crossTarget $exe.c
 	rm -f $exe.c
 ) || die "Unable to build $exe executable."
 
@@ -99,6 +99,6 @@
 cd $original
 tar cf - $exe |
 	ssh $machine "tar xf - && ./$exe && rm -f $exe" \
-	>"$lib/$crossHost/constants"
+	>"$lib/$crossTarget/constants"
 
 rm -f $original/$exe



1.25      +1 -1      mlton/bin/mlton

Index: mlton
===================================================================
RCS file: /cvsroot/mlton/mlton/bin/mlton,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mlton	26 Aug 2003 20:36:44 -0000	1.24
+++ mlton	27 Aug 2003 21:13:30 -0000	1.25
@@ -65,6 +65,6 @@
 		-mv8
 		-mcpu=ultrasparc
 		-mno-epilogue'					\
-	-link-opt '-lgdtoa -lm'					\
 	-target-link-opt sunos '-ldl -lnsl -lsocket'		\
+	-link-opt '-lgdtoa -lm'					\
 	"$@"



1.63      +2 -2      mlton/bin/regression

Index: regression
===================================================================
RCS file: /cvsroot/mlton/mlton/bin/regression,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- regression	18 May 2003 23:56:16 -0000	1.62
+++ regression	27 Aug 2003 21:13:30 -0000	1.63
@@ -23,7 +23,7 @@
 		if [ "$#" = 0 ]; then
 			usage
 		fi
-		crossHost="$1"
+		crossTarget="$1"
 		shift
 		;;
 	-run-only)
@@ -42,7 +42,7 @@
 bin="$src/build/bin"
 mlton="$bin/mlton"
 if [ $cross = 'yes' ]; then
-	flags="$flags -host $crossHost"
+	flags="$flags -target $crossTarget"
 fi
 cont='callcc.sml callcc2.sml callcc3.sml'
 intInf='conv.sml conv2.sml harmonic.sml int-inf.*.sml real.fromLargeInt.sml real.toLargeInt slow.sml slower.sml smith-normal-form.sml'



1.65      +4 -0      mlton/doc/changelog

Index: changelog
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/changelog,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- changelog	22 Aug 2003 04:14:07 -0000	1.64
+++ changelog	27 Aug 2003 21:13:31 -0000	1.65
@@ -1,5 +1,9 @@
 Here are the changes since version 20030716.
 
+* 2003-08-26
+  - Changed -host to -target.
+  - Split MLton.Platform.{arch,os} into MLton.Platform.{Arch,OS}.t.
+
 * 2003-08-21
   - Fixed bug in C codegen that would cause undefined references to
     Real_{fetch,move,store} when compiling on Sparcs with -align 4.



1.10      +3 -3      mlton/doc/user-guide/cross-compiling.tex

Index: cross-compiling.tex
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/user-guide/cross-compiling.tex,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- cross-compiling.tex	26 Aug 2003 16:39:38 -0000	1.9
+++ cross-compiling.tex	27 Aug 2003 21:13:31 -0000	1.10
@@ -1,6 +1,6 @@
 \sec{Cross compiling}{cross-compiling}
 
-You can use the {\mlton}'s {\tt -host} flag to cross compile
+You can use the {\mlton}'s {\tt -target} flag to cross compile
 applications.  By default, {\mlton} is only able to compile for the
 machine it is running on.  In order to use {\mlton} as a cross
 compiler, you need to do two things.  To make the terminology clear,
@@ -21,7 +21,7 @@
 script {\tt bin/build-cross-gcc}, available in the {\mlton} sources,
 as a template.  The value of the {\tt target} variable in that script
 is important, since that is what you will pass to {\mlton}'s {\tt
--host} flag.
+-target} flag.
 
 Once you have the toolset built, you should be able to test it by
 cross compiling a simple hello world program on your host machine.
@@ -51,7 +51,7 @@
 Once you have done all this, you should be able to cross compile SML
 applications.  For example,
 \begin{verbatim}
-mlton -host i386-pc-cygwin hello-world.sml
+mlton -target i386-pc-cygwin hello-world.sml
 \end{verbatim}
 will create {\tt hello-world}, which you should be able to run from a
 Cygwin shell on your Windows machine.



1.38      +6 -6      mlton/doc/user-guide/man-page.tex

Index: man-page.tex
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/user-guide/man-page.tex,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- man-page.tex	18 Aug 2003 03:32:44 -0000	1.37
+++ man-page.tex	27 Aug 2003 21:13:31 -0000	1.38
@@ -85,12 +85,6 @@
 header file with prototypes for all of the functions exported from
 SML.
 
-\option{-host \choiceTwo{self}{\ldots}}
-Generate an executable that runs on the specified host.  The default is {\tt
-self}, which means to compile for the machine that {\mlton} is running on.  To
-use any other host, you must first install a cross-compiler.  See
-\secref{cross-compiling}.
-
 \option{-ieee-fp \falseTrue}
 Control whether or not the native code generator is pedantic about following
 the IEEE floating point standard.  By default, it is not, because of the
@@ -170,6 +164,12 @@
 If you compile {\tt -stop g} or {\tt -stop o}, you can resume
 compilation by running {\tt mlton} on the generated {\tt .c} and {\tt
 .S} or {\tt .o} files. 
+
+\option{-target \choiceTwo{self}{\ldots}}
+Generate an executable that runs on the specified platform.  The default
+is {\tt self}, which means to compile for the machine that {\mlton} is
+running on.  To use any other target, you must first install a
+cross-compiler.  See \secref{cross-compiling}.
 
 \option{-verbose \choiceFour{0}{1}{2}{3}}
 How verbose to be about what passes are running.  The default is 0.\\



1.34      +8 -7      mlton/man/mlton.1

Index: mlton.1
===================================================================
RCS file: /cvsroot/mlton/mlton/man/mlton.1,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mlton.1	18 Aug 2003 03:32:44 -0000	1.33
+++ mlton.1	27 Aug 2003 21:13:31 -0000	1.34
@@ -77,13 +77,6 @@
 with prototypes for all of the functions exported from SML.
 
 .TP
-\fB-host \fI{\fBself\fP|\fI...}\fR
-Generate an executable that runs on the specified host.  The default
-is \fBself\fP, which means to compile for the machine that \fBMLton\fP
-is running on.  To use any other host, you must first install a cross
-compiler.  See the \fBMLton User Guide\fP for details.
-
-.TP
 \fB-ieee-fp \fI{\fBfalse\fP|\fBtrue\fP}\fR
 Control whether or not the code generator is pedantic about following
 the IEEE floating point standard.  By default, it is not, because of the
@@ -183,6 +176,14 @@
 If you compile \fB-stop g\fP or \fB-stop o\fP, you can resume
 compilation by running \fBMLton\fP on the generated \fB.c\fP and \fB.S\fP
 or \fB.o\fP files.
+
+.TP
+\fB-target \fI{\fBself\fP|\fI...}\fR
+Generate an executable that runs on the specified platform.  The
+default is \fBself\fP, which means to compile for the machine that
+\fBMLton\fP is running on.  To use any other target, you must first
+install a cross compiler.  See the \fBMLton User Guide\fP for
+details.
 
 .TP
 \fB-verbose\fP \fI{\fB0\fP|\fB1\fP|\fB2\fP|\fB3\fP}\fP



1.21      +2 -2      mlton/mllex/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/mllex/Makefile,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Makefile	8 Aug 2003 00:41:41 -0000	1.20
+++ Makefile	27 Aug 2003 21:13:31 -0000	1.21
@@ -3,8 +3,8 @@
 BIN = $(BUILD)/bin
 LIB = $(BUILD)/lib
 MLTON = mlton
-HOST = self
-FLAGS = -host $(HOST)
+TARGET = self
+FLAGS = -target $(TARGET)
 NAME = mllex
 PATH = $(BIN):$(shell echo $$PATH)
 



1.22      +2 -2      mlton/mlprof/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/mlprof/Makefile,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Makefile	8 Aug 2003 00:41:41 -0000	1.21
+++ Makefile	27 Aug 2003 21:13:31 -0000	1.22
@@ -3,8 +3,8 @@
 BIN = $(BUILD)/bin
 LIB = $(BUILD)/lib
 MLTON = mlton
-HOST = self
-FLAGS = -host $(HOST)
+TARGET = self
+FLAGS = -target $(TARGET)
 NAME = mlprof
 PATH = $(BIN):$(shell echo $$PATH)
 



1.72      +11 -6     mlton/mlton/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/Makefile,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- Makefile	8 Aug 2003 17:22:23 -0000	1.71
+++ Makefile	27 Aug 2003 21:13:31 -0000	1.72
@@ -3,8 +3,7 @@
 BIN = $(BUILD)/bin
 LIB = $(BUILD)/lib
 MLTON = mlton
-HOST = self
-FLAGS = @MLton $(RUNTIME_ARGS) gc-summary -- -host $(HOST)
+TARGET = self
 NAME = mlton
 AOUT = mlton-compile
 PATH = $(BIN):$(shell echo $$PATH)
@@ -27,10 +26,16 @@
 endif
 endif
 
-ifeq (old,$(shell PATH=$(BIN):$$PATH; $(MLTON) -v >/dev/null 2>&1 && echo old))
-  EXTRA_FLAGS = -v -o $(AOUT)
+FLAGS = @MLton $(RUNTIME_ARGS) gc-summary --
+ifeq (new,$(shell PATH=$(BIN):$$PATH; $(MLTON) -target self >/dev/null 2>&1 && echo new))
+  FLAGS += -target $(TARGET)
 else
-  EXTRA_FLAGS = -verbose 1 -output $(AOUT)
+  FLAGS += -host $(TARGET)
+endif
+ifeq (new,$(shell PATH=$(BIN):$$PATH; $(MLTON) -verbose 1 >/dev/null 2>&1 && echo new))
+  FLAGS += -verbose 1 -output $(AOUT)
+else
+  FLAGS += -v -o $(AOUT)
 endif
 
 .PHONY: all
@@ -38,7 +43,7 @@
 
 $(AOUT): $(NAME).cm $(shell $(MLTON) -stop f $(NAME).cm)
 	@echo 'Compiling mlton (takes a while)'
-	$(MLTON) $(FLAGS) $(EXTRA_FLAGS) $(CM)
+	$(MLTON) $(FLAGS) $(CM)
 	size $(AOUT)
 
 .PHONY:	$(NAME)_cm



1.66      +5 -2      mlton/mlton/codegen/c-codegen/c-codegen.fun

Index: c-codegen.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/codegen/c-codegen/c-codegen.fun,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- c-codegen.fun	26 Aug 2003 20:36:45 -0000	1.65
+++ c-codegen.fun	27 Aug 2003 21:13:32 -0000	1.66
@@ -562,8 +562,11 @@
 	    else concat [s, " /* ", Label.toString l, " */"]
 	 end
       val handleMisalignedReals =
-	 !Control.align = Control.Align4
-	 andalso !Control.hostArch = MLton.Platform.Arch.Sparc
+	 let
+	    open Control
+	 in
+	    !align = Align4 andalso !targetArch = Sparc
+	 end
       fun addr z = concat ["&(", z, ")"]
       fun realFetch z = concat ["Real64_fetch(", addr z, ")"]
       fun realMove {dst, src} =



1.49      +2 -2      mlton/mlton/codegen/x86-codegen/x86-codegen.fun

Index: x86-codegen.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/codegen/x86-codegen/x86-codegen.fun,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- x86-codegen.fun	26 Aug 2003 20:36:45 -0000	1.48
+++ x86-codegen.fun	27 Aug 2003 21:13:32 -0000	1.49
@@ -92,7 +92,7 @@
 	     * that don't handle signals, since signals get used under the hood
 	     * in Cygwin.
 	     *)
-	    !Control.hostOS = MLton.Platform.OS.Cygwin
+	    let open Control in !targetOS = Cygwin end
 
 	val makeC = outputC
 	val makeS = outputS
@@ -153,7 +153,7 @@
 		    (* Drop the leading _ with Cygwin, because gcc will add it.
 		     *)
 		    val mainLabel =
-		       if !Control.hostOS = MLton.Platform.OS.Cygwin
+		       if let open Control in !targetOS = Cygwin end
 			  then String.dropPrefix (mainLabel, 1)
 		       else mainLabel
 		 in



1.25      +1 -1      mlton/mlton/codegen/x86-codegen/x86-mlton-basic.fun

Index: x86-mlton-basic.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/codegen/x86-codegen/x86-mlton-basic.fun,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- x86-mlton-basic.fun	26 Aug 2003 20:36:45 -0000	1.24
+++ x86-mlton-basic.fun	27 Aug 2003 21:13:32 -0000	1.25
@@ -371,7 +371,7 @@
   val fileLineLabel =
      Promise.lazy
      (fn () =>
-      Label.fromString (if !Control.hostOS = MLton.Platform.OS.Cygwin
+      Label.fromString (if let open Control in !targetOS = Cygwin end
 			   then "_LINE__"
 			else "__LINE__"))
 					 



1.44      +1 -1      mlton/mlton/codegen/x86-codegen/x86.fun

Index: x86.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/codegen/x86-codegen/x86.fun,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- x86.fun	26 Aug 2003 20:36:45 -0000	1.43
+++ x86.fun	27 Aug 2003 21:13:32 -0000	1.44
@@ -62,7 +62,7 @@
 	open Label
 
 	fun toString l =
-	   if !Control.hostOS =  MLton.Platform.OS.Cygwin
+	   if let open Control in !targetOS = Cygwin end
 	      then concat ["_", Label.toString l]
 	   else Label.toString l
 



1.79      +15 -10    mlton/mlton/control/control.sig

Index: control.sig
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/control/control.sig,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- control.sig	26 Aug 2003 20:36:45 -0000	1.78
+++ control.sig	27 Aug 2003 21:13:33 -0000	1.79
@@ -64,15 +64,6 @@
       datatype handlers = Flow | Simple
       val handlers: handlers ref
 
-      datatype host =
-	 Cross of string
-       | Self
-      val host: host ref
-
-      val hostArch: MLton.Platform.Arch.t ref
-
-      val hostOS: MLton.Platform.OS.t ref
-
       (* Indentation used in laying out ILs. *)
       val indentation: int ref
 	 
@@ -109,9 +100,12 @@
       (* List of pass names to save the result of. *)
       val keepPasses: Regexp.Compiled.t list ref
 
-      (* Host dependent lib directory. *)
+      (* lib/mlton directory *)
       val libDir: Dir.t ref
 
+      (* lib/mlton/target directory *)
+      val libTargetDir: Dir.t ref
+
       datatype limitCheck =
 	 (* per block *)
 	 PerBlock
@@ -217,6 +211,17 @@
 
       (* Generate a statically linked executable. *)
       val static: bool ref
+
+      datatype target =
+	 Cross of string
+       | Self
+      val target: target ref
+
+      datatype arch = datatype MLton.Platform.Arch.t
+      val targetArch: arch ref
+
+      datatype os = datatype MLton.Platform.OS.t
+      val targetOS: os ref
 
       val textIOBufSize: int ref
 	 



1.96      +33 -25    mlton/mlton/control/control.sml

Index: control.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/control/control.sml,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- control.sml	26 Aug 2003 20:36:46 -0000	1.95
+++ control.sml	27 Aug 2003 21:13:33 -0000	1.96
@@ -128,31 +128,6 @@
 			default = Flow,
 			toString = Handlers.toString}
 
-structure Host =
-   struct
-      datatype t =
-	 Cross of string
-       | Self
-
-      val toString =
-	 fn Cross s => s
-	  | Self => "self"
-   end
-
-datatype host = datatype Host.t
-   
-val host = control {name = "host",
-		    default = Self,
-		    toString = Host.toString}
-
-val hostArch = control {name = "host arch",
-			default = MLton.Platform.Arch.X86,
-			toString = MLton.Platform.Arch.toString}
-
-val hostOS = control {name = "host OS",
-		      default = MLton.Platform.OS.Linux,
-		      toString = MLton.Platform.OS.toString}
-
 val indentation = control {name = "indentation",
 			   default = 3,
 			   toString = Int.toString}
@@ -238,6 +213,10 @@
 val libDir = control {name = "lib dir",
 		      default = "<libDir unset>",
 		      toString = fn s => s}
+
+val libTargetDir = control {name = "lib dir",
+			    default = "<libTargetDir unset>",
+			    toString = fn s => s} 
    
 structure LimitCheck =
    struct
@@ -411,6 +390,35 @@
 val static = control {name = "static",
 		      default = false,
 		      toString = Bool.toString}
+
+structure Target =
+   struct
+      datatype t =
+	 Cross of string
+       | Self
+
+      val toString =
+	 fn Cross s => s
+	  | Self => "self"
+   end
+
+datatype target = datatype Target.t
+   
+val target = control {name = "target",
+		      default = Self,
+		      toString = Target.toString}
+
+datatype arch = datatype MLton.Platform.Arch.t
+
+val targetArch = control {name = "target arch",
+			  default = X86,
+			  toString = MLton.Platform.Arch.toString}
+
+datatype os = datatype MLton.Platform.OS.t
+
+val targetOS = control {name = "target OS",
+			default = Linux,
+			toString = MLton.Platform.OS.toString}
 
 val textIOBufSize = control {name = "TextIO buffer size",
 			     default = 4096,



1.27      +1 -1      mlton/mlton/elaborate/elaborate-core.fun

Index: elaborate-core.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/elaborate/elaborate-core.fun,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- elaborate-core.fun	26 Aug 2003 20:36:46 -0000	1.26
+++ elaborate-core.fun	27 Aug 2003 21:13:33 -0000	1.27
@@ -405,7 +405,7 @@
 	 SOME (case a of
 		  Attribute.Cdecl => Convention.Cdecl
 		| Attribute.Stdcall =>
-		     if !Control.hostOS = MLton.Platform.OS.Cygwin
+		     if !Control.targetOS = MLton.Platform.OS.Cygwin
 			then Convention.Stdcall
 		     else Convention.Cdecl)
     | _ => NONE



1.60      +1 -1      mlton/mlton/main/compile.sml

Index: compile.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/compile.sml,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- compile.sml	16 Aug 2003 21:29:18 -0000	1.59
+++ compile.sml	27 Aug 2003 21:13:33 -0000	1.60
@@ -403,7 +403,7 @@
 	  | SOME (_, v) => v
       val lookupConstant =
 	 File.withIn
-	 (concat [!Control.libDir, "/constants"], fn ins =>
+	 (concat [!Control.libTargetDir, "/constants"], fn ins =>
 	  LookupConstant.load (buildDecs (), ins))
       (* Set GC_state offsets. *)
       val _ =



1.155     +74 -72    mlton/mlton/main/main.sml

Index: main.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/main.sml,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -r1.154 -r1.155
--- main.sml	26 Aug 2003 20:36:46 -0000	1.154
+++ main.sml	27 Aug 2003 21:13:33 -0000	1.155
@@ -35,31 +35,36 @@
       fun compare (p, p') = Int.compare (toInt p, toInt p')
    end
 
+structure OptPred =
+   struct
+      datatype t =
+	 Target of string
+       | Yes 
+   end
+
 val buildConstants: bool ref = ref false
-val ccOpts: string list ref = ref []
+val ccOpts: {opt: string, pred: OptPred.t} list ref = ref []
 val coalesce: int option ref = ref NONE
 val expert: bool ref = ref false
 val gcc: string ref = ref "<unset>"
 val keepGenerated = ref false
 val keepO = ref false
 val keepSML = ref false
-val linkOpts: string list ref = ref []
+val linkOpts: {opt: string, pred: OptPred.t} list ref = ref []
 val output: string option ref = ref NONE
 val profileSet: bool ref = ref false
 val showBasis: bool ref = ref false
 val stop = ref Place.OUT
-val targetCCOpts: {opt: string, target: string} list ref = ref []
-val targetLinkOpts: {opt: string, target: string} list ref = ref []
 
-val hostMap: unit -> {arch: MLton.Platform.Arch.t,
-		      host: string,
-		      os: MLton.Platform.OS.t} list =
+val targetMap: unit -> {arch: MLton.Platform.Arch.t,
+			os: MLton.Platform.OS.t,
+			target: string} list =
    Promise.lazy
    (fn () =>
     List.map
-    (File.lines (concat [!Control.libDir, "/hostmap"]), fn line =>
+    (File.lines (concat [!Control.libDir, "/target-map"]), fn line =>
      case String.tokens (line, Char.isSpace) of
-	[host, arch, os] =>
+	[target, arch, os] =>
 	   let
 	      val arch =
 		 case MLton.Platform.Arch.fromString arch of
@@ -70,20 +75,20 @@
 		    NONE => Error.bug (concat ["strange os: ", os])
 		  | SOME os => os
 	   in
-	      {arch = arch, host = host, os = os}
+	      {arch = arch, os = os, target = target}
 	   end
-      | _ => Error.bug (concat ["strange host mapping: ", line])))
+      | _ => Error.bug (concat ["strange target mapping: ", line])))
 
-fun setHostType (hostString: string, usage): unit =
-   case List.peek (hostMap (), fn {host = h, ...} => h = hostString) of
-      NONE => usage (concat ["invalid host ", hostString])
+fun setTargetType (target: string, usage): unit =
+   case List.peek (targetMap (), fn {target = t, ...} => t = target) of
+      NONE => usage (concat ["invalid target ", target])
     | SOME {arch, os, ...} =>
 	 let
 	    datatype z = datatype MLton.Platform.Arch.t
 	    open Control
 	 in
-	    hostArch := arch
-	    ; hostOS := os
+	    targetArch := arch
+	    ; targetOS := os
 	    ; (case arch of
 		  Sparc =>
 		     (align := Align8
@@ -102,7 +107,7 @@
       (
        [
        (Normal, "align",
-	case !hostArch of
+	case !targetArch of
 	   Sparc => " {8|4}"
 	 | X86 => " {4|8}",
 	"object alignment",
@@ -132,7 +137,8 @@
        (Expert, "cc", " <gcc>", "path to gcc executable",
 	SpaceString (fn s => gcc := s)),
        (Normal, "cc-opt", " <opt>", "pass option to C compiler",
-	push ccOpts),
+	SpaceString (fn s =>
+		     List.push (ccOpts, {opt = s, pred = OptPred.Yes}))),
        (Expert, "coalesce", " <n>", "coalesce chunk size for C codegen",
 	Int (fn n => coalesce := SOME n)),
        (Expert, "debug", " {false|true}", "produce executable with debug info",
@@ -183,14 +189,6 @@
 			"flow" => handlers := Flow
 		      | "simple" => handlers := Simple
 		      | _ => usage (concat ["invalid -handlers flag: ", s]))),
-       (Normal, "host",
-	concat [" {",
-		concat (List.separate (List.map (hostMap (), #host), "|")),
-		"}"],
-	"host type that executable will run on",
-	SpaceString (fn s =>
-		     (setHostType (s, usage)
-		      ; host := (if s = "self" then Self else Cross s)))),
        (Normal, "ieee-fp", " {false|true}", "use strict IEEE floating-point",
 	boolRef Native.IEEEFP),
        (Expert, "indentation", " <n>", "indentation level in ILs",
@@ -214,8 +212,6 @@
 				    in List.push (keepPasses, re)
 				    end
 		   | NONE => usage (concat ["invalid -keep-pass flag: ", s])))),
-       (Expert, "lib", " <lib>", "set MLton lib directory",
-	SpaceString (fn s => libDir := s)),
        (Expert, "limit-check", " {lhle|pb|ebb|lh|lhf|lhfle}",
 	"limit check insertion algorithm",
 	SpaceString (fn s =>
@@ -235,7 +231,8 @@
 	"compute dynamic counts of limit checks",
 	boolRef limitCheckCounts),
        (Normal, "link-opt", " <opt>", "pass option to linker",
-	push linkOpts),
+	SpaceString (fn s =>
+		     List.push (linkOpts, {opt = s, pred = OptPred.Yes}))),
        (Expert, "loop-passes", " <n>", "loop optimization passes (1)",
 	Int 
 	(fn i => 
@@ -248,9 +245,7 @@
 	"may @MLton load-world be used",
 	boolRef mayLoadWorld),
        (Normal, "native",
-	if !hostArch = MLton.Platform.Arch.Sparc
-	   then " {false}"
-	else " {true|false}",
+	if !targetArch = Sparc then " {false}" else " {true|false}",
 	"use native code generator",
 	boolRef Native.native),
        (Expert, "native-commented", " <n>", "level of comments  (0)",
@@ -332,15 +327,23 @@
 		   | "o" => Place.O
 		   | "sml" => Place.SML
 		   | _ => usage (concat ["invalid -stop arg: ", s])))),
-       (Expert, "target-cc-opt", " target <opt>", "target-dependent CC option",
+       (Normal, "target",
+	concat [" {",
+		concat (List.separate (List.map (targetMap (), #target), "|")),
+		"}"],
+	"platform that executable will run on",
+	SpaceString (fn s =>
+		     (setTargetType (s, usage)
+		      ; target := (if s = "self" then Self else Cross s)))),
+       (Expert, "target-cc-opt", " <target> <opt>", "target-dependent CC option",
 	(SpaceString2
 	 (fn (target, opt) =>
-	  List.push (targetCCOpts, {opt = opt, target = target})))),
-       (Expert, "target-link-opt", " target <opt>",
+	  List.push (ccOpts, {opt = opt, pred = OptPred.Target target})))),
+       (Expert, "target-link-opt", " <target> <opt>",
 	"target-dependent link option",
 	(SpaceString2
 	 (fn (target, opt) =>
-	  List.push (targetLinkOpts, {opt = opt, target = target})))),
+	  List.push (linkOpts, {opt = opt, pred = OptPred.Target target})))),
        (Expert, #1 trace, " name1,...", "trace compiler internals", #2 trace),
        (Expert, "text-io-buf-size", " <n>", "TextIO buffer size",
 	intRef textIOBufSize),
@@ -385,36 +388,35 @@
 	 case args of
 	    lib :: args => (libDir := lib; args)
 	  | _ => Error.bug "incorrect args from shell script"
-      val _ = setHostType ("self", usage)
+      val _ = setTargetType ("self", usage)
       val result = parse args
       val gcc = !gcc
-      val host = !host
-      val hostString =
-	 case host of
+      val target = !target
+      val targetStr =
+	 case target of
 	    Cross s => s
 	  | Self => "self"
-      val lib = concat [!libDir, "/", hostString]
-      val _ = Control.libDir := lib
-      val hostArch = !hostArch
-      val archStr = MLton.Platform.Arch.toString hostArch
-      val hostOS = !hostOS
-      val OSStr = MLton.Platform.OS.toString hostOS
+      val _ = libTargetDir := concat [!libDir, "/", targetStr]
+      val targetArch = !targetArch
+      val archStr = MLton.Platform.Arch.toString targetArch
+      val targetOS = !targetOS
+      val OSStr = MLton.Platform.OS.toString targetOS
       fun tokenize l =
 	 String.tokens (concat (List.separate (l, " ")), Char.isSpace)
-      fun addTargetOpts (opts, targetOpts) =
+      fun addTargetOpts opts =
 	 tokenize
-	 (List.append
-	  (List.fold
-	   (!targetOpts, [], fn ({opt, target}, ac) =>
-	    if target = archStr orelse target = OSStr
-	       then opt :: ac
-	    else ac),
-	   rev (!opts)))
-      val ccOpts = addTargetOpts (ccOpts, targetCCOpts)
-      val linkOpts = addTargetOpts (linkOpts, targetLinkOpts)
+	 (List.fold
+	  (!opts, [], fn ({opt, pred}, ac) =>
+	   if (case pred of
+		  OptPred.Target s => s = archStr orelse s = OSStr
+		| OptPred.Yes => true)
+	      then opt :: ac
+	   else ac))
+      val ccOpts = addTargetOpts ccOpts
+      val linkOpts = addTargetOpts linkOpts
       datatype z = datatype MLton.Platform.OS.t
       val linkWithGmp =
-	 case hostOS of
+	 case targetOS of
 	    Cygwin => ["-lgmp"]
 	  | FreeBSD => ["-L/usr/local/lib/", "-lgmp"]
 	  | Linux =>
@@ -444,12 +446,12 @@
 	  | NetBSD => ["-Wl,-R/usr/pkg/lib", "-L/usr/pkg/lib", "-lgmp"]
 	  | Sun => ["-lgmp"]
       val linkOpts =
-	 List.concat [[concat ["-L", lib],
+	 List.concat [[concat ["-L", !libTargetDir],
 		       if !debug then "-lmlton-gdb" else "-lmlton"],
-		      linkOpts,
-		      linkWithGmp]
+		      linkWithGmp,
+		      linkOpts]
       val _ =
-	 if !Native.native andalso hostArch = MLton.Platform.Arch.Sparc
+	 if !Native.native andalso targetArch = Sparc
 	    then usage "can't use -native true on Sparc"
 	 else ()
       val _ =
@@ -469,7 +471,7 @@
 	    then keepSSA := true
 	 else ()
       val _ =
-	 if hostOS = MLton.Platform.OS.Cygwin andalso !profile = ProfileTime
+	 if targetOS = Cygwin andalso !profile = ProfileTime
 	    then usage "can't use -profile time on Cygwin"
 	 else ()
       fun printVersion (out: Out.t): unit =
@@ -555,11 +557,6 @@
 			case !output of
 			   NONE => suffix suf
 			 | SOME f => f
-		     fun docc (inputs: File.t list,
-			       output: File.t,
-			       switches: string list): unit =
-			System.system
-			(gcc, List.concat [switches, ["-o", output], inputs])
 		     datatype debugFormat =
 			Dwarf | DwarfPlus | Dwarf2 | Stabs | StabsPlus
 		     (* The -Wa,--gstabs says to pass the --gstabs option to the
@@ -584,7 +581,7 @@
 			       (gcc,
 				List.concat
 				[["-o", output],
-				 (case host of
+				 (case target of
 				     Cross s => ["-b", s]
 				   | Self => []),
 				 if !debug then gccDebug else [],
@@ -594,12 +591,12 @@
 			      ()
 			   (* gcc on Cygwin appends .exe, which I don't want, so
 			    * move the output file to it's rightful place.
-			    * Notice that we do not use hostOS here, since we
+			    * Notice that we do not use targetOS here, since we
 			    * care about the platform we're running on, not the
 			    * platform we're generating for.
 			    *)
 			   val _ =
-			      if let open MLton.Platform.OS in host = Cygwin end
+			      if MLton.Platform.OS.host = Cygwin
 				 then
 				    if String.contains (output, #".")
 				       then ()
@@ -640,7 +637,7 @@
 					    then debugSwitches @ switches
 					 else switches
 				      val switches =
-					 case host of
+					 case target of
 					    Cross s => "-b" :: s :: switches
 					  | Self => switches
 				      val switches = "-c" :: switches
@@ -660,7 +657,12 @@
 							   (Counter.next c),
 							   ".o"])
 					 else temp ".o"
-				      val _ = docc ([input], output, switches)
+				      val _ =
+					 System.system
+					 (gcc,
+					  List.concat [switches,
+						       ["-o", output, input]])
+
 				   in
 				      output :: ac
 				   end



1.25      +2 -2      mlton/mlyacc/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/mlyacc/Makefile,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Makefile	8 Aug 2003 00:41:41 -0000	1.24
+++ Makefile	27 Aug 2003 21:13:33 -0000	1.25
@@ -3,8 +3,8 @@
 BIN = $(BUILD)/bin
 LIB = $(BUILD)/lib
 MLTON = mlton
-HOST = self
-FLAGS = -host $(HOST)
+TARGET = self
+FLAGS = -target $(TARGET)
 NAME = mlyacc
 PATH = $(BIN):$(shell echo $$PATH)
 



1.72      +15 -16    mlton/runtime/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/runtime/Makefile,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- Makefile	26 Jul 2003 20:16:01 -0000	1.71
+++ Makefile	27 Aug 2003 21:13:34 -0000	1.72
@@ -1,24 +1,23 @@
-HOST = self
-HOST_ARCH = $(shell ../bin/host-arch)
+TARGET = self
+TARGET_ARCH = $(shell ../bin/host-arch)
 
-ifeq ($(HOST), self)
-AR = ar rc
-HOSTFLAGS =
-else
-AR = $(HOST)-ar rc
-HOSTFLAGS = -b $(HOST)
-endif
-
-ARCHFLAGS = -fomit-frame-pointer
+FLAGS = -fomit-frame-pointer
 
-ifeq ($(HOST_ARCH), x86)
-ARCHFLAGS += -mcpu=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=5
+ifeq ($(TARGET_ARCH), x86)
+FLAGS += -mcpu=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=5
 endif
-ifeq ($(HOST_ARCH), sparc)
-ARCHFLAGS += -Wa,-xarch=v8plusa -fcall-used-g5 -fcall-used-g7 -funroll-all-loops -m32 -mv8 -mcpu=ultrasparc
+ifeq ($(TARGET_ARCH), sparc)
+FLAGS += -Wa,-xarch=v8plusa -fcall-used-g5 -fcall-used-g7 -funroll-all-loops -m32 -mv8 -mcpu=ultrasparc
+endif
+
+ifeq ($(TARGET), self)
+AR = ar rc
+else
+AR = $(TARGET)-ar rc
+FLAGS += -b $(TARGET)
 endif
 
-CC = gcc -Wall -I. -Igdtoa -D_LARGEFILE64_SOURCE $(ARCHFLAGS) $(HOSTFLAGS)
+CC = gcc -Wall -I. -Igdtoa -D_LARGEFILE64_SOURCE $(FLAGS)
 CFLAGS = -O2
 DEBUGFLAGS = -gstabs+ -g2
 





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel