Commit Graph

143 Commits

Author SHA1 Message Date
Zoltan Somogyi
96454662c0 Pass $(ALL_GRADEFLAGS) to all invocations of the compiler, since
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.rules:
	Pass $(ALL_GRADEFLAGS) to all invocations of the compiler, since
	the compiler now has sanity checks on option values that could be
	tripped with the default grade that may not be tripped with the actual
	desired grade.

library/Mmakefile:
	Delete my previous "fix" for this problem, since it is not needed
	anymore.
2003-03-27 05:32:09 +00:00
Michael Wybrow
e701e06c2e Make sure the Java back-end puts class files in the right place with
Estimated hours taken: 3
Branches: main

Make sure the Java back-end puts class files in the right place with
`--use-subdirs' and properly cleans up all generated .class files.

mercury/compiler/compile_target_code.m:
mercury/scripts/Mmake.rules:
	Tell to Java compiler to put generated .class files in the
	`Mercury/classs' directory.

mercury/compiler/modules.m:
	Clean up all generated .class files.
2003-02-12 07:00:06 +00:00
Fergus Henderson
20d4ab3dda Be consistent about using -' rather than /' for options to cl.
Estimated hours taken: 1
Branches: main, release

scripts/Mmake.rules:
compiler/compile_target_code.m:
	Be consistent about using `-' rather than `/' for options to cl.
	Use `-o ' rather than `-link -out:'.
	Ensure that `-o' comes before $(MS_CL_LIBS).
	Resynchronize the release branch with the main branch.
2002-11-20 12:33:02 +00:00
Peter Ross
dc060b2ed3 Fix a bug in my previous change to fix a bug in fjh's previous change.
Estimated hours taken: 0.5
Branches: main

Fix a bug in my previous change to fix a bug in fjh's previous change.
Revert back to using '/out:', and instead add the flag '/link' so that '/out:'
is passed to the linker instead to avoid problems compiling the library.

scripts/Mmake.rules:
compiler/compile_target_code.m:
	Add '/link' before the '/out:'.

scripts/Mmake.rules:
	Also add fjh's change for /LD to other rules building .dlls.
2002-11-15 12:09:18 +00:00
Peter Ross
e79cb48f1d Fix a bug in fjh's previous change where we are passing the linker
Estimated hours taken: 0.5
Branches: main

Fix a bug in fjh's previous change where we are passing the linker
flag for naming the output file to the C compiler, not the C compiler
flag.

scripts/Mmake.rules:
	'-o' is the flag for naming the output file for the C compiler.
2002-11-15 10:11:02 +00:00
Fergus Henderson
29679e979a When invoking $(MS_CL) to create DLLs, use the option "/LD" which
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	When invoking $(MS_CL) to create DLLs, use the option "/LD" which
	is documented in the help message, rather than the (undocumented?)
	options "-link -noentry mscoree.lib -dll".
2002-11-06 04:24:22 +00:00
Fergus Henderson
6d7c9629a4 Fix a bug where `mercury.dll' was not being found by the C# compiler.
Estimated hours taken: 3
Branches: main

Fix a bug where `mercury.dll' was not being found by the C# compiler.
when you configured with a non-MS C compiler.  This bug broke
tests/hard_coded/foreign_type in grade il.

configure.in:
bindist/bindist.build_vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC.

scripts/Mmake.vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC,
	and add new variables FIX_PATH_FOR_CL and FIX_PATH_FOR_CSC.
	The new variables are currently hard-wired as `cygpath -w',
	since currently we only support the MS versions of CL and CSC.

	Also, change the definition of MERC_DLL_DIR to use $(GRADE)
	rather than hard-coding "ilc".

scripts/Mmake.rules:
	Use the new variables, rather than $(CYGPATH).

	Also, update various comments, and delete the unnecessary version
	number from the MS_VC7_INCLUDES_DIR and MS_VC7_INCLUDES variable
	names.

scripts/ml.in:
	Use @FIX_PATH_FOR_CC@ rather than @CYGPATH@.
2002-10-24 09:16:11 +00:00
Fergus Henderson
1af57b2855 Run $(RANLIB) on the installed libraries.
Estimated hours taken: 0.75
Branches: main

scripts/Mmake.rules:
boehm_gc/Mmakefile:
runtime/Mmakefile:
library/Mmakefile:
trace/Mmakefile:
	Run $(RANLIB) on the installed libraries.
	This is needed on MacOS 10.1, where the linker checks the date
	stamp on the .a file, refusing to link if this date is greater
	than the date when ranlib was run.  Since installing the
	libraries with `cp' updates their timestamp, we need to rerun ranlib.

scripts/Mmake.rules:
	Change some hard-coded occurrences of `.a' to `.$A'.  This is
	probably needed to make things work properly when building with MSVC.
2002-10-18 04:16:18 +00:00
Fergus Henderson
ffee30fa53 Change things so that LIBGRADES includes the default grade.
Estimated hours taken: 1
Branches: main

Change things so that LIBGRADES includes the default grade.
This fixes a bug that sometimes caused the libraries not to be
installed in the default grade, e.g. when $(GRADE) is set in Mmake.params.

