Commit Graph

595 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
e3fd7e0c21 Pass INSTALL_PREFIX and LIBGRADES to mmc.
Estimated hours taken: 0.2
Branches: main

configure.in:
scripts/mmc.in:
	Pass INSTALL_PREFIX and LIBGRADES to mmc.
2002-07-05 13:51:06 +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
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
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
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
78495d8b99 Complete the support for building libraries with `mmc --make'.
Estimated hours taken: 2.5
Branches: main

Complete the support for building libraries with `mmc --make'.

compiler/make.m:
compiler/make.module_target.m:
compiler/mercury_compile.m:
compiler/compile_target_code.m:
	Generate the `.pic_o' files needed to build shared libraries.

scripts/mmc.in:
	Add `--pic-object-extension', `--create-archive-command'
	`--create-archive-command-output-flag',
	`--create-archive-commandflags' and `--ranlib-command'
	options to DEFAULT_MCFLAGS.

	Allow DEFAULT_MCFLAGS to be overridden in the environment,
	for consistency with the other *FLAGS variables.
2002-05-06 11:43:56 +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
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
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
Simon Taylor
adb93c2e38 Fix a bug in my last change.
Estimated hours taken: 0.1
Branches: main

scripts/mmc.in:
	Fix a bug in my last change.
	-	*) exec $MC -I "$@" "$INTDIR" ;;
	+	*) exec $MC "$@" -I "$INTDIR" ;;
2002-04-07 13:41:49 +00:00
Simon Taylor
c9171d6ffc Pass the default options in the DEFAULT_MCFLAGS environment
Estimated hours taken: 0.25
Branches: main

scripts/mmc.in:
	Pass the default options in the DEFAULT_MCFLAGS environment
	variable, not on the mercury_compile command line. This allows
	the options to be overridden by the setting of MCFLAGS in the
	Mercury.options file (options on the command line override
	options in the MCFLAGS variable).
2002-04-07 09:19:05 +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
Peter Ross
dc5e43dc39 Finish bootstrapping the --dotnet-library-version change.
Estimated hours taken: 0.25
Branches: main

Finish bootstrapping the --dotnet-library-version change.
This has been tagged with bootstrap_20020311_dotnet_library_version.

configure.in:
	Check that we accept --dotnet-library-version on the mmc
	command line.

scripts/mmc.in:
	Pass the autoconfed --dotnet-library-version to
	mercury_compile.
2002-03-11 13:25:39 +00:00
Peter Ross
cc5c5872db Configure the version of the .NET std library that we are using instead
Estimated hours taken: 2.5
Branches: main

Configure the version of the .NET std library that we are using instead
of hard-coding it in the compiler.

aclocal.m4:
    Find the version number of the mscorlib assembly and record it in
    MS_DOTNET_LIBRARY_VERSION.

compiler/mlds_to_il.m:
doc/user_guide.texi:
    Use and document the option --dotnet-library-version.  This option
    is used to determine what version of the .NET standard libraries
    that we are using.

compiler/mlds_to_il.m:
    We no longer need to hard-code the hash for the mscorlib.dll.

scripts/mmc.in:
    Use the autoconfigured MS_DOTNET_LIBRARY_VERSION to set the
    --dotnet-library-version.  This is commented out for the moment
    until this change bootstraps.
2002-03-03 12:12:54 +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
Simon Taylor
88c3c1eaca Add MR_ prefixes to symbols defined on the gcc command line.
Estimated hours taken: 0.25
Branches: main

scripts/mgnuc.in:
compiler/mercury_compile.m:
	Add MR_ prefixes to symbols defined on the gcc command line.
2002-02-23 03:47:23 +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
Peter Ross
70dfc04059 Avoid problems with very long command lines by using xargs.
Estimated hours taken: 1.5
Branches: main

Avoid problems with very long command lines by using xargs.

compiler/modules.m:
    Use xargs to rm all the files for the clean and realclean targets.

scripts/mmake.in:
    Use xargs to cat the .d and .dv files.
2002-02-15 09:25:07 +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
1b127a6111 Improve the handling of the mdb's `--window' option.
Estimated hours taken: 10

Improve the handling of the mdb's `--window' option.
`mdb --window' now creates a window for mdb, not the program.
The main advantage of this is that redirection of the program's
input and output now works. The new behaviour should also be
implementable using the Windows API. The old behaviour is still
available with `mdb --program-in-window'.

