CODE = $(filter %.cs,$^)
DLLS = $(addprefix -reference:,$(filter %.dll,$^))
CSC = mcs
ILRUN = mono
MKLIB = $(CSC) -out:$@ -target:library $(DLLS) $(CODE) 
MKEXE = $(CSC) -out:$@ -target:exe $(DLLS) $(CODE) 

all:Out.quad.htm Out.cmp.htm

Out.quad.htm: main.exe Makefile
	echo '<meta charset="UTF-8"><pre>' >$@
	$(ILRUN) $< >> $@ 2>log

Out.cmp.htm: main.cmp.exe Makefile test.py
	echo '<meta charset="UTF-8"><pre>' >$@
	$(ILRUN) $< >> $@ 2>log
	python3 test.py >> $@

main.exe:main.cs matlib.dll ; $(MKEXE)
main.cmp.exe:main.cmp.cs matlib.dll ; $(MKEXE)
matlib.dll: open3.cs open4.cs open6.cs open8.cs ; $(MKLIB)

clean:
	rm -f *.exe *.dll [Oo]ut* log*
