Commit Graph

48 Commits

Author SHA1 Message Date
Peter Wang
964ffbb950 These changes allow the compiler to be built with `mmake --use-mmc-make'.
Estimated hours taken: 2
Branches: main

These changes allow the compiler to be built with `mmake --use-mmc-make'.

*/Mmakefile:
	Add dummy rules for optional `Mmake.*.params' files so that
	`mmc --make' is not asked to make them.

library/INTER_FLAGS_MMC_MAKE:
library/Mmakefile:
	Add a version of the `library/INTER_FLAGS' file to be used when
	`mmc --make' is being used.

library/LIB_FLAGS.in:
	Add `--c-include-directory ../robdd' so that `mmc --make' can find
	the included C files for `robdd.m'.

tools/bootcheck:
	Make `bootcheck --use-mmc-make' imply `bootcheck --use-subdirs'.

	Copy `INTER_FLAGS_MMC_MAKE' to stage 2 and stage 3 directories.

	Manually make `*_FLAGS' files in the stage 2 directory if
	`--use-mmc-make' is in effect.
2005-12-16 05:49:40 +00:00
Zoltan Somogyi
d124cad510 Reduce the amount of clutter on mgnuc command lines by moving arguments that
Estimated hours taken: 4
Branches: main

Reduce the amount of clutter on mgnuc command lines by moving arguments that
are always the same for a given directory into a file that is always consulted
by mgnuc in the current directory.

scripts/mgnuc.in:
	Always include as C compiler arguments the contents of a file named
	.mgnuc_copts in the current directory, if it exists. (It is named
	.mgnuc_copts instead of .mgnuc_opts because it may not contain
	general mgnuc options, such as --no-mercury-stdlib-dir.)

Mmake.workspace:
	Comment out the additions of search paths to CFLAGS.

*/Mmakefile:
	Delete the additions of search paths to CFLAGS.

*/.mgnuc_copts:
	New files containing the directory-specific search paths, and in some
	cases the required macro definitions. These replace what was taken out
	of Mmake.workspace and */Mmakefile. In some cases, the old search paths
	included inappropriate directories; the .mgnuc_copt files don't.

tests/.mgnuc_copts.ws:
	New files containing the directory-specific search paths; bootcheck
	makes tests/.mgnuc_copts from it.

*/.nocopyright:
	Don't require copyright notices in .mgnuc_copts files.

tools/bootcheck:
	Copy the various .mgnuc_copts files from the stage1 to stages 2 and 3.
	They aren't needed in stage3 right now, but that may change.

	Create tests/.mgnuc_copts.

browser/util.m:
	Delete an unused and inappropriate #include.

scripts/Mmake.rules:
	Use a single invocation of mkdir -p to create all subdirectories
	needed by Java. Update a piece of documentation.

scripts/Mmakefile:
	Reorganize the process of invoking config.status to avoid invoking
	it on inappropriate files, and to ensure the right permissions
	on the files it is invoked on.

scripts/prepare_tmp_dir_grade_part:
	Copy the .mgnuc_copts files when populating tmp_dir.
2005-05-20 06:15:28 +00:00
Zoltan Somogyi
d56de30e9d Remove most of the junk from the command lines executed by make when building
Estimated hours taken: 12
Branches: main

Remove most of the junk from the command lines executed by make when building
the compiler and by bootcheck when building test cases. We do this by moving
the junk into files consulted via the --flags option.

After this change, it is actually possible to see in a glance not just which
files are being compiled but also with which options. The size of the output
(measured in bytes) from a bootcheck is now only about 40% of what is was
before.

configure.in:
	Remember the path to the bootstrap compiler and the flags it should be
	invoked with separately. Put the flags into the FLAGS files in various
	directories.

	Test whether the default install directory actually exists, so that
	the -L and -R linker options referring to this directory are passed
	to the C compiler only if it does.

Mmake.common.in:
	Comment out a bunch of additions of MCFLAGS, the ones whose contents
	are now in FLAGS files.

	Conform to the changes in configure.in.

	Add a template rule for the dependencies of the FLAGS files.

Mmake.workspace:
	Comment out a bunch of additions of MCFLAGS, the ones whose contents
	are now in FLAGS files. In some cases, add references to the FLAGS
	files.

Mmakefile:
	When rebuilding Mmake.common, rebuild only Mmake.common, not all files
	created by configure.

analysis/ANALYSIS_FLAGS.in:
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/PROF_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
profiler/DEEP_FLAGS.in:
slice/SLICE_FLAGS.in:
tests/TESTS_FLAGS.in:
	Add these files, which each contain the junk flags (the flags which are
	the same on every invocation and mostly just clutter up compiler
	command lines) that are needed on each compiler invocation in the
	relevant directory. Besides the results of configuration (word size
	etc), and the paths to other parts of the system, these files mostly
	control which warnings are enabled.

	Restrict the list of directories in -I options to what is sensible;
	for example, don't specify -I../analysis in the deep_profiler
	directory.

*/.nocopyright:
	Don't require copyright notices in FLAGS files, since that would make
	them invalid.

library/INTER_FLAGS:
	Add this file, which contains the flags enabled with intermodule
	optimization.

tests/WS_FLAGS.ws:
	Add this file. Unlike the .in files, which processed by config.status
	based on the results of autoconfiguration, this one is processed to
	specify the location of the workspace being tested.

analysis/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
tests/Mmakefile:
	Include the relevant directory's FLAGS file on the command line, to
	replace all the additions to MCFLAGS in ../Mmake.common and in
	../Mmake.workspace, and in some cases, the directory-specific Mmakefile
	itself.

	Build the directory's FLAGS file before executing the depend target,
	since most compiler options beyond --generate-dependencies come from
	there.

	Delete the FLAGS files generated by config.status when doing "make
	clean".

tests/Mmakefile:
	Allow the environment to define DIFF_OPTS.

runtime/Mmakefile:
	Use an option to tell config.status what to rebuild, not some
	environment variables.

tests/invalid/Mercury.options:
	For two test cases, reset an option that is set in tests/WS_FLAGS,
	to match the options the affected tests were compiled with before.

tests/invalid/*.err2:
	Update these expected files to account for the use of error_util
	in error messages by previous changes to the compiler. These expected
	output files are used only with --use-subdirs.

tests/warnings/Mmakefile:
	For all test cases, reset an option that is set in tests/WS_FLAGS,
	to match the options the tests were compiled with before.

scripts/prepare_tmp_dir_grade_part
	Copy the flags files when creating the subdirectories of tmp_dir.

scripts/mgnuc.in:
	Provide a mechanism, a per-directory .mgnuc_opts file, for specifying
	the options that are required for every C file in a directory. The
	intention is to use this for -I../library etc, but this is not done
	yet; one thing at a time.

tools/bootcheck:
	Copy the FLAGS files when creating stage2 and stage3.

	Don't specify the compiler options that are now in FLAGS files.

	Fill in the location of the workspace in tests/WS_FLAGS before running
	the tests.

	Provide a mechanism (a file ~/.bootcheck_diff_opts) to allow the user
	to specify what options to invoke diff with.

	Move the setting of MMAKE_USE_SUBDIRS and MMAKE_USE_MMC_MAKE after
	we have built stage1, and always copy the profilers if --use-subdirs
	is set. The old ways of doing things caused problems if bootcheck
	was given --use-subdirs but stage1 doesn't use subdirs: the bootcheck
	modified the stage1 slice, profiler and deep_profiler directories.
2005-05-06 08:42:37 +00:00
Ian MacLarty
a492e2b90d Pass the grade options to mmc whenever it is called, even when it's just
Estimated hours taken: 3
Branches: main

Pass the grade options to mmc whenever it is called, even when it's just
building dependencies.  Previously compiling the compiler with tracing
enabled, where the compiler's default grade for applications was hlc.gc,
resulted in an error message like "debugging only allowed for low-level C
grades"; even when the GRADE=reg.gc option was set in Mmake.params.

browser/Mmakefile:
compiler/Mmakefile:
mdbcomp/Mmakefile:
	Pass the grade flags event when just running mmc with the
	--generate-source-file-mapping option.

compiler/modules.m:
	Pass the grade flags everytime mmc is invoked in the .d files.
2005-03-27 14:02:23 +00:00
Zoltan Somogyi
6b0fb566ce Move the mdbcomp library to its own directory.
Estimated hours taken: 12
Branches: main

Move the mdbcomp library to its own directory. To make this change less painful
to test, improve the way we handle installs.

browser/mdbcomp.m:
browser/mer_mdbcomp.m:
browser/prim_data.m:
browser/program_representation.m:
browser/trace_counts.m:
	Move these files to the mdbcomp directory.

browser/Mmakefile:
browser/Mercury.options:
mdbcomp/Mmakefile:
mdbcomp/Mercury.options:
	Split the contents of the old Mmakefile and Mercury.options file
	in the browser directory between these files as appropriate.
	Simplify away the stuff not needed now that there is only one library
	per directory. Make the browser directory see the relevant files
	from the mdbcomp directory.

Mmake.common.in:
	Separate out the prefixes allowed in the browser and the mdbcomp
	directories.

Mmake.workspace:
	Set up a make variable to refer to the mdbcomp directory.

	Adjust references to the mdbcomp library to point to its new location.

Mmakefile:
	Make invocations visit the mdbcomp library as necessary.

	Improve the way we install grades. Making temporary backups of the
	directories modified by the install process is unsatisfactory for two
	reasons. First, if the install fails, the cleanup script, which is
	necessary for user friendliness, destroys any evidence of the cause.
	Second, the restore of the backup wasn't perfect, e.g. it left the
	.d files modified to depend on .mih files, which don't exist in
	LLDS grades, and also left altered timestamps.

	This diff changes the install process to make a single tmp_dir
	subdirectory of the workspace, with all the work of install_grade
	being done inside tmp_dir. The original directories aren't touched
	at all.

*/Mmakefile:
	Adjust references to the browser directory to refer to the mdbcomp
	directory instead or as well.

scripts/Mmake.rules:
*/Mmakefile:
	Make it easier to debug Mmakefiles. Previously, creating a
	Mmake.makefile with mmake -s and invoking "make -d" ignored the
	most fundamental rules of mmake, because Mmake.rules was treating
	an unset MMAKE_USE_MMC_MAKE as if it were set to "yes", simply because
	it was different from "no". This diff changes it to treat an unset
	MMAKE_USE_MMC_MAKE as if it were set to "no", which is a more
	sensible default.

scripts/prepare_tmp_dir_fixed_part.in:
scripts/scripts/prepare_tmp_dir_grade_part:
	Two new scripts that each do half the work of preparing tmp_dir for
	the real work of the install_grade make target. The fixed_part script
	prepares the parts of tmp_dir that are grade-independent, while the
	grade_part scripts prepares the parts that are grade-dependent.

configure.in:
	Test C files in the mdbcomp directory to see whether they need to
	be recompiled after reconfiguration.

	Create prepare_tmp_dir_fixed_part from prepare_tmp_dir_fixed_part.in.

compiler/*.m:
runtime/mercury_wrapper.c:
	Update the references to the moved files.

compiler/notes/overall_design.html:
	Mention the new directory.
2005-01-28 07:12:05 +00:00
Zoltan Somogyi
38cf98fb2f Allow users to ensure that tags files always exist in the relevant directories
Estimated hours taken: 1
Branches: main

Allow users to ensure that tags files always exist in the relevant directories
by setting the environment variable ALWAYS_MMAKE_TAGS_FILE.

runtime/Mmakefile:
trace/Mmakefile:
library/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
	If TAGS_FILE_EXISTS is set to tags_file_exists, then make the default
	action ensure the existence of the tags file. It would be too
	expensive to remake the tags file every time mmake is run, but
	just testing for its existence is cheap enough.

	Fix the formatting of some rules.

Mmake.common.in:
	Set TAGS_FILE_EXISTS to tags_file_exists if the environment variable
	ALWAYS_MMAKE_TAGS_FILE is set.

	Fix some documentation.
2005-01-14 05:53:47 +00:00
Ian MacLarty
5d2b07416c Fix shared libs on Mac OS X for the source distribution.
Estimated hours taken: 8
Branches: main

Fix shared libs on Mac OS X for the source distribution.  The problem is that
the source distribution is generated on a Linux PC, so the Darwin-specific
-install_name linker option is not passed to the linker in the .dep files.

The fix is to instead pass the -install_name linker option in the Mmakefiles.
However this means that the -install_name linker option will be passed twice
(which is not allowed by the linker) if the .dep files are generated on a
Darwin system, so we disable the --shlib-linker-use-install-name mmc flag so
that the -install_name linker option is not passed in the .dep files.

Also change the default install-name path to the value of
FINAL_INSTALL_MERC_LIB_DIR, instead of just INSTALL_MERC_LIB_DIR in case the
install directory is different from the final install directory.

Makefile
	Remove .dylib files when cleaning.

browser/Mmakefile
library/Mmakefile
	Pass -install_name linker option when building .dylib targets.
	Disable --shlib-linker-use-install-name mmc option.

compiler/options.m
	Change default value of --shlib-linker-install-name-path to the value
	of FINAL_INSTALL_MERC_LIB_DIR, instead of INSTALL_MERC_LIB_DIR.
2004-11-01 04:46:20 +00:00
Ian MacLarty
ea43cd038d Changes to get shared libraries to work on Mac OS X (Darwin).
Estimated hours taken: 20
Branches: main

Changes to get shared libraries to work on Mac OS X (Darwin).

This is phase 2 of 2.  Phase 1 added the compiler options described below.
Phase 2 uses these compiler options in the configuration scripts.

Darwin shared libraries have the extension `dylib' instead of `so'.  Also
objects that link to a shared library on Darwin don't need to be told the
runtime path in which they should look for the libraries, instead the
shared libraries themselves remember where they will be eventually installed
(called the install-name) and any object which links in the shared library will
get the install-name from the shared library at link time.  When a shared
library is built it has to be told where it will be installed which is what
the libtool -install_name option is used for on Darwin.

