| 1 |
ifneq (,$(findstring /cygdrive/,$(PATH))) |
| 2 |
UNAME := Cygwin |
| 3 |
else |
| 4 |
ifneq (,$(findstring WINDOWS,$(PATH))) |
| 5 |
UNAME := Windows |
| 6 |
else |
| 7 |
UNAME := $(shell uname -s) |
| 8 |
endif |
| 9 |
endif |
| 10 |
|
| 11 |
ifeq ("Linux","$(UNAME)") |
| 12 |
GCC := i686-w64-mingw32-gcc |
| 13 |
DLLTOOL := i686-w64-mingw32-dlltool |
| 14 |
else |
| 15 |
GCC := gcc |
| 16 |
DLLTOOL := dlltool |
| 17 |
endif |
| 18 |
|
| 19 |
GCCFLAGS = -O0 -Wall -fomit-frame-pointer -fpack-struct |
| 20 |
LINKFLAGS = -O0 -Wall -fomit-frame-pointer -fpack-struct -s -mdll -mthread |
| 21 |
|
| 22 |
#LIBS = -lwinmm -lopengl32 -lgdi32 |
| 23 |
LIBS = -lgdi32 |
| 24 |
OBJS = obj/binkw32.a |
| 25 |
OUT = build/binkw32.dll |
| 26 |
|
| 27 |
SRC = src/Daodan.c src/Daodan_BSL.c src/Daodan_Character.c src/Daodan_Cheater.c src/Daodan_Console.c src/Daodan_DLLStubs.c src/daodan_gl.c src/Daodan_Patch.c src/Daodan_Persistence.c src/Daodan_Utility.c src/Daodan_Win32.c src/Daodan_WindowHack.c src/inifile_reader.c src/Oni_Symbols.c |
| 28 |
DEST = $(patsubst src/%.c,build/%.o,$(SRC)) |
| 29 |
|
| 30 |
ALL: $(FOLDERS) $(DEST) $(OBJS) |
| 31 |
echo "Linking $<" |
| 32 |
$(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBS) |
| 33 |
|
| 34 |
clean: |
| 35 |
rm $(DEST) |
| 36 |
rm $(OUT) |
| 37 |
|
| 38 |
obj/binkw32.a: src/binkw32.def |
| 39 |
echo "Generating binkw32.a" |
| 40 |
$(DLLTOOL) -d $< -l $@ |
| 41 |
|
| 42 |
build/%.o: src/%.c |
| 43 |
echo "Compiling $<" |
| 44 |
$(GCC) $(GCCFLAGS) -c -o $@ $< |
| 45 |
echo |
| 46 |
|
| 47 |
$(FOLDERS): |
| 48 |
mkdir $@ |