Magic SDL2 sauce! Now with 32-bit!
[ipdf/code.git] / src / Makefile
1 #Makefile
2 ARCH := $(shell uname -i)
3 CXX = g++ -std=gnu++0x -Wall -Werror -Wshadow -pedantic -g
4 MAIN = main.o
5 OBJ = log.o document.o view.o screen.o
6 LIB_x86_64 = ../contrib/lib/libSDL2-2.0.so.0 -lGL
7 LIB_i686 = ../contrib/lib32/libSDL2-2.0.so.0 -lGL
8 MAINRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../contrib/lib'
9 MAINRPATH_i686 = -Wl,-rpath,'$$ORIGIN/../contrib/lib32'
10 TESTRPATH_x86_64 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib'
11 TESTRPATH_i686 = -Wl,-rpath,'$$ORIGIN/../../contrib/lib32'
12 OBJPATHS = $(OBJ:%=../obj/%)
13 DEPS := $(OBJPATHS:%.o=%.d)
14 CFLAGS_x86_64 := -I../contrib/include/SDL2 -I`pwd`
15 CFLAGS_i686 := -I../contrib/include32/SDL2 -I`pwd`
16 LIB := $(LIB_$(ARCH))
17 MAINRPATH := $(MAINRPATH_$(ARCH))
18 TESTRPATH := $(TESTRPATH_$(ARCH))
19 CFLAGS := $(CFLAGS_$(ARCH))
20
21
22 LINKOBJ = $(OBJPATHS)
23
24 RM = rm -f
25 BIN = ../bin/ipdf
26
27
28 all : $(BIN)
29
30 tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ)
31         $(CXX) -o [email protected] $(LINKOBJ) ../obj/[email protected] $(LIB) $(TESTRPATH)
32
33 runtests : tests/runtests.sh
34         cd tests; ./runtests.sh
35
36
37 $(BIN) : $(LINKOBJ) ../obj/$(MAIN)
38         @mkdir -p $(dir $@)
39         $(CXX) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB) $(MAINRPATH)
40
41 ../obj/%.o : %.cpp
42         @mkdir -p $(dir $@)
43         $(CXX) $(CFLAGS) -c -MMD -o $@ $<
44
45 -include $(DEPS)
46
47 clean_bin :
48         $(RM) $(BIN)
49
50 clean :
51         $(RM) $(BIN) $(DEPS) $(LINKOBJ) ../obj/$(MAIN)
52         $(RM) tests/*~
53         $(RM) tests/*.test
54         $(RM) tests/*.out
55         $(RM) tests/*.err
56         
57
58 clean_full: clean
59         $(RM) *.*~
60         $(RM) *~
61
62
63
64         

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