Commit Graph

76 Commits

Author SHA1 Message Date
Simon Taylor
7de0228bcc Fix the code to add extra initialization functions to library/mer_std.init.
Estimated hours taken: 1.5
Branches: main

Fix the code to add extra initialization functions to library/mer_std.init.

compiler/options.m:
doc/user_guide.texi:
compiler/compile_target_code.m:
	Rename the `--make-init-file-command' as `--extra-init-command'.
	This should now only generated the extra entries in the `.init'
	file, not the whole file.

scripts/Mmake.vars.in:
compiler/modules.m:
	Allow $(EXTRA_INIT_COMMAND) as the Mmake equivalent
	of `--extra-init-command'. Append the output of
	$(EXTRA_INIT_COMMAND) to the `.init' file.

library/Mmakefile:
	Set EXTRA_INIT_COMMAND rather than overriding the
	libmer_std.init rule.
2002-07-29 07:51:07 +00:00
Simon Taylor
0c437e9ad0 Fix a bug -- the grade-specific `inc' directory
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
compiler/handle_options.m:
	Fix a bug -- the grade-specific `inc' directory
	for an installed library must be searched first.
	`.mih' files are installed into the non-grade-specific
	directory to avoid adding an extra entry in VPATH,
	but those files won't necessarily be the right ones
	for the current grade.
2002-07-15 07:03:53 +00:00
Simon Taylor
4c4530f72b The code to look up the target-specific MCFLAGS variable
Estimated hours taken: 1
Branches: main

scripts/Mmake.vars.in:
	The code to look up the target-specific MCFLAGS variable
	assumed that mmc is always invoked by a pattern rule, which
	isn't true if the module name doesn't match the file name.
2002-06-24 16:15:22 +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
efd28044af Handle LDFLAGS and LD_LIBFLAGS with `mmc --make'.
Estimated hours taken: 1
Branches: main

Handle LDFLAGS and LD_LIBFLAGS with `mmc --make'.

compiler/options.m:
doc/user_guide.texi:
	Add `--ml-flags' as a synonym for `--link-flags'.

	Add `--ld-flags' and `--ld-libflags', which are the
	options corresponding to the LDFLAGS and LD_LIBFLAGS
	Mmake variables.

	Add a comment that the `--output-file' option is
	ignored with `mmc --make'.

compiler/options_file.m:
	Handle LDFLAGS and LD_LIBFLAGS.

	Handle MLLIBS correctly. MLLIBS contains `-l' options
	(which can be handled by mmc), not flags for ml.

	The value of LIBRARIES (which contains Mercury libraries
	to link with) now comes before MLLIBS, because Mercury
	libraries depend on C libraries, but C libraries usually
	don't depend on Mercury libraries.

compiler/compile_target_code.m:
	Pass the value `--ldflags' or `--ld-libflags' to ml.

scripts/Mmake.vars.in:
	Add LDFLAGS and LD_LIBFLAGS to the options file
	passed to the options file passed to `mmc --make'
	on standard input.
2002-05-25 13:25:17 +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
5d693f5a1c Factor out the common Mmake code to set up the mmc, mgnuc
Estimated hours taken: 8
Branches: main

Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.

Mmake.workspace:
	Similar to tools/lmc. Sets up Mmake variables to
	use the library files in a workspace rather than
	an installed library.

configure.in:
	Check for the `--no-mercury-stdlib-dir' mmc option.
	Bootstrap CVS tag: bootstrap_20020429_stdlib_dir

Mmake.common.in:
*/Mmakefile:
	Move common code into Mmake.workspace.

browser/Mmakefile:
library/Mmakefile:
	Avoid invoking the linker explicitly when creating
	libraries of Mercury code. That won't work well
	with `mmc --make'.

tools/bootcheck:
tests/Mmake.common:
	Use Mmake.workspace instead of setting up environment
	variables in bootcheck.

scripts/Mmake.vars.in:
	mmc compiles split C files to object code itself,
	so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
	compiling with `--split-c-files'.

