|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
for review: install java grade with mmc --makeBranches: main
Use mmc --make to install Java grades. The makefile rules in library/Mmakefile did not install .opt files into <prefix>/lib/mercury/ints/java. When intermodule optimisation was enabled with a Java grade, the Mercury compiler would read the .opt files from <prefix>/lib/mercury/ints, which could be from *any* grade (they are only installed to work around problems with Mmake). Mmakefile: Force mmc --make to be used to install Java grades. browser/Mmakefile: library/Mmakefile: mdbcomp/Mmakefile: ssdb/Mmakefile: Delete rules for building libraries in the Java grade with Mmake. Move --no-libgrade options to *_FLAGS files. library/Mmakefile: Create the jmercury -> ../java symlink at the `mmake depend' step. Pass -sourcepath . to javac so it can find the jmercury/runtime/*.java files. browser/MDB_FLAGS.in: compiler/COMP_FLAGS.in: library/LIB_FLAGS.in: mdbcomp/MDBCOMP_FLAGS.in: ssdb/SSDB_FLAGS.in: Add --no-libgrade options so that mmc --make libFOO.install only installs the main grade. Add --no-java-classpath so that the .jar files from the installed compiler aren't used. Tell the Java compiler about .jar files that each directory depends on. README.Java: Remove a mention of Mmake with the java grade. diff --git a/Mmakefile b/Mmakefile index cec607b..04d25ed 100644 --- a/Mmakefile +++ b/Mmakefile @@ -621,9 +621,9 @@ install_grades: install_main gc_grade=`scripts/ml --grade $${grade} --print-gc-grade`; \ IWS=`/bin/pwd`/install_grade_dir.$${grade}; \ ( \ - if [ "$${grade}" = "erlang" ]; then \ - MMAKE_USE_MMC_MAKE=yes; \ - fi; \ + case $${grade} in \ + java*|erlang*) MMAKE_USE_MMC_MAKE=yes; \ + esac; \ scripts/prepare_install_dir $${IWS} && \ ( cd $${IWS}/boehm_gc && \ $(SUBDIR_MMAKE) MC=mmc GRADE=$${grade} WORKSPACE=$${IWS} \ diff --git a/README.Java b/README.Java index c2e06a4..3d0baf0 100644 --- a/README.Java +++ b/README.Java @@ -165,16 +165,10 @@ Q. So how do I enable Java-level debugging? A. By default, javac already generates line number and source file debugging information. You can include local variable debugging information by - specifying "--target-debug" when invoking the Mercury compiler, or by - setting the JAVACFLAGS variable to include "-g" when invoking mmake, - e.g. + specifying "--target-debug" when invoking the Mercury compiler, e.g. mmc --make --java --target-debug <progname> - or - - mmake GRADE=java JAVACFLAGS=-g <progname> - You can then use Sun's "jdb" debugging tool, which comes as part of the Java SDK distribution, to debug your program. For more information, see the documentation for javac and jdb. diff --git a/browser/MDB_FLAGS.in b/browser/MDB_FLAGS.in index 54aa8f4..f7eb5b8 100644 --- a/browser/MDB_FLAGS.in +++ b/browser/MDB_FLAGS.in @@ -6,6 +6,7 @@ --no-shlib-linker-use-install-name --force-disable-tracing --no-ssdb +--no-libgrade --generate-mmc-deps -I../library -I../mdbcomp @@ -23,4 +24,8 @@ -L../trace -L../mdbcomp -L../browser +--no-java-classpath +--java-classpath ../library/mer_rt.jar +--java-classpath ../library/mer_std.jar +--java-classpath ../mdbcomp/mer_mdbcomp.jar --config-file ../scripts/Mercury.config.bootstrap diff --git a/browser/Mmakefile b/browser/Mmakefile index e3b023c..df29358 100644 --- a/browser/Mmakefile +++ b/browser/Mmakefile @@ -89,8 +89,6 @@ LD_LIBFLAGS-libmer_browser.dylib = -install_name \ #-----------------------------------------------------------------------------# -JAVACFLAGS = -classpath $(LIBRARY_DIR):$(MDBCOMP_DIR) - MTAGS = $(SCRIPTS_DIR)/mtags LN = ln @@ -222,26 +220,6 @@ dates: #-----------------------------------------------------------------------------# -JARS = $(BROWSER_LIB_NAME).jar - -.PHONY: jars -jars: classes - echo jmercury/*.class > $(BROWSER_LIB_NAME).classes - $(JAR) $(JAR_CREATE_FLAGS) $(BROWSER_LIB_NAME).jar @$(BROWSER_LIB_NAME).classes - $(JAR) i $(BROWSER_LIB_NAME).jar - $(RM) $(BROWSER_LIB_NAME).classes - -JAVAS = $(wildcard jmercury/*.java) - -.PHONY: -classes: javas - $(JAVAC) $(ALL_JAVACFLAGS) $(JAVAS) - -.PHONY: javas -javas: $(BROWSER_LIB_NAME).javas - -#-----------------------------------------------------------------------------# - .PHONY: os cs ss ils ifneq ($(MMAKE_USE_MMC_MAKE),yes) os: $($(BROWSER_LIB_NAME).os) @@ -272,12 +250,7 @@ realclean_local: # Installation targets .PHONY: install -ifeq ("$(findstring ssdebug,$(GRADE))","ssdebug") -# The ssdebug grade requires the interface files. -install: install_library install_ints -else install: install_library -endif .PHONY: install_dirs install_dirs: @@ -302,15 +275,13 @@ install_library: else ifneq (,$(findstring java,$(GRADE))) .PHONY: install_ints -install_ints: lib$(BROWSER_LIB_NAME).install_ints +install_ints: .PHONY: install_init install_init: .PHONY: install_library -install_library: jars - mkdir -p $(INSTALL_JAVA_LIBRARY_DIR) - cp $(JARS) $(INSTALL_JAVA_LIBRARY_DIR) +install_library: lib$(BROWSER_LIB_NAME).install else diff --git a/compiler/COMP_FLAGS.in b/compiler/COMP_FLAGS.in index cfee1d8..fbc54ef 100644 --- a/compiler/COMP_FLAGS.in +++ b/compiler/COMP_FLAGS.in @@ -22,5 +22,6 @@ --erlang-include-directory ../library/Mercury/hrls --erlang-include-directory ../mdbcomp/Mercury/hrls --erlang-include-directory ../ssdb/Mercury/hrls +--no-java-classpath --no-main --config-file ../scripts/Mercury.config.bootstrap diff --git a/library/LIB_FLAGS.in b/library/LIB_FLAGS.in index 3ecdab0..338cb2c 100644 --- a/library/LIB_FLAGS.in +++ b/library/LIB_FLAGS.in @@ -9,6 +9,7 @@ --no-shlib-linker-use-install-name --trace minimum --no-ssdb +--no-libgrade --c-include-directory ../boehm_gc --c-include-directory ../boehm_gc/include --c-include-directory ../runtime @@ -19,4 +20,5 @@ -L../trace -L../mdbcomp -L../browser +--no-java-classpath --config-file ../scripts/Mercury.config.bootstrap diff --git a/library/Mmakefile b/library/Mmakefile index e383f70..545fcc0 100644 --- a/library/Mmakefile +++ b/library/Mmakefile @@ -116,6 +116,9 @@ MCFLAGS += -R$(FINAL_INSTALL_MERC_LIB_DIR) \ -R$(FINAL_INSTALL_MERC_GC_LIB_DIR) endif +# Let javac find jmercury/runtime/*.java files. +JAVACFLAGS += -sourcepath . + MTAGS = $(SCRIPTS_DIR)/mtags LN = ln @@ -167,7 +170,7 @@ mercury: lib_std #-----------------------------------------------------------------------------# .PHONY: depend -depend: LIB_FLAGS $(STD_LIB_NAME).depend +depend: LIB_FLAGS java_symlinks $(STD_LIB_NAME).depend .PHONY: check check: $(STD_LIB_NAME).check @@ -243,48 +246,38 @@ ils: $(STD_LIB_NAME).ils javas: $(STD_LIB_NAME).javas endif -# The compiler names Java files differently to the original source files to -# avoid keywords. Instead of replicating that logic here we just use a -# wildcard to find the file names. -JAVAS = $(wildcard jmercury/*.java) -RUNTIME_JAVAS = $(wildcard jmercury/runtime/*.java) - -# We need to invoke javac on all of the classes at the same time, -# rather than compiling them separately. This is needed because -# otherwise javac doesn't handle cyclic dependencies between different -# modules. -classes: javas java_symlinks - $(JAVAC) $(ALL_JAVACFLAGS) $(JAVAS) - $(JAVAC) $(ALL_JAVACFLAGS) $(RUNTIME_JAVAS) - -# javac expects to find the sources for symbols named mercury.runtime.* in -# mercury/runtime/*, but in our sources those symbols actually come from +# javac expects to find the sources for symbols named jmercury.runtime.* in +# jmercury/runtime/*, but in our sources those symbols actually come from # java/runtime/*. So we set up a symbolic link to help javac find the way to # the sources. .PHONY: java_symlinks +.PHONY: install_mer_rt + +ifeq ("$(findstring java,$(GRADE))","java") + java_symlinks: [ -d jmercury ] || mkdir jmercury [ -d jmercury/runtime ] || ln -s ../../java/runtime jmercury/runtime -# Once all of the library classes have been compiled, we put them in a single -# jar file. At this point we also add the runtime classes to a jar file. -# Note that this stage makes use of the symbolic links created earlier to -# ensure that the path names are correct within the jar files. -# We also compile NATIVE_SO here and copy it into the library directory. - -JARS = $(STD_LIB_NAME).jar $(RT_LIB_NAME).jar - -# We list the classes in a temporary file to avoid overlong command lines. -# We ignore the exit status of the last two commands because NATIVE_SO is not -# an essential part of the Mercury standard library for the Java -# implementation. Users should be able to run programs in grade Java without -# any architecture-specific objects. -.PHONY: jars -jars: classes - echo jmercury/*.class > $(STD_LIB_NAME).classes - $(JAR) $(JAR_CREATE_FLAGS) $(STD_LIB_NAME).jar @$(STD_LIB_NAME).classes - $(JAR) i $(STD_LIB_NAME).jar - $(RM) $(STD_LIB_NAME).classes +install_mer_rt: $(RT_LIB_NAME).jar + mkdir -p $(INSTALL_JAVA_LIBRARY_DIR) + cp $(RT_LIB_NAME).jar $(INSTALL_JAVA_LIBRARY_DIR) + +else + +java_symlinks: + +install_mer_rt: + +endif + +# mmc --make must be used to install the java grade. +ifeq ($(MMAKE_USE_MMC_MAKE),yes) +$(STD_LIB_NAME).jar: libmer_std +endif + +$(RT_LIB_NAME).jar: java_symlinks + $(JAVAC) $(ALL_JAVACFLAGS) jmercury/runtime/*.java $(JAR) $(JAR_CREATE_FLAGS) $(RT_LIB_NAME).jar jmercury/runtime/*.class $(JAR) i $(RT_LIB_NAME).jar # -+cd jmercury/runtime && mmake $(NATIVE_SO) @@ -356,7 +349,7 @@ endif ifneq ($(MMAKE_USE_MMC_MAKE),yes) ifeq ("$(findstring java,$(GRADE))","java") -lib_std: jars +lib_std: $(STD_LIB_NAME).jar $(RT_LIB_NAME).jar $(NATIVE_SO) endif endif @@ -456,7 +449,7 @@ realclean_local: rm -rf jmercury rm -f mr_int.class mr_float.class mr_char.class rm -f mr_int\$$*.class mr_float\$$*.class mr_char\$$*.class - rm -f $(JARS) $(NATIVE_SO) + rm -f $(STD_LIB_NAME).jar $(RT_LIB_NAME).jar $(NATIVE_SO) rm -f erlang_conf.hrl #-----------------------------------------------------------------------------# @@ -530,46 +523,21 @@ install_strong_name: library_strong_name.sn else -ifneq (,$(findstring java,$(GRADE))) - -# Copy the jars and NATIVE_SO to INSTALL_JAVA_LIBRARY_DIR. Ignore the exit -# status of last command, since NATIVE_SO may not be available and is not -# essential. Note that in the java.ssdebug grade the library will still -# be copied to INSTALL_JAVA_LIBRARY_DIR. That's okay for now, because -# we turn off the ssdebug transformations for the library, so it is equivalent -# to the non-ssdebug grade. -# The int3s target is there because some modules in the browser directory need -# the library.int3 file. - -.PHONY: install_library -install_library: int3s jars - mkdir -p $(INSTALL_JAVA_LIBRARY_DIR) - cp $(JARS) $(INSTALL_JAVA_LIBRARY_DIR) - # -cp $(NATIVE_SO) $(INSTALL_JAVA_LIBRARY_DIR) - -else - # we depend on lib$(STD_LIB_NAME) because lib$(STD_LIB_NAME).install_library # doesn't make library.int3, but some modules in the browser directory need it. .PHONY: install_library install_library: lib$(STD_LIB_NAME) lib$(STD_LIB_NAME).install_library -endif #ifneq (,$(findstring java,$(GRADE))) - endif #ifneq (,$(findstring il,$(GRADE))) else #ifneq ($(MMAKE_USE_MMC_MAKE),yes) -# Prevent `mmc --make' from installing the default set of grades for -# `libFOO.install' targets. -MCFLAGS += --no-libgrade - .PHONY: install_mercury -install_mercury: lib$(STD_LIB_NAME).install +install_mercury: install_library .PHONY: install_library -install_library: lib$(STD_LIB_NAME).install +install_library: install_mer_rt lib$(STD_LIB_NAME).install endif #ifneq ($(MMAKE_USE_MMC_MAKE),yes) diff --git a/mdbcomp/MDBCOMP_FLAGS.in b/mdbcomp/MDBCOMP_FLAGS.in index 5e70e70..0177634 100644 --- a/mdbcomp/MDBCOMP_FLAGS.in +++ b/mdbcomp/MDBCOMP_FLAGS.in @@ -5,6 +5,7 @@ --no-mercury-stdlib-dir --generate-mmc-deps --no-ssdb +--no-libgrade --no-shlib-linker-use-install-name -I../library --c-include-directory ../boehm_gc @@ -19,4 +20,7 @@ -L../trace -L../mdbcomp -L../browser +--no-java-classpath +--java-classpath ../library/mer_rt.jar +--java-classpath ../library/mer_std.jar --config-file ../scripts/Mercury.config.bootstrap diff --git a/mdbcomp/Mmakefile b/mdbcomp/Mmakefile index 6b26da1..7be7ac6 100644 --- a/mdbcomp/Mmakefile +++ b/mdbcomp/Mmakefile @@ -78,8 +78,6 @@ LD_LIBFLAGS-libmer_mdbcomp.dylib = -install_name \ #-----------------------------------------------------------------------------# -JAVACFLAGS = -classpath $(LIBRARY_DIR) - MTAGS = $(SCRIPTS_DIR)/mtags LN = ln @@ -121,11 +119,7 @@ all: library all-ints $(TAGS_FILE_EXISTS) .PHONY: library -ifeq ("$(findstring java,$(GRADE))","java") -library: jars -else library: $(LIBS) -endif .PHONY: all-ints all-ints: $(MDBCOMP_LIB_NAME).int3s $(MDBCOMP_LIB_NAME).ints @@ -185,26 +179,6 @@ dates: #-----------------------------------------------------------------------------# -JARS = $(MDBCOMP_LIB_NAME).jar - -.PHONY: jars -jars: classes - echo jmercury/*.class > $(MDBCOMP_LIB_NAME).classes - $(JAR) $(JAR_CREATE_FLAGS) $(MDBCOMP_LIB_NAME).jar @$(MDBCOMP_LIB_NAME).classes - $(JAR) i $(MDBCOMP_LIB_NAME).jar - $(RM) $(MDBCOMP_LIB_NAME).classes - -JAVAS = $(wildcard jmercury/*.java) - -.PHONY: -classes: javas - $(JAVAC) $(ALL_JAVACFLAGS) $(JAVAS) - -.PHONY: javas -javas: $(MDBCOMP_LIB_NAME).javas - -#-----------------------------------------------------------------------------# - .PHONY: os cs ss ils ifneq ($(MMAKE_USE_MMC_MAKE),yes) os: $($(MDBCOMP_LIB_NAME).os) @@ -235,13 +209,7 @@ realclean_local: # Installation targets .PHONY: install - -# The ssdebug grade requires the interface files. -ifeq ("$(findstring ssdebug,$(GRADE))","ssdebug") -install: install_library install_ints -else install: install_library -endif .PHONY: install_dirs install_dirs: @@ -266,15 +234,13 @@ install_library: else ifneq (,$(findstring java,$(GRADE))) .PHONY: install_ints -install_ints: lib$(MDBCOMP_LIB_NAME).install_ints +install_ints: .PHONY: install_init install_init: .PHONY: install_library -install_library: jars - mkdir -p $(INSTALL_JAVA_LIBRARY_DIR) - cp $(JARS) $(INSTALL_JAVA_LIBRARY_DIR) +install_library: lib$(MDBCOMP_LIB_NAME).install else diff --git a/ssdb/Mmakefile b/ssdb/Mmakefile index 334b1ed..6bacbbb 100644 --- a/ssdb/Mmakefile +++ b/ssdb/Mmakefile @@ -89,8 +89,6 @@ LD_LIBFLAGS-libmer_ssdb.dylib = -install_name \ #-----------------------------------------------------------------------------# -JAVACFLAGS = -classpath $(LIBRARY_DIR):$(MDBCOMP_DIR):$(BROWSER_DIR) - MTAGS = $(SCRIPTS_DIR)/mtags LN = ln @@ -134,11 +132,7 @@ main: library $(TAGS_FILE_EXISTS) all: library $(TAGS_FILE_EXISTS) browse_test declarative_test .PHONY: library -ifeq ("$(findstring java,$(GRADE))","java") -library: jars -else library: $(LIBS) -endif .PHONY: depend depend: SSDB_FLAGS $(DEPENDS) @@ -220,25 +214,6 @@ dates: #-----------------------------------------------------------------------------# -JARS = $(SSDB_LIB_NAME).jar - -.PHONY: jars -jars: classes - echo jmercury/*.class > $(SSDB_LIB_NAME).classes - $(JAR) $(JAR_CREATE_FLAGS) $(SSDB_LIB_NAME).jar @$(SSDB_LIB_NAME).classes - $(JAR) i $(SSDB_LIB_NAME).jar - $(RM) $(SSDB_LIB_NAME).classes - -JAVAS = $(wildcard jmercury/*.java) - -.PHONY: -classes: javas - $(JAVAC) $(ALL_JAVACFLAGS) $(JAVAS) - -javas: $(SSDB_LIB_NAME).javas - -#-----------------------------------------------------------------------------# - .PHONY: os cs ss ils ifneq ($(MMAKE_USE_MMC_MAKE),yes) os: $($(SSDB_LIB_NAME).os) @@ -297,18 +272,16 @@ install_library: else ifneq (,$(findstring java,$(GRADE))) .PHONY: install_ints -install_ints: lib$(SSDB_LIB_NAME).install_ints +install_ints: .PHONY: install_init install_init: .PHONY: install_hdrs -install_hdrs: lib$(SSDB_LIB_NAME).install_hdrs +install_hdrs: .PHONY: install_library -install_library: jars - mkdir -p $(INSTALL_JAVA_LIBRARY_DIR) - cp $(JARS) $(INSTALL_JAVA_LIBRARY_DIR) +install_library: lib$(SSDB_LIB_NAME).install else diff --git a/ssdb/SSDB_FLAGS.in b/ssdb/SSDB_FLAGS.in index c2d55c1..72d8925 100644 --- a/ssdb/SSDB_FLAGS.in +++ b/ssdb/SSDB_FLAGS.in @@ -6,6 +6,7 @@ --no-shlib-linker-use-install-name --force-disable-tracing --no-ssdb +--no-libgrade --generate-mmc-deps -I../library -I../mdbcomp @@ -25,4 +26,8 @@ -L../trace -L../mdbcomp -L../browser +--no-java-classpath +--java-classpath ../library/mer_rt.jar +--java-classpath ../library/mer_std.jar +--java-classpath ../browser/mer_browser.jar --config-file ../scripts/Mercury.config.bootstrap -------------------------------------------------------------------------- mercury-reviews mailing list Post messages to: mercury-reviews@... Administrative Queries: owner-mercury-reviews@... Subscriptions: mercury-reviews-request@... -------------------------------------------------------------------------- |
|
|
Re: for review: install java grade with mmc --makeOn Tue, 20 Oct 2009, Peter Wang wrote: > Branches: main > > Use mmc --make to install Java grades. The makefile rules in library/Mmakefile > did not install .opt files into <prefix>/lib/mercury/ints/java. When > intermodule optimisation was enabled with a Java grade, the Mercury compiler > would read the .opt files from <prefix>/lib/mercury/ints, which could be from > *any* grade (they are only installed to work around problems with Mmake). > > Mmakefile: > Force mmc --make to be used to install Java grades. > > browser/Mmakefile: > library/Mmakefile: > mdbcomp/Mmakefile: > ssdb/Mmakefile: > Delete rules for building libraries in the Java grade with Mmake. > > Move --no-libgrade options to *_FLAGS files. > > library/Mmakefile: > Create the jmercury -> ../java symlink at the `mmake depend' step. > > Pass -sourcepath . to javac so it can find the jmercury/runtime/*.java > files. > > browser/MDB_FLAGS.in: > compiler/COMP_FLAGS.in: > library/LIB_FLAGS.in: > mdbcomp/MDBCOMP_FLAGS.in: > ssdb/SSDB_FLAGS.in: > Add --no-libgrade options so that mmc --make libFOO.install only > installs the main grade. > > Add --no-java-classpath so that the .jar files from the installed > compiler aren't used. > > Tell the Java compiler about .jar files that each directory depends on. > > README.Java: > Remove a mention of Mmake with the java grade. That's fine. Julien. -------------------------------------------------------------------------- mercury-reviews mailing list Post messages to: mercury-reviews@... Administrative Queries: owner-mercury-reviews@... Subscriptions: mercury-reviews-request@... -------------------------------------------------------------------------- |
| Free embeddable forum powered by Nabble | Forum Help |