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
6 OBJ = log.o real.o document.o view.o screen.o vfpu.o graphicsbuffer.o framebuffer.o shaderprogram.o stb_truetype.o gl_core44.o
7 LIB_x86_64 = ../contrib/lib/libSDL2-2.0.so.0 -lGL
8 LIB_i386 = ../contrib/lib32/libSDL2-2.0.so.0 -lGL
10 MAINRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../contrib/lib'
11 MAINRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../contrib/lib32'
12 TESTRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib'
13 TESTRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib32'
14 OBJPATHS = $(OBJ:%=../obj/%)
15 DEPS := $(OBJPATHS:%.o=%.d)
16 CFLAGS_x86_64 := -I../contrib/include/SDL2 -I`pwd`
17 CFLAGS_i386 := -I../contrib/include32/SDL2 -I`pwd`
21 MAINRPATH := $(MAINRPATH_$(ARCH))
22 TESTRPATH := $(TESTRPATH_$(ARCH))
23 CFLAGS := $(CFLAGS_$(ARCH))
36 single : DEF = -DREAL=0
39 double : DEF = -DREAL=1
42 # The tests will compile with the default REAL definition
43 # To change that you can run as `make DEFS="REAL=X" tests/<target>` where X is your chosen type
44 # But remember to make clean first.
45 tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ)
50 runtests : tests/runtests.sh
51 cd tests; ./runtests.sh
54 $(BIN) : $(LINKOBJ) ../obj/$(MAIN)
57 $(CXX) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB) $(MAINRPATH)
63 $(CXX) $(CFLAGS) $(DEF) -c -MMD -o $@ $<
71 $(RM) $(BIN) $(DEPS) $(LINKOBJ) ../obj/$(MAIN)