configure.in:
	Don't delete $(GRADE) from $(LIBGRADES).

Mmakefile:
scripts/Mmake.rules:
compiler/make.program_target.m:
	Change the loops over $(ALL_LIBGRADES) so that they skip $(GRADE).

scripts/Mmake.vars.in:
	Delete an bogus assignment setting LIBGRADES to empty, since it
	wasn't being used (LIBGRADES was being assigned again below).
	Update the documentation for LIBGRADES.
2002-10-15 16:23:57 +00:00
Fergus Henderson
16cbea5ca7 Define ERR_REDIRECT in Mmake.vars.in, rather than Mmake.rules,
Branches: main
Estimated hours taken: 0.25

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Define ERR_REDIRECT in Mmake.vars.in, rather than Mmake.rules,
	so that it can be overridden by the user's Mmakefile.
2002-09-15 10:01:51 +00:00
Fergus Henderson
bf5a95b6d7 Make the redirection of errors into `.err' files configurable,
Branches: main
Estimated hours taken: 1

scripts/Mmake.rules:
	Make the redirection of errors into `.err' files configurable,
	by abstracting out the code to redirect errors into a variable
	ERR_REDIRECT.  By default the behaviour remains the same, but if
	you run `mmake ERR_REDIRECT=', then errors will not be redirected.
2002-09-13 18:51:40 +00:00
Simon Taylor
634193dc4b Fix errors caused by attempting to move nonexistent files
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.rules:
	Fix errors caused by attempting to move nonexistent files
	when installing libraries.
2002-08-24 11:54:26 +00:00
Simon Taylor
a77d488245 In the presence of foreign code the .opt' and .trans_opt' files
Estimated hours taken: 10
Branches: main

In the presence of foreign code the `.opt' and `.trans_opt' files
aren't grade independent, so install them in grade-dependent
directories.