Unfortunately, the code to open a pseudo-terminal for mdb's I/O
isn't very portable. It works on everything we run nightly tests on,
but isn't likely to work on older systems or BSD systems.

NEWS:
	Document the change.

scripts/mdb.in:
	Handle the new behaviour of `--window'.
	Add `--program-in-window'.

trace/mercury_trace_internal.c:
	If `--window' was passed in MERCURY_OPTIONS, redirect
	mdb's I/O to a window created using `xterm -S'.

	Rename occurrences of `close' to avoid gcc warnings.

runtime/mercury_trace_base.h:
runtime/mercury_trace_base.c:
	Kill the mdb window on exit.

runtime/mercury_wrapper.h:
runtime/mercury_wrapper.c:
	Add a runtime options `--mdb-in-window' for use by the mdb script.

runtime/mercury_signal.h:
runtime/mercury_signal.c:
	Add a version of MR_setup_signal which doesn't cause
	system calls to be restarted after a signal is received.
	This is needed to allow a read() from the mdb window
	to timeout if the window failed to start.

	Add functions to get and set the action for a given signal.

configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES.
	Check for functions open, close, dup, dup2, fdopen, setpgid,
	fork, execlp, wait, kill, grantpt, unlockpt, pstname, tcgetattr,
	tcsetattr and ioctl.

	Check for type pid_t.

	Check for header files <fcntl.h>, <termios.h>, <sys/ioctl.h>,
	<sys/stropts.h>.

	Check for /dev/ptmx, used to open pseudo-terminals.

runtime/mercury_misc.c:
runtime/mercury_misc.h:
	Add MR_mdb_warning, which prefixes messages from the
	debugger with "mdb: ".

	Add MR_perror and MR_mdb_perror, which are versions
	of perror which prefix the printed message with
	"Mercury runtime: " and "mdb: " respectively.

runtime/mercury_prof_time.c:
runtime/mercury_prof.c:
runtime/mercury_memory_handlers.c:
	Don't prefix error messages passed to MR_setup_signal
	with "Mercury runtime:". MR_setup_signal now uses
	MR_perror.
2002-01-30 14:51:11 +00:00
Simon Taylor
dead626652 Allow Mercury runtime options to be set at compile time.
Estimated hours taken: 1.5
Branches: main

Allow Mercury runtime options to be set at compile time.

scripts/parse_ml_options.sh-subr.in:
	Add an initialization option `--runtime-flags'.

runtime/mercury_wrapper.h:
	Add a global variable MR_runtime_flags.

util/mkinit.c:
	Set MR_runtime_flags.

runtime/mercury_wrapper.c:
	Add the value of MR_runtime_flags to the dummy
	command line passed to getopt().

tests/hard_coded/Mmakefile:
	Use `--runtime-flags' rather than MERCURY_OPTIONS.
2002-01-13 10:13:20 +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
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
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
93f2516efb Write the grade in the header comment in the generated `<module>_init.c' file.
Estimated hours taken: 0.25
Branches: main

Write the grade in the header comment in the generated `<module>_init.c' file.
The `<module>_init.c' file contains grade dependent conditional compilation,
so the `<module>_init.o' file must be rebuilt when the grade changes.