browser/interactive_query.m:
	Use `mmc --make' when compiling the query. This is needed
	to make tests/debugger/interactive_query.m work when linking
	against a workspace using options rather than environment
	variables.  This also fixes a bug -- mmc options were being
	passed to ml.

	Clean up after the query.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Generate the input file to this test so that MCFLAGS
	and MC_MAKE_FLAGS (from Mmake.workspace) are used when
	compiling queries.

	tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
	to allow the use of $(...) style command substitution
	(`...` style command substitution can't be nested).

tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
	Include tests/Mmake.common.

tools/*:
scripts/c2init.in:
scripts/ml.in:
	Update the lists of files containing the library names.
2002-04-29 08:22:08 +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
Simon Taylor
9c9601808d Add an alternative implementation of Mmake as part of the compiler.
Estimated hours taken: 500

Add an alternative implementation of Mmake as part of the compiler.
The advantages of this are
	- more accurate dependencies
	- no `mmake depend' step
	- less process creation (no processes are created to
		build interface files).

Still to do:
	- handle --split-c-files
	- handle the IL backend properly
	- library installation
	- allow the compiler to be built and the nightly tests
	  to be run with `mmc --make'

compiler/make.m:
	Control the build process.

compiler/make.program_target.m:
	Build executables and libraries.

compiler/make.module_target.m:
	Build C files, object files, interface files etc.

compiler/make.dependencies.m:
	Work out the depenendencies between targets.

compiler/make.module_dep_file.m:
	Record the inter-module dependencies between invocations of mmc.

compiler/make.util.m:
	Utility predicates used by `mmc --make'.

compiler/compile_target_code.m:
	This module will eventually contain the predicates used
	to compile the target code files generated by the compiler
	which are now in mercury_compile.m. (That will be done
	as a separate change for ease of reviewing).

	For now compile_target_code.m

compiler/mercury_compile.m:
	Export the predicates used to compile target code.

	Call make.m.

	Pass the name of the top-level module in the source file to modules.m.
	It is needed when generating the `.module_dep' files.

	Lookup the option defaults (which will eventually be stored in
	DEFAULT_MCFLAGS by the mmc script) before compiling. Up until now
	the option defaults have been passed on the command line by the
	mmc script, but with `mmc --make' the default options need
	to be overridden by the value of the MCFLAGS make variable, but
	the MCFLAGS make variable is overridden by command line options.

	Pass the value of `--link-flags' to c2init.

	Remove some uninformative messages printed when a C, IL, etc.
	compilation fails.

compiler/options_file.m:
	Read files containing Make style variable assignments.

compiler/options.m:
doc/user_guide.texi:
	Add a new options category: build system options.

	Add some extra options:
	--warn-undefined-options-variables - like mmake --warn-undefined-vars
	--verbose-commands - print commands that the user might be
		interested in, like C compilation, but not things
		like mercury_update_interface.
	--output-compile-error-lines - print the first n lines
		of the error file generated by a command.
	--generate-mmc-make-modules-dependencies - generate dependencies
		for use by `mmc --make' even when using Mmake.

	--il-assembler, --ilasm-flags, --mcpp-compiler, --mcpp-flags,
	--csharp-compiler, --csharp-flags, --install-prefix,
	--install-command, --libgrades, --options-files,
	--options-search-directories.

compiler/modules.m:
	Add fields to the `module_imports' type for use by make.*m.

	Don't try to fill in fields of the module_imports structure
	lazily. It's error prone, and probably doesn't save much
	anyway.

	Clean up the code to compute what foreign languages
	are used by a list of item.

	Simplify the handling of fact tables by recording that a module
	containing fact tables has foreign code to implement them,
	rather than requiring separate checks everywhere.

	Generalise predicates like get_interface so that they
	work even after the imported items have been read.

	Fix the handling of header files with the LLDS backend.

	Install the `.module_dep' files created for use by
	`mmc --make'.

compiler/*.m:
	Use record syntax rather than explicit deconstruction to
	refer to fields of the `module_imports' type.