scripts/Mmake.vars.in:
	Define $(INSTALL_GRADE_INT_DIR), which holds `.opt'
	and `.trans_opt' files.

	Pass the extra libraries to mmc using `--ml' and `--mld'
	(`--mercury-library' and `--mercury-library-directory')
	options, rather than just a `-I' option. This is needed
	so that $(INSTALL_GRADE_INT_DIR) is searched for `.opt'
	files before $(INSTALL_INT_DIR)

	Fix a bug -- the `-I' options for libraries should
	go in CFLAGS, not MGNUCFLAGS.

scripts/Mmake.rules:
	Create INSTALL_GRADE_INT_DIR in the install_grade_dirs target.

compiler/modules.m:
	Install `.opt' and `.trans_opt' files in $(INSTALL_GRADE_INT_DIR).

	`.int0' files are needed by `.opt' files for sub-modules, so
	install them.

	<module>.int0s now only contains the names of modules with sub-modules
	(this is needed to avoid attempting to install nonexistent `.int0'
	files).

compiler/handle_options.m:
	Add $(INSTALL_GRADE_INT_DIR) for each `--mercury-library' option
	to `--intermod-directories'.

Mmakefile:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	Simplify the code to copy/remove the grade dependent files
	before building the libraries in a new grade when installing.

	Copy/remove all grade-dependent files, including `.opt' files
	and `.dv' files.
2002-08-22 02:34:21 +00:00
Simon Taylor
44ef4e118b Library installation with `mmc --make'.
Estimated hours taken: 10
Branches: main

Library installation with `mmc --make'.

compiler/make.m:
compiler/make.program_target.m:
	Handle `mmc --make lib<module>.install'.

compiler/options.m:
	Add an option `--use-grade-subdirs', which causes
	all grade-dependenent files to be placed in
	`Mercury/<grade>/<ext>s' subdirectories, even
	those files that are intended for use by the user.

	`--use-grade-subdirs' is not documented because it
	is only intended for use in library installation
	with `mmc --make' (it doesn't work at all with Mmake).
	Documenting it would require documenting (and setting
	in stone) the layout of the `Mercury' directory, which
	is probably a bad idea.

Mmake.workspace:
compiler/handle_options.m:
scripts/Mmake.rules:
	Header files are now always searched for using the plain
	file name (not Mercury/mihs/module.mih), so add a
	`--c-include-directory' option to search Mercury/mihs
	in the current directory.

compiler/modules.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/mercury_compile.m:
compiler/mlds_to_c.m:
compiler/trans_opt.m:
	Handle `--use-grade-subdirs' in module_name_to_file_name.

	Add module_name_to_search_file_name, which should be
	used to generate the names of files that might be part
	of an installed library. This is needed because installation
	and local directory hierarchies have a different layout,
	A better long-term fix would be to change things so that
	the installation and local directory layouts are the same.

compiler/make.util.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
	Add an extra argument to get_target_timestamp and
	get_file_name to specify whether the file should
	be searched for.

compiler/options_file.m:
scripts/Mmake.vars.in:
	Handle the LIBGRADES and INSTALL_PREFIX make variables.

doc/user_guide.texi:
	Remove the statement that library installation is
	not supported with `mmc --make'.
2002-08-07 13:12:11 +00:00
Simon Taylor
571e3318a1 In the presence of foreign code the .opt' and .trans_opt' files
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.rules:
compiler/modules.m:
	In the presence of foreign code the `.opt' and `.trans_opt' files
	aren't grade independent, so pass $(ALL_GRADEFLAGS) to mmc
	when creating them.
2002-06-26 08:20:58 +00:00
Simon Taylor
81db7bb118 My change to fix the handling of target specific MCFLAGS
Estimated hours taken: 1.5
Branches: main

My change to fix the handling of target specific MCFLAGS
variables didn't work with `--split-c-files'.

compiler/modules.m:
	Fix some bugs in the handling of `--split-c-files':

	- Make `--split-c-files' work where the module name doesn't
	  match the file name.

	- $(MCFLAGS-module) wasn't being passed to mmc when `module.dir/*.o'
	  were being rebuilt (it was being passed when the files were
	  being built from scratch).

scripts/Mmake.rules:
	The pattern rule for `%.dir/*.o' is now redundant, so remove it.
2002-06-25 14:24:10 +00:00
Simon Taylor
9406f99f9d Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
Estimated hours taken: 5
Branches: main

Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
The tests don't work yet.

compiler/make.m:
compiler/make.module_target.m:
	Handle targets such as `<module>.cs' and `<module>.ints',
	which are used when building stage 3.

Mmake.common.in:
*/Mmakefile:
*/Mercury.options:
	Add Mercury.options files to pass module-specific flags to
	`mmc --make'.

	Avoid triggering the .DEFAULT rule introduced with `--use-mmc-make'
	for optional files like Mmake.params.

compiler/modules.m:
	Build the interface files when building a library in IL grades,
	for consistency with C grades.

library/Mmakefile:
	Improve performance by removing the dependency on the interface
	files when building the library. The files are now always built
	by the libmer_std target.

	Pass the command to build libmer_std.init to `mmc --make'.

tools/bootcheck:
	Add an option `--use-mmc-make'.

	Copy the Mercury.options files into the stage2 and stage3 directories.

scripts/Mmake.rules:
	Don't include the rules for `.dep' files with `--use-mmc-make'.

	Include the rule for `--convert-to-mercury' even with `--use-mmc-make'.

compiler/Mmakefile:
tools/bootcheck:
tools/binary_step:
	`mmc --make' doesn't handle `<module>_init.c' targets, so
	don't make the `cs' target depend on `top_level_init.c'.
	As far as I can tell, that dependency is only present so
	that the stage2 and stage3 compilers have the same set of
	C files. bootcheck and binary_step now only compare `.c'
	files which are present in the stage3 directory.
2002-06-22 19:16:15 +00:00
Simon Taylor
9e947575d6 Remove Prolog support.
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Remove Prolog support.
2002-06-20 07:14:06 +00:00
Simon Taylor
0f2865b42b Avoid generating interface files for the library in
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	Avoid generating interface files for the library in
	the compiler directory by stripping the directory
	from the module name passed to mmc.
2002-06-10 07:03:14 +00:00
Simon Taylor
cc42c6d98a Fix a bug in my change to generate grade dependent header files.
Estimated hours taken: 0.25
Branches: main

Fix a bug in my change to generate grade dependent header files.
The `.mih' files weren't being installed for the default grade.

scripts/Mmake.rules:
	Run `lib<main_module>.install_grade_hdrs' for
	all grades, including the default grade.

Mmakefile:
library/Mmakefile:
	libmer_std.install_grade_hdrs is now run by
	libmer_std.install_library, so it doesn't
	need to be explicitly invoked here.
2002-05-31 07:02:37 +00:00
Simon Taylor
ac5c98bdaf Fix problems with the compiler-generated header files:
Estimated hours taken: 25
Branches: main

Fix problems with the compiler-generated header files:
1. the header files are grade dependent, but the header files
   can only be installed for one grade.
2. the generated header files can clash with system headers.

To solve these problems, the compiler now generates a
grade dependent `.mih' file containing the declarations
needed when a module is imported in a high-level C code
grade, and a grade independent `.mh' file, which contains
the prototypes for `:- pragma export' declarations.

compiler/export.m:
	Generate a `.mh' rather than a `.h' file for the `:- pragma export'
	declarations.

	Allow the header file generated by export.m to be used with
	`--high-level-code'.

compiler/modules.m:
library/Mmakefile:
	Add a module.install_grade_hdrs target to install the `.mih'
	files in a grade-dependent directory.

compiler/arg_info.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
	Make it easier to tell if the arg_info field of the proc_info
	has been set.

compiler/mlds_to_c.m:
	Include both the `.mh' and `.mih' files for imported modules.

	The type used as the return value for a semidet procedure
	exported to C is `MR_bool', not `MR_Word'.

compiler/mlds_to_c.m:
compiler/modules.m:
	Don't add a `mercury.' prefix to the standard library
	header file names. They can't clash with the system
	headers any more.

compiler/mercury_compile.m:
compiler/mlds_to_c.m:
	Use export.m to generate the header file for `:- pragma export'
	declarations even in hlc grades.

compiler/mlds.m:
compiler/ml*.m:
	Distinguish between the `.mh' and `.mih' files
	in `mlds__import's.

compiler/handle_options.m:
scripts/Mmake.vars.in:
scripts/mgnuc.in:
	Add C include directory options for the installed grade
	dependent `.mih' files.

Mmakefile:
scripts/Mmake.rules:
	s/h/mih/ in the commands to save the grade dependent
	files when installing the library grades.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.util.m:
	Handle dependencies on `.mh' and `.mih' files.

NEWS:
doc/user_guide.texi:
	Document the change.
2002-05-30 12:55:23 +00:00
Simon Taylor
30686b9e1d Remove Prolog support.
Estimated hours taken: 0.5
Branches: main

Remove Prolog support.

Makefile:
	Don't clean up Prolog files.

configure.in:
bindist/bindist.configure.in:
scripts/Mmakefile:
scripts/sicstus_conv.in:
	Remove sicstus_conv.in.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Remove Prolog-related variables and targets.
2002-05-16 06:48:43 +00:00
Simon Taylor
462a0c2780 More changes to make `mmc --make' work with mmake.
Estimated hours taken: 5
Branches: main

More changes to make `mmc --make' work with mmake.

scripts/Mmake.vars.in:
	Pass MCFLAGS, CFLAGS, MLFLAGS, etc. to mmc in an options file
	on standard input.

	Don't add options for EXTRA_LIBRARIES to CFLAGS and MLFLAGS
	when compiling with `mmc --make'. mmc handles those options
	itself.

compiler/options.m:
compiler/options_file.m:
doc/user_guide.texi:
	`--options-file -' now makes the compiler read an options
	file from standard input.

	Make `--options-file' behave as a standard accumulating option
	rather than attempting to copy the behaviour of make's `-f' option.

	s/--link_object/--link-object/

Mmake.workspace:
	Put the `.a' files for the libraries in MLOBJS, not MLLIBS.
	`mmc --make' will now relink when they change.

compiler/modules.m:
	Link MLOBS into `module.split'.

tests/debugger/Mmakefile:
	Create a Mercury.options file for use in compiling
	the queries in interactive.m test.
2002-05-04 15:16:03 +00:00
Simon Taylor
e6d6f095d7 s/MC_MAKE_FILES/MC_BUILD_FILES/ as suggested by rafe.
Estimated hours taken: 0.1
Branches: main

scripts/mmake.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	s/MC_MAKE_FILES/MC_BUILD_FILES/ as suggested by rafe.
2002-05-02 05:53:00 +00:00
Simon Taylor
6dcbb587f2 Allow `mmc --make' to be used with Mmake.
Estimated hours taken: 2.5
Branches: main

Allow `mmc --make' to be used with Mmake.

scripts/mmake.in:
	Add an option `--use-mmc-make', which tells mmake
	to use `mmc --make' to build Mercury targets.

scripts/Mmake.vars.in:
	Add a variable MC_MAKE_FILES, which should contain
	files (e.g. generated header files) which should be
	build with `mmc --make'.

	Add a variable MERCURY_MAIN_MODULES which should
	contain the top-level module names of the programs
	or libraries in the directory. The targets for
	the modules appearing in MERCURY_MAIN_MODULES
	are added to MC_MAKE_FILES.

	Add a variable MC_MAKE_FLAGS, which is like
	MCFLAGS, but is only passed to `mmc --make'.

scripts/Mmake.rules:
	Disable Mercury-specific rules when `--use-mmc-make'
	is passed to mmake.

	Use `mmc --make' for targets for which there are no
	rules, or for targets appearing in MC_MAKE_FILES.
2002-05-01 17:13:21 +00:00
Simon Taylor
351e020527 Fix a bug with --use-subdirs'. Mmake was looking for .il' files
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Fix a bug with `--use-subdirs'. Mmake was looking for `.il' files
	in the `Mercury/os' directory.
2002-04-30 03:49:50 +00:00
Simon Taylor
c1ff17b9cb Fix bugs in my change to improve the handling of linking
Estimated hours taken: 0.1
Branches: main

Fix bugs in my change to improve the handling of linking
with a non-installed standard library.

scripts/mmake.in:
	Export MERCURY_STDLIB_DIR.

scripts/Mmake.rules:
	Always set MERC_INT_DIR to avoid undefined variable warnings.
2002-04-20 15:00:32 +00:00
Simon Taylor
b99e6cc370 Allow alternative locations for the standard library files
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.

All of the Mercury scripts now accept an option
`--mercury-standard-library-directory' to specify the installed
library to use, or `--no-mercury-standard-library-directory' to
disable the use of the installed library. The location
of the alternate files to use can then be specified
using ordinary options to the scripts.

There is a new environment variable MERCURY_STDLIB_DIR, which has
the same effect as the `--mercury-standard-library-directory' option.

scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
scripts/mmc.in:
scripts/mmake.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	Handle MERCURY_STDLIB_DIR and `--mercury-standard-library-directory'.

	Remove support for the MERCURY_C_INCL_DIR, MERCURY_MOD_LIB_DIRS
	and MERCURY_TRACE_LIB_DIRS environment variables -- they aren't
	used anywhere. MERCURY_C_INCL_DIR is being removed because the
	assumption it makes (that all header files are installed into
	a single directory) will not hold for much longer because the
	generated header files for hl* grades are grade dependent.

compiler/options.m:
compiler/compile_target_code.m:
	Add an option `--trace-init-file', used to specify `.init'
	files which should only be used when tracing is enabled,
	such as browser/mer_browse.init.

	Allow `--mercury-stdlib-dir' as an abbreviation for
	`--mercury-standard-library-directory'.

tools/lmc:
	Use options rather than environment variables.

doc/user_guide.texi:
	Document MERCURY_STDLIB_DIR, MERCURY_TRACE_LIB_MODS
	and the `--trace-init-file' mmc option.

	Remove documentation for the no longer used MERCURY_C_INCL_DIR,
	MERCURY_MOD_LIB_DIRS, MERCURY_TRACE_LIB_DIRS and
	MERCURY_NC_BUILTIN environment variables.
2002-04-19 14:59:37 +00:00
Fergus Henderson
42afcc5b38 Add Mmake support for the Java back-end.
Estimated hours taken: 2
Branches: main

Add Mmake support for the Java back-end.

XXX TODO: Document it.

compiler/modules.m:
	Add rules for generating `foo.javas' and `foo.classes' targets
	and variables.

scripts/Mmake.rules:
compiler/modules.m:
	Add rules for building .java, .java_date, and .class files.

scripts/Mmake.vars.in:
	Add variables JAVAC, ALL_JAVACFLAGS, JAVACFLAGS, EXTRA_JAVACFLAGS,
	TARGET_JAVACFLAGS, LIB_JAVACFLAGS, javas_subdir, java_dates_subdir,
	and classes_subdir.
	Also add some comments.
2002-02-19 10:56:22 +00:00
Simon Taylor
c8b097668d Remove some unused code left over from an old method
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Remove some unused code left over from an old method
	of handling dependencies on MLOBJS.
2002-01-07 06:27:17 +00:00
Simon Taylor
3ef5a01ad9 s/($VAR)/$(VAR)/
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	s/($VAR)/$(VAR)/
2002-01-06 06:07:54 +00:00
Simon Taylor
60348f5df5 Allow MLOBJS-module Mmake variables.
Estimated hours taken: 0.5
Branches: main

Allow MLOBJS-module Mmake variables.

scripts/Mmake.vars.in:
	Define TARGET_MLOBJS, ALL_MLOBJS and ALL_MLPICOBJS.

scripts/Mmake.rules:
compiler/modules.m:
	Use ALL_MLOBJS and ALL_MLPICOBJS instead of
	MLOBJS and MLPICOBJS.
2002-01-05 14:12:35 +00:00
Simon Taylor
5bbf28f105 Fix a bug in my change to add timestamps for `.c' files
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	Fix a bug in my change to add timestamps for `.c' files
	which broke installation of user libraries. Move the `.c_date'
	file into the temporary directory with the `.c' file while
	building the library to install in all the different grades.
2001-08-14 16:48:42 +00:00
Peter Ross
6909db9721 Add a rule to build an executable from a C# source file.
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
    Add a rule to build an executable from a C# source file.
2001-08-14 08:19:31 +00:00
Peter Ross
bd19fe9e3e Optionally generate strongly named assemblies on the IL backend.
Estimated hours taken: 8
Branches: main

Optionally generate strongly named assemblies on the IL backend.

Strongly named assemblies are required by some aspects of the .NET
framework.  For example, when creating COM+ components.

We use the fact that you are allowed use the same key pair to sign more
then one assembly.  The key pair we use is the one used to sign the
mercury std library.  This allows us to place the correct public key
token in the `.assembly extern' reference.

README.DotNet:
    Document how to generate a strongly named assembly.

compiler/mlds_to_csharp.m:
compiler/mlds_to_mcpp.m:
    If --sign-assembly is enabled output a custom attribute which
    references the strong name key file `mercury.sn'.

compiler/mlds_to_il.m:
    If --sign-assembly is enabled add the correct decls to all the
    `.assembly extern' declarations.

compiler/modules.m:
    If --sign-assembly we need to generate a dependency between the IL
    file and the strong name key file `mercury.sn', also add the
    variable ILASM_KEYFLAG-<module> so that we add the option to sign
    the assembly with the key file `mercury.sn'.

compiler/options.m:
    Add --sign-assembly.

library/Mmakefile:
    Install the library strong name file as `mercury.sn' in the dll
    install directory.

scripts/Mmake.rules:
    Add a rule to copy mercury.sn into the local subdirectory.  This is
    needed so that cpp and csharp modules can reference this file.

scripts/Mmake.vars.in:
    Add the ILASM_KEYFLAG variables.
2001-08-12 13:29:17 +00:00
Tyson Dowd
8496ab341a Implement the array operations (in C#).
Estimated hours taken: 2
Branches: main

Implement the array operations (in C#).
Add flags for handling compiling C# files in the library directory.

library/Mmakefile:
	Add /t:module to the C# compiler flags.
	We need this because by default C# creates assemblies, but we
	expect the library to be composed of modules.

library/array.m:
	Implement most of the functionality of arrays in C#.
	We still need to implement
		array__make_empty_array/1
		array__resize/4
		array__shrink/3
		array__copy/3
	array__make_empty_array requires more RTTI support (to figure
	out what type of array to create), and array__copy requires an
	implementation of deep_copy.

	You need the latest changes to the compiler which map array(T)
	to System.Array or T[] for this to compile.

scripts/Mmake.rules:
	Add ALL_MS_CSCFLAGS to the C# compiler flags.

scripts/Mmake.vars.in:
	Add MS_CSCFLAGS and associated flags.
2001-08-03 12:30:53 +00:00
Tyson Dowd
e9d95ada12 Change calls to mercury::runtime::convert to System::Covert.
Estimated hours taken: 2
Branches: main

library/builtin.m:
library/private_builtin.m:
library/sparse_bitset.m:
library/string.m:
	Change calls to mercury::runtime::convert to System::Covert.
	Use __box instead of mercury::runtime::Convert::ToObject

runtime/Mmakefile:
	Add a rule to remove the DOTNET_DLLS for clean_local.

runtime/mercury_il.il:
	Remove ConvertImpl class, use unbox and ldobj instead of ToInt32.

runtime/mercury_mcpp.cpp:
	Remove Convert class.

runtime/mercury_mcpp.h:
	Use __box instead of mercury::runtime::Convert::ToObject

scripts/Mmake.rules:
	Put the local include directory before the installed one when
	compiling with MC++.
	Also fix the rule for .cpp.dll to be the same as the subdir
	rule.
2001-07-31 10:08:03 +00:00
Simon Taylor
8ba417ad67 Fix a bug in my change to add timestamps for `.c' files
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	Fix a bug in my change to add timestamps for `.c' files
	which broke `--use-subdirs'.
2001-07-28 06:55:17 +00:00
Fergus Henderson
8b45bd6016 Fix a bug which occurred when combining --target asm with --use-subdirs.
Branches: main, release
Estimated hours taken: 1

Fix a bug which occurred when combining --target asm with --use-subdirs.

scripts/Mmake.rules:
compiler/modules.m:
	The .pic_s files go in the `pic_ss' subdirectory,
	not in the `ss' subdirectory.

scripts/Mmake.vars.in:
	Add `pic_ss_subdir' variable.
2001-07-27 16:06:29 +00:00
mercury
76b287a421 Fix a bug with the GCC back-end Mmake support that seems to have been
Branches: main
Estimated hours taken: 2

Fix a bug with the GCC back-end Mmake support that seems to have been
triggered somehow by stayl's .c_date changes.

scripts/Mmake.rules:
	For the *__c_code.{o,pic_o} targets, depend on the .s/.pic_s
	file rather than the .c file, since the .c file is generated
	as a side effect of generating the .s/.pic_s file.
2001-07-27 06:12:31 +00:00
Tyson Dowd
66bbcfc26d Merge the changes to support csharp building into the main branch
Estimated hours taken: 4
Branches: main

Merge the changes to support csharp building into the main branch
of the compiler.

compiler/modules.m:
	Write the CSHARP_ASSEMBLY_REFS-modulename for each C# foreign
	module.

scripts/Mmake.rules:
	Add rules to build C# DLLs.
2001-07-24 14:19:23 +00:00
Peter Ross
2c5af924c0 Remove the .foreign_os target.
Estimated hours taken: 0.25
Branches: main

Remove the .foreign_os target.

compiler/modules.m:
    Don't generate any references to .foreign_os.

scripts/Mmake.rules:
    Remove the .obj file which is created as a side effect by MSVC.
2001-07-18 09:37:34 +00:00
Peter Ross
9e20b981ea Add mmake support for building modules which contain foreign code on the
Estimated hours taken: 5
Branches: main

Add mmake support for building modules which contain foreign code on the
IL backend.
Note that currently we don't install mercury_il.dll and mercury_mcpp.dll
somewhere where the C compiler can find them, so this change doesn't
work out of the box.

compiler/mlds_to_ilasm.m:
    Change the output file name for cpp files to <modulename>__cpp_code.cpp

compiler/mlds_to_mcpp.m:
    No longer output a reference to <modulename>.dll, as the cpp code
    doesn't refer to any of the entities defined in this dll.

compiler/modules.m:
    If a module contains some foreign code and we are on the IL backend
    generate a dependency which causes the foreign code dll to be built.
    Generate the make variable .foreign, .foreign_cs, .foreign_os and
    .foreign_dlls which refer to all the foreign modules.
    Generate rules to clean the foreign modules up.

scripts/Mmake.rules:
    Turn some unix paths into windows paths.

library/Mmakefile:
    Use the new .foreign variables to build the library instead of the
    previous hacks.
2001-07-17 15:40:38 +00:00
Simon Taylor
6e46b775b6 Fix a bug in my change to add timestamps for `.c' files.
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Fix a bug in my change to add timestamps for `.c' files.
	Create the subdirectories for the `.c_date', `.il_date',
	`.s_date' and `.pic_s_date' files when running `mmake depend'
	to work around a GNU make bug. (This duplicates similar code
	for `.date' etc. files).

	Fix a typo in the rules for `.pic_s' files.
2001-07-08 11:02:25 +00:00
Simon Taylor
120e4abf0c Fix a bug in my last change - add .PRECIOUS rules for
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Fix a bug in my last change - add .PRECIOUS rules for
	the new date stamp files to stop make removing them.
2001-07-07 05:50:51 +00:00
Simon Taylor
4a7fb746f9 Use a timestamp file mechanism similar to that used for `.int' files
Estimated hours taken: 3

Use a timestamp file mechanism similar to that used for `.int' files
to avoid rechecking whether a module needs to be recompiled on each
mmake if no used interfaces have changed.

compiler/mercury_compile.m:
	Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
	after compilation has finished.

compiler/recompilation_check.m:
	Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
	if a module does not need to be recompiled.

compiler/modules.m:
scripts/Mmake.rules:
	Set up the make dependencies for timestamp files, in a similar
	manner to the `.date' files.

	Remove the timestamp files in the `clean' mmake target.

	Handle `.s' and `.pic_s' files as for the `.o' files
	when using `--target asm'. There are no `.s' or `.pic_s'
	files for nested modules.

scripts/Mmake.vars.in:
	Set up the subdir variables for the timestamp files.

Mmakefile:
scripts/mercury_cleanup_install:
	Save/restore the timestamp files and the `.used' files
	across the library grade installation.

configure.in:
	Remove the `.c_date' files for the `.c' files that
	need to be rebuilt.

doc/user_guide.texi:
	Document the new file extensions.
2001-07-06 11:25:36 +00:00
Zoltan Somogyi
48dc5aae2c Fix a problem that used to cause installs into not-yet-created directories
Estimated hours taken: 0.5
Branches: main

Fix a problem that used to cause installs into not-yet-created directories
to fail.

scripts/Mmake.rules:
	Instead of invoking $(MC) --errorcheck-only when creating .err files,
	invoke the macros $(MCE).

scripts/Mmake.vars:
	Define the default value of $(MCE) as $(MC) --errorcheck-only.

compiler/Mmakefile:
	Override the default value of $(MCE) to specify the search path,
	just as all the other invocations of the Mercury compiler in this
	directory do. The absence of such override could lead to a raft
	of messages about interface files not being found when trying to
	create maybe_mlds_to_gcc.err.
2001-07-03 09:49:41 +00:00
Simon Taylor
9dd11b2fc6 Smart recompilation. Record version numbers for each item
Estimated hours taken: 400

Smart recompilation. Record version numbers for each item
in interface files. Record which items are used in each compilation.
Only recompile a module if the output file does not exist or
nothing has changed.

There is still some work to do on this:
- it doesn't work with inter-module optimization.
- it doesn't work when the module name doesn't match the file name.
  (this problem will go away when mmake functionality is moved into
  the compiler.

I'll hold off documenting this change in the NEWS file and
on the web page for a month or so, until I've had a bit more
experience using it.

compiler/options.m:
compiler/handle_options.m:
doc/user_guide.texi:
	Add an option `--smart-recompilation', currently off by default.

	Add an internal option `--generate-version-numbers' to control
	whether version numbers are written to the interface files. If
	`--smart-recompilation' is disabled because the module
	is being compiled with `--intermodule-optimization' (e.g. in the
	standard library), we still want to write the version numbers
	to the interface files.

	Add an option `--verbose-recompilation' (default off)
	to write messages describing why recompilation is needed.

	Add an option `--warn-smart-recompilation' (default on)
	to control warnings relating to the smart recompilation
	system. Warn if smart recompilation will not work with
	the output and inter-module optimization options given.

compiler/recompilation.m:
	Type declarations for smart recompilation.
	Predicates to record program items used by compilation.

compiler/recompilation_version.m:
	Compute version numbers for program items in interface files.

compiler/recompilation_usage.m:
	Find all items used by a compilation.

compiler/recompilation_check.m:
	Check whether recompilation is necessary.

compiler/timestamp.m:
	Timestamp ADT for smart recompilation.

compiler/mercury_compile.m:
	Invoke the smart recompilation passes.

compiler/modules.m:
compiler/prog_io.m:
	Return timestamps for modules read.

	When reading a module make sure the current input stream
	is reset to its old value, not stdin.

	Handle version number items in interface files.

compiler/module_qual.m:
compiler/unify_proc.m:
compiler/make_hlds.m:
	Record all items used by local items.

compiler/make_hlds.m:
	Process `:- pragma type_spec' declarations in
	add_item_list_clauses. The qual_info is needed
	when processing `:- pragma type_spec' declarations
	so that any equivalence types used by the declaration
	can be recorded as used by the predicate or function to
	which the `:- pragma type_spec' applies.

compiler/equiv_type.m:
	For each imported item, record which equivalence types
	are used by that item.

compiler/hlds_module.m:
	Add a field to the module_info to store information about
	items used during compilation of a module.

compiler/check_typeclass.m:
	Make sure any items used in clauses for typeclass method
	implementations are recorded in the `.used' file.

compiler/prog_data.m:
compiler/*.m:
	Factor out some duplicated code by combining the
	pred and func, and pred_mode and func_mode items.

	Make it easier to extract the name of a type, inst or mode
	from its declaration.

	Add an item type to hold the version numbers for an interface file.

	Allow warnings to be reported for `nothing' items (used for
	reporting when version numbers are written using an
	obsolete format).

compiler/prog_io.m:
compiler/prog_io_util.m:
compiler/typecheck.m:
compiler/type_util.m:
compiler/*.m:
	Strip contexts from all types, not just those in class constraints.
	This makes it possible to use ordinary unification to check
	whether items have changed (with the exception of clauses).

	Remove code to create types with contexts in typechecking.

	Remove code scattered through the compiler to remove contexts
	from types in class constraints.

compiler/hlds_pred.m:
compiler/prog_util.m:
	Move hlds_pred__adjust_func_arity to prog_util, so that it
	can be used by the pre-hlds passes.

compiler/typecheck.m:
compiler/hlds_module.m:
	Move typecheck__visible_modules to hlds_module.m, so it can
	be used by recompilation_usage.m.

compiler/typecheck.m:
	Add a comment telling where updates may be required if the
	code to typecheck a var-functor unification changes.

compiler/error_util.m:
	Allow writing messages without contexts (used for the verbose
	recompilation messages).

	Add functions to format sym_name and sym_name_and_arity,
	and to add punctuation to the end of an error message
	without unwanted line breaks before the punctuation.

scripts/Mmake.rules:
compiler/modules.m:
	Don't remove the output file before running the compiler. We need
	to leave the old output file intact if smart recompilation detects
	that recompilation is not needed.

compiler/notes/compiler_design.html:
	Document the new modules.

library/io.m:
NEWS:
	Add predicates to find the modification time of files
	and input_streams.

library/set.m:
NEWS:
	Add a predicate version of set__fold

	Don't sort the output of set__filter, it's already sorted.

library/std_util.m:
NEWS:
	Add a predicate `std_util__map_maybe/3' and a function
  	`std_util__map_maybe/2' to apply a predicate or a function to
    	a value stored in a term of type `std_util__maybe'.

configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
	When checking whether the compiler is recent enough, check for
	the --warn-smart-recompilation option.

	Check for stat().

library/Mmakefile:
	Disable warnings about smart recompilation not working with
	`--intermodule-optimization'.

browser/Mmakefile:
	Disable warnings about smart recompilation not working when
	the module name doesn't match the file name.

runtime/mercury_string.h:
	Add a macro MR_make_string_const() which automates computation
	of the length of string argument to MR_string_const().

tests/recompilation/Mmakefile:
tests/recompilation/runtests:
tests/recompilation/test_functions:
tests/recompilation/TESTS:
tests/recompilation/README:
	A framework for testing smart recompilation.
	The option currently only works for the recompilation directory.

tests/recompilation/TEST.m.{1,2}:
tests/recompilation/TEST_2.m.{1,2}:
tests/recompilation/TEST.exp.{1,2}:
tests/recompilation/TEST.err_exp.2:
	Test cases, where TEST is one of add_constructor_r, add_instance_r,
	add_instance_2_r, add_type_nr, change_class_r, change_instance_r,
	change_mode_r, field_r, func_overloading_nr, func_overloading_r,
	lambda_mode_r, nested_module_r, no_version_numbers_r,
	pragma_type_spec_r, pred_ctor_ambiguity_r, pred_overloading_r,
	add_type_re, remove_type_re, type_qual_re.

tests/handle_options:
	Add an option `-e' to generate any missing expected output files.
2001-06-27 05:05:21 +00:00
Tyson Dowd
bd732f891c Track the changes in the latest version of the .NET C++ compiler.
Estimated hours taken: 0.5
Branches: main

Track the changes in the latest version of the .NET C++ compiler.

scripts/Mmake.rules:
	Add mscoree.lib to the parameters passed to the C++ compiler.
2001-05-23 09:06:29 +00:00
Simon Taylor
319df48866 Remove the RM_C mmake variable, which controlled whether the intermediate
Estimated hours taken: 0.5
Branches: main

Remove the RM_C mmake variable, which controlled whether the intermediate
`.c' files were removed (now they never are).

The implementation was buggy (it didn't work with parallel makes), and
made it difficult to avoid always recompiling the `.c' file with smart
recompilation.

Mmake.common.in:
configure.in:
README.AIX:
bindist/bindist.build_vars.in:
bindist/bindist.configure.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
compiler/modules.m:
tools/bootcheck:
tools/binary_step:
*/Mmakefile:
	Remove references to RM_C, DEFAULT_RM_C and LIBRARY_RM_C.

compiler/modules.m:
	The `.o' and `.pic_o' file now depends only on the `.c' file,
	not on everthing the `.c' file depends on. The extra dependencies
	were only needed because the intermediate `.c' file could
	be removed by RM_C. This change is needed to avoid recompiling
	unchanged `.c' files with smart recompilation.
2001-05-18 14:23:59 +00:00