mirror planes detection needs work
[laserbrain_demo] / Makefile
index 8a5b897..33b01ad 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,67 @@
-src = $(wildcard src/*.cc)
-obj = $(src:.cc=.o)
+src = $(wildcard src/*.cc) \
+         $(wildcard src/audio/*.cc) \
+         $(wildcard src/machine/*.cc) \
+         $(wildcard src/blobs/*.cc) \
+         $(wildcard src/imgui/*.cc)
+csrc = $(wildcard src/*.c) \
+          $(wildcard src/machine/*.c) \
+          $(wildcard src/blobs/*.c)
+obj = $(src:.cc=.o) $(csrc:.c=.o)
 dep = $(obj:.o=.d)
-bin = anti
+bin = demo
 
-CXXFLAGS = -std=c++11 -pedantic -Wall -g
-LDFLAGS = $(libgl_$(sys)) -lm -lgmath
+#opt = -O3 -ffast-math
+dbg = -g
 
-sys = $(shell uname -s)
-libgl_Linux = -lGL -lGLU -lglut -lGLEW
-libgl_Darwin = -framework OpenGL -framework GLUT -lGLEW
+incpath = -Isrc -Isrc/machine -I/usr/local/include `pkg-config --cflags sdl2`
+#libpath = -L/usr/local/lib
 
-$(bin): $(obj)
+warn = -pedantic -Wall
+
+CFLAGS = $(warn) $(opt) $(dbg) $(incpath) -fopenmp
+CXXFLAGS = -std=c++11 $(warn) $(opt) $(dbg) $(incpath) -fopenmp
+LDFLAGS = $(libpath) -ldrawtext $(libgl_$(sys)) $(libal_$(sys)) -lm -lgmath -lvmath \
+                 -limago -lresman -lpthread -lassimp -ltreestore -lgoatvr \
+                 `pkg-config --libs sdl2 freetype2` -lpng -ljpeg -lz -lvorbisfile -lgomp
+
+sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
+libgl_Linux = -lGL -lGLU -lGLEW
+libgl_Darwin = -framework OpenGL -lGLEW
+libgl_mingw = -lopengl32 -lglu32 -lglew32
+#libgl_mingw = -lglu32 -Wl,-Bstatic -lglew32 -Wl,-Bdynamic -lopengl32
+
+libal_Linux = -lopenal
+libal_Darwin = -framework OpenAL
+libal_mingw = -lopenal
+
+ifeq ($(sys), mingw)
+       bin = demo.exe
+       LDFLAGS += -lmingw32 -lSDL2main -lSDL2 -lwinmm -mwindows
+       #CFLAGS += -DGLEW_STATIC
+       #CXXFLAGS += -DGLEW_STATIC
+endif
+
+$(bin): .clang_complete $(obj)
        $(CXX) -o $@ $(obj) $(LDFLAGS)
 
+.PHONY: cross
+cross:
+       $(MAKE) CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ sys=mingw
+
+.PHONY: instalien
+instalien: demo.exe
+       cp $< /alien/demo/$<
+       mkdir -p /alien/demo/sdr && cp sdr/* /alien/demo/sdr/
+
+.clang_complete: Makefile
+       rm -f $@
+       for i in $(CXXFLAGS); do echo $$i >>$@; done
+
 -include $(dep)
 
+%.d: %.c
+       @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
+
 %.d: %.cc
        @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
 
@@ -25,3 +72,7 @@ clean:
 .PHONY: cleandep
 cleandep:
        rm -f $(dep)
+
+.PHONY: data
+data:
+       tools/prepare_data