This diff only enables shared libraries on Darwin, not "bundles" which are
shared objects that can be loaded dynamically at runtime using something like
dlopen.  Therefore the interactive query tool in the debugger still doesn't
work on Mac OS X.

Added three new compiler options :

--shlib-linker-use-install-name :
	A boolean flag to tell the compiler to use the -install_name option
	when building shared libraries.  When this flag is set the following
	options have no effect: --linker-rpath-flag, --linker-rpath-separator,
	--shlib-linker-rpath-flag, --shlib-linker-rpath-separator.

--shlib-linker-install-name-flag :
	The flag name to use ("-install_name" for Darwin).

--shlib-linker-install-name-path :
	The path where the shared library will eventually end up, excluding the
	file name.  The file name is appended to the end before the option
	is passed on to the linker.

Mmake.common.in
	Added variables used for install-name on/off switch and flag name.

NEWS
	Mentioned shared libs working now on Mac OS X.

README.MacOS
	Removed bit about shared libs not working in Mac OS X.

configure.in
	Make shared libs the default when on Darwin and the compiler is gcc.

boehm_gc/Makefile
boehm_gc/Makefile.direct
	Added rule to make libgc.dylib and set the install-name correctly.

boehm_gc/Mmakefile
	Set variable used in boehm_gc/Makefile to get the final install path
	of the gc shared lib.

