Before this diff,
- the .d filed generated by "mmc --generate-dependencies mer_std.m", and
- the .d files generated by compiling all the modules in the library
had *two*-way differences: the first set of .d files contained dependencies
that the second did not, and *vice versa*. The latter differences were bugs.
Now, as far as I can tell from the deluge of data,
"mmc --generate-dependencies" generates a superset of the dependencies
generated by code generating compiler invocations, which is a safe
overapproximation of the actual dependencies.
compiler/generate_mmakefile_fragments.m:
Flatten the d_file_deps structure by effectively inlining the std_deps
structure inside it, and putting the resulting fields into a meaningful
order. Document the resulting structure as well as I can.
Use notag types to record the intended semantics of some fields
into their values, with the intention of making them harder to misuse.
They were misused before this diff; in particular, a missing module
name in one of these fields would reliably lead to the failure
of the hard_coded/foreign_import_module test case in hlc grades,
though only with a sequential invocation of mmake. (The bug was
that after "mmc --generate-dependencies foreign_import_module.m",
foreign_import_module.d was missing the dependency of
foreign_import_module.o on foreign_import_module_helper_1.mh,
and therefore the compilation foreign_import_module.c got a gcc abort
complaining about this .mh file being missing. The reason for
the bug being intermittent was that the mmc invocation that created
foreign_import_module.c would add the missing dependency, so *later*
mmake invocations, though not existing ones, would know
to build that .mh file.)
Generate rules for object files depending on .mh files that
account for both foreign_import_module declarations, and for
foreign type definitions. Add an XXX about the absence of the
information we need to properly handle the latter in the presence
of intermodule optimization.
Generate just one rule for object files depending on .mh files,
instead of generating two (one for the dependencies that exist
without intermodule optimization, and for one those that exist only
with intermodule optimization.)
Flatten the intermod_deps structure as well. It used to have two
components that encoded the outcomes of two *almost* identical tests,
but a change to d_file_deps.m below makes them actually identical,
so they do not need to be recorded twice.
Inline the old (and misnamed) gather_foreign_import_deps predicate
at its only call site, for greater clarity.
Simplify the code constructing some actions.
Use more specifically descriptive predicate and variable names.
compiler/d_file_deps.m:
Stop requiring the caller of construct_d_file_deps_gendep to pass
an aug_compilation_unit; get it to pass instead two of its components,
the only ones that are meaningful and also the only ones we actually need:
the parse_tree of the module in question and its baggage.
Eliminate some unnecessary differences between compute_d_file_deps_gendep
and compute_d_file_deps_hlds by replacing some existing tests for just
--intermod-opt with tests for *either* --intermod-opt *or* --use-opt-files,
which is the test used elsewhere for the same purpose in the rest of this
module. The two tests are equivalent for now, because handle_options.m
force-sets --no-use-opt-files. And even when we undo that force-set,
the new test will actually be what we want.
Completely redo the code that computes the dependencies that
generate_mmakefile_fragments.m converts into the dependencies
of object files on .mh files.
Give some predicates more meaningful names.
compiler/mmakefiles.m:
Add a mechanism to allow the simplification of some codes
creating actions.
compiler/module_deps_graph.m:
Give a type a more descriptive name.
Document a predicate.
Add an XXX.
compiler/make.program_target.m:
compiler/write_deps_file.m:
Conform to the changes above.
compiler/intermod.m:
Fix comment rot.
compiler/parse_tree_out_item.m:
Generate more readable output for foreign_enum pragmas.
library/digraph.m:
Put the predicates/functions of this file into meaningful groups.
We have several operations that have two names, one old and short,
and one newer, longer and more descriptive. Implement the short named
versions in terms of the longer named versions, not vice versa.
Give some internal predicates more meaningful names.
There are no algorithmic changes in this module.
browser/Mmakefile:
Update a comment.
scripts/mmake.in:
Allow $MMAKE_DEBUG to specify what debug flags to invoke gmake with.
The extra targets that this diff puts into .dep files are not yet used,
though they can be (and have been) tested manually.
compiler/generate_mmakefile_fragments.m:
Generate three new mmake rules to do library installs:
- one to install non-grade-specific files
- one to install grade-specific files, and
- one to
- invoke the ngs target once for the current grade, and
- invoke the gs target for each to-be-installed grade.
The code in this last rule that saves and restores the working files
of the current directory is an adapted version of the lib%.install_grades
target in scripts/Mmake.rules.
Add some code to prepare for storing .int and .int2 files in separate
directories.
scripts/Mmake.rules:
scripts/Mmake.vars.in:
Delete code whose job was to install .s and .pic_s files.
Such files were never meant to be installed; their only purpose
was debugging.
Add a conditional definition to shut up a useless warning by gmake.
scripts/mmake_grade_test:
This new script tests whether a given grade targets C, Java or C#,
and if it targets C, whether it is an MLDS or LLDS grade.
It is intended for use by the new make actions generated
by generate_mmakefile_fragments.m.
scripts/mmake_grade_test_test:
This new script tests the operation of mmake_grade_test.
scripts/Mmakefile:
Install mmake_grade_test (but not mmake_grade_test_test) along with
the other scripts.
scripts/ml.in:
Fix the vim modeline.
scripts/mmake.in:
Fix indentation.
compiler/generate_dep_d_files.m:
Document the reason for the split between .dep and .dv files.
Fix typo.
scripts/mmake.in:
Delete code that was only needed for bootstrapping that split
(in 1999!).
Document an incorrect comment.
scripts/c2init.in:
scripts/mercury.in:
scripts/mmake.in:
scripts/mmc.in:
scripts/prepare_install_dir.in:
Indent by four spaces, not by tabs, or by three spaces.
Use ${varname}, not just $varname.
Put successive commands on separate lines.
Indent case statements in a consistent manner: put case patterns
on their own lines; put ;;s on their own lines.
Put quotes around strings that should be considered one word
even if they are empty or contain spaces.
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.
Specifically, when the environment variable is nonempty, pass the debugging
flag -d to make.
Also, bring this script up to date with our current programming style,
including 4-space indentation.
Estimated hours taken: 0.3
Branches: main
scripts/mmake.in:
Fix a bug introduced by Peter where the command `mmake <target>' just
hangs if there is no Mmakefile. The problem was that cat was being
called with no arguments, causing it to wait for input from stdin.
Estimated hours taken: 0.1
Branches: main
scripts/mmake.in:
Move the dvs back to their original position before
the Mmakefile as the Mmakefiles in the compiler depend on this.
"Recursive make considered harmful".
This consists of two parts, giving mmake the optional ability to ignore
the .d files in the current directory. The second part is adding
support to the compiler to write out just the .d file.
We may need to ignore the .d files in the current directory because we
may have included that file from another directory and we don't want to
define rules twice.
scripts/mmake.in:
scripts/Mmake.vars.in:
If the mmake variable MMAKE_AUTO_INCLUDE_DS is set to no then
don't include the rules defined in the .d files in the current
directory.
compiler/mercury_compile.m:
Add support for the --generate-dependency-file flag which just
writes out the .d file for a module and then stops.
compiler/options.m:
Add the generate_dependency_file option.
compiler/mercury_compile.m:
compiler/add_type.m:
compiler/handle_options.m:
Make sure that generate_dependency_file implies that we don't
need to build/link anything.
doc/user_guide.texi:
Document the --generate-dependency-file flag.
Estimated hours taken: 2
Fix the -f mmake option. Previously `mmake install' would ignore this option
when compiling different grades in the temporary directory.
scripts/mmake.in:
Export a MMAKEFILE variable which stores the Mmakefile being used.
This causes child calls to mmake to use the same Mmakefile if no
-f option is given to the child calls.
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.
Estimated hours taken: 1
Branches: main
Add the option `--file' to mmake. This allows the user
to specify the name of the file that mmake uses as the Mmakefile.
This can be useful when porting programs between systems
and experimenting with different configurations, particularly
when the programs are not under the control of autoconf.
The option `--file' may be abbreviated to `-f'. If a file
is specified via `--file' then it will be used in preference to
any file in the current directory named Mmakefile or Mmake.
Unlike GNU make using multiple instances of `--file' will
not cause mmake to jointly use all of the specified files.
Instead it will use the last one specified and ignore the
others.
scripts/mmake.in:
Add the `--file' option to mmake.
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.
Estimated hours taken: 2.5
Branches: main
Allow `mmc --make' to be used with Mmake.
scripts/mmake.in:
Add an option `--use-mmc-make', which tells mmake
to use `mmc --make' to build Mercury targets.
scripts/Mmake.vars.in:
Add a variable MC_MAKE_FILES, which should contain
files (e.g. generated header files) which should be
build with `mmc --make'.
Add a variable MERCURY_MAIN_MODULES which should
contain the top-level module names of the programs
or libraries in the directory. The targets for
the modules appearing in MERCURY_MAIN_MODULES
are added to MC_MAKE_FILES.
Add a variable MC_MAKE_FLAGS, which is like
MCFLAGS, but is only passed to `mmc --make'.
scripts/Mmake.rules:
Disable Mercury-specific rules when `--use-mmc-make'
is passed to mmake.
Use `mmc --make' for targets for which there are no
rules, or for targets appearing in MC_MAKE_FILES.
Estimated hours taken: 0.1
Branches: main
Fix bugs in my change to improve the handling of linking
with a non-installed standard library.
scripts/mmake.in:
Export MERCURY_STDLIB_DIR.
scripts/Mmake.rules:
Always set MERC_INT_DIR to avoid undefined variable warnings.
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.
Estimated hours taken: 1.5
Branches: main
Avoid problems with very long command lines by using xargs.
compiler/modules.m:
Use xargs to rm all the files for the clean and realclean targets.
scripts/mmake.in:
Use xargs to cat the .d and .dv files.
Estimated hours taken: 0.25
Branches: main
scripts/mmake.in:
Delete some accidentally duplicated code.
The code for handling `--no-use-subdirs' was there twice.
Estimated hours taken: 40
(to do this merge... 100s of hours on the HAL branch
itself by myself and Warwick Harvey though).
Merge the changes from the HAL branch onto the main branch. With the recent
changes made to the HAL implementation, this means adding just one grade,
`.rt' or --reserve-tag, which reserves one tag (zero) in each type for
use by HAL's Herbrand constraint solver. This disables no-tag types and
enumerations.
This grade will now bootstrap, and passes all tests, except for a few failing
cases in the debugger and tabling directories.
compiler/options.m:
compiler/handle_options.m:
Add the `.rt' or --reserve-tag grade option.
runtime/mercury_conf_param.h:
Document the macro MR_RESERVE_TAG
doc/user_guide.texi:
Document the `.rt' grade.
compiler/make_hlds.m:
Don't record any types as no-tag types if we are in a .rt grade.
compiler/make_tags.m:
compiler/type_ctor_info.m:
Allocate tags starting from `1' in .rt grades.
compiler/rtti_out.m:
In .rt grades, output a dummy ptag definition for tag `0'.
compiler/type_util.m:
Add predicates `type_util__constructors_are_dummy_argument_type' and
`type_constructors_are_type_info' for use when allocating tags to
ensure that type infos and dummy types (io__state/0 and store__store/1)
are still treated as no-tag types in .rt grades.
library/sparse_bitset.m:
When allocating a sparse bitset element, use tag `1' if we are in a
.rt grade.
runtime/mercury_tags.h:
Define a macro `MR_UNIV_TAG' which is `1' is we in a .rt grade and
`0' otherwise. (Now that univ is a user defined type, it is a also
assigned a `var' tag).
Also make the definitions of MR_RAW_TAG_NIL and MR_RAW_TAG_CONS take the
.rt grade into account.
runtime/mercury_type_info.h:
Define `MR_unravel_univ' and
`MR_initialise_univ' for taking apart and putting together univs.
Add a new secondary tag alternative: MR_SECTAG_VARIABLE, used to
represent Herbrand variables.
library/std_util.m:
Use MR_UNIV_TAG, MR_unravel_univ and MR_initialise_univ when
manipulating univs.
Handle the new MR_SECTAG_VARIABLE secondary tag by aborting.
runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
runtime/mercury_unify_compare_body.h:
Handle the new MR_SECTAG_VARIABLE secondary tag by aborting.
library/std_util.m:
Add a constant for MR_SECTAG_VARIABLE in the MC++ back end.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Process the new grade.
scripts/mmake.in:
Add an option `--include-makefile', which includes a Makefile given
as a command line argument into the Makefile generated by mmake.
This is used to implement `halmake', a make program for HAL which
just passes a bunch of extra rules and variable definitions onto
mmake.
tests/debugger/existential_type_classes.m:
tests/hard_coded/existential_types_test.m:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
Use MR_UNIV_TAG.
TODO:
- The declarative debugger falls over in .rt grades. This is possibly
because compiler/static_term.m assumes that the generated code uses
the same data representation as the compiler itself. This should be
fixed, although it is not critical; the declarative debugger won't
work with trailing as is, and the .rt grade is only ever used in
conjunction with trailing (.tr) at this stage.
Estimated hours taken: 0.25
scripts/mmake.in:
Add some comments explaining that the `--target il' option is
not supported. Issue a warning if it is used.
Estimated hours taken: 0.5
Fix a problem where the test cases were sometimes failing
if old /tmp/mmake* directories were left lying around.
scripts/ml.in:
scripts/mmake.in:
When creating the temporary directory, if mkdir fails (e.g.
because that directory already exists), then try again with a
different directory name. Only report an error if it fails 20
times in a row.
Estimated hours taken: 15
Split the automatically generated `.dep' file into two files. The new `.dv'
file contains all the variable definitions which used to be in the `.dep'
file, which now contains just the rules. With mmake including the `.dv'
files before the user's Mmakefile and the `.dep' files after, this allows
user-defined Mmakefiles to refer to the automatically-generated variables
and automatically-generated rules to refer to variables defined in the
user's Mmakefile. This was possible before to a limited extent, but in
particular dependency lists for automatically-generated rules could not
refer to user-defined variables.
Also introduced `C2INITARGS' as part of an illustration of how this change
is useful (though probably this should be a separate change). `C2INITARGS'
should be used to specify extra files to be passed to `c2init', rather than
the currently-used `C2INITFLAGS' (which should only be used for option
flags). The `_init.c' target should depend on these extra arguments, but it
was not possible to do this automatically prior to this change (at least,
not if one wanted to support per-program specification of `C2INITARGS').
compiler/modules.m:
Generate the new `.dv' files and revised `.dep' files.
Update the `change_clean' and `real_clean' targets to delete the
`.dv' files.
Update the `_init.c' rule to refer to `$(ALL_C2INITARGS)' as well as
`$(ALL_C2INITFLAGS)', and add a dependency on `$(ALL_C2INITARGS)'.
scripts/Mmake.rules:
Add appropriate rules and dependencies for `.dv' files.
scripts/Mmake.vars.in:
Add definitions for implementing `C2INITARGS'.
scripts/mmake.in:
Add code for using `.dv' files (while maintaining backward
compatibility for when they don't exist).
doc/user_guide.texi:
Document the new `.dv' files.
Document the new `C2INITARGS' variables and the dependencies they
imply.
../clpr/Mmakefile:
../clpr/samples/Mmakefile:
extras/complex_numbers/samples/Mmakefile:
extras/complex_numbers/tests/Mmakefile:
extras/graphics/mercury_opengl/Mmakefile:
extras/references/samples/Mmakefile:
extras/references/tests/Mmakefile:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
Update to use `C2INITARGS' instead of `C2INITFLAGS', where
appropriate, and remove any now-obsolete `%_init.c' dependencies
(which wouldn't have worked anyway since GNU Make ignores pattern
dependencies with no commands).
Estimated hours taken: 3
Add Mmake support for target-specific MCFLAGS flags (MCFLAGS-foo, etc.)
using some tricky GNU Make hackery that avoids warning about undefined
variables.
Also define ALL_MCFLAGS = $(MCFLAGS) $(TARGET_MCFLAGS) $(EXTRA_MCFLAGS)
and use $(ALL_MCFLAGS) instead of $(MCFLAGS). This allows user Mmakefiles
to override MCFLAGS without suppressing the use of the TARGET_MCFLAGS
and EXTRA_MCFLAGS.
Similarly for the other *FLAGS variables.
scripts/Mmake.vars.in:
Define ALL_*FLAGS and TARGET_*FLAGS.
scripts/Mmake.rules:
Use ALL_*FLAGS instead of *FLAGS.
scripts/mmake.in:
Re-enable the warnings about undefined variables,
since we won't get too many spurious warnings now.
Mmake.common.in:
Delete `$(MCFLAGS-$*)' from the definition of `MCFLAGS', since this
is now done automatically by Mmake.
tests/Mmake.common:
Delete the definitions of MCFLAGS and GRADEFLAGS, since this stuff
is now done automatically by Mmake.
doc/user_guide.texi:
NEWS:
Document these changes.
Estimated hours taken: 0.5
scripts/mmake.in:
scripts/ml.in:
Ensure that the scripts clean up properly if interrupted --
avoid a small timing window during which an interrupt signal
could cause the scripts to leave temporary directories lying
around in /tmp.
Estimated hours taken: 0.5
Make another small fix to mmake.in and add more empty definitions for various
Mmake variables to avoid spurious warnings.
scripts/mmake.in:
Add `*clean*' to the patterns for which we do not
pass `--warn-undefined-variables'.
scripts/Mmake.rules:
When invoking make recursively, pass $(MFLAGS) rather than
$(MAKEOVERRIDES). This avoids a warning, and is probably the
right thing to do anyway (I'm not sure why I used MAKEOVERRIDES
in the first place).
boehm_gc/Mmakefile:
tests/hard_coded/Mmakefile:
Add empty definition for `MMAKEFLAGS'.
Estimated hours taken: 1
Fix some Mmakefile errors that were diagnosed by `--warn-undefined-variables'.
Also, make a small fix to mmake.in and add empty definitions for various
Mmake variables to avoid spurious warnings.
scripts/mmake.in:
Add ` dep*' to the patterns for which we do not
pass `--warn-undefined-variables'; previously it
matched "$@" against `dep*', which did not catch the
case of `mmake -k depend'.
^^^
scripts/Mmake.vars.in:
Add definition for `ds_subdir'.
Define `MLLIBS' as `$(EXTRA_MLLIBS)' rather than empty,
and add empty definition for `EXTRA_MLLIBS'.
Add empty definition for `MAIN_TARGET'.
Mmakefile:
Fix misspelling: `deps_subdir' not `dep_subdir'.
Add empty definitions for `PREINSTALL_HACK', `POSTINSTALL_HACK',
and `MMAKEFLAGS'.
boehm_gc/Mmakefile:
Add empty definition for `PROF'.
runtime/Mmakefile:
Add empty definition for `DLL_CFLAGS'.
library/Mmakefile:
Add empty definition for `CHECK_TERM_OPTS'.
compiler/Mmakefile:
Add empty definition for `MTAGSFLAGS'.
Estimated hours taken: 0.05
scripts/mmake.in:
Bugfix for previous change, mmake wasn't working on murlibobo.
"if ! mkdir... " seems to be a bash-ism. Use mkdir ...., then
check $? instead.
Estimated hours taken: 1
Fix two security holes in the way temporary files in /tmp are handled.
configure.in:
Look for mktemp.
scripts/ml.in:
Previously, if a file /tmp/ml$$ existed, linker errors would
be missed (or fake linker errors could be provided).
Use
mkdir /tmp/ml.$$ || exit 1
approach to create a directory, then use a file in that
directory as the fifo for linker errors.
scripts/mmake.in:
Previously, if a file /tmp/mmake.$$ existed, it would stop
the generation of a mmake file, and the system would invoke
gmake on the existing file (possibly executing arbitrary
commands).
Use mktemp (if available) to create the file, and exit if
it is not possible to create the file.
If mktemp is not available, use mkdir || exit 1 technique.
Estimated hours taken: 0.75
scripts/mmake.in:
Pass `--warn-undefined-variables', except when making dependencies.
runtime/Mmakefile:
scripts/Mmake.vars.in:
Add empty definitions of a few variables, to avoid warnings with
`--warn-undefined-variables'.
Estimated hours taken: 11
Finish off the centralization of the file name handling code, and
add support for generating intermediate files in subdirectories.
scripts/mmake.in:
Add a new boolean option `--use-subdirs';
if enabled, it just sets the environment variable MMAKE_USE_SUBDIRS
to `yes' before invoking Make.
Also add negative versions of the various options
(`--no-use-subdirs', `--no-verbose', `--no-save-makefile').
scripts/Mmake.rules:
Add code to handle generating intermediate file names
in subdirectories. If MMAKE_USE_SUBDIRS=yes, we add
`--use-subdirs' to MCFLAGS, and most of the pattern rules
are changed to use subdirectories.
Note that getting this to work required a bit of a hack:
due to what seem to be bugs in GNU Make, `mmake depend'
needs to do `mmc --make-short-interface *.m' to get things
started. But once the int3s are there, the dependencies
seem to work OK.
compiler/options.m:
Add a new boolean option `--use-subdirs'.
compiler/modules.m:
Add new predicate `fact_table_file_name'.
Add an extra argument to `module_name_to_file_name',
specifying whether or not to create any directories
needed for the file name.
Change all the file-name-creating predicates here
to go through a single new predicate `choose_file_name',
and add code in that predicate to handle the `--use-subdirs'
option.
Also if the `--use-subdirs' option is set, don't use the
compact dependencies format, since it can't work in that case.
compiler/fact_table.m:
Call `fact_table_file_name' rather than using `string__append'.
compiler/mercury_compile.m:
Change `link_module_list' and `join_module_list'
so that they create file names by calling `module_name_to_file_name'.
compiler/export.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/termination.m:
compiler/trans_opt.m:
compiler/unused_args.m:
Change all calls to `module_name_to_file_name' to pass
the extra argument specifying whether or not to make
any directories needed for the file name.
library/Mmakefile:
Change the rule for `mmake install_ints' so that it
creates a `Mercury' subdirectory with symbolic links
`ints', `int2s', `int3s', `opts', and `trans_opts'
which just point to `..'. This is needed for the
`--use-subdirs' option to work, because Mmake currently
does not support mixing libraries compiled with and
without `--use-subdirs'.
doc/user_guide.texi:
Document the above changes.
Estimated hours taken: 0.25
scripts/mmake.in:
Undo my previous change to use `exec', since that causes
problems because the temporary files never get removed.
Instead, I've just added a comment saying why `exec' can't
be used.
Estimated hours taken: 0.25
scripts/mmake.in:
Change the code so that it uses `exec' to run make,
rather than just invoking it as a sub-process. This
should be a little more efficient.