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

TESTS_DIR = ..
THIS_DIR = invalid_options_file
MAYBE_J1 =

PROGS = \
	inf_incl_direct \
	inf_incl_indirect \
	no_assign \
	no_var \
	nonexistent_file \
	undefined_var \
	unterminated_string \
	unterminated_var

TESTS = $(patsubst %,%-nodepend,$(sort $(PROGS)))
include ../Mmake.common

# Note: in this test directory, there is no point in enabling color
# diagnostics. The errors we report here are detected *while we are
# trying to figure out which options are specified for the module
# we are compiling*. Such errors are output using the default option table.
# Even if this table has "yes" as the value of enable_color_diagnostics
# and a valid color scheme as the value of color_scheme_set_to, that is
# *not* what write_error_spec.m looks at. write_error_spec.m looks at the
# values of the set_color_<role> options, which won't be set up, since the
# code that is intended to set them up in handle_options.m has no effect
# on the contents of the *default* option table.
#
# We could possibly change this, but there is little point in doing so.

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

%.runtest: %.err_res ;

$(PROGS:%=%.err): %.err: %.m %.options_file
	if $(MC) --errorcheck-only --options-file $*.options_file \
		--halt-at-warn $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) $* \
		> $*.err 2>&1; \
	then false; \
	else true; \
	fi

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

clean_local: clean_invalid_options_file

clean_invalid_options_file:

realclean_local: realclean_invalid_options_file

realclean_invalid_options_file:
	rm -f *.err *.err_res

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