# Mono compiler and runtime for C-sharp:
#compiler = /usr/users/wwwifa/docs/subatom/nucltheo/bin/mcs
runtime = /usr/users/wwwifa/docs/subatom/nucltheo/bin/mono

# Pnet compiler and runtime for C-sharp:
compiler = /usr/users/wwwifa/docs/subatom/nucltheo/bin/cscc
#runtime = /usr/users/wwwifa/docs/subatom/nucltheo/bin/ilrun

comma:=,
empty:=
space:=$(empty) $(empty)

# a default rule to compile .cs file into a .dll file:
%.dll: %.cs
	$(compiler) $*.cs /target:library /out:$*.dll

dlls = vector.dll vmatrix.dll qr.dll lsfit.dll
refs = $(subst $(space),$(comma),$(dlls))

all: $(dlls)

qr.dll: qr.cs vmatrix.dll
	$(compiler) qr.cs /target:library \
	/reference:vector.dll,vmatrix.dll \
	/out:qr.dll

vmatrix.dll: vmatrix.cs vector.dll
	$(compiler) vmatrix.cs \
	/target:library \
	/reference:vector.dll \
	/out:vmatrix.dll

lsfit.dll: lsfit.cs vector.dll
	$(compiler) lsfit.cs \
	/target:library \
	/reference:vector.dll,vmatrix.dll,qr.dll \
	/out:lsfit.dll

clean:
	rm -f $(dlls) *.exe core* out.txt
