[m-rev.] diff: more work on installation with non-C grade compilers

Julien Fischer jfischer at opturion.com
Wed Dec 30 02:50:18 AEDT 2015


More work on installation with non-C grade compilers.

runtime/Mmakefile:
     Always install the runtime header files, even in non-C grades.
     Add a comment explaining why this needs to be done.

     Update the comment describing where all the different versions of
     the runtime live and how they are built.

     Delete now-unused code for building the IL backend version of the
     runtime.

compiler/Mmakefile:
      Document the how we install the C# version of the compiler.

      Add an XXX comment about a difference between Mono and .NET that
      we don't yet handle when the compiler is built in the C# grade.

library/Mmakefile:
      Delete code for cleaning up files generated by the IL backend.

Julien.

diff --git a/compiler/Mmakefile b/compiler/Mmakefile
index 765b8d2..fec7e0a 100644
--- a/compiler/Mmakefile
+++ b/compiler/Mmakefile
@@ -254,6 +254,13 @@ install_dirs:
  # version of the wrapper script from the scripts directory and leave the
  # one here alone.
  #
+# Similarly, for compilers built in the C# grade we need to install the
+# executable assembly (currently called top_level.exe), but *not* the generated
+# wrapper script 'mercury_compile' from this directory.  As with the Java grade,
+# we use the version of the wrapper script from the scripts directory.
+# XXX This covers Mono but not actual .NET; in the latter case we don't need
+# a wrapper script at all -- probably we should just rename the assembly.
+#
  ifeq ($(findstring java,$(GRADE)),java)
  INSTALL_PROGRAM=top_level.jar
  else ifeq ($(findstring csharp,$(GRADE)),csharp)
diff --git a/library/Mmakefile b/library/Mmakefile
index a34400c..30f8e4d 100644
--- a/library/Mmakefile
+++ b/library/Mmakefile
@@ -424,9 +424,7 @@ $(os_subdir)robdd.pic_o \

  # In the past we generated liblibrary.* and then linked
  # libmer_std.* to the files.
-# XXX IL We should remove the code cleaning up IL files soon.
  realclean_local:
-	rm -f mercury_dotnet.dll mercury_il.dll
  	rm -f liblibrary.$A liblibrary.so library.init
  	rm -f $($(STD_LIB_NAME).mods:%=%.h)
  	rm -f tags LIB_FLAGS LIB_FLAGS.date
diff --git a/runtime/Mmakefile b/runtime/Mmakefile
index 40c7b23..ecf19b0 100644
--- a/runtime/Mmakefile
+++ b/runtime/Mmakefile
@@ -355,29 +355,6 @@ runtime:
  	@echo "No Mercury runtime needed for GRADE=$(GRADE)"

  else
-ifeq ($(findstring il,$(GRADE)),il)
-
-# We put the runtime and library dlls into a single assembly called `mercury'
-CSCFLAGS=/t:module
-
-# We need to build the following DLLs for the .NET runtime
-DOTNET_DLLS=mercury_il.dll mercury_dotnet.dll
-
-clean_local:
-	rm -f $(DOTNET_DLLS)
-
-runtime: $(DOTNET_DLLS)
-
-mercury_dotnet.dll: mercury_il.dll
-
-# Uncomment the following rule if you want to build Mercury in a form
-# that will work with ROTOR.
-# mercury_il.dll: mercury_il.il
-#	sed '/REMOVE FOR ROTOR/s@^@//@' mercury_il.il > mercury_il.rotor.il
-#	$(ILASM) $(ALL_ILASMFLAGS) /dll /quiet /OUT=mercury_il.dll \
-#			mercury_il.rotor.il
-
-else

  .PHONY: runtime
  runtime: lib$(RT_LIB_NAME).$A lib$(RT_LIB_NAME).$(EXT_FOR_SHARED_LIB)
@@ -407,7 +384,6 @@ lib$(RT_LIB_NAME).dylib: $(PIC_OBJS)
  		$(SHARED_LIBS)

  endif
