X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrtris;a=blobdiff_plain;f=Makefile;h=6f8257b077d78ff580341f3cb2994533032aaa48;hp=a773a6e7ea5475195dba7f60fdcc5f373fbd8633;hb=HEAD;hpb=2077648d589ede39a1e47d331ba4a8b57dc25970 diff --git a/Makefile b/Makefile index a773a6e..6f8257b 100644 --- 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)