Files
mercury/tests/valid/Mmake.valid.common
Zoltan Somogyi 251ab8cce5 Don't treat .m files as substitutes for .opt files.
compiler/write_deps_file.m:
    When trying to check for the existence of .opt files, whether alone
    or together with .trans_opt files, do not consider a .m file as
    an acceptable substitute. Delete the option that can ask for this
    behavior.

compiler/globals.m:
    Delete ie_src as a kind of search for source files, since the change
    to write_deps_file.m deletes its only use.

compiler/generate_dep_d_files.m:
compiler/handle_options.m:
    Conform to the changes above.

tests/term/existential_error1.trans_opt_exp:
    Update the expected output of this test case, because the change
    in write_deps_file.m causes the compiler to get a library predicate's
    termination info from a .opt file instead of a .trans_opt file,
    and it happens to be different

tests/term/existential_error1.m:
    Document the reason for this difference.

tests/valid/Mmake.valid.common:
tests/warnings/Mmakefile:
    The valid_seq/opt_det_warn and warnings/inst_with_no_type test cases
    both specify --intermodule-optimization. Before this diff, the .opt file
    did not get built, but this was not an issue for the following reasons.

    - opt_det_warn tests for the *absence* of any message about something
      in the .opt file, while inst_with_no_type tests for a type definition
      in the implementation section of the helper module being invisible
      outside its module. Both tests are much easier to pass if you do not
      actually read the .opt file.

    - The generation of the warning message about the .opt file not being
      available was suppressed by the fact that the helper module's *source*
      file *was* available.

    Since the compiler now generates this warning message, so add
    mmake rules to force the helper modules' .opt files to be built
    before the compilation of the main modules.

tests/valid_seq/Mmakefile:
    Define some mmake vars that looked like they should help with
    those additional rules, but it seems, they don't.

    Add an XXX about a possible problem.

    Delete an XXX that is no longer relevant.

    Delete a commented out duplicate of an mmakefile entry.
2024-11-15 14:48:00 +11:00

220 lines
6.1 KiB
Makefile