util/mkinit.c:
	Add an option `-g' for the grade.
	Add the grade to the header comment.

scripts/c2init.in:
	Pass the grade to mkinit.

scripts/Mmakefile:
scripts/canonical_grade.sh-subr:
	canonical_grade.sh-subr is now used by c2init.
2001-12-18 05:44:17 +00:00
Simon Taylor
bb885a0807 Address Fergus's review comments.
Estimated hours taken: 0.25
Branches: main

scripts/parse_ml_options.sh-subr.in:
	Address Fergus's review comments.
2001-12-06 14:39:51 +00:00
Simon Taylor
5c9f6f5841 Combine the options for ml and c2init. Once mmake has been
Estimated hours taken: 1
Branches: main

Combine the options for ml and c2init. Once mmake has been
altered to pass MLFLAGS to c2init users will be able to
mostly ignore the existence of c2init.

This change requires an installed compiler which uses `--init-c-file'
rather than `-o' to name c2init's output file. This is difficult to
test for in configure.in.

Bootstrap CVS tag: bootstrap_20011203_init_c_file_c2init_option

scripts/parse_ml_options.sh-subr.in:
	Parse the combined options for ml and c2init.

	The `-o' and `--output' options for c2init have been removed
	(`-o' conflicts with a linker option), use `--init-c-file' instead.

configure.in:
	Add parse_ml_options.sh-subr.in to the list of files to substitute.

scripts/ml.in:
scripts/c2init.in:
	Include parse_ml_options.sh-subr.

scripts/Mmakefile:
	ml and c2init depend on parse_ml_options.sh-subr.
2001-12-03 03:11:26 +00:00
Simon Taylor
285dc19732 Finish the change to allow installed Mercury libraries to be
Estimated hours taken: 0.2
Branches: main

Finish the change to allow installed Mercury libraries to be
used directly by mmc.

bootstrap CVS tag: bootstrap_20011119_fullarch_opt

scripts/mmc.in:
	Pass the value of the `--fullarch' option determined
	at configuration time.

configure.in:
	Test for the `--fullarch' option. Remove an old test
	for `.c_date' files.
2001-11-19 07:25:08 +00:00
Simon Taylor
161226cc22 This is the first part of a change to make c2init and ml take
Estimated hours taken: 0.25

This is the first part of a change to make c2init and ml take
the same set of options (the c2init options will be added as
an "Initialization options" section of the ml options). When
this change is complete, users will only need to add `--trace'
to MLFLAGS, not C2INITFLAGS as well. c2init is an implementation
detail that users shouldn't need to know about.

scripts/c2init.in:
	Remove the `-l' short form of the `--library' option,
	since it conflicts with the use of `-l' as a linker option.

	Add `--no-main' as a synonym for `--library', which will
	cause less confusion with the `--make-shared-lib' ml
	option. `--library' will still be accepted for backwards
	compatability because the C interface samples refer to it.

	Add `--init-c-file' as a synonym for `-o' and `--output'.
	The latter two will be removed after mmake and mmc are
	changed to use `--init-c-file' because they don't make
	sense as ml options.
2001-11-13 08:28:05 +00:00
Fergus Henderson
2a897087f7 Allow for the possibility of comments and blank lines in `:- type'
Branches: main
Estimated hours taken: 1

scripts/mtags:
	Allow for the possibility of comments and blank lines in `:- type'
	declarations.
2001-10-31 14:57:12 +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
Simon Taylor
c697725315 The compiler usually considers a file extension to include the `.',
Estimated hours taken: 0.25
Branches: main

The compiler usually considers a file extension to include the `.',
so pass `.o' rather than `o' as the value of `--object-file-extension'.
This change avoids the need to handle `--executable-file-extension' (which
can be empty) as a special case.

scripts/mmc.in:
	Pass `.o' as the value of `--object-file-extension', rather than `o'.

compiler/mercury_compile.m:
	Remove code to prepend a `.' to the value of `--object-file-extension'
	before passing it to `module_name_to_file_name'.

compiler/options.m:
	Update the default values for the various `--*-extension' options
	to include the `.'.
2001-10-02 07:09:45 +00:00
Simon Taylor
fe350bd3bf Back out my change to pass -I- options to gcc to avoid
Estimated hours taken: 0.25

compiler/mercury_compile.m:
scripts/mgnuc.in:
boehm_gc/Makefile:
	Back out my change to pass -I- options to gcc to avoid
	Mercury generated header files clashing with system
	header files. The change doesn't work with the GCC
	sources.
2001-09-05 16:52:54 +00:00
Simon Taylor
bcccddd2f1 Don't allow header files generated by the Mercury compiler
Estimated hours taken: 6
Branches: main, release

scripts/mgnuc.in:
compiler/mercury_compile.m:
	Don't allow header files generated by the Mercury compiler
	to override the system header files. Unfortunately, this fix
	only works with GCC. We should avoid generating header files
	which clash with system headers.

	This fixes a problem that caused the compiler compiled with
	`--intermodule-optimization' to go into an infinite loop during
	termination analysis while compiling list.m. I think this problem
	was triggered by Tyson's change to implement exception handling
	for the .NET backend, which added a `:- pragma export' declaration
	to library/math.m. The generated library/math.h file was being
	selected in preference to /usr/include/math.h, which was causing
	compiler/term_pass1.c to be miscompiled by GCC.

	This change should't be needed at the moment. My change to improve
	error handling in the library removed the `:- pragma export'
	declaration from math.m.
2001-09-05 13:28:57 +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