CPPFLAGS=-s -O2 -mwindows
LDFLAGS=-s -O2 -mwindows
EXE_LDFLAGS=$(LDFLAGS) -nostdlib -Wl,--entry,_WinMainCRTStartup
DLL_LDFLAGS=$(LDFLAGS) -shared -nostdlib -Wl,--entry,_DllMainCRTStartup,--enable-stdcall-fixup
LIBS=-lkernel32 -lshell32
EXE_OBJS=cst.o cst.res
DLL_OBJS=cstHook.o
DLL_LIBS=-limagehlp

MINGW=$(MINGW_PATH)
TARGET=cst.exe
RES=cst.rc
CC=g++
WINDRES=windres

all:$(TARGET)

cst.dll:$(DLL_OBJS)
	$(CC) $(DLL_LDFLAGS) $(DLL_OBJS) $(LIBS) $(DLL_LIBS) -o $@

cst.exe:$(EXE_OBJS)
	$(CC) $(EXE_LDFLAGS) $(EXE_OBJS) $(LIBS) -o $@

cst.res:cst.dll
	$(WINDRES) -i $(RES) -J rc -o $(RES:%.rc=%.res) -O coff

clean:
	rm -f $(TARGET) *.exe *.dll *.o *.a *.res
