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.
scripts/c2init.in:
scripts/mmake.in:
scripts/msc.in:
Small changes to the help messages to make them come out
better when converted to man pages.
scripts/mgnuc.in:
Add a `--help' option.
Estimated hours taken: 0.25
scripts/mmake.in:
Check for `Mmakefile' as an alternative to `Mmake'.
(This change is so I can rename scripts/Mmake as Mmakefile
to avoid a conflict with scripts/mmake on systems with
case-insensitive file systems, e.g. Windows 95.)
Estimated hours taken: 1
Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date.
(This change should hopefully fix a problem with the source distribution not
being able to bootstrap itself.)
Also a couple of minor tidy-ups.
scripts/mmake.in:
Export new variable MMAKE_MAKE_CMD, for use by Mmake.rules.
scripts/Mmake.rules:
In the rule for `.m' -> `.o', use a recursive invocatino of
make (via the MMAKE_MAKE_CMD variable) to build the `.c' file,
rather than unconditionally invoking `$(MCG)'.
scripts/.cvsignore:
Add Mmake.vars, since it is now automatically-generated.
scripts/ml.in:
Some stylistic changes: make sure that autoconf @var@ variables occur
only in assignments to shell variables at the start of the script,
not scattered throughout the body of the script.
scripts/*.in:
Replace all uses of
... "$@" ...
with
case $# in
0) ... ...
*) ... "$@" ...
esac
since on ULTRIX and OSF, "$@" does the wrong thing if $# is 0.
scripts/ml.in:
Remove some old special-case stuff (if $host = kryten ...).
Change it so that it uses $CC as determined by configure
rather than hard-coding gcc.
Use a named pipe to invoke the demangler, so that we
return the exit status of the C compiler, not the demangler.
Add a new option --no-libs which suppresses the linking
in of the libraries; this is useful if you want to link
a shared library and have the output of the linker passed
through the demangler.
scripts/mmake.in:
Use a new environment variable MMAKE_DIR as the location to
look for both Mmake.vars and Mmake.rules; this is simpler than
use the MMAKE_VARS and MMAKE_RULES environment variables.
{mc,ml,mgnuc,mmake}.in:
Use MERCURY_DEFAULT_GRADE, with a default value @DEFAULT_GRADE@
determined by configure, rather than hard-coding asm_fast.gc as
the default grade.
mmake.in:
Update the documentation.