Shading still doesn't work
[ipdf/code.git] / src / Makefile
1 #Makefile
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
5 MAIN = main.o
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 group.o
7
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 
11
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)
15
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)
27
28
29 LIB := $(LIB_$(ARCH))
30 MAINRPATH := $(MAINRPATH_$(ARCH))
31 TESTRPATH := $(TESTRPATH_$(ARCH))
32 CFLAGS := $(CFLAGS_$(ARCH))
33
34 REALTYPE=1
35 LINKOBJ = $(OBJPATHS)
36
37 RM = rm -f
38 BIN = ../bin/ipdf
39
40
41 all : REAL = 1
42 all : $(BIN)
43
44 single : REAL = 0
45 single : $(BIN)
46
47 double : REAL = 1
48 double : $(BIN)
49
50 DEF = -DREAL=$(REALTYPE) -DQUADTREE_DISABLED
51
52 CFLAGS := $(CFLAGS) $(QT_DEF)
53
54 demo : $(BIN) ../tools/stream_plot.py
55         mkdir -p ../data/
56         $(RM) ../data/performance.dat
57         ./ipdf | tee ../data/performance.dat | ../tools/stream_plot.py 2>/dev/null
58
59 movie : $(BIN) ../tools/stream_plot.py
60         mkdir -p ../data/
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
64
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)
69         $(CXX) $(CFLAGS) -o [email protected] $(LINKOBJ) ../obj/[email protected] $(LIB) $(TESTRPATH)
70
71 -include $(DEPS)
72
73 runtests : tests/runtests.sh
74         cd tests; ./runtests.sh
75
76
77 $(BIN) : $(LINKOBJ) ../obj/$(MAIN)
78         echo $(LINKOBJ)
79         @mkdir -p $(dir $@)
80         $(CXX) $(CFLAGS) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB) $(MAINRPATH)
81
82 -include $(DEPS)
83
84 moc_controlpanel.cpp : controlpanel.cpp controlpanel.h
85         moc-qt4 $(DEF) controlpanel.h -o moc_controlpanel.cpp
86
87 ../obj/%.o : %.cpp main.h
88         @mkdir -p $(dir $@)
89         $(CXX) $(CFLAGS) $(DEF) -c -MMD -o $@ $<
90
91 ../obj/%_asm.o : %_asm.S main.h
92         @mkdir -p $(dir $@)
93         $(CXX) -c -o $@ $<
94
95 -include $(DEPS)
96
97 clean_bin :
98         $(RM) $(BIN)
99
100 clean :
101         $(RM) $(BIN) $(DEPS) $(LINKOBJ) ../obj/$(MAIN)
102         $(RM) tests/*~
103         $(RM) tests/*.test
104         $(RM) tests/*.out
105         $(RM) tests/*.err
106
107 clean_full: clean
108         $(RM) *.*~
109         $(RM) *~
110
111
112
113         

UCC git Repository :: git.ucc.asn.au