#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab ft=make
#-----------------------------------------------------------------------------#
#
# This file is included in the Mmakefile of both ../valid and ../valid_seq.
# Both those directories contain test cases for which we check only that
# compilation succeeds, and don't test what its result is. The difference
# is that in the valid directory, each test file is self-contained and
# may be compiled in parallel, while the test cases valid_seq each consist of
# more than one module (some separate, some nested), and thus must be compiled
# sequentially, without parallelism.
#
# The Mmakefiles in both directories should define the following make variables
# beyond those required by ../Mmake.common.
#
# AGC_PROGS:
# The test cases testing the accurate gc system.
#
# C_INTERFACE_PROGS:
# The test cases that test the operation of the foreign language interface
# with C.
#
# C_PROGS:
# The test cases for which we should only produce a `.c' file.
#
# CONSTRAINT_TYPECHECK_PROGS:
# Tests that use constraint based type checking.
# XXX These are never enabled.
#
# CTGC_PROGS:
# The test cases that only work in grades that support compile-time
# garbage collection. Debugging is incompatible with ctgc.
#
# DEEP_PROF_CAPABLE_PROGS:
# The test cases that test compilation with deep profiling enabled.
#
# LLDS_PROGS:
# The test cases that require debugging, which hasn't been implemented
# for the MLDS backend.
#
# NON_DECLDEBUG_PROGS:
# Test that do not work in .decldebug grades
#
# PAR_CONJ_PROGS:
# The test cases that only work in grades that support parallel conjunction.
#
# SOLVER_PROGS:
# The test cases that test the handling of solver type variables.
#
# TABLE_PROGS:
# The test cases that only work in grades that support tabling.
#
# TRAIL_PROGS:
# The test cases that only work in trailing grades.
#
# TYPECLASS_PROGS:
# The test cases testing the handling of typeclasses.
#
# OTHER_PROGS:
# All the other test cases.
# The AGC_PROGS tests don't work in --high-level-code grades, except hl*.agc*,
# because they require grade-specific header files to be installed.
ifeq "$(findstring hl,$(GRADE))$(findstring .agc,$(GRADE))" "hl"
PROGS1 = $(TYPECLASS_PROGS) $(OTHER_PROGS)
else
# The AGC_PROGS tests don't work in the java or csharp grades.
# The AGC_PROGS tests also don't work in minimal model grades,
# because the collector doesn't scan the copied areas of the stacks.
ifneq "$(filter java% csharp%,$(GRADE))$(findstring mm,$(GRADE))" ""
PROGS1 = $(TYPECLASS_PROGS) $(OTHER_PROGS)
else
PROGS1 = $(AGC_PROGS) $(TYPECLASS_PROGS) $(OTHER_PROGS)
endif
endif
ifneq "$(findstring mm,$(GRADE))" ""
PROGS2 = $(PROGS1)
else
ifeq "$(filter java% csharp%,$(GRADE))" ""
PROGS2 = $(PROGS1) $(TRAIL_PROGS)
else
PROGS2 = $(PROGS1)
endif
endif
ifneq "$(filter java% csharp%,$(GRADE))$(findstring profdeep,$(GRADE))" ""
PROGS3 = $(PROGS2)
else
PROGS3 = $(PROGS2) $(TABLE_PROGS)
endif
ifeq "$(filter hl% java% csharp%,$(GRADE))" ""
PROGS4 = $(PROGS3) $(C_INTERFACE_PROGS) $(SOLVER_PROGS) \
$(DEEP_PROF_CAPABLE_PROGS)
else
PROGS4 = $(PROGS3)
endif
ifeq "$(filter hl% java% csharp%,$(GRADE))$(findstring par,$(GRADE))" ""
PROGS5 = $(PROGS4) $(LLDS_PROGS)
else
PROGS5 = $(PROGS4)
endif
ifneq "$(findstring decldebug,$(GRADE))" ""
PROGS6 = $(PROGS5)
else
PROGS6 = $(PROGS5) $(PAR_CONJ_PROGS)
endif
ifeq "$(findstring debug,$(GRADE))" ""
PROGS7 = $(PROGS6) $(CTGC_PROGS)
else
PROGS7 = $(PROGS6)
endif
ifeq "$(filter hl% java% csharp%,$(GRADE))$(findstring par,$(GRADE))$(findstring decldebug,$(GRADE))" ""
PROGS8 = $(PROGS7) $(NON_DECLDEBUG_PROGS)
else
PROGS8 = $(PROGS7)
endif
OBJ_PROGS = $(PROGS8)
ifneq "$(findstring tsw,$(GRADE))$(findstring tsc,$(GRADE))" ""
PROGS = $(OBJ_PROGS) $(C_PROGS)
else
PROGS = $(OBJ_PROGS) $(C_PROGS)
endif
# `mmc --make' doesn't expect subdirectories to appear in targets.
ifeq ($(MMAKE_USE_MMC_MAKE),yes)
CS_SUBDIR =
CSS_SUBDIR =
JAVAs_SUBDIR =
OS_SUBDIR =
DLLS_SUBDIR =
CLASSES_SUBDIR =
else
CS_SUBDIR = $(cs_subdir)
CSS_SUBDIR = $(css_subdir)
JAVAs_SUBDIR = $(javas_subdir)
OS_SUBDIR = $(os_subdir)
DLLS_SUBDIR = $(dlls_subdir)
CLASSES_SUBDIR = $(classes_subdir)
endif
ifeq ($(findstring csharp,$(GRADE)),csharp)
TARGET_SRC_EXT = cs
TARGET_SRC_SUBDIR = $(CSS_SUBDIR)
# XXX Why do we expect .cs files to be stored in $(DLLS_SUBDIR)?
TARGET_OBJ_EXT = cs
TARGET_OBJ_SUBDIR = $(DLLS_SUBDIR)
else
ifeq ($(findstring java,$(GRADE)),java)
TARGET_SRC_EXT = java
TARGET_SRC_SUBDIR = $(JAVAS_SUBDIR)
TARGET_OBJ_EXT = class
TARGET_OBJ_SUBDIR = $(CLASSES_SUBDIR)
else
TARGET_SRC_EXT = c
TARGET_SRC_SUBDIR = $(CS_SUBDIR)
TARGET_OBJ_EXT = $(O)
TARGET_OBJ_SUBDIR = $(OS_SUBDIR)
endif
endif
OBJS = $(OBJ_PROGS:%=$(TARGET_OBJ_SUBDIR)%.$(TARGET_OBJ_EXT))
#-----------------------------------------------------------------------------#
# When compiling using the installed libraries, setting GRADEFLAGS
# may cause mgnuc to look for the `.mih' files for a non-installed grade.
# test_mercury runs the tests using the installed libraries, so GRADEFLAGS
# won't be set, but test_mercury runs the tests in at least one `.tr' grade
# on all machines, so it isn't a problem.
ifneq ($(origin WORKSPACE),undefined)
GRADEFLAGS_TRAIL = --use-trail
else
GRADEFLAGS_TRAIL =
endif
# Make sure GRADEFLAGS_TRAIL is passed to `mmc --make'.
export GRADEFLAGS_TRAIL
TESTS = $(sort $(PROGS))
include ../Mmake.common
# Module-specific options should go in Mercury.options so they can be found
# by `mmc --make'.
include Mercury.options
$(OBJ_PROGS:%=%.runtest): %.runtest: %.$(TARGET_OBJ_EXT) ;
$(C_PROGS:%=%.runtest): %.runtest: %.c ;
#-----------------------------------------------------------------------------#
print_test_params:
@echo TARGET_OBJ_EXT is set to =$(TARGET_OBJ_EXT)=
@echo TARGET_OBJ_SUBDIR is set to =$(TARGET_OBJ_SUBDIR)=
@echo OBJ_PROGS is set to =$(OBJ_PROGS)=
@echo C_PROGS is set to =$(C_PROGS)=
objs: $(OBJS)
printtests:
@echo $(PROGS)
printobjs:
@echo $(OBJS)
clean_local: clean_valid
clean_valid:
rm -f *.err *.h
#-----------------------------------------------------------------------------#