browser/Mercury.options
	Added mer_mdbcomp library for target libmer_browser.dylib.

browser/Mmakefile
	Added --shlib-linker-install-name-path option to MC options.

doc/user_guide.texi
	Documented the --shlib-linker-install-name-path option.  The other
	options will be automatically set by the configure script and
	should never need to be set by the user, so they're not documented in
	the user guide.

runtime/Mmakefile
	Added rule to make the Darwin shared library.

scripts/Mercury.config.bootstrap.in
	Added default values for --shlib-linker-use-install-name and
	--shlib-linker-install-name-flag.

scripts/Mercury.config.in
	Added default values for --shlib-linker-use-install-name and
	--shlib-linker-install-name-flag.

trace/Mmakefile
	Added rule to make the Darwin shared library.
2004-10-19 06:01:38 +00:00
Fergus Henderson
d0228c4489 Some work towards getting the "browser" directory to build in grade java.
Estimated hours taken: 24
Branches: main

Some work towards getting the "browser" directory to build in grade java.

In particular, this is a step towards fixing a problem in the Java
back-end with sub-modules.  When compiling code that uses sub-modules,
we run up against a Java restriction that a class which is in a package
is not allowed to have the same name as the package.  The work-around
is to use names starting with an uppercase letter for Java class names,
and names starting with a lower-case letter for Java package names.

XXX This diff is a partial step: it uses names starting with an
uppercase letter for Java class names that correspond to Mercury types.
It does not yet use an uppercase letter for Java classes that correspond
to Mercury modules.

XXX With this diff, we just flip the case of the initial letter,
which just works around the problem by avoiding the clashing cases,
rather than eliminating them.  We should use a more complicated mangling
that eliminates the problem completely, e.g. map lowercase Mercury names
to uppercase, map uppercase Mercury names to "U_" followed by the name.

compiler/mlds_to_java.m:
	Output type names with an initial uppercase letter.

compiler/mlds.m:
	Add a new enumeration type qual_kind, with values type_qual
	and module_qual.
	Add a qual_kind field to the fully_qualified_type type.
	Add a qual_kind argument to the append_class_qualifier function,
	and if the qual_kind is module_qual, adjust the case of the
	qualifier appropriately for the back-end.

compiler/ml*.m:
compiler/rtti_to_mlds.m:
	Fill in the new qual_kind field, and pass qual_kind to
	append_class_qualifier.

library/builtin.m:
library/private_builtin.m:
library/type_desc.m:
library/io.m:
library/rtti_implementation.m:
	Use type names with an initial uppercase letter.

browser/Mmakefile:
	Work around problems where Java compilers don't like the file names
	generated by mmc for code using sub-modules.

	For IL and Java, build with --allow-stubs --no-warn-stubs.

browser/declarative_execution.m:
	Give a Java definition for the "proc_layout" type.
	This is needed to avoid compilation errors in grade java.
2004-08-02 08:30:17 +00:00
Fergus Henderson
f81fd43151 Add yet more missing dependencies, which caused problems when
Estimated hours taken: 0.5
Branches: main

browser/Mmakefile:
	Add yet more missing dependencies, which caused problems when
	bootstrapping with intermodule optimization enabled.
