test/Makefile
branchlocal_cpptest
changeset 2639 60be0da624a6
parent 2638 d52e41da942e
child 2642 7dbfc6c3f3c8
     1.1 --- a/test/Makefile	Mon Apr 30 15:33:54 2018 +0200
     1.2 +++ b/test/Makefile	Tue May 01 14:40:18 2018 +0200
     1.3 @@ -7,16 +7,15 @@
     1.4  include ../default.conf
     1.5  
     1.6  HERE:=$(CURDIR)
     1.7 -TEST_HOME=$(HERE)pEp_test_home
     1.8 +TEST_HOME=$(HERE)/pEp_test_home
     1.9  
    1.10  TARGET=TestDriver
    1.11  
    1.12 -SRC_DIRS := ./src ./src/util ./src/engine_tests
    1.13 -SRCS := src/EngineTestSuite.cc src/EngineTestIndividualSuite.cc src/EngineTestSessionSuite.cc $(wildcard src/*/*.cc) src/SuiteMaker.cc src/TestDriver.cc
    1.14 +SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
    1.15  OBJS := $(addsuffix .o,$(basename $(SRCS)))
    1.16  DEPS := $(OBJS:.o=.d)
    1.17  
    1.18 -INC_DIRS := ./include /usr/local/include #$(shell find $(SRC_DIRS) -type d) 
    1.19 +INC_DIRS := ./include /usr/local/include  
    1.20  INC_FLAGS := $(addprefix -I,$(INC_DIRS))
    1.21  
    1.22  LDFLAGS += -L/usr/local/lib
    1.23 @@ -80,108 +79,28 @@
    1.24  	endif
    1.25  endif
    1.26  
    1.27 -
    1.28  CPPFLAGS += $(INC_FLAGS) -MMD -MP
    1.29  
    1.30 +all: $(TARGET) test_home_
    1.31 +	
    1.32  $(TARGET): $(OBJS)
    1.33 -	$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LOADLIBES) $(LDLIBS)
    1.34 +	$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
    1.35 +
    1.36 +.PHONY: test_home_
    1.37 +test_home_: 
    1.38 +	mkdir -p $(TEST_HOME)
    1.39  
    1.40 +TEST_CMD_=$(TARGET)
    1.41 +
    1.42 +.PHONY: test
    1.43 +test: all
    1.44 +	./$(TARGET) $(TEST_CMD_)
    1.45 +	
    1.46  .PHONY: clean
    1.47  clean:
    1.48  	$(RM) $(TARGET) $(OBJS) $(DEPS)
    1.49  
    1.50 --include $(DEPS)
    1.51  
    1.52  
    1.53 -# 
    1.54 -# TEST_CMD_PFX=$(LIBPATH)=$(EXTRA_LIB_PATHS) #HOME=$(TEST_HOME) GNUPGHOME=$(TEST_GNUPGHOME)
    1.55 -# 
    1.56 -# 
    1.57 -# CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
    1.58 -# ifneq ($(MAKECMDGOALS),clean)
    1.59 -# 	ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
    1.60 -# 		$(error The macro NDEBUG must not be defined for test compilation.)
    1.61 -# 	endif
    1.62 -# endif
    1.63 -# 
    1.64 -# CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
    1.65 -# ifneq ($(MAKECMDGOALS),clean)
    1.66 -# 	ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
    1.67 -# 		$(error The macro NDEBUG must not be defined for test compilation.)
    1.68 -# 	endif
    1.69 -# endif
    1.70 -# 
    1.71 -# # .PHONY: all
    1.72 -# # all: main
    1.73 -# 
    1.74 -# # don't delete .o files!
    1.75 -# .PRECIOUS: %.o
    1.76 -# 
    1.77 -# 
    1.78 -# SRC_DIRS ?= ./src
    1.79 -# 
    1.80 -# SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
    1.81 -# OBJS := $(addsuffix .o,$(basename $(SRCS)))
    1.82 -# DEPS := $(OBJS:.o=.d)
    1.83 -# 
    1.84 -# CPPFLAGS += -I./include -MMD -MP
    1.85 -# 
    1.86 -# #	$(CC) $(LDFLAGS) $(OBJS) -o $@ $(LOADLIBES) $(LDLIBS)
    1.87 -# $(TARGET): $(OBJS)
    1.88 -# 	$(CXX) $(CXXFLAGS) $^ $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
    1.89 -# 
    1.90 -# 
    1.91 -# .PHONY: test_home_
    1.92 -# test_home_: 
    1.93 -# 	mkdir -p $(TEST_HOME)
    1.94 -# 
    1.95 -# # .PHONY: clean
    1.96 -# # clean:
    1.97 -# # 	rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS) msg4.asc msg_encrypt_for_self.asc
    1.98 -# 
    1.99 -# 
   1.100 -# .PHONY: clean
   1.101 -# clean:
   1.102 -# 	$(RM) $(TARGET) $(OBJS) $(DEPS)
   1.103 -# 
   1.104 -# -include $(DEPS)
   1.105 -# 
   1.106 -# # .PHONY: main
   1.107 -# # main: TestDriver
   1.108 -# # 	
   1.109 -# # TestDriver : src/TestDriver
   1.110 -# # 	$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS) $(TESTOBJ) $(SUITEOBJ) -o TestDriver
   1.111 -# # 
   1.112 -# # .PHONY: testfiles
   1.113 -# # testfiles : $(TESTOBJ)
   1.114 -# # 	$(CXX) -c $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS)
   1.115 -# # 
   1.116 -# # .PHONY: suitefiles	
   1.117 -# # suitefiles : $(SUITEOBJ)
   1.118 -# # 	$(CXX) -c $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS)
   1.119 -# #  
   1.120 -# # # %_test : %_test.o test_util.o
   1.121 -# # # 	$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@
   1.122 -# # # 
   1.123 -# # # %_run : % test_home_
   1.124 -# # # 	$(TEST_CMD_PFX) ./$<
   1.125 -# # # 
   1.126 -# # # %_lldb : % test_home_
   1.127 -# # # 	$(TEST_CMD_PFX) $(LLDB_BIN) ./$<
   1.128 -# # # 
   1.129 -# # # %_valgrind : % test_home_
   1.130 -# # # 	$(TEST_CMD_PFX) valgrind --leak-check=yes ./$<
   1.131 -# # # 
   1.132 -# # # %_gdb : % test_home_
   1.133 -# # # 	$(TEST_CMD_PFX) gdb ./$<
   1.134 -# # 
   1.135 -# # # .PHONY: unit_tests
   1.136 -# # # unit_tests: $(UNIT_TESTS) $(UNIT_TESTS_RUN)
   1.137 -# # 
   1.138 -# # # .PHONY: compile
   1.139 -# # # compile: $(UNIT_TESTS) $(TARGET)
   1.140 -# # 
   1.141 -# # # Installs the engine, not the test binaries
   1.142 -# # .PHONY: install
   1.143 -# # install:
   1.144 -# # 	$(MAKE) -C .. install
   1.145 +-include $(DEPS)
   1.146 +