CXXFLAGS=-g -O0 include ../common.mk PROJECTNAME=test-webserver ifeq ($(CXXTYPE),clang++) CXXFLAGS+=-fprofile-instr-generate -fcoverage-mapping LDFLAGS+=-fprofile-instr-generate -fcoverage-mapping else # GCC CXXFLAGS+=--coverage LDFLAGS+=--coverage endif CXXFLAGS+= -I. -I.. -fPIE CXXTESTFLAGS= LIBS=\ -lreichwein \ -lboost_context \ -lboost_filesystem \ -lboost_timer \ -lboost_system \ -lcrypt \ -lpthread \ -lssl -lcrypto \ -ldl LDFLAGS+=-pie UNITS=\ auth.cpp \ base64.cpp \ config.cpp \ http.cpp \ https.cpp \ os.cpp \ plugin.cpp \ privileges.cpp \ response.cpp \ statistics.cpp \ server.cpp \ webserver.cpp TESTSRC=\ test-environment.cpp \ test-webserver.cpp \ $(PROGSRC) build: $(PROJECTNAME) ifeq ($(CXXTYPE),clang++) LLVM_PROFILE_FILE="$(PROJECTNAME).profraw" ./$(PROJECTNAME) $(LLVMPROFDATA) merge -sparse $(PROJECTNAME).profraw -o $(PROJECTNAME).profdata $(LLVMCOV) report --ignore-filename-regex='google' --ignore-filename-regex='test-' --show-region-summary=0 -instr-profile $(PROJECTNAME).profdata $(PROJECTNAME) else ./$(PROJECTNAME) gcovr -r .. endif $(PROJECTNAME): $(TESTSRC:.cpp=.o) $(UNITS:.cpp=.o) $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@ dep: $(TESTSRC:.cpp=.d) %.d: %.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -MM -MP -MF $@ -c $< %.o: %.cpp %.d $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ auth.o: ../auth.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ base64.o: ../base64.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ config.o: ../config.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ http.o: ../http.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ https.o: ../https.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ os.o: ../os.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ plugin.o: ../plugin.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ privileges.o: ../privileges.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ response.o: ../response.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ statistics.o: ../statistics.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ server.o: ../server.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ webserver.o: ../webserver.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ ADD_DEP=Makefile # misc --------------------------------------------------- clean: -rm -f *.o *.a *.d $(PROJECTNAME) *.gcda *.gcno *.profraw *.profdata *.gcov .PHONY: clean all install -include $(wildcard $(TESTSRC:.cpp=.d))