CC=gcc CFLAGS=-g3 -I. DLL_LDFLAGS=-Wl,--export-all-symbols -Wl,--out-implib=libcrtest.dll.a EXE_LDFLAGS=-Wl,--enable-auto-import -Wl,--enable-extra-pe-debug all: crtest.exe crtest.dll crtest_dll.o: crtest_dll.c $(CC) $(CFLAGS) -c $< crtest.o: crtest.c $(CC) $(CFLAGS) -c $< crtest.dll libcrtest.dll.a: crtest_dll.o $(CC) -shared -o crtest.dll $(DLL_LDFLAGS) $< crtest.exe: crtest.o libcrtest.dll.a $(CC) $(EXE_LDFLAGS) -o crtest.exe crtest.o -L. -lcrtest.dll .PHONY: clean clean: rm -f *.o *.a crtest.exe crtest.dll