default: A B C
A:out.a.txt
B:out.b.txt
C:out.c.txt

out.a.txt: main-a.exe
	mono main-a.exe > out.a.txt

out.b.txt: main-b.exe
	mono main-b.exe > out.b.txt

main-a.exe: main-a.cs
	mcs main-a.cs -target:exe -out:main-a.exe

main-b.exe: main-b.cs print-hello.dll print-me.dll
	mcs main-b.cs -target:exe -reference:print-hello.dll,print-me.dll -out:main-b.exe

print-hello.dll:print-hello.cs
	mcs print-hello.cs -target:library -out:print-hello.dll

print-me.dll:print-me.cs
	mcs print-me.cs -target:library -out:print-me.dll

clean:
	$(RM) *.exe *.dll *.txt

out.c.txt: out.a.txt out.b.txt correct.txt
	echo "checking part A..." | tee out.c.txt
	diff --brief out.a.txt correct.txt
	echo "part A is correct" | tee --append out.c.txt
	echo "checking part B..." | tee --append out.c.txt
	diff --brief out.b.txt correct.txt
	echo "part B is correct" | tee --append out.c.txt
correct.txt:
	echo "hello, $(shell whoami)" > correct.txt
