LIB ?= lib.exe
CL ?= cl.exe

all: call_from_cl.exe

clean:
	$(RM) call_from_cl.obj call_from_cl.exe libchicken.exp libchicken.lib

spotless: clean
	$(RM) libchicken.dll

libchicken.lib: libchicken.def
	$(LIB) $(LIBFLAGS) /def:libchicken.def /out:libchicken.lib

call_from_cl.exe: call_from_cl.c libchicken.lib
	$(CL) $(CLFLAGS) call_from_cl.c /link $(LINKFLAGS) libchicken.lib

libchicken.dll:
	echo ERROR: please copy libchicken.dll (created via a 64-bit MinGW build) into this directory.
	exit 1

.PHONY: all clean spotless
