X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2FMakefile;h=0a1bc96f11b69b04047ce80ea8b490fe05d10050;hp=3e8d8a02e41ece0ebb77bb2e20978bed40cbebe8;hb=42737c4c096f6469fb27e261806b48338a8f672f;hpb=901ea3355265e7f413674a62f7c29806ae35a565;ds=sidebyside diff --git a/src/Makefile b/src/Makefile index 3e8d8a0..0a1bc96 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,10 +1,11 @@ #Makefile CXX = g++ -std=gnu++0x -Wall -Werror -Wshadow -pedantic -g -OBJ = log.o tests/saveload.o document.o view.o screen.o +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` +CFLAGS += `sdl2-config --cflags` -I`pwd` LINKOBJ = $(OBJPATHS) @@ -14,9 +15,16 @@ BIN = ../bin/ipdf all : $(BIN) +tests/% : tests/%.cpp ../obj/tests/%.o $(LINKOBJ) + $(CXX) -o $@.test $(LINKOBJ) ../obj/$@.o $(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 $@) @@ -24,14 +32,21 @@ $(BIN) : $(LINKOBJ) -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 +