2004-02-17 23:44:52 +00:00
Fergus Henderson
ade1a43631 Add some more missing dependencies, which caused problems when building
Estimated hours taken: 0.25
Branches: main

browser/Mmakefile:
	Add some more missing dependencies, which caused problems when building
	with intermodule optimization enabled.
2004-02-09 12:05:17 +00:00
Fergus Henderson
e324ed42ba Add a missing dependency, which caused problems when building
Estimated hours taken: 0.5
Branches: main

browser/Mmakefile:
	Add a missing dependency, which caused problems when building
	with intermodule optimization enabled.
2004-02-05 15:30:14 +00:00
Fergus Henderson
899353ce88 Fix a bug in Zoltan's recent change: it was depending on
Estimated hours taken: 0.5
Branches: main

browser/Mmakefile:
	Fix a bug in Zoltan's recent change: it was depending on
	"libmer_browser.int" instead of "libmer_browser.ints"
	(and likewise for libmdbcomp).                     ^
2003-12-15 15:14:18 +00:00
Fergus Henderson
9b087fcc36 Ensure that we create libmer_mdbcomp.so before trying to build
Estimated hours taken: 0.1
Branches: main

browser/Mmakefile:
	Ensure that we create libmer_mdbcomp.so before trying to build
	libmer_browser.so.
2003-12-11 00:02:39 +00:00
Fergus Henderson
3f7c562053 Work around a problem where the mdbcomp library was being
Estimated hours taken: 1
Branches: main

browser/Mmakefile:
	Work around a problem where the mdbcomp library was being
	included in the mer_browser library, rather than just being
	referenced from it.
2003-12-10 23:56:35 +00:00
Fergus Henderson
8020bfed3c Some Mmakefile tweaks for grade java.
Estimated hours taken: 0.5
Branches: main

Some Mmakefile tweaks for grade java.

boehm_gc/Mmakefile:
browser/Mmakefile:
trace/Mmakefile:
	Don't try to build the boehm_gc, browser, or trace directories
	in grade java.

compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
	Avoid dependencies on *.$A files in grade java.
2003-12-09 14:57:57 +00:00
Fergus Henderson
4a76e32c47 Fix a typo: s/MDCOMP/MDBCOMP/g
Estimated hours taken: 0.25
Branches: main

browser/Mmakefile:
	Fix a typo: s/MDCOMP/MDBCOMP/g
2003-11-05 08:05:55 +00:00
Zoltan Somogyi
ecdc285bc7 Split the existing browser library into two libraries, by making the
Estimated hours taken: 10
Branches: main

Split the existing browser library into two libraries, by making the
program_representation module into its own library. This is useful because
the compiler refers to program_representation.m, whose code thus needs to be
linked into compiler executables even if the compiler isn't compiled with
debugging enabled. By creating a new library for this module, we avoid any
chance of the linker dragging in the rest of the modules in the browser
library. (This is a problem with an upcoming diff.).

The name of the new library is "mdbcomp", because the intention is that it
contain code that is shared between the debugger and the compiler. This means
mostly the definitions of data structures that the compiler generates for the
debugger, and the predicates that operate on them.

Mmake.common.in:
	Allow MDB_COMP_ as a prefix for symbol names in the browser directory.

Mmake.workspace:
	Add a make variable holding for the name of the new library, and
	add the name to the relevant lists of libraries.

	Avoid duplicating the lists of filenames that need to be updated
	when adding new libraries or changing their names.

Mmakefile:
	Use make variables to refer to library names.

browser/mdbcomp.m:
browser/mer_mdbcomp.m:
	Add these files as the top modules of the new library.

browser/program_representation.m:
	Make program_representation.m a submodule of mdbcomp, not mdb.

browser/program_representation.m:
browser/browser_info.m:
	Move a predicate from program_representation.m to browser_info.m
	to avoid the mdbcomp library depend on the browser library, since
	this would negate the point of the exercise.

browser/mdb.m:
	Delete program_representation.m from the list of submodules.

browser/Mmakefile:
	Update this file to handle the new module.

browser/Mercury.options:
	Mention the new module.

browser/*.m:
	Update the lists of imported modules. Import only one browser module
	per line.

compiler/notes/overall_design.html:
	Document the new library.

compiler/compile_target_code.m:
	Add the mdbcomp library to the list of libraries we need to link with.

compiler/prog_rep.m:
trace/mercury_trace_internal.c:
	Import program_representation.m by its new name.

scripts/c2init.in:
	Centralize knowledge about which files need to be updated when the list
	of libraries changes here.

scripts/c2init.in:
scripts/ml.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/linear:
tools/lml:
	Update the list of libraries programs are linked with.
2003-10-27 06:00:50 +00:00
Zoltan Somogyi
7c57ab785e Include Mmake.browser.params, if it exists.
Estimated hours taken: 0.1
Branches: main

browser/Mmakefile:
	Include Mmake.browser.params, if it exists.
2003-05-26 06:07:20 +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
Fergus Henderson
e132bebac7 Add `ils' target, for use by tools/bootcheck.
Estimated hours taken: 1
Branches: main

analysis/Mmakefile:
compiler/Mmakefile:
browser/Mmakefile:
profiler/Mmakefile:
	Add `ils' target, for use by tools/bootcheck.

library/Mmakefile:
	Add a missing dependency to ensure that we build all of the
	`.int*' files for the `il' grade (it was forgetting to build
	`library.int3').
	Also, add a target to build the library as an executable,
	so that you can run PEverify on it (PEverify doesn't
	work properly on multi-file assemblies unless they
	are executables).
2003-02-19 06:31:22 +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
Fergus Henderson
83c7eea7e7 "Oops, missed one."
Estimated hours taken: 0.25
Branches: main

"Oops, missed one."
Apply the same change as for the other */Mmakefile
files in my 2002/10/18 patch to browser/Mmakefile.

