CS Lab machines have met their nemesis
[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
7 LIB_x86_64 = ../contrib/lib/libSDL2-2.0.so.0 -lGL -lgmp
8 LIB_i386 = ../contrib/lib32/libSDL2-2.0.so.0 -lGL -lgmp
9 LIB_i686 = $(LIB_i386)
10
11 MAINRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../contrib/lib'
12 MAINRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../contrib/lib32'
13 MAINRPATH_i686 = $(MAINRPATH_i386)
14 TESTRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib'
15 TESTRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib32'
16 TESTRPATH_i686 = $(TESTRPATH_i386)
17 OBJPATHS = $(OBJ:%=../obj/%)
18 DEPS := $(OBJPATHS:%.o=%.d)
19 CFLAGS_x86_64 := -I../contrib/include/SDL2 -I`pwd`
20 CFLAGS_i386 := -I../contrib/include32/SDL2 -I`pwd`
21 CFLAGS_i686 := $(CFLAGS_i386)
22
23
24 LIB := $(LIB_$(ARCH))
25 MAINRPATH := $(MAINRPATH_$(ARCH))
26 TESTRPATH := $(TESTRPATH_$(ARCH))
27 CFLAGS := $(CFLAGS_$(ARCH))
28
29 DEF = -DREAL=1
30
31 LINKOBJ = $(OBJPATHS)
32
33 RM = rm -f
34 BIN = ../bin/ipdf
35
36
37 all : DEF = -DREAL=1
38 all : $(BIN)
39
40 single : DEF = -DREAL=0
41 single : $(BIN)
42
43 double : DEF = -DREAL=1
44 double : $(BIN)
45
46 demo : $(BIN) ../tools/stream_plot.py
47         mkdir -p ../data/
48         $(RM) ../data/performance.dat
49         ./ipdf | tee ../data/performance.dat | ../tools/stream_plot.py 2>/dev/null
50
51 movie : $(BIN) ../tools/stream_plot.py
52         mkdir -p ../data/
53         $(RM) ../data/performance.dat
54         $(RM) ../data/movie.ogv
55         ./ipdf | tee ../data/performance.dat | ../tools/stream_plot.py 2>/dev/null & recordmydesktop --fps 10 --on-the-fly-encoding -o ../data/movie.ogv
56
57 # The tests will compile with the default REAL definition
58 # To change that you can run as `make DEFS="REAL=X" tests/<target>` where X is your chosen type
59 # But remember to make clean first.
60 tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ)
61         $(CXX) $(CFLAGS) -o [email protected] $(LINKOBJ) ../obj/[email protected] $(LIB) $(TESTRPATH)
62
63 -include $(DEPS)
64
65 runtests : tests/runtests.sh
66         cd tests; ./runtests.sh
67
68
69 $(BIN) : $(LINKOBJ) ../obj/$(MAIN)
70         echo $(LINKOBJ)
71         @mkdir -p $(dir $@)
72         $(CXX) $(CFLAGS) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB) $(MAINRPATH)
73
74 -include $(DEPS)
75
76 ../obj/%.o : %.cpp main.h
77         @mkdir -p $(dir $@)
78         $(CXX) $(CFLAGS) $(DEF) -c -MMD -o $@ $<
79
80 ../obj/%_asm.o : %_asm.S main.h
81         @mkdir -p $(dir $@)
82         $(CXX) -c -o $@ $<
83
84 -include $(DEPS)
85
86 clean_bin :
87         $(RM) $(BIN)
88
89 clean :
90         $(RM) $(BIN) $(DEPS) $(LINKOBJ) ../obj/$(MAIN)
91         $(RM) tests/*~
92         $(RM) tests/*.test
93         $(RM) tests/*.out
94         $(RM) tests/*.err
95
96 clean_full: clean
97         $(RM) *.*~
98         $(RM) *~
99
100
101
102         

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