2 ARCH := $(shell uname -m)
3 # TODO: stb_truetype doesn't compile with some of these warnings.
4 CXX = g++ -std=gnu++0x -g -Wall -Werror -Wshadow -pedantic -rdynamic
6 OBJ = log.o real.o bezier.o document.o objectrenderer.o view.o screen.o vfpu.o quadtree.o graphicsbuffer.o framebuffer.o shaderprogram.o stb_truetype.o gl_core44.o add_digits_asm.o sub_digits_asm.o mul_digits_asm.o div_digits_asm.o arbint.o moc_controlpanel.o controlpanel.o
8 QT_INCLUDE := -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -Itests -I.
9 QT_DEF := -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
10 QT_LIB := -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtCore -lpthread
12 LIB_x86_64 = ../contrib/lib/libSDL2-2.0.so.0 -lGL -lgmp $(QT_LIB)
13 LIB_i386 = ../contrib/lib32/libSDL2-2.0.so.0 -lGL -lgmp
14 LIB_i686 = $(LIB_i386)
16 MAINRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../contrib/lib'
17 MAINRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../contrib/lib32'
18 MAINRPATH_i686 = $(MAINRPATH_i386)
19 TESTRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib'
20 TESTRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib32'
21 TESTRPATH_i686 = $(TESTRPATH_i386)
22 OBJPATHS = $(OBJ:%=../obj/%)
23 DEPS := $(OBJPATHS:%.o=%.d)
24 CFLAGS_x86_64 := -I../contrib/include/SDL2 -I`pwd` $(QT_INCLUDE)
25 CFLAGS_i386 := -I../contrib/include32/SDL2 -I`pwd`
26 CFLAGS_i686 := $(CFLAGS_i386)
30 MAINRPATH := $(MAINRPATH_$(ARCH))
31 TESTRPATH := $(TESTRPATH_$(ARCH))
32 CFLAGS := $(CFLAGS_$(ARCH))
50 DEF = -DREAL=$(REALTYPE) -DQUADTREE_DISABLED
52 CFLAGS := $(CFLAGS) $(QT_DEF)
54 demo : $(BIN) ../tools/stream_plot.py
56 $(RM) ../data/performance.dat
57 ./ipdf | tee ../data/performance.dat | ../tools/stream_plot.py 2>/dev/null
59 movie : $(BIN) ../tools/stream_plot.py
61 $(RM) ../data/performance.dat
62 $(RM) ../data/movie.ogv
63 ./ipdf | tee ../data/performance.dat | ../tools/stream_plot.py 2>/dev/null & recordmydesktop --fps 10 --on-the-fly-encoding -o ../data/movie.ogv
65 # The tests will compile with the default REAL definition
66 # To change that you can run as `make DEFS="REAL=X" tests/<target>` where X is your chosen type
67 # But remember to make clean first.
68 tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ)
73 runtests : tests/runtests.sh
74 cd tests; ./runtests.sh
77 $(BIN) : $(LINKOBJ) ../obj/$(MAIN)
80 $(CXX) $(CFLAGS) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB) $(MAINRPATH)
84 moc_controlpanel.cpp : controlpanel.cpp controlpanel.h
85 moc $(DEF) controlpanel.h -o moc_controlpanel.cpp
87 ../obj/%.o : %.cpp main.h
89 $(CXX) $(CFLAGS) $(DEF) -c -MMD -o $@ $<
91 ../obj/%_asm.o : %_asm.S main.h
101 $(RM) $(BIN) $(DEPS) $(LINKOBJ) ../obj/$(MAIN)