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

Out.txt:main.exe
	$(RUN) $< > $@ 2>log

main.exe: main.cs matlib.dll; $(MKEXE)

matlib.dll: \
	../matrix/matrix.cs \
	../matrix/vector.cs \
	../lineq/qr.cs newton.cs jacobian.cs broyden.cs
	$(MKLIB);

clean:
	$(RM) Out* *.dll *.exe log*
