X-Git-Url: https://git.llucax.com/software/posixx.git/blobdiff_plain/b79c4060e2a0ff03c3548b8d4e1bc181414c8e16..3e4bff1a7e8e2d1f1ecb0f04440946b5eb78a591:/test/Makefile?ds=sidebyside diff --git a/test/Makefile b/test/Makefile index edf0957..9e9ad9f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,12 +1,11 @@ -CINCPATH = -isystem include -CFLAGS += -std=c++98 -Wall -pedantic -LDFLAGS = -lboost_unit_test_framework +LOCAL_CFLAGS = -std=c++98 -Wall -pedantic -Iinclude +LOCAL_LDFLAGS = -lboost_unit_test_framework TESTPRG = test_suite TESTCMD = ./$(TESTPRG) --detect_memory_leak=1 --report_level=short \ -# --build_info=yes --log_level=test_suite \ -# | grep -v "Entering test case " | grep -v "Leaving test case" + #--build_info=yes --log_level=test_suite \ + #| grep -v "Entering test case " | grep -v "Leaving test case" VALGRIND = valgrind --tool=memcheck --leak-check=yes --db-attach=no \ --num-callers=24 --leak-resolution=high --track-fds=yes \ @@ -18,10 +17,11 @@ OBJS = $(SOURCES:.cpp=.o) -ALL_CFLAGS = $(CFLAGS) $(CINCPATH) +ALL_CFLAGS = $(LOCAL_CFLAGS) $(LI_CFLAGS) $(CFLAGS) +ALL_LDFLAGS = $(LOCAL_LDFLAGS) $(LI_LDFLAGS) $(LDFLAGS) ifdef RELEASE -ALL_CFLAGS += -O3 -NDEBUG +ALL_CFLAGS += -O3 -DNDEBUG endif ifdef DEBUG @@ -36,9 +36,9 @@ endif ifneq ($(V), 1) NICE_CXX = @echo " CXX $@"; $(CXX) NICE_LINK = @echo " LINK $@"; $(CXX) -NICE_TEST = @echo " TEST"; $(TESTCMD) > /dev/null 2>&1 +NICE_TEST = @echo " TEST"; $(TESTCMD) > $(TESTPRG).log 2>&1 NICE_MEMTEST = @echo " MEMTEST"; $(VALGRIND) --log-file=valgrind.log \ - $(TESTCMD) > /dev/null 2>&1 + $(TESTCMD) > valgrind.$(TESTPRG).log 2>&1 NICE_CLEAN = @echo " CLEAN"; $(RM) else NICE_CXX = $(CXX) @@ -51,7 +51,7 @@ endif default: all -all: test_suite +all: $(TESTPRG) # dependency handling @@ -69,7 +69,8 @@ all: test_suite @mkdir -p $(dir $@) @set -e; rm -f $@; \ $(CC) -MM -MG -MP $(CPPFLAGS) $(ALL_CFLAGS) $< -MF $@.$$$$; \ - sed 's,\($(notdir $*)\)\.o[ :]*,$(dir $<)\1.o $@ : ,g' < $@.$$$$ > $@; \ + sed 's,\($(notdir $*)\)\.o[ :]*,$(dir $<)\1.o $@ : ,g' \ + < $@.$$$$ > $@; \ rm -f $@.$$$$ ifneq ($(MAKECMDGOALS),clean) @@ -81,7 +82,7 @@ endif $(TESTPRG): $(OBJS) - $(NICE_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $^ + $(NICE_LINK) $(ALL_LDFLAGS) -o $@ $^ $(OBJS): include @@ -92,16 +93,22 @@ include: @mkdir -p include @ln -fs ../../src include/posixx -test: all +test: .test-stamp + +.test-stamp: $(TESTPRG) $(NICE_TEST) + @touch $@ + +memtest: .memtest-stamp -memtest: all +.memtest-stamp: $(TESTPRG) $(NICE_MEMTEST) + @touch $@ clean: $(NICE_CLEAN) -r $(TESTPRG) include $(OBJS) .deps valgrind.log \ - *.bb *.bbg *.da *.gcov *.gcda *.gcno gmon.out + *.bb *.bbg *.da *.gcov *.gcda *.gcno gmon.out .*-stamp -.PHONY: default all test clean +.PHONY: default all test memtest clean