browser/Mmakefile:
        Run $(RANLIB) on the installed libraries.
        This is needed on MacOS 10.1, where the linker checks the date
        stamp on the .a file, refusing to link if this date is greater
        than the date when ranlib was run.  Since installing the
        libraries with `cp' updates their timestamp, we need to rerun ranlib.
2002-10-20 11:59:41 +00:00
Zoltan Somogyi
b7e55aa8ad Enforce namespace cleanliness in the library and browser directories
Estimated hours taken: 6
Branches: main

Enforce namespace cleanliness in the library and browser directories
as well as in the runtime and trace directories.

Mmake.common.in:
	Move the rules check_namespace here (they used to be in the Mmakefiles
	of the runtime and trace directories), together with the variables they
	need. Generalize them to also handle the needs of the browser, library
	and bytecode directories. The former two in particular need the
	ability to check automatically generated .mh files.

	Make all the rules used by check_namespace conditional on a macro
	that is defined by the Makefiles in all the directories that are
	checked for namespace cleanliness.

trace/Mmakefile:
runtime/Mmakefile:
	Replace the old rules for check_namespace, which are now in
	../Mmake.common.in, with the macros needed to control their behavior.

bytecode/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

	Move the lists of files to the start, before the include of
	../Mmake.common.

browser/Mmakefile:
library/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

runtime/RESERVED_MACRO_NAMES:
	Update comments, and delete obsolete exceptions.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	New files to contain the exceptions from the naming scheme.

tools/bootcheck:
	Invoke "mmake check_namespace" in the library and browser directories
	as well as the runtime and the trace directories. Perform the
	invocation before we delete the object files we are checking for
	cleanliness.

	Clean up object files in all stage2 directories, not just the library,
	as soon as we can.

library/array.m:
library/builtin.m:
library/io.m:
library/time.m:
	Fix namespace violations.
2002-09-24 06:55:36 +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
35d8516ff4 Remove work-arounds for a bug in deforestation and for
Estimated hours taken: 0.1
Branches: main

browser/Mmakefile:
	Remove work-arounds for a bug in deforestation and for
	smart recompilation not working where the module name
	doesn't match the file name. Both of these problems
	have been fixed.
2002-06-17 15:30:03 +00:00
Simon Taylor
46ba9ddd41 Make sure the Mercury.modules file is created before it is
Estimated hours taken: 0.1
Branches: main

browser/Mmakefile:
	Make sure the Mercury.modules file is created before it is
	used with parallel make.
2002-06-16 09:12:58 +00:00
Simon Taylor
cd4b049b9a Make smart recompilation work where the module name doesn't
Estimated hours taken: 1
Branches: main

Make smart recompilation work where the module name doesn't
match the file name (e.g. in the compiler).

compiler/modules.m:
	Where the module name doesn't match the file name
	and there is a Mercury.modules file, pass the
	module name to mmc, not the file name.

compiler/source_file_map.m:
	Add a predicate `have_source_file_map' for use
	by modules.m.

	Don't put the Mercury.modules file in the Mercury
	subdirectory. It's the user's responsibility to clean
	it up, so it should be in the main directory.

compiler/mercury_compile.m:
	Suggest creating the Mercury.modules file if passed
	a file name which doesn't match the module name.

compiler/Mmakefile:
browser/Mmakefile:
	Generate the Mercury.modules file.

tests/hard_coded/Mmakefile:
	The Mercury.modules file is no longer generated in
	the Mercury subdirectory.
2002-06-10 10:05:54 +00:00
Simon Taylor
72f34f5b3d Fix link problems on murlibobo caused by my recent changes
Estimated hours taken: 2
Branches: main

Fix link problems on murlibobo caused by my recent changes
to the way libmer_std.so and libmer_browser.so are built.
The problem was due to shared libraries being renamed
after they were built without telling the linker.

library/mer_std.m:
browser/mer_browser.m:
	Empty modules used to generate the libraries with
	the correct names.

library/Mmakefile:
browser/Mmakefile:
	Build and install libmer_std.* and libmer_browser.*
	rather than liblibrary.* and libmdb.*.

Mmake.workspace:
Mmake.common.in:
	Make sure SO_LOCATIONS_DIR is in ml's environment
	when building the libraries.

	Fix the order of the `-l' options.

compiler/Mmakefile:
	Make sure `main.o' comes before the library `.a' files
	on the ml command line.

doc/Mmakefile:
	Add mer_std.m to the list of files for which documentation
	should not be generated.

trace/Mmakefile:
	Add the grade-specific library directory to the rpath
	for libmer_trace.so.
2002-05-13 08:09:43 +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
16461887bc Disable deforestation when compiling browser/declarative_user.m
Estimated hours taken: 0.1
Branches: main

browser/Mmakefile:
	Disable deforestation when compiling browser/declarative_user.m
	to work around a bug which causes a compiler abort.
2002-03-09 07:17:09 +00:00
Simon Taylor
9dd11b2fc6 Smart recompilation. Record version numbers for each item
Estimated hours taken: 400

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Handle version number items in interface files.

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

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

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

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

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

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

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

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

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

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

	Remove code to create types with contexts in typechecking.

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

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

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

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

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

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

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

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

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

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

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

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

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

	Check for stat().

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

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

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

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

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

tests/handle_options:
	Add an option `-e' to generate any missing expected output files.
2001-06-27 05:05:21 +00:00
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
96eac21430 Modify Mmakefiles so that we don't try to install unnecessary
Estimated hours taken: 1
Branches: main release

boehm_gc/Mmakefile:
browser/Mmakefile:
trace/Mmakefile:
	Modify Mmakefiles so that we don't try to install unnecessary
	subsystems in IL grades.

runtime/Mmakefile:
	Add some support for installing the MCPP_HDRS and the DLLs in IL
	grades (largely untested).
	Fix some missing dependencies on the 'install_dirs' target.

library/Mmakefile:
scripts/Mmake.rules:
	Remove the check for ils_subdir, as this appears to be a
	cut-and-paste error -- the rules it surrounds are not for doing
	subdir builds.
	Use a clearer test for il as a substring in GRADE.
2001-03-16 01:40:43 +00:00
Fergus Henderson
e912dbc0be On platforms which support it, check that there are no undefined
Estimated hours taken: 2

On platforms which support it, check that there are no undefined
symbols when linking the Mercury shared libraries.
Some platforms (AIX, Windows, and BeOS) require this when building
shared libraries.  This change means that we check it on our usual
platforms, including Linux.

configure.in:
	Set ERROR_UNDEFINED to `-Wl,--no-undefined' on x86 Linux.
	Using --no-undefined on Linux requires linking in ld-linux.so,
	so add some code to figure out the right version of that to
	link with.

