#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab ft=make
#-----------------------------------------------------------------------------#

TESTS_DIR = ..
THIS_DIR = invalid_purity
MAYBE_J1 =

STD_PROGS = \
	foreign_proc_and_mercury \
	impure_func_t2 \
	impure_func_t3 \
	impure_func_t4 \
	impure_func_t5 \
	impure_func_t5_fixed \
	impure_func_t7 \
	impure_par_conj \
	impure_pred_t1 \
	impure_pred_t1_fixed \
	impure_pred_t2 \
	purity \
	purity_nonsense_1 \
	purity_type_error

NODEPEND_PROGS = \
	purity_nonsense_2

PROGS = $(STD_PROGS) $(NODEPEND_PROGS)
TESTS = $(STD_PROGS) $(NODEPEND_PROGS:%=%-nodepend)
include ../Mmake.common

# These tests all get spurious failures with intermodule optimization,
# because the errors get detected when creating the `.opt' file rather
# than when compiling the main module. So we disable intermodule optimization
# for these tests.
override EXTRA_MCFLAGS += \
	--no-intermodule-optimization

# Module-specific options should go in Mercury.options so they can be found
# by `mmc --make'.
include Mercury.options

MCFLAGS += --color-diagnostics

%.runtest: %.err_res ;

.PRECIOUS: %.err_res

#-----------------------------------------------------------------------------#

# See ../Mmakefile for an explanation of this.
ifneq ($(MMAKE_USE_MMC_MAKE),yes)
$(PROGS:%=%.err): %.err: %.m
	if $(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) --errorcheck-only $* \
		> $*.err 2>&1; \
	then false; \
	else true; \
	fi
else
$(PROGS:%=%.err):
	-$(MCM) $@
	if $(MCM) -r $@ > /dev/null 2>&1; \
	then false; \
	else true; \
	fi
endif

clean_local: clean_invalid_purity

clean_invalid_purity:
	rm -f *.err *.err_res

#-----------------------------------------------------------------------------#