-endif

  $(RT_LIB_NAME).init: $(CFILES)
  	cat `vpath_find $(CFILES)` | grep '^INIT ' > $(RT_LIB_NAME).init
@@ -467,14 +443,14 @@ install_dirs:

  ifneq "$(filter csharp% java% erlang%,$(GRADE))" ""

-# For these grades, there's nothing to do.
-# (The java version of the Mercury runtime is in mercury/java/runtime,
-# not mercury/runtime, and its build and installation is handled by
-# mercury/library/Mmakefile.)
-# (Runtime support for the Erlang backend is in the library directory.)
-
-.PHONY: install_headers
-install_headers:
+# For non-C grades, the only thing that needs to be done is install the runtime
+# headers (see the comment above the install_headers target for the rationale).
+# The Java version of the Mercury runtime is in ../java/runtime not this
+# directory and it is built and installed by ../library/Mmakefile.
+# The C# version of the Mercury runtime *is* in this directory (in
+# mercury_dotnet.cs.in), but it is included directly in the standard library
+# assembly (mer_std.dll) by ../library/Mmakefile.
+# The Erlang version of the Mercury runtime is in the library directory.

  .PHONY: install_init
  install_init:
@@ -484,19 +460,6 @@ install_lib:

  else

-# mercury_conf.h needs to be in a separate directory so it can be
-# overridden by a different configuration.
-.PHONY: install_headers
-install_headers: $(HDRS) $(BODY_HDRS) $(MACHHDRS) \
-		$(LIB_DLL_H) $(LIB_GLOBALS_H) install_dirs
-	cp `vpath_find $(HDRS) $(BODY_HDRS) $(LIB_DLL_H) $(LIB_GLOBALS_H)` \
-		$(INSTALL_INC_DIR)
-	rm -f $(INSTALL_INC_DIR)/mercury_conf.h
-	cp `vpath_find mercury_conf.h` $(INSTALL_CONF_DIR)
-	-chmod u+w $(INSTALL_CONF_DIR)/mercury_conf.h
-	cp `vpath_find mercury_conf.h.in` $(INSTALL_RECONF_DIR)/runtime
-	cp `vpath_find $(MACHHDRS)` $(INSTALL_INC_DIR)/machdeps
-
  .PHONY: install_init
  install_init: $(RT_LIB_NAME).init install_dirs
  	cp `vpath_find $(RT_LIB_NAME).init` $(INSTALL_GRADE_MODULE_DIR)
@@ -511,6 +474,26 @@ install_lib: lib$(RT_LIB_NAME).$A lib$(RT_LIB_NAME).$(EXT_FOR_SHARED_LIB) \

  endif

+# NOTE: we install the header files for the C version of the Mercury runtime
+# even in non-C grades.  The reason for this is that they are *not* installed
+# by the install_lib target used by the install_grades target in ../Mmakefile.
+# If we don't install them as part of the main install target then they won't
+# ever be installed and installations with non-C grade Mercury compilers that
+# also install the library in C grades will be broken.
+
+# mercury_conf.h needs to be in a separate directory so it can be overridden by
+# a different configuration.
+.PHONY: install_headers
+install_headers: $(HDRS) $(BODY_HDRS) $(MACHHDRS) \
+		$(LIB_DLL_H) $(LIB_GLOBALS_H) install_dirs
+	cp `vpath_find $(HDRS) $(BODY_HDRS) $(LIB_DLL_H) $(LIB_GLOBALS_H)` \
+		$(INSTALL_INC_DIR)
+	rm -f $(INSTALL_INC_DIR)/mercury_conf.h
+	cp `vpath_find mercury_conf.h` $(INSTALL_CONF_DIR)
+	-chmod u+w $(INSTALL_CONF_DIR)/mercury_conf.h
+	cp `vpath_find mercury_conf.h.in` $(INSTALL_RECONF_DIR)/runtime
+	cp `vpath_find $(MACHHDRS)` $(INSTALL_INC_DIR)/machdeps
+
  #-----------------------------------------------------------------------------#

  mercury_dotnet.cs: mercury_dotnet.cs.in



More information about the reviews mailing list