Tweak Makefile to make testing nicer
[ipdf/code.git] / src / Makefile
index 13e54d1..0a1bc96 100644 (file)
@@ -1,35 +1,52 @@
 #Makefile
 CXX = g++ -std=gnu++0x -Wall -Werror -Wshadow -pedantic -g
-OBJ = log.o main.o document.o view.o
-LIB = #-lSDL2
+MAIN = main.o
+OBJ = log.o document.o view.o screen.o
+LIB = `sdl2-config --libs` -lGL
 OBJPATHS = $(OBJ:%=../obj/%)
 DEPS := $(OBJPATHS:%.o=%.d)
+CFLAGS += `sdl2-config --cflags` -I`pwd`
 
 LINKOBJ = $(OBJPATHS)
 
 RM = rm -f
 BIN = ../bin/ipdf
 
--include $(DEPS)
 
 all : $(BIN)
 
+tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ)
+       $(CXX) -o [email protected] $(LINKOBJ) ../obj/[email protected] $(LIB)
+
+runtests : tests/runtests.sh
+       cd tests; ./runtests.sh
+
+
 $(BIN) : $(LINKOBJ)
        @mkdir -p $(dir $@)
-       $(CXX) -o $(BIN) $(LINKOBJ) $(LIB)
+       $(CXX) -o $(BIN) $(LINKOBJ) ../obj/$(MAIN) $(LIB)
 
 ../obj/%.o : %.cpp
        @mkdir -p $(dir $@)
-       $(CXX) -c -MMD -o $@ $<
+       $(CXX) $(CFLAGS) -c -MMD -o $@ $<
+
+-include $(DEPS)
+
+clean_bin :
+       $(RM) $(BIN)
 
 clean :
        $(RM) $(BIN) $(DEPS) $(LINKOBJ)
+       $(RM) tests/*~
+       $(RM) tests/*.test
+       $(RM) tests/*.out
+       $(RM) tests/*.err
+       
 
-clean_full: #cleans up all backup files
-       $(RM) $(BIN) $(DEPS) $(LINKOBJ)
+clean_full: clean
        $(RM) *.*~
        $(RM) *~
-       $(RM) *.o
+
 
 
        

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