Mmake.common.in:
	Set ALLOW_UNDEFINED and ERROR_UNDEFINED to the values
	determined by configure.in.  Also pass down the values of
	SOCKET_LIBRARY, NSL_LIBRARY, and DL_LIBRARY, since we need
	to link with those libraries to resolve all the undefined
	symbols.

runtime/Mmakefile:
library/Mmakefile:
browser/Mmakefile:
trace/Mmakefile:
	Pass $(ERROR_UNDEFINED) to $(LINK_SHARED_OBJ).

browser/Mmakefile:
trace/Mmakefile:
	Link in SOCKET_LIBRARY, NSL_LIBRARY, and DL_LIBRARY.
2001-02-07 14:37:39 +00:00
Fergus Henderson
8b0dcbb231 Various fixes to get the GCC back-end interface to bootstrap.
Estimated hours taken: 20

Various fixes to get the GCC back-end interface to bootstrap.

library/exception.m:
	Define function versions of mercury__exception__builtin_catch_3_p_*.
	This is needed (a) in case we take their address, and (b) for the
	GCC back-end interface, where we can't use C macros, since we're
	compiling to assembler.

browser/dl.m:
browser/util.m:
browser/interactive_query.m:
compiler/stack_layout.m:
	Add #includes for header files needed by these modules.

browser/dl.m:
	Delete an unnecessary nested extern declaration, to avoid
	a warning from `gcc -Wshadow'.

compiler/mlds_to_gcc.m:
	When calling mlds_to_c to process foreign_code, make all
	definitions public, so that the can be used from the assembler
	code that we generate in mlds_to_gcc.

	Don't call mlds_to_c to generate `.c' and `.h' files if the
	module contains only `pragma foreign_decls', not `pragma
	foreign_code', `pragma foreign_proc', or `pragma export'.
	This change is needed to avoid calling mlds_to_c when
	intermodule optimization is enabled and `pragma c_header_code'
	declarations have been read in from the `.opt' file and have
	propagated through to the MLDS.  Calling mlds_to_c when the
	module itself doesn't contain C code breaks things, since
	Mmake won't compile and link in the generated `.c' files, but
	those files contain the definition of the `*__init_type_tables()'
	functions that are referenced by `*_init.c'.

	XXX This is not quite right, since if the module itself contains
	`pragma foreign_decls', the `.h' file might be needed.
	But the Mercury standard library needs intermodule optimization
	enabled for `make install' to work.
	A better fix would be to ignore foreign_decls that were defined
	in other modules, but to call mlds_to_c for foreign_decls
	that were defined in the module that we're compiling.

compiler/modules.m:
	Change the code which decides when to link in extra object files
	for foreign code to reflect the above change to when mlds_to_gcc.m
	invokes mlds_to_c.m.

compiler/mlds_to_c.m:
	When target=asm, i.e. we're compiling to asm, but mlds_to_c.m
	has been invoked to generate C code for a `foreign_code',
	`foreign_proc', or `pragma export' declaration, don't generate
	#include directives for the imported modules, since we may not
	have generated any header file for them.

	XXX This is a bit of a hack; it might sometimes lead to
	problems, since the header files might sometimes be needed.
	But including them unconditionally is definitely wrong,
	since they may not exist, and so this change is needed to get
	the compiler to bootstrap.

compiler/Mmakefile:
	Add a dependency of mercury_compile on $(GCC_BACK_END_LIBS),
	so that we know to relink it if the GCC back-end has changed.
	(That variable is set to empty if we're not linking in the GCC
	back-end, so it won't cause problems when not using the GCC
	back-end.)

library/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
	Add an `ss' target, for use by tools/bootcheck.

tools/bootcheck:
	Add `--target asm' option.  If that is set, pass `--target asm'
	to mmake, and build and compare the stage 3 `.s' files rather
	than the `.c' files.

	Also add `--make-opts' option, for passing options to `make'.
	Put `-k' in `--make-opts', not `--mmake-opts', since `-k' is
	an option to `make', not to `mmake'.  This makes a difference
	since although `make' options can be passed to `mmake', any
	options after the first `make' option are assumed to be
	options to `make', not to `mmake'.
2001-01-29 06:47:32 +00:00
Fergus Henderson
d7ed113ec6 Support installing both .par' and non-.par' versions of the GC library.
Estimated hours taken: 3

Support installing both `.par' and non-`.par' versions of the GC library.

scripts/ml.in:
	Change the code for computing which version of the GC library
	to link in so that it also takes the `.par' grade component
	into account, rather than just the `.prof' grade component.
	Add new options `--print-gc-grade' (for use by the top-level
	Mmakefile) and `--print-grade' (for symmetry).

Mmakefile:
	When invoking sub-makes in the boehm_gc directory,
	pass down GC_GRADE instead of PROF.
	Compute the GC_GRADE value using `scripts/ml ... --print-gc-grade`
	rather than computing it manually, since this avoids code duplication.

boehm_gc/Mmakefile:
boehm_gc/Makefile:
boehm_gc/NT_MAKEFILE:
	s/gc$(PROF)/$(GC_GRADE)/g

runtime/Mmakefile:
trace/Mmakefile:
browser/Mmakefile:
bytecode/Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
	Change the code for computing which version of the GC library
	to link in so that it also takes the `.par' grade component
	into account, rather than just the `.prof' grade component.
2000-08-17 05:31:11 +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
Fergus Henderson
38787b3da1 Fix a bug reported by Erwan Jahier:
Estimated hours taken: 0.25

browser/util.m:
	Fix a bug reported by Erwan Jahier:
	the order of the enum here should match that
	in runtime/mercury_trace_base.h.

runtime/mercury_trace_base.h:
	Update the documentation to point to browser/util.m
	rather than browser/debugger_interface.m.
2000-05-15 06:09:49 +00:00
Simon Taylor
9ba3b14098 Make all the modules in the browser library sub-modules of
Estimated hours taken: 1

Make all the modules in the browser library sub-modules of
module `mdb', to avoid link errors when users use module names
such as `parse'.

browser/Mmakefile:
browser/browser_library.m:
browser/mdb.m:
	Rename browser_library.m to mdb.m.
	Change `:- import_module' declarations to
	`:- include_module' declarations.

