From 709ba7ae8df8ce358e56b77c732f00e95a428259 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 2 Apr 2020 17:09:58 +0200 Subject: Add empty project --- Makefile | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9e69649 --- /dev/null +++ b/Makefile @@ -0,0 +1,90 @@ +PROJECTNAME=webserver + +CXX=clang++-10 +#CXX=g++-9 + +#CXXFLAGS=-O2 -DNDEBUG +CXXFLAGS=-O0 -g -D_DEBUG +# -fprofile-instr-generate -fcoverage-mapping +# gcc:--coverage + +CXXFLAGS+= -Wall -I. + +ifeq ($(CXX),clang++-10) +CXXFLAGS+=-std=c++20 -stdlib=libc++ +else +CXXFLAGS+=-std=c++2a +endif + +CXXTESTFLAGS=-Igoogletest/include -Igooglemock/include/ -Igoogletest -Igooglemock + +LIBS=\ +-lboost_context \ +-lboost_coroutine \ +-lboost_program_options \ +-lboost_system \ +-lboost_thread \ +-lboost_filesystem \ +-lboost_regex \ +-lpthread + +ifeq ($(CXX),clang++-10) +LIBS+= \ +-fuse-ld=lld-10 \ +-lc++ \ +-lc++abi +#-lc++fs +#-lstdc++ \ +#-lstdc++fs \ +else +LIBS+= \ +-lstdc++ +#-lstdc++fs +endif + +PROGSRC=\ + http.cpp + +TESTSRC=\ + test-webserver.cpp \ + googlemock/src/gmock-all.cpp \ + googletest/src/gtest-all.cpp \ + $(PROGSRC) + +SRC=$(PROGSRC) webserver.cpp + +all: test-$(PROJECTNAME) $(PROJECTNAME) + ./test-$(PROJECTNAME) + +# testsuite ---------------------------------------------- +test-$(PROJECTNAME): $(TESTSRC:.cpp=.o) + $(CXX) $(CXXFLAGS) $^ $(LIBS) -o $@ + +dep: $(TESTSRC:.cpp=.d) + +%.d: %.cpp + $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -MM -MP -MF $@ -c $< + +%.o: %.cpp %.d + $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ + +googletest/src/%.o: googletest/src/%.cc + $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ + +# dependencies + +ADD_DEP=Makefile + +# misc --------------------------------------------------- +clean: + -rm -f test-$(PROJECTNAME) $(PROJECTNAME) + -find . -name '*.o' -o -name '*.d' -o -name '*.gcno' -o -name '*.gcda' | xargs rm -f + +zip: clean + -rm -f ../$(PROJECTNAME).zip + zip -r ../$(PROJECTNAME).zip * + ls -l ../$(PROJECTNAME).zip + +.PHONY: clean all zip + +-include $(wildcard $(SRC:.cpp=.d)) -- cgit v1.2.3