UNAME := $(shell uname -s) ifeq ("Linux","$(UNAME)") GCC := i686-w64-mingw32-gcc WINDRES := i686-w64-mingw32-windres else GCC := gcc WINDRES := windres endif DEF = NOFLATLINE GCCFLAGS = -std=c99 -O0 -Wall -fomit-frame-pointer -fpack-struct -Wextra -Wno-unused-variable -Wno-unused-parameter -D $(DEF) LINKFLAGS = -O0 -Wall -fomit-frame-pointer -fpack-struct -s -mdll LOCALE = LC_MESSAGES=C #LIBS = -lwinmm -lopengl32 -lgdi32 LIBS = -lgdi32 -lwsock32 OBJS = src/binkw32.def OUT = build/binkw32.dll FOLDERS = patches SRC = src/Daodan.c src/Daodan_BSL.c src/Daodan_Character.c src/Daodan_Cheater.c src/Daodan_Config.c src/Daodan_Console.c src/Daodan_GL.c src/Daodan_Patch.c src/Daodan_Persistence.c src/Daodan_Utility.c src/Daodan_Win32.c src/Inifile_Reader.c src/_DLLInfo.rc src/patches/Patches.c src/Flatline.c src/Flatline_BSL.c src/Flatline_Client.c src/Flatline_Hooks.c src/Flatline_Net.c src/Flatline_Packet.c src/Flatline_PacketReader.c src/Flatline_PacketBuilder.c src/Flatline_Server.c src/Flatline_Win32.c src/Mariusnet.c src/Flatline_Events.c DEST = $(patsubst src/%.rc,build/%.o,$(patsubst src/%.c,build/%.o,$(SRC))) ALL: $(FOLDERS) $(DEST) $(OBJS) @echo "Linking" $(LOCALE) $(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBS) clean: rm $(DEST) rm -R $(FOLDERS) rm $(OUT) $(FOLDERS): mkdir -p build/$@ build/%.o: src/%.c @echo "Compiling $<" $(LOCALE) $(GCC) $(GCCFLAGS) -c -o $@ $< @echo build/%.o: src/%.rc @echo "Assembling resource $<" $(WINDRES) -i $< -o $@ @echo