browser/Mmakefile:
	Remove the special case rule for `mer_browser.init' --
	it doesn't work when the file names are not the same
	as the module name. Instead, the default rule for `mdb.init'
	is used and the output is copied to `mer_browser.init'.

browser/.cvsignore:
	Rename header files, etc.

browser/*.m:
	Add a `mdb__' prefix to the names of modules in the browser library
	in `:- module' and `:- import_module' declarations.

trace/*.c:
	Rename the header files for the browser library in
	`#include' statements.

tests/hard_coded/Mmakefile:
tests/hard_coded/parse.m:
tests/hard_coded/parse.exp:
	Test case.
2000-02-04 03:45:53 +00:00
Mark Brown
9179be5e15 Implement a new data structure for declarative debugging.
Estimated hours taken: 160

Implement a new data structure for declarative debugging.  The
major differences between this and the old implementation are:
	- The data structure is implemented in Mercury.  The definition
	  of the type, and procedures for constructing values of that
	  type, have been moved from trace/mercury_trace_declarative.{c,h}
	  to browser/declarative_execution.m (which is a new module).
	- The front end no longer needs to call the back end via an
	  indirect pointer---the front end does not call the back end at
	  all.
	- The data structure is not specifically for wrong answer
	  analysis, it is intended to be used for any sort of analysis.
	- The data structure represents execution at a lower level---the
	  new front end defines a more abstract view in terms of this
	  data structure.

Implement a test harness for debugging the front end code.  This allows
the front end to run as a stand-alone program, which can then be
debugged using `mdb'.

The code in the front end does not currently handle the new structure
very nicely.  This is because that code is about to undergo some major
structural changes, so there is little point cleaning it up now.
Consequently:
	- Some of the code in the front end is incorrect (eg. the
	  user interface does not print missing answer nodes
	  properly).
	- The tests have not been reinstated.
These things will be fixed in subsequent changes.

Likewise the compiler still reserves two stack slots, even though
only one is required.  After this change the algorithm should be able
to get away with using no stack slots, so modifications to the compiler
will be postponed until then.

browser/declarative_execution.m:
	New module.  Implement the execution_tree typeclass, which
	represents the execution of a Mercury program.  Implement
	two instances of this typeclass, one for normal use and one for
	testing purposes.

browser/declarative_test.m:
	New module.  A test harness that can be compiled as a
	stand-alone program, enabling the front end to be debugged.

trace/mercury_trace_declarative.c:
trace/mercury_trace_declarative.h:
	- Remove the definition of the old data structure.
	- Add some macros which enable the new Mercury data structure
	  to be destructively updated by C code.
	- Change the interface to this module so that it reflects more
	  general diagnosis, not just wrong answer analysis.
	- Implement the new algorithm.
	- Call an alternative front end if in test mode.
	- Update comments.

trace/mercury_trace_internal.h:
	Add a new mode for debugging the declarative debugger.

trace/mercury_trace_internal.c:
	Change the command from `dd_wrong' to `dd', since it is not
	specifically for wrong answer analysis.  Add a new command
	`dd_dd' which calls the alternative front end used for testing.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
	Remove any reference to `MR_edt_root_node', since it is no
	longer used.

browser/declarative_debugger.m:
	- Add a case for missing answer nodes to `edt_node'.
	- Change the `evaluation_tree' typeclass into `mercury_edt'
	  typeclass.  This is to make it more distinct from the new
	  `execution_tree' typeclass, which is a lower level concept.
	- New interface to the diagnoser: types `diagnoser_response'
	  and `diagnoser_state', and procedure `diagnosis'.
	- Define an instance of `mercury_edt' from an instance of
	  `execution_tree'.
	- Updates to the analyser to get it to compile---further changes
	  will be forthcoming.

browser/declarative_user.m:
	- Updates to the user interface to get it to compile---further
	  changes will be forthcoming.

browser/browser_library.m:
	Import the new module (declarative_execution.m).

browser/debugger_interface.m:
browser/util.m:
	Move the definitions of trace_port_type and goal_path_string
	to browser/util.m, since they are now used by more than just
	the external debugger.

browser/Mmakefile:
	Add the test harness as a `depend' target.

browser/browse_test.m:
	Use the correct interface to the browser.
1999-11-30 00:05:08 +00:00
Fergus Henderson
98b0afa001 Use clean_local' instead of clean' and `realclean_local' instead
Estimated hours taken: 0.75

Mmakefile:
*/Mmakefile:
*/*/Mmakefile:
*/*/*/Mmakefile:
	Use `clean_local' instead of `clean' and `realclean_local' instead
	of `realclean' where appropriate.  This is necessary now that
	`realclean' does not depend on `clean'.
1999-09-16 04:46:31 +00:00
Fergus Henderson
dfc4e243cd Simplify the code by deleting unnecessary uses of $(EXTRA_*), etc.
Estimated hours taken: 1

browser/Mmakefile:
compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
	Simplify the code by deleting unnecessary uses of $(EXTRA_*), etc.
	This is now handled once and for all in scripts/Mmake.vars, and
	so it doesn't need to be separately handled by */Mmakefile.
	This patch also fixes an annoyance where if you set EXTRA_CFLAGS,
	the flags that you set were being passed to mgnuc twice.
1999-06-01 08:16:13 +00:00
Fergus Henderson
68d2f1c727 Simplify the Mmakefiles. Fix a few minor latent bugs.
Estimated hours taken: 2

Simplify the Mmakefiles.  Fix a few minor latent bugs.

*/Mmakefile:
	- Factor out some common code by defining a new variable M_ENV
	  which holds settings of environment variables for mmc, mgnuc, etc.
	- For consistency, always override MERCURY_C_ALL_INCL_DIRS rather
	  than passing extra `-I' options to mgnuc.
	- Make sure to always include `$(BOEHM_GC)/include' in the search path,
	  so that it will work if we try to compile with `-O6'.
	- Make sure to always include `--cflags $(ALL_CFLAGS)' in MCS, so
	  that the EXTRA_CFLAGS etc. will get passed down to gcc via mmc.
	- Make sure that the Mmakefiles in all directories set
	  all the MC* variables: MCPI, MCSI, MCOI, MCTOI, etc.
1999-04-08 12:58:17 +00:00
Warwick Harvey
4a52a9b94c Separated out all the commands to create installation directories
Estimated hours taken: 0.5

