Commit Graph

973 Commits

Author SHA1 Message Date
Zoltan Somogyi
b92c11973c Document mmakefile fragment files better.
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.
2023-10-12 15:18:59 +11:00
Zoltan Somogyi
104a8ebd9e Get "make cs"/"mmc --make x.cs" to build a C# file ...
... instead of building a bunch of .c files.

Our tradition of adding an "s" at the end of a suffix to mean "all of the
files with the original suffix" had a problem when we added C# as a target
language. Until then, just as "os" stood for ".o files" when it occurred
as either a mmake target, mmc --make target, or mmake variable name component.
"cs" likewise stood for ".c files", but was now also needed to mean ".cs file".
We coped by keeping "cs" meaning ".c files", and adding "csharp" as a target
name synonym to mean ".cs file".

This diff keeps that synonym, but it changes

- the name needed to refer to ".c files" from "cs" to "all_cs"
- the name needed to refer to ".o files" from "os" to "all_os"
- the name needed to refer to ".pic_o files" from "pic_os" to "all_pic_os"
- the name needed to refer to ".cs files" from "css" to "all_css"
- the name needed to refer to ".java files" from "javas" to "all_javas"
- the name needed to refer to ".opt files" from "opts" to "all_opts"
- the name needed to refer to ".trans_opt files"
        from "trans_opts" to "all_trans_opts"

It would be nice if we could apply this same change to all other similar
target names and mmake variable name suffixes, such as "ints" and "int3s",
but some of those names are already in use to mean semantically different
things. All of the names above that used to have the form "<ext>s" and
now have the form "all_<ext>s" stood for all the files with extension
".<ext>" that are prerequisites for building a linked target, i.e.
an executable or a library. But the mmake variable name suffixes
".all_mihs", ".all_mhs" and ".all_int0s" each stand for something subtly
different: the names of files that *may or may not exist", but which,
if they do exist, should be deleted by a clean or realclean target.

To make this breaking change easier to handle by users, this diff does
not simply redefine the meaning of ".all_int0s". (It does change the meaning
of the "cs" target, but the fact this will happen at some time has been
announced ages ago.) Instead, it defines three new mmake var suffixes,
".mihs_to_clean", ".mhs_to_clean" and ".int0s_to_clean", which are
synonyms for ".all_mihs", ".all_mhs" and ".all_int0s" respectively,
and announces that ".all_mihs", ".all_mhs" and ".all_int0s" are being
deprecated, and will have the above change of semantics applied to them
in the future.

NEWS.md:
    Announce the breaking change.

compiler/make.top_level.m:
    Stop treating the target "cs" as meaning "build all the .c files
    for this program".

    The code of classify_target_2 has long been semidet, but only in a way
    that was not apparent to the compiler. Change the code to allow the
    compiler to see its semidet nature while keeping the algorithm the same,
    except for the change in the paragraph above.

    This includes keeping e.g. "ints" as meaning "build all the .int/.int2
    files needed by this program".

compiler/write_deps_file.m:
    Stop generating mmake variables with suffixes ".cs", ".os", ".pic_os",
    ".javas" and ".css". The mmake variables with suffixes ".all_cs",
    ".all_os", ".all_pic_os", ".all_javas" and ".all_css" already existed.
    All had the same value as the mmake variable without the "all",
    with one exception: ".cs". However, in this case, the old (and still
    current) value of ".all_cs" is what the value of ".cs" *should* have been.

    Simplify some code.