compiler/*.m:
	Be more careful about where output goes.
	mercury_compile.m sets the output stream to be io__stderr_stream
	at the start of compilation, so remove all explicit writes to
	io__stderr_stream (with `--make' the error output stream may be
	a `.err' file, not io__stderr_stream).

	Change all occurrences of io__tell/io__told to use
	io__open_output/io__close_output (io__told restores the current
	output stream to io__stdout_stream, not the previous value).

compiler/passes_aux.m:
	Make the output from system commands go to the current
	output stream, not C stdout and stderr.

	Allow commands to be printed with `--verbose-commands'.

	Remove uninformative error messages when a command fails.

compiler/timestamp.m:
	Add functions oldest_timestamp and newest_timestamp.

compiler/llds_out.m:
	Record the number of C files written with `--split-c-files'
	in <module>.num_split.

compiler/prog_io.m:
compiler/*.m:
	`search_for_file' now returns the directory in which the
	file was found.

compiler/foreign.m:
	Use sub-typing to make some calls to predicates in this
	module `det' rather than `semidet'.

compiler/handle_options.m:
	Return the option arguments.

compiler/Mmakefile:
	make.util.m refers to kill() and `struct sigaction' which
	are not exported from <signal.h> unless `--no-ansi' is
	passed to gcc.

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

runtime/mercury_signal.h:
runtime/mercury_signal.c:
	Add a function MR_signal_should_restart() which alters
	whether a signal restarts or interrupts system calls.
	In general restarting is the preferred behaviour, but
	the wait() for a child process needs to be interruptible.

scripts/Mmake.vars.in:
	Add subdirs for `.module_dep', `.err_date'
	and `.num_split' files.

library/io.m:
	Add a version of io_call_system which returns the signal
	that killed the command rather than converting it into
	an error message.

	Add a predicate to interpret the result of system() or wait().

library/list.m:
	Add list__map_foldl2 and a unique mode for list__foldl3.

NEWS:
	Document the new library predicates.

configure.in:
runtime/mercury_conf.h.in:
	Check for siginterrupt().

doc/user_guide.texi:
	Document the new options.

	Add a description of `mmc --make' to the "Using Mmake" chapter.
2002-03-12 16:33:37 +00:00
Fergus Henderson
653b8276ac Fix an Mmake bug which broke tests/hard_coded/integer_test and
Estimated hours taken: 1
Branches: main

scripts/Mmake.vars.in:
	Fix an Mmake bug which broke tests/hard_coded/integer_test and
	tests/hard_coded/rational_test in grade asm_fast when built with
	--use-subdirs.	The problem was that target-specific variable
	definitions where not getting set correctly when building the
	*_init.c file, because various references to `%_init.c' in this
	file should have been `$(cs_subdir)%_init.c'.
2002-02-27 11:14:17 +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
def073c16d Fix Mmake's handling of linker options.
Estimated hours taken: 0.5

Fix Mmake's handling of linker options.

scripts/Mmake.vars.in:
	Add Mmake variables LDFLAGS, used for linker flags for
	executables, and LD_LIBFLAGS, used for linker flags for
	shared libraries. The separate variables are need because
	on some architectures `ml' invokes the C compiler, but
	`ml --make-shared-lib' invokes the linker directly.

	Put `--' before CFLAGS in the construction of ALL_MGNUCFLAGS
	to avoid confusion between C compiler options and mgnuc
	options.

compiler/modules.m:
	Pass LDFLAGS and LD_LIBFLAGS to ml.

doc/user_guide.texi:
	Document CFLAGS, LDFLAGS and LD_LIBFLAGS.

scripts/parse_ml_options.sh_subr.in:
scripts/ml.in:
	Define options `--print-link-command' and
	`--print-shared-lib-link-command', which print
	the commands ml uses to link executables and
	shared libraries.
2002-02-07 03:11:00 +00:00
Simon Taylor
24a8a45e3f Fix a bug which stopped the target-specific MLFLAGS
Estimated hours taken: 0.25
Branches: main

scripts/Mmake.vars.in:
	Fix a bug which stopped the target-specific MLFLAGS
	being passed to c2init.
2002-01-11 11:33:15 +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
8ee89867fc Finish off the change to make ml' and c2init' take the
Estimated hours taken: 0.5
Branches: main

Finish off the change to make `ml' and `c2init' take the
same set of options.

scripts/Mmake.vars.in:
	Make ALL_MLFLAGS include C2INITFLAGS, EXTRA_C2INITFLAGS, etc.
	ALL_C2INITFLAGS is now equivalent to ALL_MLFLAGS.

doc/reference_manual.texi:
	Change references to C2INITFLAGS to refer to MLFLAGS instead.
2001-12-18 12:13:15 +00:00
Simon Taylor
286462b554 Define the $(useds_subdir) variable, which is used
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.vars.in
	Define the $(useds_subdir) variable, which is used
	by the clean target. This fixes recompilation test
	case failures on mars.
2001-10-28 18:04:12 +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
Simon Taylor
5180ce3f39 Add a comment documenting why $(rlos_subdir) is set to the
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
	Add a comment documenting why $(rlos_subdir) is set to the
	empty string, even with --use-subdirs.
2001-08-06 14:13:06 +00:00
Simon Taylor
6d1e43394d The Aditi query shell does not know about --use-subdirs,
Estimated hours taken: 0.2
Branches: main

The Aditi query shell does not know about --use-subdirs,
so put all the files it uses in the current directory.

compiler/modules.m:
	Put `.rlo', `.base_schema' and `.derived_schema' files
	in the current directory.

scripts/Mmake.vars.in:
	Set $(rlos_subdir) to the empty string, even with --use-subdirs.

compiler/rl_out.pp:
	Create the directory when creating the `.derived_schema' file.
	This isn't necessary any more, but will be needed if we ever
	go back to putting the `.derived_schema' file in a sub-directory.
2001-08-06 12:54:27 +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
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
Fergus Henderson
080a9de8e1 Fix a typo in the definition of ss_subdir.
Estimated hours taken: 0.1
Branches: main, release

scripts/Mmake.vars.in:
	Fix a typo in the definition of ss_subdir.
	This broke things if you tried to use --target asm with --use-subdirs.
2001-07-27 15:40:26 +00:00
Peter Ross
7fe31d3493 Fix mmake rules to install the ilc grade.
Estimated hours taken: 2.5
Branches: main

Fix mmake rules to install the ilc grade.

library/Mmakefile:
    No longer build mercury_all.dll, instead just use the individual
    library dlls directly as the fixed limit in gacutil has been
    removed.
    Install mercury.dll in the gac.

scripts/Mmake.vars.in:
    Set the location of the mercury library DLLs correctly.

runtime/Mmakefile:
    For the IL backend make install_headers depend on install_lib so
    that the headers get installed during the grade install process.
2001-07-18 08:13:46 +00:00
Peter Ross
03f1a1ece3 Improve the mmake support for the IL backend.
Estimated hours taken: 4
Branches: main

Improve the mmake support for the IL backend.
We still need to add code to do the pragma foreign code.

configure.in:
    To determine the extension off executable files use the new macro
    AC_EXEEXT.

compiler/modules.m:
    In the .dep file add a check to see if we are compiling in an IL
    grade.  If so, use a different top level rule.
    Add rules to generate, remove and so on all the .dll files.

scripts/Mmake.vars.in:
    Minor changes.
2001-07-17 08:56:32 +00:00
Zoltan Somogyi
1a0b253854 Add rules for installing the deep profiler from source. (Installing it from
Estimated hours taken: 2
Branches: main

Add rules for installing the deep profiler from source. (Installing it from
binary distributions is future work.)

configure.in:
	Add an option, --enable-deep-profiler=/path/name, that specifies the
	path name of the directory in which the CGI script should be installed
	(the default is apache's /usr/lib/cgi-bin).

	Report an error if the user requests deep profiling but it is not
	available.

Mmakefile:
	Remind the user to copy the CGI script to its directory.

scripts/Mmakefile:
	Document why we can't install the CGI script automatically.

	Be consistent about the order of rules.

scripts/Mmake.vars.in:
	Record the CGI directory for use in the toplevel Mmakefile.

scripts/mdprof.in:
	Record that mdprof_cgi and mdprof_server are installed in the directory
	for non-user-visible programs, alongside mercury_compile and
	mercury_profile.
2001-07-09 04:58:52 +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
Fergus Henderson
a63454386c Fix some quoting bugs in my previous change.
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.vars.in:
	Fix some quoting bugs in my previous change.
2001-06-18 05:58:15 +00:00
Fergus Henderson
3913870d4a Fix a couple of bugs in Tyson's recent change:
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.vars.in:
	Fix a couple of bugs in Tyson's recent change:
	- $(MS_VISUALCPP_DIR) may contain spaces, and so must be in quotes
	- "/include" uses Unix-style path separators rather than Windows
	  path separators and so should be outside the call to cygpath.
2001-06-18 02:37:04 +00:00
Tyson Dowd
61fc5c0818 Fixes required for .NET Beta 2.
Estimated hours taken: 6
Branches: main

Fixes required for .NET Beta 2.

aclocal.m4:
	Autodetect the C++ compiler and find the VC++ directory from it.

compiler/mlds_to_il.m:
	Put "public" annotations on the IL we generate (private is now the
	default).

library/char.m:
	Fix a use of c_header_code to be foreign_decl("C",

runtime/mercury_il.il:
	Put "public" annotations on the IL (private is now the default).

scripts/Mmake.vars.in:
	Fix the include path and commandline for VC++.
2001-06-14 22:36:24 +00:00
Simon Taylor
46b8cd7a50 Fix a problem caused by my change to remove the RM_C mmake
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
	Fix a problem caused by my change to remove the RM_C mmake
	variable. RM_C is still referred to by `.d' files generated
	before that change, so it still needs to be defined.
2001-05-19 13:53:06 +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
Tyson Dowd
5ddff184df A few fixes for the scripts in the .NET backend.
Estimated hours taken: 0.5
Branches: main

A few fixes for the scripts in the .NET backend.


scripts/Mmake.rules:
	Use -CLR instead of -com+, the latter is undocumented, confusing and
	may stop working in the future.

scripts/Mmake.vars.in:
	Remove the reference to the .NET libraries as these are no longer
	needed when using the command line C++ compiler cl.
	Remove ALL_CFLAGS from the CLFLAGS -- the wrong flags were being
	passed to cl (such as the -g flag) which it didn't understand.
2001-04-25 15:16:49 +00:00
Fergus Henderson
da1f8c7f6a Fix a bug where the Mmake rule for making `.pic_s' files didn't work,
Estimated hours taken: 0.5

Fix a bug where the Mmake rule for making `.pic_s' files didn't work,
because it was passing $(CFLAGS_FOR_PIC), i.e. `-fpic -DPIC',
to the GCC back-end, but the GCC back-end didn't understand `-DPIC'.
(The GCC *driver* understands `-D', as does the GCC C front-end,
but the back-end doesn't.)

scripts/Mmake.vars.in:
	Define new variable GCCFLAGS_FOR_PIC, and set it to `-fpic'.

scripts/Mmake.rules:
	In the rule for making `.pic_s' files, use $(GCCFLAGS_FOR_PIC)
	instead of $(CFLAGS_FOR_PIC).
2001-01-23 16:12:56 +00:00
Fergus Henderson
3de6904858 Merge my recent changes on the gcc-backend-branch back onto
Estimated hours taken: 0.5

mercury/Mmake.common.in:
mercury/configure.in:
mercury/compiler/Mmakefile:
mercury/compiler/maybe_mlds_to_gcc.pp:
mercury/compiler/mercury_compile.m:
mercury/compiler/mlds_to_gcc.m:
mercury/compiler/modules.m:
mercury/runtime/mercury_type_info.h:
mercury/runtime/mercury_wrapper.c:
mercury/runtime/mercury_wrapper.h:
mercury/scripts/Mmake.rules:
mercury/scripts/Mmake.vars.in:
mercury/scripts/final_grade_options.sh-subr:
mercury/scripts/init_grade_options.sh-subr:
mercury/scripts/mmake.in:
mercury/scripts/parse_grade_options.sh-subr:
gcc/Make-lang.in:
gcc/Makefile:
gcc/Mmakefile:
gcc/lang-specs.h:
gcc/mercury-gcc.c:
	Merge my recent changes on the gcc-backend-branch back onto
	the main branch.
2001-01-17 02:45:07 +00:00
Tyson Dowd
53f2dbc1b4 First implementation of the standard library in managed C++.
Estimated hours taken: 200

First implementation of the standard library in managed C++.

configure.in:
	Autodetect the .NET SDK, and set MS_DOTNET_SDK_DIR based on it.
	Find the IL assembler, and set ILASM.

compiler/inlining.m:
	Turn off inlining of pragma_foreign_code with the IL backend.

compiler/mlds_to_c.m:
	Add a comment questioning the foreign language interfacing still to be
        done in this backend, and remove the "inline target code" from
        this list (since it has been completed).

compiler/mlds_to_il.m:
	Generate code for :- external.  We generate a forwarding
	function to the expected implementation in
	<modulename>__c_code.cpp

	Rename all the classes to use MixedCase, and to put them in the
	mercury.runtime namespace.

compiler/mlds_to_ilasm.m:
	Don't use the System or mercury namespaces by default.
	Change the names of the runtime cpp files to mercury_mcpp.dll
	and mercury_il.dll.
	Use c_util to output unops and binops.

doc/user_guide.texi:
	Document MS_CL_NOASM, MS_CLFLAGS and EXTRA_MS_CLFLAGS.

library/*.m:
	Rename pragma c_code as pragma foreign_code("C", ...).
	Add pragma foreign_code for MC++.
	Only a fraction of the predicates are implemented, everything
	else simply throws and exception when called.
	Implementations of predicates marked with :- external are
	provided as pragma foreign_code, but are commented out.

library/Mmakefile:
runtime/Mmakefile:
	Add targets for building the dlls for the library.

runtime/mercury_mcpp.cpp:
runtime/mercury_mcpp.h:
	Implementation of the runtime.

runtime/mercury_il.il:
	This file mainly implements things that can't be written in
	managed C++ (e.g. function pointers).

scripts/Mmake.rules:
scripts/Mmake.vars.in:
        Add rules for generating .dlls and .exes from .ils and .cpps.
2001-01-01 04:04:05 +00:00
Fergus Henderson
72565412b8 Add Mmake support for generating `.il' files.
Estimated hours taken: 1

Add Mmake support for generating `.il' files.
Note that this change does NOT add rules for generating
`.dll' or `.exe' files from the `.il' files.

scripts/Mmake.vars.in:
	Set the ils_subdir variable.

scripts/Mmake.rules:
	Add a pattern rule for creating `.il' files.

compiler/modules.m:
	Add code to emit the dependencies for `.il' files.
	Add code to emit the `<main-module>.ils' variable
	and the `<main-module>.ils' target.
	Also fix a bug where it wasn't handling the `.rlos'
	target correctly when --use-subdirs was enabled.
2000-11-17 07:34:17 +00:00
Peter Ross
83cae0d2d0 When generating the .dv and .dep files use autoconfed settings for
Estimated hours taken: 8

When generating the .dv and .dep files use autoconfed settings for
such things as: object and library file extensions, and how to create a
library.  Change the compiler Mmakefiles to handle files with the new
extensions.

compiler/modules.m:
    When generating the '.dv' and '.dep' files use '.$O' and '.$A'
    instead of '.o' and '.a'.  Use $EXT_FOR_EXE when generating the
    realclean target, as you need to pass the full file name to rm.
    Use $AR_LIBFILE_OPT when creating libraries.

scripts/Mmake.vars.in:
    Set the value EXT_FOR_EXE, which is the extension which must be
    placed on executables.

Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
scripts/Mmake.rules:
tools/bootcheck:
trace/Mmakefile:
    Use '.$O' for '.o' and '.$A' for '.a'.

util/Mmakefile:
    You need to remove PROGFILENAMES not PROGS, as PROGFILENAMES
    includes the executable extension.
2000-06-22 08:50:27 +00:00
Fergus Henderson
230e3a0182 Fix a quoting bug in Pete's recent change.
Estimated hours taken: 0.5

scripts/Mmake.vars.in:
	Fix a quoting bug in Pete's recent change.
2000-06-16 00:21:39 +00:00
Peter Ross
a7044d60d2 Fix a bug on dec-alpha-osf3.2 where
Estimated hours taken: 0.1

Fix a bug on dec-alpha-osf3.2 where
    mgnuc -c mercury_accurate_gc.c -omercury_accurate_gc.c
gives the error
    mips-tfile:mercury_accurate_gc.o: No such file or directory

configure.in:
    Set OBJFILE_OPT to be "-o " on unix systems.  Note the trailing
    space.

scripts/Mmake.vars.in:
    Quote OBJFILE_OPT to ensure that the trailing space is preserved.
2000-06-13 10:12:49 +00:00
Peter Ross
01ebbaafb5 Name library files with the default extension for the system used.
Estimated hours taken: 2

Name library files with the default extension for the system used.

Mmake.common.in:
    Record the default extension for library files.
    Add the variable BOEHMGC_MAKEFILE only needed for building the
    compiler.

scripts/Mmake.vars.in:
    Delete BOEHMGC_MAKEFILE as it is only needed for building the
    compiler.

configure.in:
    Define the default for EXT_FOR_SHARED_LIB to be the extension
    for libraries defined in Mmake.common.

boehm_gc/NT_MAKEFILE:
    Use .lib instead of .a, seeing we only use this Makefile for
    building the library on win32 systems.

Mmakefile:
boehm_gc/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
trace/Mmakefile:
    Use the variable defined in Mmake.common for the extension of
    library files.
2000-06-08 13:06:49 +00:00
Peter Ross
a68df3d95f Allow compilation of the mercury compiler *ONLY* in the grade hlc.gc
Estimated hours taken: 40

Allow compilation of the mercury compiler *ONLY* in the grade hlc.gc
using the Microsoft Visual C++ compiler (MSVC).  This is still
work-in-progress.

configure.in:
    Test to see whether or not we are using the Microsoft compiler.
    Don't fail if we can't interpret return values from system.

boehm_gc/Mmakefile:
    Use NT_MAKEFILE if we are using MSVC.

boehm_gc/NT_MAKEFILE:
    Apply the the changes to boehm_gc/Makefile to this file.

browser/Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
trace/Mmakefile:
    Use the correct executable to create libraries.
    Use AR_LIBFILE_OPT to name the library.

compiler/llds_out.m:
    Export output_c_file_intro_and_grade so that the correct header can
    be placed at the start of each C file.

compiler/mlds_to_c.m:
    Output the header at the start of each C file, so that configure
    doesn't delete the file when checking the compatability with
    the configured settings.
    When initializing empty arrays place a dummy entry in the array, so
    that the MSVC compiler generates a symbol for that array.

compiler/passes_aux.m:
    Add invoke_shell_command.  This predicate wraps commands with
    a bash -c 'command ' when shell scripts aren't supported by the
    target system.

compiler/mercury_compile.m:
compiler/modules.m:
    Use invoke_shell_command instead of invoke_system_command for shell
    scripts.

library/io.m:
    Call _unlink in io_rename_file, when compiling with MSVC.


runtime/mercury_wrapper.c:
    Initialise MR_runqueue_head so that the segment containing this
    variable is registered with the garbage collector.  This stops
    intermittent failures of the GC_is_visible() test.

runtime/mercury_conf.h.in:
    Define MR_WIN32 when we are using MSVC.

runtime/mercury_memory.c:
runtime/mercury_memory_handlers.c:
runtime/mercury_memory_zones.c:
runtime/mercury_prof.c:
runtime/mercury_reg_workarounds.c:
runtime/mercury_reg_workarounds.h:
runtime/mercury_signal.c:
runtime/mercury_timing.c:
runtime/mercury_timing.h:
runtime/mercury_trace_base.c:
util/mkinit.c:
    Only include unistd.h and sys/times.h when they exist.
    MSVC doesn't have SIGBUS so #ifdef sections which refer to it.

scripts/Mmake.rules:
    Use /Fo instead of -o to generate .o files if compiling with MSVC.

scripts/Mmake.vars.in:
    Define AR to use the autoconfed executable for linking.

scripts/mgnuc.in:
    Only add option -Wno-uninitialized if we are using gcc.

util/Mmakefile:
    Explicitly locate the getopt src, and use it in compiling the
    utilities.
2000-06-08 07:59:13 +00:00
Simon Taylor
bde558d7ac Modify the Mmake rules to install libraries so that the user can
Estimated hours taken: 1

Modify the Mmake rules to install libraries so that the user can
specify commands to copy files and make directories. This is useful
if the user wants more control over the ownership and permissions of
the created files and directories.

scripts/Mmake.rules:
compiler/modules.m:
	Use $(INSTALL) to copy a file into its installed location.
	Use $(INSTALL_MKDIR) to create directories.

scripts/Mmake.vars.in:
	Set the default value of INSTALL to `cp' and
	INSTALL_MKDIR to `mkdir -p'.

doc/user_guide.texi:
	Document the new Mmake variables.
2000-05-11 03:46:29 +00:00
Warwick Harvey
2f5cfeaaf4 Pass the extra C include directories to mgnuc, in case there are
Estimated hours taken: 0.5

scripts/Mmake.vars.in:
	Pass the extra C include directories to mgnuc, in case there are
	header files installed there.
2000-01-11 07:59:46 +00:00
Warwick Harvey
be51ca48b6 Added built-in mmake support for installing user libraries.
Estimated hours taken: 30

Added built-in mmake support for installing user libraries.

Mmake.common.in:
	Moved the definitions of many of the generic install directories
	(plus FULLARCH and LIBGRADES) to scripts/Mmake.vars.in, so they
	can be used for things other than just the Mercury compiler.

compiler/modules.m:
	Added code to generate appropriate lib<module>.install* targets.
	Improved the dependency list generated for the lib<module> target to
	include intermodule optimisation files if and only if the
	appropriate flags have been set (previously it always depended on
	the `.opt' files, but never on the `.trans_opt' files).

scripts/Mmake.rules:
	Added some rules for use when installing libraries.

scripts/Mmake.vars.in:
	Added the definitions of many of the generic install directories
	(plus FULLARCH and LIBGRADES) from Mmake.common.in.
	Added support for overriding and/or adding to the definition of
	LIBGRADES on a per-library basis.

scripts/mercury_cleanup_install:
	New script, for cleaning up after failed installs.

scripts/Mmakefile:
	Added `mercury_cleanup_install' to the list of scripts to be
	installed.

bindist/Mmakefile:
bindist/bindist.Makefile.in:
	Added `mercury_cleanup_install' and `vpath_find' to the list of
	utilities included in and installed by a binary distribution.  These
	are used by some of the install targets.

doc/user_guide.texi:
	Documented the new features.

extras/references/Mmakefile:
extras/references/samples/Mmakefile:
	Changed to exploit/test new features.
1999-10-21 14:36:39 +00:00
Warwick Harvey
a7b1401531 Allow the user to conveniently use Mercury libraries installed in
Estimated hours taken: 70

Allow the user to conveniently use Mercury libraries installed in
non-standard places, by specifying the variables `EXTRA_LIBRARIES' and
`EXTRA_LIB_DIRS' in their Mmakefile.

doc/user_guide.texi:
	Documented the new `EXTRA_LIBRARIES' and `EXTRA_LIB_DIRS' Mmake
	variables.

scripts/Mmake.vars.in:
	Added/changed definitions appropriately to support the new
	variables.
	This included adding a `GRADESTRING' variable which holds the
	canonical name of the grade being used, taking into account all the
	grade flags.

scripts/c2init.in:
	Added a new option to `c2init':
	-I/--init-file-directory <directory> adds the directory to the list
		of directories to search for `.init' files.

util/mkinit.c:
	Added a new option `-I' to add a directory to the list of
	directories to search for `.init' files.
1999-07-26 02:52:46 +00:00
Warwick Harvey
293b4a1d59 Make some improvements in automatically generated dependencies.
Estimated hours taken: 2.5

Make some improvements in automatically generated dependencies.

compiler/modules.m:
	Change the generation of `.dep' files so that dependencies on
	library files are specified.
	Also change the dependencies on `$(MLOBJS)' and `$(MLPICOBJS)' to be
	explicit rather than using the `MLOBJS_DEPS' / `MLPICOBJS_DEPS'
	hacks, since the hacks aren't necessary any more.

scripts/Mmake.vars.in:
	Introduce the variable `ALL_MLLIBS_DEP' which provides a list of
	dependencies based on the contents of the `ALL_MLLIBS' variable.
	XXX At the moment it isn't clear how to know whether the files
	appearing in `ALL_MLLIBS_DEP' should be `.a' or `.so' libraries,
	so for now it is defined to be empty (though the user can specify
	it if desired).
1999-07-24 08:40:56 +00:00