mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
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?)
102 lines
3.3 KiB
Makefile
102 lines
3.3 KiB
Makefile
#-----------------------------------------------------------------------------#
|
|
# vim: ts=8 sw=8 noexpandtab ft=make
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
TESTS_DIR = ..
|
|
THIS_DIR = invalid_submodules
|
|
MAYBE_J1 = -j1
|
|
|
|
# This directory contains tests for errors in programs in which at least
|
|
# one source file contains more than one nested module. We disable
|
|
# parallel make with the -j1 above, because if we didn't, we would get
|
|
# intermittent failures caused by interface files of nested submodules
|
|
# not being ready when another job, executed in parallel by mmake,
|
|
# wants to read them.
|
|
#
|
|
# For multi-module tests (which includes all the tests in this directory)
|
|
# we normally need to make the dependencies. However, multi-module tests
|
|
# where the error is detected when building the dependencies
|
|
# (e.g. duplicate_module_test.m) should be included in MAKE_DEP_ONLY_PROGS,
|
|
# not STD_PROGS, because we have a specific make rule for them below.
|
|
|
|
STD_PROGS = \
|
|
exported_unify3 \
|
|
undef_mod_qual \
|
|
unresolved_overloading
|
|
|
|
MAKE_DEP_ONLY_PROGS = \
|
|
duplicate_module_test \
|
|
func_class \
|
|
nested_impl_in_int
|
|
|
|
# XXX The test cases import_in_parent and subtype_submodule are
|
|
# currently disabled, because
|
|
#
|
|
# - we now discover the errors they reports when making .int files,
|
|
# which would require moving them to invalid_make_int, but
|
|
# - this would require adding support for nested submodules to
|
|
# invalid_make_int, and
|
|
# - this is not warranted, because the errors they report are tested for
|
|
# elsewhere.
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
PROGS = $(STD_PROGS) $(MAKE_DEP_ONLY_PROGS)
|
|
# For the MAKE_DEP_ONLY_PROGS, we want to make the dependencies
|
|
# using our own rule below, not the usual rule, which is why we disable
|
|
# the usual rule for them via the -nodepend suffix.
|
|
TESTS = $(sort $(STD_PROGS) $(MAKE_DEP_ONLY_PROGS:%=%-nodepend))
|
|
include ../Mmake.common
|
|
|
|
# Module-specific options should go in Mercury.options so they can be found
|
|
# by `mmc --make'.
|
|
include Mercury.options
|
|
|
|
%.runtest: %.err_res ;
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
ifneq ($(MMAKE_USE_MMC_MAKE),yes)
|
|
|
|
$(STD_PROGS:%=%.err): %.err: %.m
|
|
if $(MC) --errorcheck-only $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) $* \
|
|
> $*.err 2>&1; \
|
|
then false; \
|
|
else true; \
|
|
fi
|
|
|
|
else
|
|
|
|
% XXX: with `mmake --use-mmc-make' the ".DEFAULT:" rule seems to take
|
|
# precedence over "%.err: %.m" rules.
|
|
% XXX: the reason we run the $(MCM) command twice is to avoid doubled up
|
|
# error messages, once while making interface files, then the module proper.
|
|
# The second time the command is run, only one set of error messages
|
|
# should appear.
|
|
$(STD_PROGS:%=%.err):
|
|
-$(MCM) $@
|
|
if $(MCM) -r $@ > /dev/null 2>&1; \
|
|
then false; \
|
|
else true; \
|
|
fi
|
|
|
|
endif
|
|
|
|
# For these test cases, the bug is caught when generating dependencies,
|
|
# so it is easiest just to do that step.
|
|
$(MAKE_DEP_ONLY_PROGS:%=%.err): %.err: %.m
|
|
if $(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) \
|
|
--generate-dependencies $* > $*.err 2>&1; \
|
|
then false; \
|
|
else true; \
|
|
fi
|
|
|
|
$(dates_subdir)undef_mod_qual.date: $(int0s_subdir)undef_mod_qual.int0
|
|
|
|
clean_local: clean_invalid_submodules
|
|
|
|
clean_invalid_submodules:
|
|
rm -f *dep_err *.err *.err_res
|
|
|
|
#-----------------------------------------------------------------------------#
|