The following changes in compiler/*.m are only cosmetic, but they helped me
rule out possible sources of problems with incomplete versions of this diff.

compiler/file_names.m:
    Add a version of a fact_table_file_name_return_dirs which does not
    return directories, since most of its callers don't need that info.

compiler/make.program_target.m:
    Clarify code by making variable names more descriptive,

compiler/make.file_names.m:
compiler/make.module_target.m:
    Conform to the changes above,

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
grade_lib/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
    Rename os to all_os, cs to all_cs, css to all_css, javas to all_javas,
    and opts to all_opts. (There were no occurrences of trans_opts to rename.)

    Replace [s as sh command names in actions.

scripts/Mmake.vars.in:
    Specify the names of mmake variables holding the names of sets of files
    with a given extension directly, since for some of them, adding an "s"
    at the end of the name of the extension does not generate the name
    of the corresponding mmake variable anymore.

scripts/Mmake.rules:
    Use the directly specified mmake variable names from Mmake.vars.in
    in the rule for installing lbraries. Temporarily add some debugging
    output to make suree that the updated nested mmake variable references
    work as intended.

tools/bootcheck:
    Specify the names of mmake targets for making all the files in a program
    with a given extension directly, since adding an "s" at the end of the
    name of the extension does not generate the name of the corresponding
    mmake target anymore.

    Print timestamps around the action of checking namespace cleanliness,
    to allow the time taken by that action to be measured. (I kept track
    of bootchecks as they happened while working on this diff, and found
    this time to be nontrivial.)
2023-10-05 02:03:47 +11:00
Zoltan Somogyi
4e90f2d238 Update the programming style of yet more scripts. 2023-10-02 15:02:53 +11:00
Zoltan Somogyi
a319773719 Update the programming style of more scripts.
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.
2023-10-01 21:02:18 +11:00
Zoltan Somogyi
622d8c5656 Update the programming style of some scripts.
scripts/init_grade_options.sh-subr:
scripts/mdb.in:
scripts/mercury_config.in:
scripts/mercury_update_interface.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/parse_ml_options.sh-subr.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.

    Replace the [ command with test.

    Put quotes around strings that should be considered one word
    even if they are empty or contain spaces.

    Fix English in messages and comments.
2023-09-30 23:36:03 +10:00
Julien Fischer
adece804aa Build the man page for mtc.
docs/Mmakefile:
    As above.

scripts/mtc:
    Escape double quotes in the usage message.
2023-09-22 23:13:22 +10:00
Julien Fischer
ea4b27f57f Delete --fullarch.
The internal option --fullarch has been deprecated in favour of --target-arch
since 2014. Delete it and replace any uses with --target-arch.

compiler/options.m:
    As above.

scripts/Mercury.config.in:
scripts/Mercury.config.boostrap.in:
extras/windows_installer_generator/sample/Mercury.config:
    Conform to the above change.
2023-09-07 11:47:38 +10:00
Zoltan Somogyi
0528eeb78e Fix out-of-date references to changed subdir names. 2023-09-06 19:47:06 +10:00
Julien Fischer
31bd49f7db Revert commit 8a3be4e.
scripts/Mmake.vars.in:
    The above commit breaks the installed version of mmake on Linux.
    Revert it until we find a solution that works on both Windows
    and Linux.
2023-09-04 12:48:11 +10:00
Zoltan Somogyi
f4e24a37d0 s/classs/classes/ 2023-08-18 15:52:49 +02:00
Julien Fischer
460a11ec3d Fix the debugger tests with MSYS2/MinGW64.
These were failing because debugger expects Windows-style paths in the
test_mdbrc file, but it was being generated with Unix-style paths. A
similar problem was recently fixed for MSVC, this change extends that
fix to also work for MSYS2/MinGW64.

configure.ac:
    Define a new configuration variable, FIX_PATH_FOR_WINDOWS, that expands
    to the command used to do path conversion in Unix-like environments on
    Windows. (The previous fix for MSVC used FIX_PATH_FOR_CC to do this,
    but the MinGW64 port of GCC does use Unix-style paths so that cannot
    be used here.)

scripts/Mmake.vars.in:
    Add a new mmake variable, FIX_PATH_FOR_WINDOWS.

scripts/Mmakefile:
    Use FIX_PATH_FOR_WINDOWS when creating the test_mdbrc file.
2023-07-26 21:24:28 +10:00
Julien Fischer
16a2943e26 Delete an unused mmake variable.
scripts/Mmake.vars.in:
    The variable FIX_PATH_FOR_CSC has not been used since the old
    .NET backend was deleted. (The current C# backend does not use
    mmake.)
2023-07-23 00:16:34 +10:00
Julien Fischer
74ae4b80b7 Fix debugger tests on Windows.
scripts/Mmakefile:
    Use Windows-style paths in test_mdbrc on Windows.
2023-07-23 00:12:05 +10:00
Julien Fischer
6c0c603aaa Update a comment.
scripts/Mmake.vars.in:
    We have not used cygpath's -w flag for many years; we
    actually use the -m flag.
2023-07-17 19:42:46 +10:00
Peter Wang
adb22a74a7 Delete MERCURY_OPTIONS -a -r -t options.
The MERCURY_OPTIONS environment variable supported these options

    -a  benchmark_all_solns
    -r  repeats
    -t  use_own_timer

to perform microbenchmarks very early on in the Mercury project,
but the time for that is past.

runtime/mercury_wrapper.c:
    Delete code supporting -a, -r and -t options.

scripts/mprof_merge_runs:
    Delete mention of -r option.

tests/benchmarks/Mmakefile:
    Delete/comment out rules that makes use of the -r option.
2023-07-14 11:03:03 +10:00
Julien Fischer
2a366cf295 Deprecate --no-ansi and --no-ansi-c.
--no-ansi (mgnuc) and --no-ansi-c (mmc) have not actually done anything for
many years now. Deprecate these options and remove their "use" throughout most
of the Mercury system. (The remaining uses are in the Makefiles for the Boehm
GC, which need to be updated separately.)

Also deprecate the internal compiler option --cflags-for-ansi.

compiler/options.m:
    Document that --no-ansi-c is now deprecated.

    Document that the internal option --cflags-for-ansi is now
    deprecated.

compiler/compile_target_code.m:
    Do not pass the ANSI options to the C compiler.

scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
    Deprecate the --no-ansi option; delete code that no longer does
    anything useful.

configure.ac:
    Delete the configuration variable CFLAGS_FOR_ANSI; it is only ever
    set to be empty. (The comment talks about --no-ansi doing other things
    in the mgnuc script. It used to also cause some preprocessor macros
    to be defined for compatibility with the system headers on some
    platforms -- that has not been the case since 2013.)

doc/user_guide.texi:
    Document that --no-ansi-c is deprecated.

bytecode/Mmakefile:
compiler/Mercury.options:
library/Mercury.options:
extras/odbc/odbc.m:
runtime/Mmakefile:
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
tests/hard_coded/Mercury.options:
tests/valid/Mercury.options:
trace/Mmakefile:
util/Mmakefile:
    Conform to the above change.

NEWS.md:
    Announce the above.
2023-05-31 17:44:26 +10:00
Julien Fischer
8a3be4eaea Avoid a warning from make on Windows.
scripts/Mmake.vars.in:
    The cygpath utility prints a warning if it is invoked with an empty
    argument.
2023-04-07 19:14:34 +10:00
Peter Wang
3446667416 Fix references to unassigned mmake variables.
compiler/write_deps_file.m:
    Fix reference to used_subdir, should be useds_subdir.

scripts/Mmake.vars.in:
    Assign analysiss_subdir variable.
2023-01-31 15:26:24 +11:00
Peter Wang
b0ae10248b Use --trans-opt-deps-spec option.
Use the recently added --trans-opt-deps-spec option to break cycles in
the trans-opt dependency graph for the standard library. This enables
more parallelism when making the .trans_opt files; it now takes about
half as long as before.

Ordering modules sensibly, so that .trans_opt files are created in a
logical order, also improves analysis results for many predicates and
functions. The only results which show a regression with this change are
for deprecated forwarding predicates/functions.

In future, we will probably be able to trim more dependencies to further
improve parallelism, without impacting analysis results.

configure.ac:
    Check that the bootstrap compiler supports --trans-opt-deps-spec.

library/mer_std.trans_opt_deps_spec:
    Add the spec file that adjusts dependencies in the trans-opt
    dependency graph.

library/INTER_FLAGS:
    Use the --trans-opt-deps-spec option when building with mmake.

scripts/prepare_install_dir.in:
tools/binary:
tools/bootcheck:
tools/unary:
    Copy mer_std.trans_opt_deps_spec when preparing a copy of the
    library directory.
2023-01-25 16:48:45 +11:00
Zoltan Somogyi
05ef8e01fb Rename the .ll_debug grade component to .c_debug.
Rename mmc and mgnuc options that set this grade component to --c-debug-grade.
Let the options named --c-debug of both mmc and mgnuc enable C level debugging
of only the module being compiled.

runtime/mercury_grade.h:
    Rename the .ll_debug grade component to .c_debug. Also rename the C macro
    that controls the presence or absence of this grade component
    from MR_LL_DEBUG to MR_C_DEBUG_GRADE.

runtime/mercury_conf_param.h:
runtime/mercury_debug.c:
runtime/mercury_debug.h:
runtime/mercury_engine.c:
runtime/mercury_label.c:
runtime/mercury_memory_zones.c:
runtime/mercury_memory_zones.h:
runtime/mercury_overflow.c:
runtime/mercury_std.h:
runtime/mercury_wrapper.c:
    Rename the MR_LOWLEVEL_DEBUG macro to MR_DEBUG_THE_RUNTIME.
    Previously, the name of this macro wrongly implied that it had
    something to do with the old .ll_debug grade component, even though

    - the MR_LOWLEVEL_DEBUG macro was designed to debug LLDS grades,
      since only these existed when it was created, while

    - the .ll_debug grade component (now .c_debug) is useful only for
      MLDS grades targeting C.

compiler/options.m:
    Rename the old confusingly named low_level_debug option to c_debug_grade.
    Move it to the list of grade options, and fix its documentation, which
    was completely wrong:

    - code in compile_target_code.m treated it as being a synonym of
      the .ll_debug (now .c_debug) grade component, while
    - its (commented out) documentation here in options.m said it called for
      the enabling of what is now MR_DEBUG_THE_RUNTIME.

compiler/compile_target_code.m:
    Conform to the rename just above.

    Define MR_C_DEBUG_GRADE instead of MR_LL_DEBUG if c_debug_grade is enabled.

    Pass -g to the C compiler if either c_debug_grade or target_debug
    is enabled.

    Add an XXX about a missing safety check for an obsolete experimental
    feature.

compiler/compute_grade.m:
    When given a grade with a .c_debug grade component, set only the
    c_debug_grade option; don't set the target_debug option, which is NOT
    a grade option. The change to compile_target_code.m above handles the
    only situation in which this implication was formerly required.

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
    Look for and process the .c_debug grade component instead of .ll_debug.
    Use a sh variable named c_debug_grade to record its absence/presence.

    Look for and process the --c-debug-grade grade-component option,
    setting the same sh variable, c_debug_grade. (All grade components
    can be set piecemeal using sh options to the scripts using these
    subroutines.) This replaces the old, confusingly named option
    --low-level-debug.

scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
    Consistently use the sh variable c_debug to record the presence of
    the (non-grade) --c-debug option to mgnuc, and the sh variable
    c_debug_grade to record the presence of the .c_debug grade component.

    Stop looking for and handling the --low-level-debug option, which
    mgnuc used to document, even though this duplicated the same documentation
    in init_grade_options.sh-subr, which mgnuc includes. The difference was
    that init_grade_options.sh-subr meant it to represent the old .ll_debug
    MLDS grade component, while mgnuc treated it as specifying what is now
    MR_DEBUG_THE_RUNTIME for LLDS grades. It didn't help that two sh variables
    with quite different semantics had names that differed only in an
    underscore: LLDEBUG_OPTS vs LL_DEBUG_OPTS.

scripts/Mmakefile:
    Add a missing dependency to force the rebuild of mgnuc after each update
    of its sh subroutine mgnuc_file_ops.sh-subr.

doc/user_guide.texi:
    Document the --c-debug-grade option of mmc. This option was not publicly
    documented under its original misleading name (--low-level-debug), but
    its documentation is now possible without contorted dancing around the
    name.

    Clarify the documentation of mgnuc's --c-debug option.

README.sanitizers:
configure.ac:
    Conform to the rename of the grade component.

grade_lib/grade_spec.m:
grade_lib/grade_string.m:
grade_lib/grade_structure.m:
grade_lib/try_all_grade_structs.m:
    Conform to the rename of the grade component .ll_debug to .c_debug.

    Don't allow the .c_debug grade component in LLDS grades.

    In grade_string.m, add some obvious implications of some grade components.

grade_lib/choose_grade.m:
grade_lib/grade_lib.m:
grade_lib/test_grades.m:
grade_lib/var_value_names.m:
    Fix white space.

scripts/ml.in:
tools/lmc.in:
tools/test_mercury:
    Conform to the change in compile_target_code.m to the naming of
    Boehm gc library variants.
2022-12-29 20:33:08 +11:00
brendanzab
b99fea212a Fix typo in mercury_config.in 2022-08-16 15:05:16 +10:00
Julien Fischer
e0c7eedb49 Fix Github issue #102.
Avoid the use of the GCC option -Warray-bounds with GCC version 12 and later.

configure.ac:
scripts/mgnuc.in:
    As above.

NEWS:
    Announce the fix.
2022-06-18 20:12:03 +10:00
Julien Fischer
8ef9073be2 Delete remaining references to --use-trail-segments.
doc/user_guide.texi:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
samples/solver_types/Mercury.options:
scripts/init_grade_options.sh-subr:
    As above.

RELEASE_NOTES_NEXT:
    Delete item concerning the above.
2022-04-18 21:45:15 +10:00
Julien Fischer
105580a765 Delete the trseg component and --trail-segments option.
Trail segments have been the default in trailing grades since Mercury 20.06.
Delete the trseg grade components and --trail-segment option since apart from
acting as synonyms for the tr component and --use-trail option repsectively,
they no longer do anything.

compiler/compute_grade.m:
compiler/handle_options.m:
compiler/options.m:
doc/user_guide.texi:
grade_lib/grade_vars.m:
scripts/parse_grade_option.sh-subr:
grade_lib/grade_string.m:
grade_lib/grade_vars.m:
   Delete the trseg grade component and --trail-segments option.

compiler/add_pragma.m:
   Update the wording of an error message.

NEWS:
   Announce the above.

extras/trail/Mercury.options:
extras/trailed_update/Mmakefile:
extras/references/Mercury.options:
tests/invalid/test_feature_set.err_exp:
    Conform to the above changes
2022-04-05 17:02:40 +10:00
Julien Fischer
668ce29aa1 Fix github issue #101.
scripts/ml.in:
    Avoid turning --mercury-libs none into --mercury-libs static when
    using MSVC. This is causing the linker command line to be invalid.
2022-03-13 05:06:43 +11:00
Julien Fischer
d0f22be99e Avoid spurious warnings from GCC.
As mentioned recently on the developers list, GCC versions 9 10 and 11 are
emitting suprious warnings with -Warray-bounds for the specialised code they
introduce for strcmp etc. Disable that warning for those versions of GCC. In
addition to this issue, according to the GCC bug database is is generating a
lot of false positives anyway.

configure.ac:
scripts/mgnuc.in:
    As above.
2022-03-05 22:39:10 +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
f66a7d6642 Generate diagnostics for .par.mm grades.
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/final_grade_options.sh-subr:
    Generate an error message for grades that mix parallel execution
    and minimal model tabling.

compiler/compute_grade.m:
    Improve two comments.
2021-06-13 21:41:56 +10:00
Peter Wang
795202f55a Delete erlang options from Mercury.config files.
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
    Delete Erlang related environment variables and options.
2021-06-07 16:53:40 +10:00
Peter Wang
1dcebc891b Fix -O<n> options below default optimisation level.
The default optimisation level was implemented by having the
Mercury.config file add a -O<n> option to the DEFAULT_MCFLAGS variable.
This allowed the user to override the default optimisation level
by setting the MERCURY_DEFAULT_OPT_LEVEL environment variable.

Commit 181ada0dbf made it so that -O<n>
options do not reset previously set options. This had the unintended
consequence that any -O<n> options below the default optimisation level
had no effect when passed on the command line or in a Mercury.options
file, because a -O<n> option passed by the user would never undo the
options set by the default optimisation level.

compiler/options.m:
    Add new option `--default-opt-level' for use by Mercury.config.

tools/make_optimization_options_end:
    Add predicate to parse the value of `--default-opt-level' from the
    options table. The option value is a string because the value of the
    MERCURY_DEFAULT_OPT_LEVEL environment variable will be passed as
    the option value. The existence of the environment variable was
    (barely) documented, but the allowable values are not.
    Though the user might conceivably have set any Mercury compiler
    option in that environment variable, the value was probably only
    intended to be a string of the form "-O<int>", and that is all we
    will support.

tools/make_optimization_options_middle:
    Use `get_default_opt_level'.

compiler/optimization_options.m:
    Regenerate this file.

compiler/options_file.m:
    Do not automatically add "-O2" to MCFlags.
    The comment says this was to set a default optimisation level when
    calling the `mercury_compile' binary instead of the `mmc' script,
    but `get_default_opt_level' already defaults to optimisation level 2.

scripts/Mercury.config.in:
    Pass the value of MERCURY_DEFAULT_OPT_LEVEL using the
    `--default-opt-level' option.
2021-06-07 16:49:54 +10:00
Peter Wang
347837ca06 Delete erlang from grade scripts.
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
    Stop recognising "erlang" as a target or grade component.
2020-10-27 11:10:11 +11:00
Peter Wang
c4c840cb7e Delete Erlang backend from configure.
configure.ac:
m4/mercury.m4:
    Delete --enable-erlang-grade configure option.

    Don't search for erlang compiler and interpreter.

    Don't substitute @ERLC@ and @ERL@.

    Don't add erlang to libgrades.

    Don't generate erlang_conf.hrl

library/erlang_conf.hrl.in:
    Delete template file.

.dockerignore:
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/.gitignore:
library/Mmakefile:
library/library.m:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
scripts/Mercury.config*.in:
scripts/mercury_config.in:
scripts/prepare_install_dir.in:
ssdb/SSDB_FLAGS.in:
tools/bootcheck:
    Delete references to Erlang .hrl files.

    Delete references to @ERLC@ and @ERL@.
2020-10-27 11:10:11 +11:00
Julien Fischer
0721d90373 Drop support for versions of macOS prior to 10.9.
This means that the following are no longer supported:

- the powerpc*apple*darwin* configuration.
- versions of XCode prior to about 6 or so

NEWS:
    Announce the above.

README.MacOS:
    Delete text describing things that are no longer supported.

configure.ac:
    Do not check if gcc is really llvm-gcc.  llvm-gcc was replaced
    by clang years ago.

compiler/compile_target_code.m:
scripts/mgnuc.in:
    Delete a workaround for an issue on powerpc based Macs.
2020-10-26 12:54:14 +11:00
Julien Fischer
32eafdab15 Delete an unused script.
scripts/fullarch:
    Delete this script; it isn't used anywhere, no longer works, and has not
    been meaningfully updated since 1995.
2020-10-21 15:22:10 +11:00
Julien Fischer
ff39b3463b Remove legacy support for the Alpha architecture.
README.Linux-Alpha:
runtime/machdeps/ALPHA_REGS:
runtime/machdeps/alpha_regs.h:
runtime/machdeps/alpha_regtest:
    Delete these files.

configure.ac:
runtime/Mmakefile:
runtime/mercury_goto.h:
runtime/mercury_regs.h:
README.md:
README.Linux:
README.Linux-PPC:
    Delete or update references to the Alpha architecture.

NEWS:
    Announce the above.

scripts/mgnuc.in:
    Unrelated: update a comment.
2020-10-18 16:35:52 +11:00
Peter Wang
89e59e7cc8 Delete support for browsing terms as XML.
The 'browse --xml' command has not worked with current versions of
xsltproc for quite some time, but we have not received any bug reports,
nor has anyone tried to fix it. We have a method for interactively
exploring a term in 'browse --web' so IMHO there is no need to keep
support for 'browse --xml'.

browser/browse.m:
browser/browser_info.m:
browser/declarative_user.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
    Delete code.

doc/mdb_categories:
doc/user_guide.texi:
    Delete documentation.

configure.ac:
    Don't search for a XUL browser and xsltproc.

scripts/mdbrc.in:
    Delete 'xml_browser_cmd' and 'xml_tmp_filename' lines.

scripts/xul_tree.xsl:
    Delete now unused file.

scripts/Mmakefile:
    Conform to deletions.

tests/debugger/Mmakefile:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp3:
tests/debugger/browser_test.inp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
tests/declarative_debugger/browse_arg.exp:
tests/declarative_debugger/browse_arg.inp:
    Don't test 'browse --xml' any longer.

extras/xml_stylesheets/README:
    Delete reference to 'browse --xml' command.

NEWS:
    Announce change.
2020-10-14 17:41:54 +11:00
Julien Fischer
deb79feb2b Delete a leftover reference to getopt_template.
scripts/prepare_install_dir.in:
    As above.
2020-10-10 20:09:03 +11:00
Zoltan Somogyi
be3f9443b1 Simplify the setup of mdbrc for tests.
We used to set up *two* mdbrc files for use by test cases:
scripts/test_mdbrc, and tests/mdbrc. Tools/bootcheck said
the tests should use the former, while tests/Mmake.common
said they should use the latter. This diff deletes the latter,
and uniformly uses the former.

The setup code was also scattered, with parts being done by
the configure script, and part being done by tools/bootcheck.
Move it all to scripts/Mmakefile, since that is the natural
place to put code to build scripts/test_mdbrc.

Mmakefile:
    Fix the action for cleaning up the tests directory.
    This started out as the reason for this whole change.
    As it happens, a *working* action for cleaning up the tests
    broke things, because it deleted an autoconfigured file
    (tests/mdbrc) that there was no rule for rebuilding.
    This issue is what required the rest of this diff.

    When doing "mmake clean/realclean", clean the extras as well.

configure.ac:
    Delete the code creating tests/mdbrc.in.

scripts/Mmakefile:
    Add a rule to build test_mdbrc, as mentioned above.

tests/Mmake.common:
    Switch to using scripts/test_mdbrc in test cases
    run under mdb.

    Mark the rules that clean up mdbrc and mdbrc.in
    as obsolete, since we will now stop creating those files.

tools/bootcheck:
    Delete the code that used to build tests/mdbrc. Instead,
    rebuild scripts/test_mdbrc (in case the workspace was moved),
    and use that.

tests/Mmakefile:
    When cleaning the tests directory, clean its subdirectories
    (since the top level directory does not have much clean).
2020-10-04 23:00:29 +11:00
Zoltan Somogyi
4f3c57e559 Copy getop_template to install dirs. 2020-09-19 08:22:16 +10:00
Zoltan Somogyi
a2def4bcc8 Bring the style of some scripts up to date ...
... by replacing tabs with spaces, adding modelines, replacing [ with test,
and fixing indentation.
2020-08-14 20:11:56 +10:00
Julien Fischer
5bdde5935b Fix problem building stage 1 compiler in Java grade.
scripts/Mercury.config.bootstrap.in:
    Pass --restricted-command-line to the bootstrap compiler.  On Windows, the
    command lines with which we invoke the Java compiler in the compiler
    directory are apparently "too long".
2020-06-29 16:06:50 +10:00
Julien Fischer
9630af2d5c Add mercury script to .gitignore.
scripts/.gitignore:
    As above.
2020-06-27 15:06:21 +10:00
Julien Fischer
7ce2ddd2b2 Update and fix copyright notices in the scripts directory.
scripts/*:
    As above.
2020-06-16 17:22:09 +10:00
Julien Fischer
fb643a2ca7 Support 'mercury' as a synonym for 'mmc' on all platforms.
On Windows the name 'mmc' is also used for the executable for Microsoft
Management Console.  For the MSVC port on the Windows command line we have long
provided a batch file named 'mercury' as an alternative to `mmc' in order to
avoid this clash.  (Re-arranging your PATH to avoid the clash is not always an
option.)

Provide a shell script named 'mercury' that serves the same purpose elsewhere.
Its main use is to avoid the name clash on MinGW/MSYS, Cygwin etc., but
making the name available everywhere should avoid unnecessary changes in build
scripts and alike.

Document the issue with the name clash in the appropriate chapter of the user's
guide and also in the top-level Windows README file.

scripts/mercury.in:
     Add a template for the 'mercury' script.

configure.ac:
     Create the 'mercury' wrapper script.

scripts/Mmakefile:
     Add 'mercury' to the list of scripts.

doc/user_guide.texi:
     Add a paragraph describing the 'mmc' name clash on Windows and what
     to do about it.

     Unrelated change: ':' is no longer a module qualifier.

README.MS-Windows:
     Point users to the relevant chapter of the user's guide for ways
     to deal with the `mmc' name clash.

NEWS:
     Announce the addition.
2020-06-16 16:33:22 +10:00
Zoltan Somogyi
79d81d09d8 Fix bugs and nits pointed out by shellcheck.
scripts/mgnuc.in:
    Delete the unused variables AS, AS_OPTS, HLD_OPTS and ARG_OPTS.
    The first two are hstorical relics, HLD_OPTS lost its raison d'etre
    when we deleted the hl grades; I don't know what we used ARG_OPTS for.

    Make the unused variable CFLAGS_FOR_ANSI used.

    Fix a spelling inconsistency: DEBUG_OPT vs DEBUG_OPTS.

scripts/ml.in:
    Delete the unused variables NONSHARED_LIB_DIR and DL_LIBRARY.

scripts/parse_grade_options.sh-subr:
    Fix typos that prevented an almost-never-used option from working.

scripts/parse_ml_options.sh-subr.in:
    Fix a quoting error.

tools/bootcheck:
    Comment out the definition of an unused variable. (Its parallel
    exists and is used in c2init.in, which is why it is not deleted.)

    Fix typos in spelling SSDB_LIB_NAME.

    Quote a variable value that may contain spaces.

    Replace "cat file | cmd" with "cmd < file".
2020-05-29 21:18:08 +10:00
Julien Fischer
d0ae4d2819 Update the reconfiguration script.
scripts/mercury_config.in:
    As above.
2020-04-14 21:55:34 +10:00
Zoltan Somogyi
1b23b4bc7c Fix a typo in user-facing documentation. 2020-04-13 06:07:29 +10: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
3e894a7a9d Remove the hl grade component.
As we discussed, it has fallen into disuse. Its main purpose was to
pave the way for the .net backend and later for the java and csharp grades.
Now that the .net backend is ancient history and the java and csharp grades
are established, that purpose is gone, and for every other purpose,
hlc is better because it is simpler and faster.

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

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

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

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

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

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

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

    Delete the requirements involving the deleted solver variable.

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

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

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

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

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

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

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

    Add or fix vim modelines where relevant.

    Fix inconsistent indentation.

    Add missing ;;s in case statements.

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

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

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

Patch contributed by Keri Harris.

scripts/Mmake.vars.in:
scripts/mdprof.in:
scripts/mmc.in:
scripts/mprof.in:
    As above.
2020-04-11 03:17:48 +10:00