From 6b2a9dabbfad4d64268967a32dff0f1dc55763de Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 16 May 2020 13:28:52 +0200 Subject: Makefile cleanup, included missing files --- Makefile | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 45beff4..f6a0ced 100644 --- a/Makefile +++ b/Makefile @@ -31,17 +31,15 @@ endif # -fprofile-instr-generate -fcoverage-mapping # gcc:--coverage -CXXFLAGS+= -Wall -I. -DVERSION=\"$(VERSION)\" -fPIE +CXXFLAGS+=-Wall -I. -DVERSION=\"$(VERSION)\" -fPIE -CXXFLAGS+= -pthread +CXXFLAGS+=-pthread ifeq ($(CXX),clang++-10) CXXFLAGS+=-std=c++20 #-stdlib=libc++ else CXXFLAGS+=-std=c++17 endif -CXXTESTFLAGS=-Igoogletest/include -Igooglemock/include/ -Igoogletest -Igooglemock - LIBS=\ -lcommon \ -lboost_context \ @@ -87,38 +85,25 @@ PROGSRC=\ statistics.cpp \ server.cpp -TESTSRC=\ - test-webserver.cpp \ - googlemock/src/gmock-all.cpp \ - googletest/src/gtest-all.cpp \ - $(PROGSRC) - SRC=$(PROGSRC) webserver.cpp -build: $(PROJECTNAME) test-$(PROJECTNAME) +build: $(PROJECTNAME) +set -e ; for i in $(PLUGINS) ; do make -C plugins/$$i ; done - ./test-$(PROJECTNAME) all: build ./webserver -c webserver.conf -# testsuite ---------------------------------------------- -test-$(PROJECTNAME): $(TESTSRC:.cpp=.o) - $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@ - $(PROJECTNAME): libcommon/libcommon.a $(SRC:.cpp=.o) $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@ libcommon/libcommon.a: $(MAKE) -C libcommon -dep: $(TESTSRC:.cpp=.d) - %.d: %.cpp - $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -MM -MP -MF $@ -c $< + $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< %.o: %.cpp %.d - $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ + $(CXX) $(CXXFLAGS) -c $< -o $@ googletest/src/%.o: googletest/src/%.cc $(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@ @@ -127,6 +112,9 @@ googletest/src/%.o: googletest/src/%.cc ADD_DEP=Makefile +test: + $(MAKE) -C tests + install: mkdir -p $(DESTDIR)/usr/bin cp webserver $(DESTDIR)/usr/bin @@ -156,11 +144,11 @@ $(DISTROS): deb-src debs: $(DISTROS) clean: - -rm -f test-$(PROJECTNAME) $(PROJECTNAME) + -rm -f $(PROJECTNAME) -rm -f plugins/*.so -find . -name '*.o' -o -name '*.d' -o -name '*.gcno' -o -name '*.gcda' | xargs rm -f - for i in $(PLUGINS) ; do make -C plugins/$$i clean ; done - $(MAKE) -C libcommon clean + #for i in $(PLUGINS) ; do $(MAKE) -C plugins/$$i clean ; done + for i in libcommon tests ; do $(MAKE) -C $$i clean ; done DISTFILES= \ archive.h \ @@ -187,7 +175,8 @@ DISTFILES= \ server.h \ statistics.cpp \ statistics.h \ - test-webserver.cpp \ + tests/Makefile \ + tests/test-webserver.cpp \ webserver.cpp \ webserver.1 \ README.txt \ @@ -262,6 +251,6 @@ dist: clean rm -rf $(PROJECTNAME)-$(VERSION) ls -l ../$(PROJECTNAME)-$(VERSION).tar.xz -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean all zip test install deb deb-src debs all $(DISTROS) -include $(wildcard $(SRC:.cpp=.d)) -- cgit v1.2.3