Commit Graph

123 Commits

Author SHA1 Message Date
Julien Fischer
20efff236e Fix for check_namespace with MSVC.
Mmake.common.in:
     When checking the symbols exported by object files, ignore
     any that have been introduced by MSVC for global string pool
     entries.
2023-07-24 23:17:33 +10:00
Julien Fischer
4b5c94c050 Work towards supporting 64-bit Windows with MSVC.
compiler/globals.m:
     Extend c_compiler_type to distinguish between versions of MSVC
     that target x86 and those that target x86_64 (x64).

compiler/handle_options.m:
     Update the list of valid C compiler types.

compiler/compile_target_code.m:
     Handle versions of MSVC that generate x86_64 code.

m4/mercury.m4:
    Distinguish between versions of MSVC that target x86 and those
    that target x86_64.

configure.ac:
    Generate the new values of --c-compiler-type for MSVC.

    Determine the CPU type to pass to boehm_gc/NT_MAKEFILE.
    (This will also require an update to boehm_gc/Mmakefile; this change does
    not do that.)

Mmake.common.in:
    Add a new variable for setting the CPU type for boehm_gc/NT_MAKEFILE.
2023-06-25 16:19:01 +10:00
Zoltan Somogyi
e93f589e26 Fix comment. 2022-03-08 09:38:01 +11:00
Zoltan Somogyi
adf6c55847 Shut up mmake actions for check_namespace.
This reduces the size of the output of tools/bootcheck by 3700+ lines,
or about 25%.

Mmake.common.in:
    Don't print the actions implementing namespace cleanliness checks.
    To allow the attribution of any violations of the namespace rules,
    print the name of the C module before any list of detected
    nonallowed symbols.

    To avoid mmake printing the actions for creating the .o files
    that some of the check_namespace actions later check, rename
    the affected object files .pseudo_o files, so that we can specify
    a rule for them that is a copy of the rule for .o files, differing
    only in not printing the compilation command.

    Mark the files involved in check_namespace actions as dependencies
    of .SECONDARY, which means that mmake does not automatically delete them
    after building them as intermediate files. The reason for this is that
    there is no way to tell make to delete intermediate files *silently*,
    i.e. without writing out the rm command that deletes them.
    To make up for this, tools/bootcheck now cleans up each directory
    immediately after "mmake check_namespace" with "mmake clean_check",
    which invokes mmake rules that do not print the rm commands.

    This change does have the effect that these intermediate files *will*
    hang around if the check_namespace target is every invoked manually.
    However,

    - we just about never run check_namespace in a directory manually, and
    - when we do, a simple "mmake clean_check" will do the required cleanup.

scripts/Mmake.rules:
    Move the vim tag line to its usual place at the top.

    Replace old-school rules such as .m.err with their modern equivalents
    (such as %.err: %.m).

scripts/Mmakefile:
    Instead of printing the rules that make test_mdbrc, print only a
    "making test_mdbrc" message.

runtime/Mmakefile:
    Conform to the change of the name of a make variable in Mmake.common.in.

