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= CXXFLAGS+=$(shell pkg-config --cflags fcgi) LIBS+=\ -lreichwein \ -lboost_context \ -lboost_filesystem \ -lboost_timer \ -lboost_system \ -lcrypt \ -lpthread \ -lssl -lcrypto \ -ldl \ $(shell pkg-config --libs fcgi) LDFLAGS+=-pie UNITS=\ auth.cpp \ config.cpp \ fastcgiprocess.cpp \ http.cpp \ plugin.cpp \ privileges.cpp \ response.cpp \ statistics.cpp \ server.cpp \ webserver.cpp \ websocket.cpp TESTSRC=\ test-auth.cpp \ test-config.cpp \ test-environment.cpp \ test-http.cpp \ test-plugin.cpp \ test-privileges.cpp \ test-response.cpp \ test-server.cpp \ test-statistics.cpp \ test-webserver.cpp \ helper.cpp \ webserverprocess.cpp \ websocketserverprocess.cpp build: $(PROJECTNAME) fcgi1 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 $@ fcgi1: fcgi1.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 $@ config.o: ../config.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ fastcgiprocess.o: ../plugins/fcgi/fastcgiprocess.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ http.o: ../http.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 $@ websocket.o: ../websocket.cpp $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ ADD_DEP=Makefile # misc --------------------------------------------------- clean: -rm -f *.o *.a *.d $(PROJECTNAME) *.gcda *.gcno *.profraw *.profdata *.gcov fcgi1 .PHONY: clean all install -include $(wildcard $(TESTSRC:.cpp=.d))