Commit Graph

43 Commits

Author SHA1 Message Date
Zoltan Somogyi
a2def4bcc8 Bring the style of some scripts up to date ...
... by replacing tabs with spaces, adding modelines, replacing [ with test,
and fixing indentation.
2020-08-14 20:11:56 +10:00
Julien Fischer
7ce2ddd2b2 Update and fix copyright notices in the scripts directory.
scripts/*:
    As above.
2020-06-16 17:22:09 +10:00
Zoltan Somogyi
3e894a7a9d Remove the hl grade component.
As we discussed, it has fallen into disuse. Its main purpose was to
pave the way for the .net backend and later for the java and csharp grades.
Now that the .net backend is ancient history and the java and csharp grades
are established, that purpose is gone, and for every other purpose,
hlc is better because it is simpler and faster.

compiler/options.m:
    Delete the --high-level-data option. It is no longer needed,
    bacause the data representation scheme is now a direct function
    of the target language.

doc/user_guide.texi:
    Delete references to the --high-level-data option.

NEWS:
    Mention that --high-level-data is no longer supported.

compiler/compute_grade.m:
    Delete references to the hl grade component, and conform
    to the deletion of the --high-level-data option.

compiler/compile_target_code.m:
    Give some predicates more meaningful names, and conform to the
    deletion of the --high-level-data option.

compiler/const_struct.m:
compiler/du_type_layout.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/lco.m:
compiler/mercury_compile_main.m:
compiler/ml_gen_info.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_c_util.m:
    Conform to the deletion of the --high-level-data option.

grade_lib/grade_spec.m:
grade_lib/grade_vars.m:
    Delete the datarep solver variable, since the data representation
    is now a direct function of the target language.

    Delete the requirements involving the deleted solver variable.

grade_lib/grade_structure.m:
    Delete the datarep component of the representation of MLDS C grades,
    since its value would now be fixed.

grade_lib/grade_solver.m:
grade_lib/grade_string.m:
grade_lib/try_all_grade_structs.m:
grade_lib/var_value_names.m:
    Conform to the changes above.

grade_lib/Mmakefile:
    Link the grade library's test programs statically, like we do
    the executables in the other directories.

library/io.m:
library/robdd.m:
library/rtti_implementation.m:
runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
runtime/mercury_hlc_types.h:
    Remove references to MR_HIGHLEVEL_DATA, as well as any code
    that was guarded by #ifdef MR_HIGHLEVEL_DATA.

scripts/Mmake.vars.in:
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
scripts/mmake.in:
scripts/mmc.in:
scripts/mtc:
scripts/parse_grade_options.sh-subr:
scripts/parse_ml_options.sh-subr.in:
    Remove references to --high-level-data options.

    In canonical_grade.sh-subr, compute the base grade more directly.

    Remove a few left-over references to the assembler backend.

    Add or fix vim modelines where relevant.

    Fix inconsistent indentation.

    Add missing ;;s in case statements.

    Switch to using ${var} references instead of just $var.

tests/invalid/Mercury.options:
    Make the test_feature_set test case run in grade java instead of hl.gc.

tests/invalid/test_feature_set.err_exp:
    Update the expected out for the grade change.
2020-04-11 19:30:58 +10:00
Julien Fischer
467a2c978d Set the executable installation directory using --bindir.
Support setting an alternative executable installation directory using the
configure script's --bindir option.

Patch contributed by Keri Harris.

scripts/Mmake.vars.in:
scripts/mdprof.in:
scripts/mmc.in:
scripts/mprof.in:
    As above.
2020-04-11 03:17:48 +10:00
Ian MacLarty
2e04ddc748 Remove the architecture string from the installed directory structure
Estimated hours taken: 1
Branches: main and 0.12

Remove the architecture string from the installed directory structure
and put the executables in $PREFIX/bin, instead of
$PREFIX/lib/mercury/bin/$FULLARCH.

The reason for this change is to reduce the need for unix shell scripts in
the top-level bin directory that call the actual programs in the
lib/mercury/bin/FULLARCH directory.  The unix scripts can't be run on Windows
without a unix emulation environment like Cygwin.

Because the executables are now in the top-level bin directory, we cannot
install multiple architectures under the same directory structure.  However
this is not a real loss, since the binaries for different architectures can
just be installed to different locations, as we currently do anyway on
mundula.cs.mu.oz.au.

The plan is to rename mercury_compile to mmc and do away with the mmc unix
script.  This will allow mmc to be run on Windows without Cygwin or MSYS.
This proposal replaces a previous proposal to implement a C version of the
mmc script.  That solution turned out to be quite complicated and
unreliable.

This diff will also mean mdice, mslice and mtc_union will be in the same
directory as mmc, so will be in the PATH as long as mmc is in the PATH.

configure.in:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/make.program_target.m:
debian/rules:
library/Mmakefile:
scripts/Mmake.vars.in:
scripts/mdprof.in:
scripts/mercury.bat.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/mmc.in:
scripts/mprof.in:
tools/run_all_tests_from_cron:
tools/test_mercury:
	Remove FULLARCH from the installed directory structure.
	Install executables to the top-level bin directory.
2005-10-25 10:17:29 +00:00
Ian MacLarty
2a01606e30 Port Mercury to MinGW.
Estimated hours taken: 7
Branches: main and 0.12

Port Mercury to MinGW.

README.Cygwin:
README.MS-Windows:
README.MinGW:
	Move most of README.MS-Windows to README.Cygwin and make
	README.MS-Windows refer the user to README.Cygwin, README.MinGW or
	README.MS-VisualC.
	README.MinGW describes how to install the source distribution under
	MSYS.

configure.in:
	Configure Mercury for MinGW.  Most of the options are the same as
	Cygwin.

boehm_gc/Makefile:
	Add a workaround to a problem with cp not working properly just
	after a file is created on MinGW.
	If cygpath is not present (which it isn't on MSYS), then use
	/bin/sh to invoke the C compiler.

scripts/mmc.in:
	Do not use exec to invoke mercury_compile under MinGW.  exec
	doesn't seem to understand Windows like paths with a drive
	letter in front.
2005-10-04 10:34:38 +00:00
Ian MacLarty
86a83a3462 Fix linking error for hlc.par.gc grade on Darwin.
Estimated hours taken: 3
Branches: main

Fix linking error for hlc.par.gc grade on Darwin.  The problem was that the
"-undefined suppress" option is not allowed with two level namespaces.
The solution is to use "-undefined dynamic_lookup" instead.
However this means the MACOSX_DEPLOYMENT_TARGET environment variable must be
set to 10.3 since this feature will not work on Mac OS < 10.3.  To allow
hlc.gc.par to be built on Mac 10.3, but targetted for Mac OS 10.0 - 10.2 add
a configuration option to force the use of flat namespaces (the
"-undefined suppress" option may be used with flat namespaces).

configure.in
	Add --enable-darwin-flat-namespace option.  This is the default
	for Mac OS < 10.3.  For Mac OS 10.3 two level namespaces are used
	unless this option is given.

	Set a variable to cause the MACOSX_DEPLOYMENT_TARGET environment
	variable to be set if two level namespaces are being used.

scripts/mmake.in
scripts/ml.in
scripts/mmc.in
	Set the MACOSX_DEPLOYMENT_TARGET environment variable wherever the
	linker may be called.
2004-12-23 04:19:36 +00:00
Simon Taylor
404a95cdd7 Remove Unix dependencies in the compiler.
Estimated hours taken: 50
Branches: main

Remove Unix dependencies in the compiler.

Avoid calling passes_aux.invoke_shell_command, which
requires the presence of a Unix shell.

The implementation of fact tables still has dependencies
on Unix utilities (e.g. sort).

aclocal.m4:
	Don't pass Unix style paths to MSVC.

configure.in:
	Use `cygpath -m' rather than `cygpath -w'.
	`cygpath -m' uses '/' as the directory separator,
	so it doesn't cause quoting problems in shell
	scripts.

	Apply $CYGPATH to $PREFIX, $LIBDIR, $CONFIG_PREFIX
	and $CONFIG_LIBDIR.

	Don't pass `-lm' when linking with MSVC.

configure.in:
compiler/options.m:
scripts/Mercury.config.in:
	Add extra configuration options to deal with differences
	between linking with gcc and MSVC:
		--linker-opt-separator
		--linker-link-lib-flag
		--linker-link-lib-suffix
		--shlib-linker-link-lib-flag
		--shlib-linker-link-lib-suffix
		--linker-path-flag

NEWS:
doc/user_guide.texi:
compiler/options.m:
compiler/compile_target_code.m:
compiler/make.program_target.m:
	Instead of substituting in an arbitrary shell script when
	processing `--pre-link-command' and `--extra-init-command',
	require that these options specify a command which will
	be passed the name of the source file containing the main
	module as the first argument, with the source files containing
	the remaining modules following. This is simpler and avoids
	dependencies on a shell.

	Fix quote_arg to handle Windows paths better.

compiler/handle_options.m:
	Don't attempt to use symlinks if they're not available.

compiler/compile_target_code.m:
	Be more careful about quoting.

	Don't call invoke_shell_command where invoke_system_command
	would do.

	Allow linking using MSVC.

compiler/modules.m:
	Remove make_directory, which is now implemented by dir.m.

	Use io.make_symlink rather than shell scripts.

	Implement mercury_update_interface in Mercury.

compiler/llds_out.m:
compiler/make.program_target.m:
	Use dir.make_directory, not modules.make_directory,
	which has been removed.

compiler/make.module_target.m:
	Invoke mercury_compiler directly, not through the
	mmc script to avoid shell dependencies.

	If we can't fork() child `mmc --make' processes,
	pass the arguments to the child process using a
	file to avoid overflowing system limits on Windows.

compiler/mercury_compile.m:
compiler/options_file.m:
	Read argument files.

	Handle backslash-newline in options files correctly.

compiler/passes_aux.m:
	invoke_system_command shouldn't set the exit status --
	the caller may be able to try something else.

compiler/process_util.m:
	Export can_fork for use by make.module_target.m.

	Remove hacks to work around bugs in the implementation
	of zero-arity foreign procs.

compiler/prog_io.m:
	Handle bizarre file names without aborting.

library/Mmakefile:
library/print_extra_inits:
	Move code to find extra initialization functions into
	print_extra_inits, due to the change to the handling
	of the --extra-init-command option described above.

scripts/mmc.in:
	Set the MERCURY_COMPILER environment variable if it is
	not already set, so that the mercury_compile executable
	knows where to find itself.

scripts/mercury.bat.in:
	Make this actually work.

tools/bootcheck:
	Set ANALYSIS_LIB_NAME.

	Apply cygpath (-m not -w) to $root.

	Link print_extra_inits into the stage2 and stage3
	library directories.

util/mkinit.c:
	Handle '\\' in path names.
2003-08-06 12:38:14 +00:00
Simon Taylor
d1989b37cf Fix bugs in my change to the handling of environment variables.
Estimated hours taken: 0.1
Branches: main

Fix bugs in my change to the handling of environment variables.

scripts/mgnuc.in:
	Fix a sh syntax error which broke .hl(c) grades.

scripts/mmc.in:
	Fix the list of environment variables.
2003-04-14 06:50:13 +00:00
Simon Taylor
2b6712425e Clean up the handling of environment variables.
Estimated hours taken: 0.5
Branches: main

Clean up the handling of environment variables.

scripts/Mmake.rules:
scripts/c2init.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/mmc.in:
scripts/parse_ml_options.sh-subr.in:
scripts/binary_step.in:
	Remove support for the environment variables which were
	previously used to override the location of the standard
	library (MERCURY_ALL_C_INCL_DIRS, MERCURY_ALL_MC_C_INCL_DIRS,
	MERCURY_INT_DIR, MERCURY_C_LIB_DIR, MERCURY_MOD_LIB_MODS,
	MERCURY_TRACE_LIB_MODS).

scripts/Mercury.config.in:
	Fix syntax errors.

	Set the DEFAULT_MERCURY_LINKAGE variable here rather
	than in the mmc script.

scripts/mmc.in:
	Setting DEFAULT_MCFLAGS is no longer required -- mmc
	now reads its configuration information from the
	Mercury.config file. This also fixes a bug which
	caused failures in the `mmc --make' tests in
	debugging grades on mundroo -- `mmc --make' wasn't
	including /usr/local/lib and /usr/local/include in
	the search paths for libraries and headers.

configure.in:
	Check that the installed compiler is capable of
	reading the Mercury.config file.
	Bootstrap tag: bootstrap_20030413_read_config_file.

NEWS:
doc/user_guide.texi:
	Document the change.
2003-04-13 05:48:37 +00:00
Simon Taylor
ceaa856013 Move the setting of configuration options from mmc.in to
Estimated hours taken: 20
Branches: main

Move the setting of configuration options from mmc.in to
an options file Mercury.config. This has a few advantages:
- reduces the duplication between mmc and mercury.bat
- reduces the chance of running out of environment space
  on crappy operating systems (although we probably exceed
  the command line length limits on those systems anyway).
- makes it easier to bootstrap changes which add new
  configuration options.

Always read the options files, even without `--make',
to avoid inconsistent behaviour.

scripts/Mercury.config.in:
	New file containing the configuration code from mmc.in.

configure.in:
	Create scripts/Mercury.config.

bindist/Mmakefile:
	Make sure Mercury.config.in goes in the binary distribution.

Mmakefile:
bindist/Mmakefile:
Mmake.common.in:
	Make sure we get the correct setting of INSTALL_PREFIX
	when building the binary distribution.

scripts/Mmakefile:
scripts/mercury_config.in:
bindist/bindist.Mmakefile.in:
	Install Mercury.config.

compiler/options.m:
doc/user_guide.texi:
	Add documentation for the `--config-file' option, which gives
	the name of the configuration file to read.

	Add an option `read-config-file-2003-03-01' which will be
	used in configure.in to test whether the compiler is up
	to date after the configuration code is removed from mmc.in
	(after this change is installed everywhere).

	Add `--mercury-config-dir' as an abbreviation for
	`--mercury-configuration-directory'.

Mmake.workspace:
	Use the configuration file in scripts/Mercury.config.

browser/Mmakefile:
compiler/Mmakefile:
scripts/Mmake.vars.in:
	Always pass ALL_MCFLAGS to mmc so that mmc will
	use the configuration file specified in the options.

compiler/handle_options.m:
	Handle the default value of `--config-file'.

compiler/mercury_compile.m:
	Read the configuration file.

	Always read the options files, even without `--make',
	to avoid inconsistent behaviour.

compiler/make.m:
	Pass the variable settings from the configuration file
	to make__process_args.

	The options files have already been read in mercury_compile.m,
	so don't read them again here.

compiler/make.util.m:
	Add a version of build_with_module_options which doesn't
	need a make_info, for use by mercury_compile.m.

compiler/options_file.m:
	Export a predicate to read a single options file.

	Make the predicates to read options files add to an initial
	options_variables map, rather than always creating a new one.

	Allow MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR
	to be set in the options file or environment.

scripts/mmc.in:
	Set MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR in
	mercury_compile's environment.
2003-03-01 06:35:17 +00:00
Simon Taylor
7673992a15 Fix `mmc --make' test failures in debugging grades on mundroo
Estimated hours taken: 0.25
Branches: main

Fix `mmc --make' test failures in debugging grades on mundroo
(it wasn't finding the readline library).

aclocal.m4:
scripts/mmc.in:
	Pass `-L/usr/local/lib' and `--c-include-directory /usr/local/include'
	to mmc if those directories exist.
2003-02-17 07:42:56 +00:00
Simon Taylor
4b49b1f019 Implement the ml and c2init scripts in the compiler to
Estimated hours taken: 25
Branches: main

Implement the ml and c2init scripts in the compiler to
reduce dependencies on Cygwin.

compiler/compile_target_code.m:
	Implement the functionality of ml and c2init, rather than
	calling those scripts.

	Handle all compiler dependencies using options, rather than
	testing for particular compilers here.

compiler/options.m:
NEWS:
doc/user_guide.texi:
	Add options which implement functionality which is part
	of ml, c2init or mgnuc when using Mmake:
	--warn-target-code, --output-link-command,
	--output-shared-lib-link-command, --ansi-c,
	--no-strip, --no-demangle, --no-main,
	--allow-undefined, --use-readline, --runtime-flags,
	--extra-inits.

	Add options to describe the C compiler and linker, for
	use by configure/mmc.

	The `--ml-flags' (`--link-flags') option has been removed.

compiler/options_file.m:
	Remove the MLFLAGS variable.

compiler/handle_options.m:
	`--target-debug' implies `--no-strip'.

	Add the path to the GC libraries to the library search paths.

compiler/mercury_compile.m:
	Handle --output-link-command and --output-shared-lib-link-command.

compiler/passes_aux.m:
	Add a variant of invoke_shell_command which takes a second
	command to process the first command's output. This is used
	by compile_target_code.m to invoke the demangler.

configure.in:
scripts/mmc.in:
	Handle extra default options.

scripts/c2init.in:
scripts/ml.in:
	Document that the code here is duplicated in
	compiler/compile_target_code.m.

Mmake.workspace:
browser/Mmakefile:
compiler/Mercury.options:
compiler/Mmakefile:
library/Mmakefile:
	Pass `-R' options pointing to the installation directories
	to mmc, as we already do for ml.
2003-02-05 14:41:20 +00:00
Simon Taylor
7597ca1e80 Allow reconfiguration of existing installations, for example
Estimated hours taken: 20
Branches: main

Allow reconfiguration of existing installations, for example
to use a different C compiler. The reconfiguration works
by making a new copy of the scripts and mercury_conf.h,
and storing them in a partial installation directory tree
which uses the libraries and executables from the existing
installation.

Use this method to configure binary distributions, rather
than using a cut down version of the configuration script,
to avoid code duplication and to handle the case where the
C compiler in use on the installation machine is different
than that used to build the binary distribution.

This is more robust than the previous method of using a different
C compiler, which was to set the MERCURY_C_COMPILER variable and
hope the different C compilers were compatible enough.

Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
	Modify the `install' targets to store files needed to create
	a new configuration in $INSTALL_LIBDIR/reconf.

runtime/Mmakefile:
	Install mercury_conf.h in $INSTALL_LIBDIR/conf, rather than
	$INSTALL_LIBDIR/inc, so that it can be overridden by a
	different configuration.

scripts/mercury_config.in:
	Create a new configuration, by creating part of a Mercury
	source tree from the files stored in $INSTALL_LIBDIR/reconf,
	running configure, then copying the files into a partial
	installation tree.

scripts/Mmake.vars.in:
	Define ENABLE_DEEP_PROFILER, for use by bindist/bindist.Makefile.

	Define variables INSTALL_CONF_DIR (contains the files describing
	the configuration) and INSTALL_RECONF_DIR (contains files needed
	to reconfigure an installation).

configure.in:
	Add an option `--enable-reconfigure', for use by
	mercury_config.in.

	Don't look for runtime/mercury_wrapper.c when checking
	for the sources -- it isn't present when reconfiguring.
	Look for scripts/mmc.in instead.

	Look for the runtime headers in the installation hierarchy
	rather than the `runtime/' and `trace/' directories when
	reconfiguring.

	Output the help message for the `configure' script to
	`configure.help'.  This is included in the help message
	for `mercury_config'.

	Add new configuration variables CONFIG_PREFIX and CONFIG_LIBDIR,
	which are like PREFIX and LIBDIR except that they point
	to the configuration files, not the library files.
	In the normal case PREFIX and CONFIG_PREFIX will be the same.

bindist/bindist.INSTALL.in:
bindist/bindist.Makefile.in:
	Use mercury_config to configure binary distributions.

bindist/Mmakefile:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
	Remove bindist.configure.in and bindist.build_vars.in.

compiler/options.m:
scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
doc/user_guide.texi:
	Add an option `--mercury-config-dir', and an environment
	variable MERCURY_CONFIG_DIR, which tell the compiler and
	scripts where to find the configuration files for the
	installation.
	MERCURY_CONFIG_DIR is not documented because it should
	only be used by the scripts.

compiler/compile_target_code.m:
	Pass `--mercury-config-dir' to the scripts.

compiler/handle_options.m:
	Add `--c-include-directory $MERCURY_CONFIG_DIR/conf'.

library/getopt.m:
	Handle `maybe_string_special' options.

doc/user_guide.texi:
	Update the "Using a different C compiler" chapter.

NEWS:
	Document the changes.
2003-01-24 07:17:13 +00:00
Simon Taylor
886d2ae474 Make it easier to use shared libraries on x86 with
Estimated hours taken: 20
Branches: main

Make it easier to use shared libraries on x86 with
`mmc --make'.

There is now a third kind of object file, `.lpic_o'.
These files are compiled with `--pic-reg' but not with
CFLAGS_FOR_PIC, so they can be linked with shared Mercury
libraries.

On x86, executables which are linked with shared Mercury
libraries now depend on $(main_module.lpic_os), not
$(main_module.os).

This doesn't work with Mmake because ml doesn't know
which libraries are Mercury libraries, so it can't
link with the static versions of those libraries if
MERCURY_LINKAGE is set to "static".

configure.in:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
	Work out whether `.lpic_o' files are needed.

compiler/modules.m:
	Add `.lpic_o' to the list of grade or architecture
	dependent files.

NEWS:
README.Linux:
compiler/options.m:
doc/user_guide.texi:
	Document MERCURY_LINKAGE, LINKAGE, --linkage,
	--mercury-linkage and -R.

compiler/options_file.m:
compiler/make.program_target.m:
	Handle LINKAGE and MERCURY_LINKAGE variables.

	Allow LIBGRADES, LINKAGE and MERCURY_LINKAGE to be target-specific.

scripts/mmc.in:
	Set up the default linkage using the MERCURY_LINKAGE
	variable.

compiler/compile_target_code.m:
	Build `.lpic_o' files.

	Work out which type of object files to link with.

	When linking statically with Mercury libraries,
	find the absolute pathname for the `.a' file
	for each Mercury library, and pass that to ml,
	rather than just using `-lname'.

	Pass `-R' options to ml for each `-R' option to mmc.

compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile.m:
	Specify which type of object files to build.

compiler/make.program_target.m:
compiler/make.module_target.m:
	Make sure all generated object files are cleaned up.

compiler/prog_io.m:
	Add a better message for files which can't be found.

compiler/make.util.m:
	Add `.lpic_o' to the list of extensions.

compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
	Pass `--linkage shared' to mmc (`--shared' is in MLFLAGS).

tests/Mmakefile:
tests/mmc_make/Mmakefile:
tests/mmc_make/Mercury.options:
tests/mmc_make/complex_test.{m,exp}:
tests/mmc_make/hello.{m,exp}:
	Test `mmc --make'.

tests/lib/complex*.m:
	The complex numbers library from the extras distribution,
	for use in the mmc_make tests.
2003-01-23 00:24:20 +00:00
Simon Taylor
585fca09ae Pass the configured values for --executable-file-extension,
Estimated hours taken: 0.1
Branches: main, release

scripts/mmc.in:
	Pass the configured values for --executable-file-extension,
	--shared-library-extension and --pic-object-extension.
2003-01-16 04:11:30 +00:00
Simon Taylor
7620b07c54 Use `DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS-...}' rather than
Estimated hours taken: 0.25
Branches: main, release

scripts/mmc:
	Use `DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS-...}' rather than
	`DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS=...}'. The latter form
	causes /bin/sh on mundroo (Solaris/x86 2.8) to crash when
	the RHS of the assignment is very long.
2002-08-08 06:22:00 +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
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
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
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
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
Fergus Henderson
7f0ff9ac19 Delete an old bootstrapping hack that is no longer needed.
Estimated hours taken: 0.25
Branches: release, main

scripts/mmc.in:
	Delete an old bootstrapping hack that is no longer needed.
2001-04-09 08:54:05 +00:00
Fergus Henderson
3f52368009 When invoking mercury_compile to check whether it supports
Estimated hours taken: 0.25

scripts/mmc.in:
	When invoking mercury_compile to check whether it supports
	`--cflags-for-threads', make sure that we redirect stdin
	from /dev/null, to ensure that the test doesn't hand if
	debugging is enabled.
2000-09-18 07:06:32 +00:00
Fergus Henderson
50ce611dd7 Add a work-around for a bootstrapping problem with my
Estimated hours taken: 0.25

scripts/mmc.in:
	Add a work-around for a bootstrapping problem with my
	previous change to use `--cflags-for-threads'.
2000-09-16 00:08:38 +00:00
Fergus Henderson
385d38b5cf Fix a bug: mmc wasn't passing the right flags to the C compiler
Estimated hours taken: 2

Fix a bug: mmc wasn't passing the right flags to the C compiler
when `--parallel' was specified.

configure.in:
	Set CFLAGS_FOR_THREADS, using code adopted from the code
	in scripts/mgnuc.in.

scripts/mgnuc.in:
	Use CFLAGS_FOR_THREADS rather than doing the case analysis
	here.

scripts/mmc.in:
	Pass `--cflags-for-threads $CFLAGS_FOR_THREADS' to mercury_compile.

compiler/options.m:
	Add a new option `--cflags-for-threads', for use by scripts/mmc.in.

compiler/mercury_compile.m:
	If --parallel is enabled, pass the --cflags-for-threads
	options to the C compiler.

bindist/bindist.build_vars.in:
	Pass on CFLAGS_FOR_THREADS.
2000-09-16 00:08:37 +00:00
Peter Ross
11565225ad Enable the options --c-flag-to-name-object-file and --object-file-extension.
Estimated hours taken: 0.25

Enable the options --c-flag-to-name-object-file and --object-file-extension.
These changes are tagged with bootstrap_20000707_obj_ext.

configure.in:
    The bootstrap compiler is only recent enough if it accepts the
    --object-file-extension flag.

scripts/mmc.in:
    Used the autoconfed values to set -c-flag-to-name-object-file and
    --object-file-extension defaults.
2000-07-07 11:11:35 +00:00
Peter Ross
b96449d4ba We cannot just comment out the --c-flag-to-name-object-file and
Estimated hours taken: 0.1

mmc.in:
    We cannot just comment out the --c-flag-to-name-object-file and
    --object-file-extension flags, as that destroys the line
    continuations.  Instead remove the options from inside the execs,
    and leave them with a comment that they need to enabled when a
    compiler that understands these flags bootstraps.
2000-06-20 08:02:55 +00:00
Peter Ross
edb44545b9 Fix a bootstraping problem, the options --c-flag-to-name-object-file
Estimated hours taken: 0.1

scripts/mmc.in:
    Fix a bootstraping problem, the options --c-flag-to-name-object-file
    and --object-file-extension can't be set by the mmc.in script until
    a compiler exists that recognises them, so comment them out.  The
    defaults for these flags are the unix flags.
2000-06-19 12:29:24 +00:00
Peter Ross
1c02ce69b3 Changes needed to get
Estimated hours taken: 16

Changes needed to get
    mmc --grade hlc.gc file.m
producing an executable, using MSVC as the compiler.

compiler/options.m:
    Add the flags --c-flag-to-name-object-file and
    --object-file-extension.  --c-flag-to-name-object-file is the flag
    the C compiler uses to name object files (ie -o for gcc, /Fo for
    MSVC).  --object-file-extension is the extension used by object
    files on the current system.

compiler/mercury_compile.m:
    Use the values of --c-flag-to-name-object-file and
    --object-file-extension to generate the command line to compile
    C files.

scripts/mmc.in:
    Set the default values of the two new flags from the autoconfed
    settings.

configure.in:
    Set the value for CYGPATH, a utility which transforms between unix
    and window paths.  This is just echo under unix.

scripts/ml.in:
    Use the autoconfed extension for the library files.
    Use the autoconfed flag to add a path to list of directories to be
    searched for libraries.
    Make static libraries the default on cygwin systems.
    Factor out the code which determines all the flags to be passed to
    the linker.
    Add an autoconfed variable LINK_OPT_SET which is the flag used to
    indicate that all the options following this flag are to be passed
    on to the linker.
    Use the autoconfed setting for CYGPATH to transform the path to
    static libraries into the correct format.
2000-06-16 16:37:46 +00:00
Fergus Henderson
364b867a37 Fix a quoting bug in my previous change.
Estimated hours taken: 0.1

scripts/mmc.in:
	Fix a quoting bug in my previous change.
2000-03-24 20:16:52 +00:00
Fergus Henderson
179d8be613 Fix a bug where tools/bootcheck was failing the
Estimated hours taken: 1

Fix a bug where tools/bootcheck was failing the
tests/hard_coded/split_c_files test case.

scripts/mmc.in:
	Add a new environment variable MERCURY_MC_ALL_C_INCL_DIRS
	which can be used to override MERCURY_C_INCL_DIR;
	it is similar to the MERCURY_ALL_C_INCL_DIRS used by mgnuc,
	except that it should contain `--c-include-directory' options
	rather than `-I' options.

tools/bootcheck:
	Pass down MERCURY_MC_ALL_C_INCL_DIRS,
	just like the way we pass down MERCURY_ALL_C_INCL_DIRS.
2000-03-24 20:11:51 +00:00
Fergus Henderson
322fc3065f Delete the definition of MERCURY_LPSOLVE, since it's long
Estimated hours taken: 0.25

scripts/mmc.in:
	Delete the definition of MERCURY_LPSOLVE, since it's long
	obsolete.
1998-11-05 10:51:32 +00:00
Fergus Henderson
f777d1920c Move the `-I $INTDIR' so that it goes *after* the user's arguments
Estimated hours taken: 0.5

scripts/mmc.in:
	Move the `-I $INTDIR' so that it goes *after* the user's arguments
	to mmc, rather than before.  This ensures that any directories that
	the user specifies using `-I' options are searched before the
	standard Mercury library directory, which is consistent with
	the way `-L' and `-R' options are currently handled.

	This patch is needed to allow `-I ..' specified in Mmakefile in
	extras/clpr/samples to work.  Otherwise, it uses the installed
	`.int' files, but links with the local (and potentially different)
	libraries, resulting in link errors.
1998-02-05 03:41:56 +00:00
Fergus Henderson
300761d01d Fix a bug in the setting of the MERCURY_LPSOLVE environment
Estimated hours taken: 0.25

scripts/mmc.in:
	Fix a bug in the setting of the MERCURY_LPSOLVE environment
	variable.
1997-10-14 03:29:02 +00:00
Fergus Henderson
269cbfb37c Set the MERCURY_LPSOLVE environment variable to the full path
Estimated hours taken: 0.25

scripts/mmc.in:
	Set the MERCURY_LPSOLVE environment variable to the full path
	"@BINDIR@/lp_solve", if not already set, so that it won't matter
	if users have another command called `lp_solve' in their path.
1997-10-11 12:37:58 +00:00
Fergus Henderson
04b720630b Update the copyright messages so that (a) they contain the correct years
and (b) they say "Copyright (C) ... _The_ University of Melbourne".
1997-07-27 15:09:59 +00:00
Tyson Dowd
9e9aea4053 Rename mc' as mmc'. (Remember to commit mmc.in this time ;)
Estimated hours taken: 0.5

Rename `mc' as `mmc'. (Remember to commit mmc.in this time ;)

scripts/mmc.in:
	Change references to mc into mmc.
1997-07-16 05:18:56 +00:00