2 ARCH := $(shell uname -m)
3 CXX = g++ -std=gnu++0x -Wall -Werror -Wshadow -pedantic -g
5 OBJ = log.o real.o document.o view.o screen.o vfpu.o
6 LIB_x86_64 = ../contrib/lib/libSDL2-2.0.so.0 -lGL
7 LIB_i386 = ../contrib/lib32/libSDL2-2.0.so.0 -lGL
9 MAINRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../contrib/lib'
10 MAINRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../contrib/lib32'
11 TESTRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib'
12 TESTRPATH_i386 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib32'
13 OBJPATHS = $(OBJ:%=../obj/%)
14 DEPS := $(OBJPATHS:%.o=%.d)
15 CFLAGS_x86_64 := -I../contrib/include/SDL2 -I`pwd`
16 CFLAGS_i386 := -I../contrib/include32/SDL2 -I`pwd`
20 MAINRPATH := $(MAINRPATH_$(ARCH))
21 TESTRPATH := $(TESTRPATH_$(ARCH))
22 CFLAGS := $(CFLAGS_$(ARCH))
34 single : DEF = -DREAL=0
37 double : DEF = -DREAL=1
40 # The tests will compile with the default REAL definition
41 # To change that you can run as `make DEFS="REAL=X" tests/<target>` where X is your chosen type
42 # But remember to make clean first.
43 tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ)
46 runtests : tests/runtests.sh
47 cd tests; ./runtests.sh
50 $(BIN) : $(LINKOBJ) ../obj/$(MAIN)
52 $(CXX) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB) $(MAINRPATH)
56 $(CXX) $(CFLAGS) $(DEF) -c -MMD -o $@ $<
64 $(RM) $(BIN) $(DEPS) $(LINKOBJ) ../obj/$(MAIN)