
INTERFACE_SRC = $(wildcard test*.thi)
BODY_SRC = $(wildcard test*.thb)
PROPER_PROG_SRC = $(wildcard test*.thp)
SCRIPT_SRC = $(wildcard test*.ths)
CORRECT_OUTPUT = $(wildcard test*.out)

CUSTOM_RKT = custom1.rkt

COMPILE = GUILE_LOAD_PATH=../.. THEME_D_CONFIG_FILE=../../theme-d-config-maint ../../theme-d/translator/theme-d-compile.scm

AUX_FILES = \
	aux-test229-data.txt \
	aux-test266-data.txt \
	aux-test267-data.txt \
	aux-test268-data.txt \
	aux-test270-data.txt \
	aux-test273-data.txt

COMPILED_FILES = \
        mod1.tci mod1.tcb \
        numerical-test-env.tci numerical-test-env.tcb

%.tci : %.thi
	$(COMPILE) -m .. -o $@ $(EXTRA_COMP_OPTIONS) $<

%.tcb : %.thb
	$(COMPILE) -m .. -o $@ $(EXTRA_COMP_OPTIONS) $<

numerical-test-env.tcb : numerical-test-env.tci

# There is a special version for mod1.tci for testing.
mod1.tci : mod1.thi
	cp -v mod1.tci-0 $@

testsdir = $(THEME_D_TESTS_DIR)
tests_DATA = $(INTERFACE_SRC) $(BODY_SRC) $(PROPER_PROG_SRC) \
  $(SCRIPT_SRC) $(AUX_FILES) $(CORRECT_OUTPUT) $(COMPILED_FILES) \
  $(CUSTOM_RKT)

mostlyclean-local: mostlyclean-local-check

.PHONY:  mostlyclean-local-check clean-test-env

mostlyclean-local-check:
	-rm -f $(patsubst %.thi,%.tci,$(INTERFACE_SRC))
	-rm -f $(patsubst %.thb,%.tcb,$(BODY_SRC))
	-rm -f $(patsubst %.thp,%.tcp,$(PROPER_PROG_SRC))
	-rm -f $(patsubst %.ths,%.tcs,$(SCRIPT_SRC))
	-rm -f $(patsubst %.thp,%.go,$(PROPER_PROG_SRC))
	-rm -f $(patsubst %.ths,%.go,$(SCRIPT_SRC))
	-rm -f $(patsubst %.thp,%.tree-il,$(PROPER_PROG_SRC))
	-rm -f $(patsubst %.ths,%.tree-il,$(SCRIPT_SRC))
	-rm -f $(patsubst %.thp,%.scm,$(PROPER_PROG_SRC))
	-rm -f $(patsubst %.ths,%.scm,$(SCRIPT_SRC))
	-rm -f numerical-test-env.tci numerical-test-env.tcb

clean-test-env:
	-rm -f numerical-test-env.tci numerical-test-env.tcb

