doing stuff
[ld42_outofspace] / Makefile
index 4189eb2..27fd39b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,11 +12,16 @@ inc =
 
 CFLAGS = $(warn) $(dbg) $(opt) $(inc)
 CXXFLAGS = $(warn) $(dbg) $(opt) $(inc)
-LDFLAGS = $(libgl) $(syslibs)
+LDFLAGS = $(syslibs) $(libgl) -lgmath -limago
 
 sys := $(shell uname -s | sed 's/MINGW.*/mingw/')
 ifeq ($(sys), mingw)
+       obj = $(ccsrc:.cc=.w32.o) $(csrc:.c=.w32.o)
+       dep     = $(obj:.o=.d)
+       bin = game.exe
+
        libgl = -lopengl32 -lglu32 -lfreeglut -lglew32
+       syslibs = -lmingw32 -lwinmm
 else
        libgl = -lGL -lGLU -lglut -lGLEW
        syslibs = -ldl
@@ -33,6 +38,12 @@ $(bin): $(obj)
 %.d: %.cc
        @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
 
+%.w32.o: %.c
+       $(CC) -o $@ $(CFLAGS) -c $<
+
+%.w32.o: %.cc
+       $(CC) -o $@ $(CXXFLAGS) -c $<
+
 .PHONY: clean
 clean:
        rm -f $(obj) $(bin)
@@ -40,3 +51,11 @@ clean:
 .PHONY: cleandep
 cleandep:
        rm -f $(dep)
+
+.PHONY: cross
+cross:
+       $(MAKE) CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ sys=mingw
+
+.PHONY: cross-clean
+cross-clean:
+       $(MAKE) CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ sys=mingw clean