boehm_gc/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
	Separated out all the commands to create installation directories
	into a single target in each Mmakefile, upon which all targets which
	used to create directories depend.  This avoids a race condition
	with parallel installs into a new directory tree, whereby two or
	more `mkdir -p' commands simultaneously try to create the same
	missing path component, resulting in all but one failing.
1999-03-15 00:39:30 +00:00
Bert Thompson
eee1996975 Add a simple term browser for use by the trace-based debugger.
Estimated hours taken: 40

Add a simple term browser for use by the trace-based debugger.

This is minimal but useful browser. Not included in this version
are a scripting language, Windows Explorer-style tree expansion,
and other features not yet thought of.

N.B. This still needs to be hooked into the debugger.

browser/Mmakefile:
	Added target browse_test.

browser/browser_library.m:
	Added modules required for the browser.

browser/browse_test.m:
	A simple driver for the browser with an example
	data structure to browse. (new file)

browser/browse.m:
	The browser proper. (new file)

browser/parse.m:
	Parser for browser's command language. (new file)

browser/util.m:
	Miscellaneous utilities used in the browser code. (new file)

browser/frame.m:
	Bare minimal ASCII graphics frames. (new file)
1998-10-25 07:16:41 +00:00
Zoltan Somogyi
8ddce575d4 Introduce two new directories, trace and browser, containing libraries
Estimated hours taken: 10

Introduce two new directories, trace and browser, containing libraries
holding the C and Mercury code of the debugger respectively. (Although
the browser directory does not have a browser in it yet, the browser
should soon become its biggest component.) Take the opportunity to
rename the existing libraries, for consistency.

After this change, the linking order becomes:

	the object of the auto-generated init file
	program object files
	trace library (libmer_trace.a)
	browser library (libmer_browser.a)
	standard library (libmer_std.a)
	runtime library (libmer_rt.a)
	Boehm collector (libgc.a)

To avoid circularities, libraries cannot contain direct calls to
any routines that are defined in libraries (or object files) that
occur earlier in the above list.  Any such calls must be made into
indirect calls via function pointers.

In particular, there was a circularity caused by the library calling
MR_trace() which invokes the tracer which in turn invokes the
library.  This circularity was broken by having MR_trace(),
which is defined in the runtime, call the tracer indirectly via
a global variable named MR_trace_func_ptr.  This global variable
is initialized by the auto-generated *_init.c file.

To avoid linking in the tracer even when it is not being used,
this global variable is only set to point to MR_trace_real()
if you're using a debugging grade or if c2init was invoked
with the `-t' flag.  Otherwise it is set to MR_trace_fake()
which just prints an error message telling the user to
rebuild the executable with debugging enabled.

Makefile.DLLs:
	Reserve random locations for the two new libraries. Whether they work
	will be decided by testing on Windows.

Mmake.common.in:
	Add variables naming the new directories, and create variables
	naming the libraries.

Mmakefile:
	Add targets for the new directories, and modify existing rules
	as appropriate.

browser/Mmakefile:
	Mmakefile for the new directory, modelled on library/Mmakefile.

browser/browser_library.m:
	Umbrella file for the new directory, modelled on library/library.m.

{browser,library}/debugger_interface.m:
	Moved this file from library to browser without change.

browser/help.m:
	A new module for the help system of the debugger. Not yet used.

compiler/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate.

compiler/mercury_compile.m:
	If we are doing tracing, then pass -t instead of -i to c2init.

compiler/modules.m:
	When generating the .dep file, get the grade flags passed to c2init.

doc/Mmakefile:
	Remove the special treatment of library/debugger_interface.m.

library/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate, and to conform to the new name of the library.

library/library.m:
	Do not import debugger_interface.

profiler/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate.

runtime/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate, and to conform to the new name of the library.

	Remove references to files being moved to the trace directory.

runtime/mercury_init.h:
	Refer to the automatically generated dll header file by its new name
	(renamed because the runtime library is renamed).

	Add declarations to support the new global variable MR_trace_func_ptr.

runtime/mercury_memory_handlers.c:
runtime/mercury_memory_zones.c:
runtime/mercury_misc.c:
	Remove inappropriate #includes of "mercury_trace.h", and substitute
	a #include of "mercury_trace_base.h" if necessary.

{runtime,trace}/mercury_trace.[ch]:
{runtime,trace}/mercury_trace_external.[ch]:
{runtime,trace}/mercury_trace_internal.[ch]:
	Move these files from the runtime to the trace directory.

	The only changes are the removal from mercury_trace.h of declarations
	added to runtime/mercury_trace_base.h, and the change from MR_trace
	to MR_trace_real.

runtime/mercury_trace_base.[ch]:
	Define MR_trace(), which does an indirect call through
	MR_trace_func_ptr if the event should be traced.

	Define MR_trace_fake, which just prints an error message.
	Its address will be assigned to MR_trace_func_ptr if tracing
	is not enabled.

	Define the types needed by the signature of MR_trace.

	Fix an old bug: s/MERCURY_TRACE_PERMANENT_H/MERCURY_TRACE_BASE_H/.

runtime/mercury_wrapper.[ch]:
	Add the new global variable MR_trace_func_ptr.

scripts/c2init.in:
	Add a new option, -t/--trace, which enables tracing by causing the
	address of MR_trace_real to be assigned to MR_trace_func_ptr.

	Have this option be implied by the grade. Also have the old option
	-i (need initialization code) be implied by the grade, as well as by
	-t.

scripts/ml.in:
	Include the new libraries in the link command.

tests/debugger/Mmakefile:
	Include -t instead of -i in the list of c2init options. (-t implies
	-i.)

tools/bootcheck:
	Copy and build the new directories as appropriate. The trace directory
	is treated like the runtime, the browser directory is treated like the
	library.

trace/Mmakefile:
	Mmakefile for the new directory, modelled on runtime/Mmakefile.

util/mkinit.c:
	Add the new option -t, as discussed above.
	Mmakefile for the new directory, modelled on runtime/Mmakefile.

util/Mmakefile:
	Specify -O0, since with the default optimization level, gcc on
	cyclone ignores the assignment of TRUE to need_tracing when -t is
	given (!!!).
1998-09-29 05:12:06 +00:00