summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2009-04-02 15:23:39 +0200
committerGravatar Martin Szulecki2009-04-02 15:23:39 +0200
commitcbcb3c8af0648e8dc595bbcc382423acad9de754 (patch)
tree1e6122caa37511c5f449cc68ad6e14244231385c /Makefile
parent65e58e271e9ff9590c1eb3814a9e449e3c9d607a (diff)
downloadwiiwadtools-cbcb3c8af0648e8dc595bbcc382423acad9de754.tar.gz
wiiwadtools-cbcb3c8af0648e8dc595bbcc382423acad9de754.tar.bz2
Allow compilation for Windows using mingw
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 20 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 5090652..6296e9b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,23 @@
-CC=gcc
-CFLAGS=-g -O2 -Wall
-LIBS=-lcrypto
-TARGET=wii-wad-tool
-OBJECTS=main.o types.o patcher.o wii_tmd.o wii_wad.o wii_tik.o crypto.o ucs.o
-HEADERS=types.h patcher.h wii_tmd.h wii_wad.h wii_imet.h wii_tik.h crypto.h ucs.h
+# cross compilation
+CC = $(CROSS)gcc
+LD = $(CROSS)ld
+AR = $(CROSS)ar
+RANLIB = $(CROSS)ranlib
+STRIP = $(CROSS)strip
+
+# flags
+CFLAGS = -g -O2 -Wall
+LIBS = -lcrypto
+
+# mingw windows compilation
+ifeq ($(findstring mingw,$(shell $(CC) --version)), mingw)
+CFLAGS += -mms-bitfields
+EXEEXT = .exe
+endif
+
+TARGET = wadtool$(EXEEXT)
+OBJECTS = main.o types.o patcher.o wii_tmd.o wii_wad.o wii_tik.o crypto.o ucs.o
+HEADERS = types.h patcher.h wii_tmd.h wii_wad.h wii_imet.h wii_tik.h crypto.h ucs.h
$(TARGET): $(OBJECTS) $(HEADERS)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)