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

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