ssdb/Mmakefile:
    Fix an old bug that something else in this diff tickled: make the
    .depend target of each main module depend on SSDB_FLAGS, *not* just
    the phony general "depend" target. This was a bug because tools/bootcheck

    - copied across to stage 2 ONLY SSDB_FLAGS.in, and NOT SSDB_FLAGS,

    - did NOT explicitly make SSDB_FLAGS from SSDB_FLAGS.in, even though
      pretty much invocations of the Mercury compiler in this directory
      have "--flags SSDB_FLAGS" as an implicit argument, and then

    - built dependencies in the ssdb directory by invoking the top
      Mmakefile's dep_ssdb target, which (indirectly) invokes
      $(SSDB_LIB_NAME).depend.

    Due to all the above, I don't actually know how tools/bootcheck
    could ever build stage2/ssdb until now :-(

tools/bootcheck:
    Invoke "mmake clean_check" after each "mmake check_namespace".

    Change the code that explicitly builds the directory-specific
    X_FLAGS file in each directory (which is invoked only when using
    mmc --make) to actually build all such files, when previously
    it built only a subset.

tests/invalid/Mmakefile:
tests/invalid_nodepend/Mmakefile:
tests/invalid_onlydepend/Mmakefile:
tests/invalid_options_file/Mmakefile:
tests/invalid_purity/Mmakefile:
tests/invalid_submodules/Mmakefile:
tests/stm/Mmakefile:
    Fix an unintended consequence of replacing the .m.err rule in
    scripts/Mmake.rules with %.err: %.m, which is that the %.err: %.m
    rules in these mmakefiles became ineffective, because they appear
    in the makefile we construct *after* the rule in scripts/Mmake.rules,
    which specify a different action (the rules here return a nonzero
    status in the *absence* of failure, which would be ridiculous
    for the rule in scripts/Mmake.rules). Apparently, the %.err: %.m rules
    overrode the rule in scripts/Mmake.rules while it had the old form,
    but do not do so now it has the new form.

    The fix is to make replace all the "%.err: %.m" rules in these Mmakefiles
    with "$(PROGS:%=%.err): %.err: %.m" rules, which specify that they
    override the generic rule for the .err files of the test cases
    in each directory.

    In invalid_purity/Mmakefile, fix a bug: -nodepend suffixes make sense
    in only in the name of a *test*, not the name of a *program*, so
    move such a suffix from a program name to a test name. Without this,
    the program's .err file would be included in the list of .err files
    to which the ".err: .m" rule applies under the wrong name.

    In invalid_submodules/Mmakefile, fix the misleading names of some
    make variables, and fix a misspelt directory name.

    Standardize on "$(PROGS:%=%.err)" notation, replacing earlier instances
    of "$(addsuffix .err,$(PROGS))". The reason for this is that when I tried
    using "$addsuffix .int_err,$(PROGS))" in tests/invalid/invalid_make_int,
    it did not work. (A google search on "gnu make addsuffix" did not yield
    any clues as to why. Maybe you can only add suffixes that do not contain
    underscores?)
2022-01-24 17:38:35 +11:00
Zoltan Somogyi
b8b845a568 Fix mmakefile rules for os,cs,css,javas.
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.

However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.

browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
    When creating stage 3, the bootcheck builds, in each directory,
    only the files that it wants to compare against their stage 2 versions.
    This means that it wants to build all the .c, .cs or .java files,
    which it does via the cs, css and javas mmake targets.

    The correct definitions of the rules of these targets depends on
    whether mmc --make is being used or not, so we need at least two
    sets of definitions: one for mmc --make, and for no mmc --make,
    and conditionally selecting the appropriate one. The latter definition
    has the problem that it refers to mmake variables that are intended
    to be defined in .dv files created by mmc --generate-dependencies,
    but until that has been run, those mmake variables are undefined.

    Until now, the only directories that had both the mmc --make
    and the no mmc --make definitions were the ones needed to build
    the compiler. Bootchecks in the csharp and java grades, which
    always use --make make, got errors when they tried to build
    the directories that bootcheck builds after the compiler:
    the slice, profiler, deep_prof and mfilterjavac directories.

    This diff ensures that all directories we build in bootcheck
    get all both versions of the os, cs, css, and javas targets.
    In fact, they get two subversions of the no mmc --make version:
    one for use in the presence of .dv files, and one for use in their
    absence. The latter just builds the .dv files and invokes mmake
    again. This avoids one source of warnings about undefined mmake
    variables.

    To avoid another source, make the rules for tags files and their
    proxies depends on *.m instead of mmake variables such as $(mcov.ms),
    since this makes sense even before making dependencies. The only price
    is that any untracked Mercury source files in the directory have to
    either be given some other suffix, or moved somewhere else.

    Where relevant, make the mtags invocation prefer the master versions
    of files that are copied from the mdbcomp directory to other directories,
    since this is the only writeable version.

    Make the os and cs rules consistently NOT build the _init.[co] files.
    The way we use those files in bootcheck, we never need them;
    when we need them, the right target to give is the executable anyway.

    In the slice directory, don't put mcov between mtc_union and mtc_diff.

    Eliminate unnecessary duplication, e.g. of sources in rules.

    Eliminate double negatives in conditionals.

    Fix formatting.

Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
    Add "ft=make" to vim modelines. This is redundant for the files whose
    names is Mmakefile, but it is needed for Mmake.common.
2020-04-11 20:10:38 +10:00
Zoltan Somogyi
db985ef95a Allow Java bootcheck with ALWAYS_MAKE_TAGS_FILE. 2019-06-18 00:18:00 +02:00
Peter Wang
789ec91e03 Use nm portable format in namespace check.
Mmake.common.in:
    Invoke `nm' with -P (POSIX format). This should allow the namespace
    check to work on systems where the default output format of nm is
    not BSD format.
2019-06-05 13:15:08 +10:00
Peter Wang
c33f811c37 Check availability of getopt() directly.
configure.ac:
Mmake.common.in:
    Check for availability of getopt() in the C library,
    setting the HAVE_GETOPT variable as appropriate.

    Delete GETOPT_H_AVAILABLE variable.

util/Mmakefile:
    Use getopt() if available. This can be true even without getopt.h
    as getopt() is declared in <unistd.h> according to POSIX.

util/getopt.h:
    Add a comment.
2019-05-31 18:13:54 +10:00
Peter Wang
6568b53295 Pass compiler flags to build bdwgc for musl.
The version of bdwgc we have now works with musl libc to some degree.
I am waiting for the next release for bdwgc before upgrading our copy;
that will fix parallel marking and possibly other problems.

configure.ac:
Mmake.common.in:
    Check for functions getcontext and dl_iterate_phdr.

    Add -DNO_GETCONTEXT to BOEHM_CFLAGS if getcontext does not exist.

    Add -DHAVE_DL_ITERATE_PHDR to BOEHM_CFLAGS if dl_iterate_phdr does
    exist.
2017-09-21 14:27:26 +10:00
Peter Wang
ef5a4fa59d Support building with AddressSanitizer and UndefinedBehaviorSanitizer.
configure.ac:
    Add configure option --enable-sanitizers.

Mmake.common.in:
scripts/Mercury.config.in:
    Add variables to be set when --enable-sanitizers is used.

scripts/mgnuc.in:
scripts/ml.in:
    Pass sanitizer options to the C compiler and the linker.

compiler/options.m:
    Add options --cflags-for-sanitizers and --linker-sanitizer-flags
    for receiving the configuration.

    Set --linker-trace-flags and --shlib-linker-trace-flags default
    values to empty instead of "-g" (likely copy error).

compiler/compile_target_code.m:
    Pass sanitizer options to the C compiler, and the linker when
    building an executable or shared library.

runtime/Mmakefile:
trace/Mmakefile:
    Pass sanitizer options to linker when building shared libraries.

README.sanitizers:
    Add instructions.
2016-10-13 17:15:10 +11:00
Paul Bone
eed9cc75bd Make changes required to upgrade to Boehm GC 7.4.2
GC_stackbottom, GC_gc_no and GC_dont_gc are now deprecated.  These changes
use new options in the API where possible.

Update scripts to copy the boehm_gc and libatomic_ops directories correctly.

Pass Boehm GC the correct flags for thread support

Update documentation regarding the version of Boehm GC.

runtime/mercury_wrapper.c:
    Don't use the deprecated GC_dont_gc variable.

library/benchmarking.m:
    Use GC_get_stackbottom() to get the bottom of stack and GC_get_gc_no()
    to get the number of collections so far.

util/mkinit.c:
    Do not explicitly set GC_stackbottom anymore, except on AIX where it
    cannot be found automatically.

scripts/prepare_install_dir.in:
tools/bootcheck:
tools/build_srcdist:
    Add some missing files present in Boehm GC 7.4.2 that wern't present
    earlier and remove some old ones.

    Coby and link the libatomic_ops directory correctly.

.README.in:
bindist/bindist.README:
    Update documentation regarding the version of Boehm GC.

configure.ac:
    Something in Boehm GC's build system has changed and we must now pass
    -DGC_THREADS whenever building threadsafe versions of BOehm GC.  This is now
    done using the BOEHM_MISC_CFLAGS_FOR_THREADS autoconf variable, which has
    been renamed to BOEHM_CFLAGS_FOR_THREADS now that it is more generally used.

    Boehm GC no longer (or perhaps never did) require developers to specify the
    type of threading to use, eg -DGC_LINUX_THREADS rather than -DGC_THREADS.
    With the exception of win32-pthreads.  We now pass -DGC_THREADS whereever
    possible.

Mmake.common.in:
    Rename BOEHM_MISC_CFLAGS_FOR_THREADS.
2015-10-01 10:26:46 +10:00
Zoltan Somogyi
cd72d000a8 Remove support for the MPS garbage collector.
As Tomas By's recent emails suggest, this support is doing more harm than good,
by falsely implying to people that MPS is a viable alternative to the Boehm
collector. The MPS collector was only ever experimental, and never performed
as well as Boehm. MPS isn't even in the git repository on git hub. It was
stored in a separate CVS repository on mundula, and (as far as I know)
wasn't carried over to github. The code of MPS was last touched a long time
ago; I would be surprised if it worked on today's systems without changes.

Mmake.common.in:
Mmake.workspace:
RESERVED_MACRO_NAMES:
boehm_gc/Mmakefile:
compiler/add_pragma.m:
compiler/compile_target_code.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c.m:
compiler/options.m:
compiler/peephole.m:
doc/user_guide.texi:
library/benchmarking.m:
runtime/Mmakefile.m:
runtime/mercury.h:
runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
runtime/mercury_wrapper.[ch]:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
scripts/parse_grade_options.sh-subr:
util/mkinit.c:
    Remove all references to MPS.
2014-08-05 15:45:33 +02:00
Peter Wang
d63a294e1f Use mmap for Boehm GC in threaded grades on Linux.
The glibc implementation of malloc (commonly used on Linux) can use sbrk
to acquire more memory, and so does Boehm GC in its default configuration
on Linux.  When both allocators are invoked simultaneously from different
threads then memory corruption may result.

configure.ac:
	Add --enable-gc-mmap option.

	Make --enable-gc-munmap imply --enable-gc-mmap.

	Detect mmap and set MR_HAVE_MMAP.

	Detect sbrk and set MR_HAVE_SBRK.

	On Linux (and potentially other platforms), build Boehm GC for
	threaded grades with -DUSE_MMAP if mmap was found.

Mmake.common.in:
	Add ENABLE_BOEHM_USE_MMAP.

runtime/mercury_conf.h.in:
	Add MR_HAVE_MMAP, although it is not used anywhere yet.

	Add MR_HAVE_SBRK.  It is only for used by the test program.

tests/hard_coded/Mmakefile:
tests/hard_coded/thread_sbrk.exp:
tests/hard_coded/thread_sbrk.exp2:
tests/hard_coded/thread_sbrk.m:
	Add test program.

NEWS:
	Announce changes.
2014-07-30 15:53:47 +10:00
Julien Fischer
d256d24ea5 Drop support for OSF/1.
configure.ac:
	Drop support for OSF/1.

	Delete more IRIX stuff.

configure.ac:
runtime/mercury_conf.h.in:
runtime/mercury_thread.h:
	Delete workarounds required when using the Digital Unix pthreads
	library.

Mmake.common.in:
runtime/mercury_wrapper.c:
	Delete stuff for IRIX.

README.OSF1:
	Delete this file.

.README.in:
	Delete the pointers to the readme files for IRIX and OSF/1.

NEWS:
	Announce the dropping of support for OSF/1.
2014-06-16 15:08:05 +10:00
Zoltan Somogyi
ba57f4a5df Reorganize the way we handle reserved C macro names.
RESERVED_MACRO_NAMES:
*/RESERVED_MACRO_NAMES:
    Add a macro, _FORTIFY_SOURCE, that gcc defines by default on some recent
    versions of Linux.

    I could have added it in SIX separate RESERVED_MACRO_NAMES files.
    Instead, I moved the content common to all these files to a
    RESERVED_MACRO_NAMES file in the top directory, leaving the
    RESERVED_MACRO_NAMES files of the subdirectories containing only
    macros that *don't* occur in all those subdirectories.

tools/bootcheck:
   Copy the top-level RESERVED_MACRO_NAMES names to the stage 2 directory.

Mmake.common.in:
   Filter out the contents of the top level RESERVED_MACRO_NAMES file,
   as well as the RESERVED_MACRO_NAMES file in the current directory.
2014-01-22 08:55:58 +11:00
Julien Fischer
cc22d8e969 Fix the namespace cleanliness check on MinGW64.
configure.ac:
	Check for the host specific version of the nm tool.
	For MinGW64 we need to use the MinGW64 version, not
	the MinGW32 version (i.e. x86_64-w64-mingw32-nm, not
	nm).

Mmake.common.in:
	Use the host specific version of the nm tool to list
	external symbols in object files.
2013-04-03 13:37:36 +11:00
Julien Fischer
f6bdd99a80 Delete the MLDS->GCC (assembler) backend.
As discussed in the recent Mercury meeting, remove support for the GCC backend.
It was very much out of date and supporting it proprerly would means having to
track changes to GCC's internals.  Furthermore, its presence complicates
building the compiler.

The main thing this change does not address is the fact that we invoke
the compiler through C code, e.g. main.c in the top-level of the source
tree.  This was required by the GCC backend and can now be removed, but
I will do that as a separate change.

configure.ac:
Mmake.common.in:
scripts/Mmake.rules:
compiler/Mercury.options:
compiler/Mmakefile:

compiler/gcc.m:
compiler/maybe_mlds_to_gcc.pp:
compiler/mlds_to_gcc.m:
    Delete the files containing the GCC backend.

compiler/options.m:
compiler/handle_options.m:
    Delete support for `--target asm' and `--pic'.
    (The latter was only used by the GCC backend.)

compiler/*.m:
doc/user_guide.texi:
compiler/notes/comiler_design.html:
compiler/notes/work_in_progress.m:
    Conform to the above change.

README.gcc-backend.m:
    Delete this file.
2013-01-16 15:31:10 +11:00
Julien Fischer
e468080ddb Make the namespace cleanliness check work on Mac OS X.
Fix an old problem: the check_objs target would fail on Mac OS X because
exported symbols on that platform are prefixed with "_".

Mmmake.common.in:
    Allow object symbols to have an optional system-specific prefix.

    Delete a workaround for a problem that was fixed five years ago.

configure.ac:
    On Darwin systems set the appropriate prefix.
2013-01-07 14:06:13 +11:00
Peter Wang
6b1f89831e Let Mercury be built with a MinGW cross-compiler.
Branches: main

Let Mercury be built with a MinGW cross-compiler.

tools/configure_mingw_cross:
	Add shell script to prepare for cross-compilation.

README.MinGW-cross:
	Document how to use the shell script.

configure.in:
Mmake.common.in:
	Set a new variable CROSS_COMPILING.

	Set FULLARCH and BUILD_C_PROGS_FOR_BUILD_SYSTEM variables
	to be passed to the Boehm GC build system.

	Use $host-ar for AR when cross-compiling.

m4/mercury.m4:
	Determine gcc version with gcc -dumpversion instead of building
	a program and running it.

	Don't run test for mercury_cv_cc_type if set explicitly.

Mmake.workspace:
	Use the default c2init and mkinit when cross-compiling.
	The copies in the util directory would not be usable then.

boehm_gc/Mmakefile:
	Pass configured values of AR, RANLIB down to sub-make.

boehm_gc/Makefile.direct:
boehm_gc/build_atomic_ops.sh:
	Use configured value from Mmake.common for HOSTCC.

	Pass --host when configuring libatomic_ops.

util/Mmakefile:
	Make tools with .exe suffixes on Windows.

Mmakefile:
	Use the bootstrap compiler to build libgrades when cross-compiling.

	Conform to changed target names in the util directory.

compiler/Mmakefile:
deep_profiler/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
	Conform to changed target names in the util directory.

Makefile:
	Clean .exe files on Windows.
2012-01-09 00:35:41 +00:00
Paul Bone
a071eaba53 Improve thread pinning:
+ Now pins threads intelligently on SMT systems by balancing threads among
      cores.
    + performs fewer migrations when pinning threads (If a thread's current
      CPU is a valid CPU for pinning, then it is not migrated).
    + Handle cases where the user requests more threads than available CPUs.
    + Handle cases where the process is restricted to a subset of CPUs by its
      environment.  (for instance, Linux cpuset(7))

This is largely made possible by the hwloc library
http://www.open-mpi.org/projects/hwloc/  However, hwloc is not required and the
runtime system will fall back to sched_setaffinity(), it will simply be less
intelligent WRT SMT.

runtime/mercury_context.h:
runtime/mercury_context.c:
    Do thread pinning either via hwloc or sched_setaffinity.  Previously only
    sched_setaffinity was used.

    Update thread-pinning algorithm, this:

    Include the general thread pinning code only if MR_HAVE_THREAD_PINNING is
    defined.

    Use a combination of sysconf and sched_getaffinity to detect the number of
    processors when hwloc isn't available.  This makes the runtime compatible
    with Linux cpuset(7) when hwloc isn't available.

configure.in:
Mmake.common.in:
    Detect presence of the hwloc library.

configure.in:
    Detect sched_getaffinity()

aclocal.m4:
acinclude.m4:
    Move aclocal.m4 to acinclude.m4, the aclocal program will build aclocal.m4
    and retrieve macros from the system and the contents of acinclude.m4.

Mmakefile:
    Create a make target for aclocal.m4.

runtime/Mmakefile:
    Link the runtime with libhwloc in low-level C parallel grades.

    Include CFLAGS for libhwloc.

scripts/ml.in:
    Link programs and libraries with libhwloc in low-level C parallel grades.

runtime/mercury_conf.h.in:
    Define MR_HAVE_HWLOC when it is available.

    Define MR_HAVE_SCHED_GETAFFINITY when it is available.

runtime/mercury_conf_param.h:
    Define MR_HAVE_THREAD_PINNING if either hwloc or [sched_setaffinity and
    sched_getaffinity] are available.

runtime/mercury_thread.c:
runtime/mercury_wrapper.c:
    Only call MR_pin_thread and MR_pin_primordial_thread if
    MR_HAVE_THREAD_PINNING is defined.

runtime/mercury_thread.h:
runtime/mercury_context.h:
    Move the declaration of MR_pin_primordial_thread to mercury_context.h from
    mercury_thead.h since it's definition is in mercury_context.c.

    Require MR_HAVE_THREAD_PINNING for the declaration of
    MR_pin_primordial_thread.

runtime/mercury_wrapper.c:
    Conform to changes in mercury_context.h

INSTALL_CVS:
tools/test_mercury
    Run aclocal at the right times while testing Mercury.
2011-10-13 02:42:21 +00:00
Julien Fischer
b4d7509570 Only modify the value of Boehm GC HBLKSIZE macro on Linux.
Branches: main

Only modify the value of Boehm GC HBLKSIZE macro on Linux.
Attempting this modification on other system, e.g. Mac OS X and
MinGW, results in a system that doesn't work.

configure.in:
	Define a new configure variable, BOEHM_MISC_CFLAGS_FOR_THREADS,
	that can be used to pass C compiler flags to the Boehm collector
	in parallel grades on a system specific basis.

	On Linux, modify the value of HBLKSIZE when building the collector
	in parallel grades.

Mmake.common.in:
	Delete the hardcoded setting of HBLKSIZE and use the new configure
	variable.

	Fix a comment.
2010-12-17 11:59:02 +00:00
Paul Bone
0ee263a3fe Modify the documentation that discusses how to override INSTALL_PATH
Mmke.vars.in:
    Modify the documentation that discusses how to override INSTALL_PATH
    to describe setting of $DESTDIR instead.

    Don't add a slash before INSTALL_PATH if DESTDIR is empty since this
    breaks installation on Windows.  (This change has already been made
    in Mmake.common.in)

    Set more FINAL_INSTALL_ variables to support the new code in
    Mmakefile and bindist.Makefile.in.

Mmake.common.in:
    Improve the prose in a comment.

Mmakefile:
    Update installation message.

    Tell the user that their install is in $(DESTDIR) if applicable.

    Use FINAL_INSTALL variables rather than INSTALL variables.
2010-12-17 00:28:08 +00:00
Paul Bone
50c57788ac Fix the handling of $DESTDIR on Windows.
Mmake.common.in:
    As above.
2010-12-15 05:28:47 +00:00
Paul Bone
fd1459eccc Compatibility with Debian packaging.
Packaging Mercury for Debian requires creating some patches to make sure that
Mercury can be built under the control of dpkg-buildpackage.  It's recommended
that these patches are pushed upstream (into Mercury) so that everyone can
benefit from them, not just Debian packagers.

Mmake.common.in:
scripts/Mmake.vars.in:
    Install Mercury at $DESTDIR/@prefix@, $DESTDIR helps someone setup Mercury
    to run from @prefix@ while putting it in $DESTDIR.  $DESTDIR/* can easily
    be tared up and then deployed on other systems.

Mmakefile:
Makefile:
    Pass the $DESTDIR variable to make sub-processes.

scripts/Mercury.config.in:
scripts/Mercury.config.bootstrap.in:
    Remove the hash-bang line from these scripts since they are not executable.

    This change improves conformance with Debian packaging standards.
2010-12-14 07:01:55 +00:00
Paul Bone
7bf374188a Made changes after a post-commit review.
Mmake.common.in:
    Documented the meaning of HBLKSIZE for the Boehm collector as I understand
    it.
2010-12-08 08:54:29 +00:00
Paul Bone
349c039edc When bulding the garbage collector in a parallel grade increase the
thread-local free list size by increasing HBLKSIZE.  This causes memory
allocation to access global resources less often improving parallel
performance.

Mmake.common.in:
    As above.
2010-12-08 04:21:28 +00:00
Ian MacLarty
2e859b4208 Get Mercury compiling on Mac OS X 10.6 (Darwin 10).
Mmake.common.in:
    Add ENABLE_BOEHM_XOPEN_SOURCE.

README.MacOS:
    Document that Mercury works on Mac OS X 10.5 and 10.6.
    Also document that it hasn't been tested on 10.3 for
    some time.

configure.in:
    Pass -m32 to gcc on Darwin 9 and 10, because our current version of boehm
    doesn't work on 64 bit Darwin.

    Define _XOPEN_SOURCE on Darwin 10 when compiling boehm to
    avoid errors about the functions in ucontext.h being deprecated.

    Don't pass -s to the linker on Darwin 9 and 10.

boehm_gc/Makefile:
    Include BOEHM_CFLAGS (generated by the Mercury configure script)
    in SPECIALCFLAGS which is used when compiling mach_dep.c so that
    _XOPEN_SOURCE is defined in mach_dep.c.

trace/mercury_event_scanner.l:
    Remove declaration of mercury_event_get_leng, because flex generates a
    different return value type depending on the platform (on Mac OS X 10.6 it
    returns yy_size_t while on Linux it returns int).
2009-10-10 10:44:13 +00:00
Peter Wang
c3da39bd95 Fix a performance problem with mmc --make --jobs <n>.
Branches: main

Fix a performance problem with mmc --make --jobs <n>.  It would fork a new
process for each target, whether or not that target was already up-to-date.
For a large program which is mostly up-to-date, this could be very costly.
The main reason it was implemented so was to avoid interprocess communication
which might be non-portable (the only communication was via a sub-process's
exit code).

This patch makes use of IPC to allow the master process to fork off only N-1
worker processes, itself being the last worker.  The workers communicate via
shared memory as to which tasks still need doing, and which are completed.
A worker process therefore may work on as many tasks as required before
terminating.

Parallel mmc --make is currently disabled in .par grades.  It should be
fairly simple to restore.


configure.in:
runtime/mercury_conf.h.in:
        Check sys/mman.h is available for mmap().

Mmake.common.in:
compiler/Mmakefile:
        Link with thread libraries for POSIX mutexes.

compiler/make.util.m:
        Reimplement process-based concurrent fold predicate as above.
        Fall back to non-concurrent fold if the IPC mechanisms are
        unavailable.

        Delete old thread-based concurrent fold implementation.

compiler/process_util.m:
        Add wait_pid to wait on a particular child process.

compiler/Mercury.options:
        Set --no-ansi-c on make.util.m.
2009-07-30 02:41:52 +00:00
Peter Wang
200d798286 Allow the use of munmap() in Boehm GC, in order to return unused memory pages
Estimated hours taken: 6
Branches: main

Allow the use of munmap() in Boehm GC, in order to return unused memory pages
back to the OS.  This has an adverse effect on run times so we want to be able
to enable it on a per-application basis.  To avoid installing both
munmap-enabled and munmap-disabled copies of Boehm GC, we make it so that
munmap() capability can be compiled in but disabled with a global variable.
In that case the performance difference (seems to) be negligible.

As mmap/munmap aren't supported on all platforms, munmap() capability needs to
be selected with `configure'.  It is currently disabled by default.

Mmake.common.in:
configure.in:
	Add the configure option `--enable-gc-munmap' and
	add -DUSE_MMAP -DUSE_MUNMAP to the Boehm GC C flags if set.

boehm_gc/allchblk.c:
boehm_gc/alloc.c:
boehm_gc/malloc.c:
boehm_gc/include/gc.h:
boehm_gc/include/private/gc_priv.h:
	Add the global variable `GC_mercury_use_munmap'.

	Modify the code to check `GC_mercury_use_munmap' before executing code
	that would normally be run when USE_MUNMAP is set.

runtime/mercury_wrapper.c:
	Set `GC_mercury_use_munmap' if MERCURY_OPTIONS contains `--munmap'.

doc/user_guide.texi:
	Document the new MERCURY_OPTIONS and configure options.
2008-02-06 01:45:50 +00:00
Peter Ross
bc7319923b Handle the ALLOW_SSDB_PREFIX variable, so that
Estimated hours taken: 0.25
Branches: main

Mmake.common.in:
	Handle the ALLOW_SSDB_PREFIX variable, so that
	the check_namespace target passes in the ssdb
	directory.
2007-10-04 02:46:48 +00:00
Julien Fischer
8174552aa5 Work around a problem that is breaking the nightly builds.
Estimated hours taken: 0.1
Branches: main

Work around a problem that is breaking the nightly builds.

Mmake.common.in:
	The namespace cleanliness check is failing in the library
	directory because the compiler does not prefix mutable names
	with `mercury_' when the mutable is defined in a standard
	library module.  Work around this problem by temporarily
	accepting `pretty_printer_' as a valid name prefix.
2007-08-05 15:09:40 +00:00
Simon Taylor
f1275fa6e8 Implement io.write for arbitrary streams. With type specialization
Estimated hours taken: 25
Branches: main

Implement io.write for arbitrary streams.  With type specialization
this is only slightly slower than the original.

library/stream.string_writer.m:
library/library.m:
	A module containing predicates for writing to streams
	which accept strings.

library/stream.m:
	Move stream.format to stream.string_writer.m.

	Add stream.put_list, which is like io.write_list.

library/io.m:
	Move io.write and io.print to stream.string_writer.m.

library/term_io.m:
	Add stream versions of predicates used by io.write.

library/ops.m:
	Move io.adjust_priority_for_assoc to here (private
	predicate used only by library modules).

	Export ops.mercury_max_priority for use by
	stream.string_writer.write.

Mmake.common.in:
compiler/modules.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/prog_util.m:
compiler/format_call.m:
mdbcomp/prim_data.m:
	Allow sub-modules in the standard library.

compiler/polymorphism.m:
	Fix a bug which caused tests/hard_coded/print_stream.m to
	fail with this change.  The wrong argument type_info would
	be extracted from a typeclass_info if the constraints of the
	typeclass-info were not all variables.

browser/browse.m:
tests/hard_coded/stream_format.m:
tests/hard_coded/test_injection.m:
tests/invalid/string_format_bad.m:
tests/invalid/string_format_unknown.m:
	Updated for predicates moved between library modules.

util/mdemangle.c:
	The demangler doesn't properly handle the arguments MR_DECL_LL*
	and various other recently added macros for type specialized
	procedures.  It's still broken (it doesn't handle mode and label
	suffixes properly), but the output is at least more readable.
2006-12-21 11:11:37 +00:00
Peter Wang
0e486700db Revert previous change regarding thread-local allocation.
Estimated hours taken: 0.2
Branches: main

configure.in:
Mmake.common.in:
	Revert previous change regarding thread-local allocation.
	We do need to define THREAD_LOCAL_ALLOC when building Boehm GC.
2006-08-15 09:01:46 +00:00
Peter Wang
c6a14c35b0 Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
Estimated hours taken: 5
Branches: main

Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
collector.  The main reason is that thread-local allocation is not
supported on Solaris in version 6.x of the collector.

boehm_gc/*:
	Merge in changes from the vendor branch.

.README.in:
	Update Boehm GC version number and copyright notice.

Mmake.common.in:
configure.in:
runtime/RESERVED_MACRO_NAMES:
scripts/mgnuc.in:
	Don't define `THREAD_LOCAL_ALLOC' nor `GC_REDIRECT_TO_LOCAL' as
	thread-local allocation is automatically enabled in gc 7.0.

	Consistently use `GC_WIN32_THREADS' and `GC_LINUX_THREADS' as the
	non-prefixed versions of those symbols are deprecated.

	Don't define `NO_SIGNALS' as it is no longer necessary.

	Add librt to the list of thread libraries on Solaris.  This is
	needed for the POSIX semaphore functions now used on Solaris.

runtime/mercury_prof_mem.c:
runtime/mercury_prof_mem.h:
	Update comments mentioning `NO_SIGNALS'.

compiler/compile_target_code.m:
	Make `--inline-alloc' do nothing as inline allocation is currently
	broken in gc 7.0.

runtime/mercury.h:
runtime/mercury_heap.h:
	Include `gc_inline.h' instead of `gc_inl.h' as the latter no longer
	exists.

extras/concurrency/semaphore.m:
library/par_builtin.m:
robdd/bryant.c:
	Replace instances of `GC_PTR' by `void *' as the former no longer
	exists.

runtime/mercury_wrapper.c:
	Remove references to `GC_quiet' which no longer exists.

	Replace uses of `GC_quiet' for the MPS collector by a new variable
	`MR_mps_quiet'.

tools/bootcheck:
	Copy libatomic_ops-related files and directories when copying
	boehm_gc.
2006-08-15 04:19:40 +00:00
Peter Wang
eaf12fb887 Enable the parallel marking code in the Boehm GC in parallel grades
Estimated hours taken: 1
Branches: main

Mmake.common.in:
configure.in:
	Enable the parallel marking code in the Boehm GC in parallel grades
	by adding -DPARALLEL_MARK to the compiler flags, on Linux.

boehm_gc/include/private/gc_locks.h:
	Backport implementations of GC_test_and_set, GC_compare_and_exchange,
	and GC_memory_barrier for x86-64 from libatomic_ops-1.2.

boehm_gc/include/private/gcconfig.h:
	Fix a typo that prevented gcc prefetch builtins from being used on
	x86-64.
2006-08-03 06:26:08 +00:00
Peter Wang
6e27cee1f3 This patch enables the thread-local memory allocation feature of Boehm GC in
Estimated hours taken: 4
Branches: main

This patch enables the thread-local memory allocation feature of Boehm GC in
parallel grades on Linux hosts; without it, performance is terrible.  It may
work on other operating systems using pthreads, but I haven't tested.

Mmake.common.in:
configure.in:
boehm_gc/Makefile:
	Build Boehm GC with the THREAD_LOCAL_ALLOC preprocessor symbol in
	parallel grades on Linux.

	Add -DGC_REDIRECT_TO_LOCAL to CFLAGS_FOR_THREADS to redirect
	calls to GC_malloc() to GC_local_malloc().

runtime/mercury_memory.c:
	Work around a bug in the garbage collector when using thread-local
	allocation.  Hans Boehm says, "A size zero GC_local_malloc allocation
	currently just returns a fixed address outside the real heap."
	This leads to a crash when we later try to GC_free() the address.
2006-04-21 01:04:47 +00:00
Julien Fischer
9d8ca0ad37 Remove residual parts of the Aditi backend that weren't deleted the other day.
Estimated hours taken: 1.5
Branches: main

Remove residual parts of the Aditi backend that weren't deleted the other day.

configure.in:
Mmake.common.in:
	Remove support for enabling the Aditi backend.

runtime/mercury_aditi.h:
	Remove this file.

runtime/Mmakefile:
runtime/mercury.h:
runtime/mercury_imp.h:
runtime/mercury_ho_call.[ch]:
runtime/mercury_wrapper.[ch]:
	Delete support for Aditi in the runtime.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/parse_ml_options.sh-subr.in:
	Remove mmake support for building .rlo files, etc.

util/mkinit.c:
	Remove Aditi specific code.

compiler/bytecode_data.m:
compiler/closure_analysis.m:
compiler/code_model.m:
compiler/compile_target_code.m:
compiler/det_analysis.m:
compiler/handle_options.m:
compiler/hlds_goal.m:
compiler/hlds_module.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/mlds_to_gcc.m:
compiler/modecheck_call.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/options.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/term_errors.m:
compiler/unify_proc.m:
mdbcomp/prim_data.m:
	Remove residual support for Aditi.

library/ops.m:
	Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the
	ops table.

doc/reference_manual.texi:
doc/user_guide.texi:
	Delete the sections on the Aditi interface.

extras/aditi/*:
	Delete this.
2006-02-24 07:11:21 +00:00
Mark Brown
8143cb76c2 Add a configure option to enable LARGE_CONFIG when compiling boehm_gc.
Estimated hours taken: 1.5
Branches: main

Add a configure option to enable LARGE_CONFIG when compiling boehm_gc.
This should probably be made the default, but I'll leave that until after
the performance impact has been measured.

For future versions of boehm_gc, it might make sense to _not_ define
LARGE_CONFIG by default.

configure.in:
	Subst the variable ENABLE_BOEHM_LARGE_CONFIG with the appropriate
	C compiler option.

Mmake.common.in:
	Set the BOEHM_CFLAGS variable to the value of the configured variable.
	In future, other options may also be specified in BOEHM_CFLAGS (which
	is why it has a more generic name).

boehm_gc/Makefile:
	Include BOEHM_CFLAGS in the CFLAGS variable, in our version of the
	Makefile for this package.
2006-02-13 07:14:36 +00:00
Julien Fischer
dfcf7d2709 Update some documentation.
Estimated hours taken: 0.1
Branches: main

Mmake.common.in:
	Update some documentation.
2005-12-03 05:19:38 +00:00
Julien Fischer
350464b856 Update the namespace cleanliness check to conform to Peter's
Estimated hours taken: 0.1
Branches: main

Mmake.common.in:
	Update the namespace cleanliness check to conform to Peter's
	change of the header guards for .mh files.
2005-12-02 12:46:53 +00:00
Ian MacLarty
ce245623ae Build pdf versions of the documentation and install them to the web site.
Estimated hours taken: 0.5
Branches: main and 0.12

Build pdf versions of the documentation and install them to the web site.

Mmake.common.in:
configure.in:
	Set PDFTEX to the location of the pdftex program.

doc/Mmakefile:
	Make and install the pdf documentation.

scripts/Mmake.vars.in:
	Set the install directory for pdf version of the documentation.
2005-08-16 15:51:30 +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
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
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
Peter Ross
9c6a241018 Only include the source to getopt when building mkinit, if a getopt
library doesn't appear to be available.

This avoids a problem where mkinit segfaults under windows with cygwin
due to header files defining different versions of optarg.

configure.in:
	Check for getopt.h and then save the status into
	GETOPT_H_AVAILABLE.

Mmake.common.in:
	Save GETOPT_H_AVAILABLE for use by mmake.

util/Mmakefile:
	Only include the getopt source if GETOPT_H_AVAILABLE is no.
2004-06-24 11:25:50 +00:00
Fergus Henderson
0edf3a522e Remove the intermediate *.empty.c and *.mempty.c files
Estimated hours taken: 0.25
Branches: main

Mmake.common.in:
	Remove the intermediate *.empty.c and *.mempty.c files
	(which are used by the check_namespace target)
	after we have finished using them.
2003-12-30 10:11:25 +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
Peter Ross
dabbb837e2 Not everybody has lynx installed on their systems, so test for it.
Hi,


===================================================================


Estimated hours taken: 0.5
Branches: main

Not everybody has lynx installed on their systems, so test for it.

configure.in:
	Add a check for lynx.

Mmake.common.in:
	Save the result of the test.

Mmakefile:
	Use cat instead of lynx for converting HTML to text, if lynx
	doesn't exist.


Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.74
diff -u -r1.74 Mmake.common.in
--- Mmake.common.in	26 May 2003 10:08:17 -0000	1.74
+++ Mmake.common.in	25 Oct 2003 15:03:14 -0000
@@ -193,6 +193,7 @@
 TEXI2DVI=@TEXI2DVI@
 DVIPS=@DVIPS@
 MAKEINFO=@MAKEINFO@
+LYNX=@LYNX@
 PERL=@PERL@

 #-----------------------------------------------------------------------------#
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.100
diff -u -r1.100 Mmakefile
--- Mmakefile	17 Apr 2003 06:24:22 -0000	1.100
+++ Mmakefile	25 Oct 2003 15:03:17 -0000
@@ -264,7 +264,11 @@
 INSTALL: .INSTALL.in VERSION
 	sed 's/@VERSION@/$(VERSION)/g' .INSTALL.in > INSTALL

+ifeq ("$(LYNX)","")
+TEXT_TO_HTML = cat
+else
 TEXT_TO_HTML = TERM=vt100 lynx -dump
+endif

 WORK_IN_PROGRESS: compiler/notes/work_in_progress.html
 	$(TEXT_TO_HTML) compiler/notes/work_in_progress.html > WORK_IN_PROGRESS
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.376
diff -u -r1.376 configure.in
--- configure.in	7 Oct 2003 12:34:33 -0000	1.376
+++ configure.in	25 Oct 2003 15:03:24 -0000
@@ -443,6 +443,9 @@
 esac
 AC_SUBST(TEXI2DVI)
 #-----------------------------------------------------------------------------#
+AC_PATH_PROG(LYNX,lynx)
+AC_SUBST(lynx)
+#-----------------------------------------------------------------------------#
 AC_PATH_PROG(DVIPS,dvips)
 AC_SUBST(DVIPS)
 #-----------------------------------------------------------------------------#
2003-10-25 15:06:17 +00:00
Zoltan Somogyi
288508e926 Allow Mmake.params to specify LIBRARY_TRACE_MINIMUM=no, which
Estimated hours taken: 0.5
Branches: main

Mmake.common.in:
library/Mmakefile:
	Allow Mmake.params to specify LIBRARY_TRACE_MINIMUM=no, which
	allows Mmake.params to also specify the trace level of the library,
	and in debugging grades by default compiles the library with
	--trace deep.

	Include Mmake.library.params if it exists.
2003-05-26 10:08:22 +00:00