ok now it works nicely in VR
[vrtris] / Makefile
index a773a6e..6f8257b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,43 @@
+# options -------------------------------------------------
+vrbuild = true
+# ---------------------------------------------------------
+
 src = $(wildcard src/*.c)
 obj = $(src:.c=.o)
 dep = $(obj:.o=.d)
-bin = vrtris
 
+ifeq ($(vrbuild), true)
+       bin = vrtris
+       vr_ldflags = -lgoatvr
+       vr_cflags = -DBUILD_VR
+else
+       bin = gltris
+endif
+
+warn = -pedantic -Wall -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
+dbg = -g
+opt = -O0
 
-CFLAGS = -pedantic -Wall -g `pkg-config --cflags sdl2`
-LDFLAGS = $(libsys) $(libgl) `pkg-config --libs sdl2` -ldrawtext
+CFLAGS = $(warn) $(dbg) $(opt) `pkg-config --cflags sdl2 freetype2` $(vr_cflags)
+LDFLAGS = $(libsys) -ldrawtext $(libgl) `pkg-config --libs sdl2 freetype2` \
+                 $(vr_ldflags) -limago -lpng -lz -ljpeg -lpthread -lm
 
 sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
 
 ifeq ($(sys), mingw)
+       obj = $(src:.c=.w32.o)
+       dep     = $(obj:.o=.d)
+
        bin = vrtris.exe
 
-       libgl = -lopengl32 -lglew32
-       libsys = -lmingw32 -lwinmm -mwindows
+       libgl = -lopengl32 -lglu32 -lglew32
+       libsys = -lmingw32 -lSDL2main -lwinmm -mconsole
 
 else ifeq ($(sys), Darwin)
        libgl = -framework OpenGL -lGLEW
 
 else
-       libgl = -lGL -lGLEW
+       libgl = -lGL -lGLU -lGLEW
 endif
 
 
@@ -28,6 +46,13 @@ $(bin): $(obj)
 
 -include $(dep)
 
+%.d: %.c
+       @echo depfile $@
+       @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
+
+%.w32.o: %.c
+       $(CC) -o $@ $(CFLAGS) -c $<
+
 .PHONY: cross
 cross:
        $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw
@@ -36,6 +61,11 @@ cross:
 cross-clean:
        $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw clean
 
+.PHONY: instalien
+instalien: vrtris.exe
+       cp $< /alien/vrtris/$<
+       for i in `tools/dlldepends | grep -v '++'`; do echo $$i; rsync $$i /alien/vrtris; done
+
 .PHONY: clean
 clean:
        rm -f $(obj) $(bin)