From d0db131a73933d0a6c65bab59d1e0e4f6a185338 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 6 Jun 2020 13:58:22 +0200 Subject: Code cleanup, use gcc 8 on debian 10 --- plugins/cgi/Makefile | 73 ++++++--------------------------------- plugins/fcgi/Makefile | 68 ++++++------------------------------ plugins/redirect/Makefile | 72 ++++++-------------------------------- plugins/static-files/Makefile | 73 ++++++--------------------------------- plugins/statistics/Makefile | 74 +++++++-------------------------------- plugins/webbox/Makefile | 80 ++++++++----------------------------------- plugins/weblog/Makefile | 76 ++++++---------------------------------- 7 files changed, 80 insertions(+), 436 deletions(-) (limited to 'plugins') diff --git a/plugins/cgi/Makefile b/plugins/cgi/Makefile index 2d86c50..df51e89 100644 --- a/plugins/cgi/Makefile +++ b/plugins/cgi/Makefile @@ -1,34 +1,12 @@ -DISTROS=debian10 -VERSION=$(shell dpkg-parsechangelog --show-field Version) -PROJECTNAME=cgi - -CXX=clang++-10 - -ifeq ($(shell which $(CXX)),) -CXX=clang++ -endif - -ifeq ($(shell which $(CXX)),) -CXX=g++-9 -endif +include ../../common.mk -ifeq ($(CXXFLAGS),) -#CXXFLAGS=-O2 -DNDEBUG -CXXFLAGS=-O0 -g -D_DEBUG -endif -# -fprofile-instr-generate -fcoverage-mapping -# gcc:--coverage +PROJECTNAME=cgi -CXXFLAGS+= -Wall -I. -I ../.. +CXXFLAGS+= -fvisibility=hidden -fPIC -CXXFLAGS+= -pthread -fvisibility=hidden -fPIC -ifeq ($(CXX),clang++-10) -CXXFLAGS+=-std=c++20 #-stdlib=libc++ -else -CXXFLAGS+=-std=c++17 -endif +CXXFLAGS+= -I../.. -LIBS=\ +LDLIBS=\ -lcommon \ -lboost_context \ -lboost_coroutine \ @@ -41,21 +19,7 @@ LIBS=\ -lssl -lcrypto \ -ldl -ifeq ($(CXX),clang++-10) -LIBS+= \ --fuse-ld=lld-10 \ --lstdc++ -#-lc++ \ -#-lc++abi -#-lc++fs -#-lstdc++fs -else -LIBS+= \ --lstdc++ \ --lstdc++fs -endif - -LDFLAGS=-L../../libcommon +LDFLAGS+=-L../../libcommon PROGSRC=\ cgi.cpp @@ -67,6 +31,9 @@ all: $(PROJECTNAME).so $(PROJECTNAME).so: ../../libcommon/libcommon.a $(SRC:.cpp=.o) $(CXX) $(LDFLAGS) $^ -shared $(LDLIBS) $(LIBS) -o $@ +../../libcommon/libcommon.a: + cd ../.. && $(MAKE) libcommon/libcommon.a + %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< @@ -82,27 +49,9 @@ install: cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins # misc --------------------------------------------------- -deb: - # build binary deb package - dpkg-buildpackage -us -uc -rfakeroot - -deb-src: - dpkg-source -b . - -$(DISTROS): deb-src - sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc ; \ - -debs: $(DISTROS) - clean: + -rm -f *.o *.so *.d -zip: clean - -rm -f ../$(PROJECTNAME).zip - zip -r ../$(PROJECTNAME).zip * - ls -l ../$(PROJECTNAME).zip - - - -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean install all -include $(wildcard $(SRC:.cpp=.d)) diff --git a/plugins/fcgi/Makefile b/plugins/fcgi/Makefile index 8937689..d3b8ed1 100644 --- a/plugins/fcgi/Makefile +++ b/plugins/fcgi/Makefile @@ -1,34 +1,12 @@ -DISTROS=debian10 -VERSION=$(shell dpkg-parsechangelog --show-field Version) -PROJECTNAME=fcgi - -CXX=clang++-10 - -ifeq ($(shell which $(CXX)),) -CXX=clang++ -endif +include ../../common.mk -ifeq ($(shell which $(CXX)),) -CXX=g++-9 -endif - -ifeq ($(CXXFLAGS),) -#CXXFLAGS=-O2 -DNDEBUG -CXXFLAGS=-O0 -g -D_DEBUG -endif -# -fprofile-instr-generate -fcoverage-mapping -# gcc:--coverage +PROJECTNAME=fcgi -CXXFLAGS+= -Wall -I. +CXXFLAGS+= -fvisibility=hidden -fPIC -CXXFLAGS+= -pthread -fvisibility=hidden -fPIC -ifeq ($(CXX),clang++-10) -CXXFLAGS+=-std=c++20 #-stdlib=libc++ -else -CXXFLAGS+=-std=c++17 -endif +CXXFLAGS+= -I../.. -LIBS=\ +LDLIBS=\ -lboost_context \ -lboost_coroutine \ -lboost_program_options \ @@ -40,19 +18,7 @@ LIBS=\ -lssl -lcrypto \ -ldl -ifeq ($(CXX),clang++-10) -LIBS+= \ --fuse-ld=lld-10 \ --lstdc++ -#-lc++ \ -#-lc++abi -#-lc++fs -#-lstdc++fs -else -LIBS+= \ --lstdc++ \ --lstdc++fs -endif +LDFLAGS+=-L../../libcommon PROGSRC=\ fcgi.cpp \ @@ -66,6 +32,9 @@ all: $(PROJECTNAME).so $(PROJECTNAME).so: $(SRC:.cpp=.o) $(CXX) $(CXXFLAGS) $^ -shared $(LIBS) -o $@ +../../libcommon/libcommon.a: + cd ../.. && $(MAKE) libcommon/libcommon.a + %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< @@ -81,27 +50,12 @@ install: cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins # misc --------------------------------------------------- -deb: - # build binary deb package - dpkg-buildpackage -us -uc -rfakeroot - -deb-src: - dpkg-source -b . - -$(DISTROS): deb-src - sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc ; \ debs: $(DISTROS) clean: + -rm -f *.o *.so *.d -zip: clean - -rm -f ../$(PROJECTNAME).zip - zip -r ../$(PROJECTNAME).zip * - ls -l ../$(PROJECTNAME).zip - - - -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean install all -include $(wildcard $(SRC:.cpp=.d)) diff --git a/plugins/redirect/Makefile b/plugins/redirect/Makefile index 77b496b..344aa91 100644 --- a/plugins/redirect/Makefile +++ b/plugins/redirect/Makefile @@ -1,34 +1,12 @@ -DISTROS=debian10 -VERSION=$(shell dpkg-parsechangelog --show-field Version) -PROJECTNAME=redirect - -CXX=clang++-10 - -ifeq ($(shell which $(CXX)),) -CXX=clang++ -endif +include ../../common.mk -ifeq ($(shell which $(CXX)),) -CXX=g++-9 -endif - -ifeq ($(CXXFLAGS),) -#CXXFLAGS=-O2 -DNDEBUG -CXXFLAGS=-O0 -g -D_DEBUG -endif -# -fprofile-instr-generate -fcoverage-mapping -# gcc:--coverage +PROJECTNAME=redirect -CXXFLAGS+= -Wall -I. +CXXFLAGS+= -fvisibility=hidden -fPIC -CXXFLAGS+= -pthread -fvisibility=hidden -fPIC -ifeq ($(CXX),clang++-10) -CXXFLAGS+=-std=c++20 #-stdlib=libc++ -else -CXXFLAGS+=-std=c++17 -endif +CXXFLAGS+= -I../.. -LIBS=\ +LDLIBS=\ -lboost_context \ -lboost_coroutine \ -lboost_program_options \ @@ -40,19 +18,7 @@ LIBS=\ -lssl -lcrypto \ -ldl -ifeq ($(CXX),clang++-10) -LIBS+= \ --fuse-ld=lld-10 \ --lstdc++ -#-lc++ \ -#-lc++abi -#-lc++fs -#-lstdc++fs -else -LIBS+= \ --lstdc++ \ --lstdc++fs -endif +LDFLAGS+=-L../../libcommon PROGSRC=\ redirect.cpp @@ -64,6 +30,9 @@ all: $(PROJECTNAME).so $(PROJECTNAME).so: $(SRC:.cpp=.o) $(CXX) $(CXXFLAGS) $^ -shared $(LIBS) -o $@ +../../libcommon/libcommon.a: + cd ../.. && $(MAKE) libcommon/libcommon.a + %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< @@ -75,29 +44,10 @@ install: cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins # misc --------------------------------------------------- -deb: - # build binary deb package - dpkg-buildpackage -us -uc -rfakeroot - -deb-src: - dpkg-source -b . - -$(DISTROS): deb-src - sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc ; \ - -debs: $(DISTROS) clean: - -rm -f $(PROJECTNAME) - -find . -name '*.o' -o -name '*.so' -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 - - + -rm -f *.o *.so *.d -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean install all -include $(wildcard $(SRC:.cpp=.d)) diff --git a/plugins/static-files/Makefile b/plugins/static-files/Makefile index 9834e96..f4cfb31 100644 --- a/plugins/static-files/Makefile +++ b/plugins/static-files/Makefile @@ -1,34 +1,12 @@ -DISTROS=debian10 -VERSION=$(shell dpkg-parsechangelog --show-field Version) -PROJECTNAME=static-files - -CXX=clang++-10 - -ifeq ($(shell which $(CXX)),) -CXX=clang++ -endif - -ifeq ($(shell which $(CXX)),) -CXX=g++-9 -endif +include ../../common.mk -ifeq ($(CXXFLAGS),) -#CXXFLAGS=-O2 -DNDEBUG -CXXFLAGS=-O0 -g -D_DEBUG -endif -# -fprofile-instr-generate -fcoverage-mapping -# gcc:--coverage +PROJECTNAME=static-files -CXXFLAGS+= -Wall -I. -I../.. +CXXFLAGS+= -fvisibility=hidden -fPIC -CXXFLAGS+= -pthread -fvisibility=hidden -fPIC -ifeq ($(CXX),clang++-10) -CXXFLAGS+=-std=c++20 #-stdlib=libc++ -else -CXXFLAGS+=-std=c++17 -endif +CXXFLAGS+= -I../.. -LIBS=\ +LDLIBS=\ -lcommon \ -lboost_context \ -lboost_coroutine \ @@ -41,20 +19,6 @@ LIBS=\ -lssl -lcrypto \ -ldl -ifeq ($(CXX),clang++-10) -LIBS+= \ --fuse-ld=lld-10 \ --lstdc++ -#-lc++ \ -#-lc++abi -#-lc++fs -#-lstdc++fs -else -LIBS+= \ --lstdc++ \ --lstdc++fs -endif - LDFLAGS=-L../../libcommon PROGSRC=\ @@ -67,6 +31,9 @@ all: $(PROJECTNAME).so $(PROJECTNAME).so: ../../libcommon/libcommon.a $(SRC:.cpp=.o) $(CXX) $(LDFLAGS) $^ -shared $(LDLIBS) $(LIBS) -o $@ +../../libcommon/libcommon.a: + cd ../.. && $(MAKE) libcommon/libcommon.a + %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< @@ -82,29 +49,9 @@ install: cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins # misc --------------------------------------------------- -deb: - # build binary deb package - dpkg-buildpackage -us -uc -rfakeroot - -deb-src: - dpkg-source -b . - -$(DISTROS): deb-src - sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc ; \ - -debs: $(DISTROS) - clean: - -rm -f $(PROJECTNAME) - -find . -name '*.o' -o -name '*.so' -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 - - + -rm -f *.o *.so *.d -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean all install -include $(wildcard $(SRC:.cpp=.d)) diff --git a/plugins/statistics/Makefile b/plugins/statistics/Makefile index 2a0d246..8e8a6f7 100644 --- a/plugins/statistics/Makefile +++ b/plugins/statistics/Makefile @@ -1,34 +1,13 @@ -DISTROS=debian10 -VERSION=$(shell dpkg-parsechangelog --show-field Version) -PROJECTNAME=statistics - -CXX=clang++-10 - -ifeq ($(shell which $(CXX)),) -CXX=clang++ -endif - -ifeq ($(shell which $(CXX)),) -CXX=g++-9 -endif +include ../../common.mk -ifeq ($(CXXFLAGS),) -#CXXFLAGS=-O2 -DNDEBUG -CXXFLAGS=-O0 -g -D_DEBUG -endif -# -fprofile-instr-generate -fcoverage-mapping -# gcc:--coverage +PROJECTNAME=statistics -CXXFLAGS+= -Wall -I. +CXXFLAGS+= -fvisibility=hidden -fPIC -CXXFLAGS+= -pthread -fvisibility=hidden -fPIC -ifeq ($(CXX),clang++-10) -CXXFLAGS+=-std=c++20 #-stdlib=libc++ -else -CXXFLAGS+=-std=c++17 -endif +CXXFLAGS+= -I../.. -LIBS=\ +LDLIBS=\ +-lcommon \ -lboost_context \ -lboost_coroutine \ -lboost_program_options \ @@ -40,19 +19,7 @@ LIBS=\ -lssl -lcrypto \ -ldl -ifeq ($(CXX),clang++-10) -LIBS+= \ --fuse-ld=lld-10 \ --lstdc++ -#-lc++ \ -#-lc++abi -#-lc++fs -#-lstdc++fs -else -LIBS+= \ --lstdc++ \ --lstdc++fs -endif +LDFLAGS=-L../../libcommon PROGSRC=\ statistics.cpp @@ -64,6 +31,9 @@ all: $(PROJECTNAME).so $(PROJECTNAME).so: $(SRC:.cpp=.o) $(CXX) $(CXXFLAGS) $^ -shared $(LIBS) -o $@ +../../libcommon/libcommon.a: + cd ../.. && $(MAKE) libcommon/libcommon.a + %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< @@ -75,29 +45,9 @@ install: cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins # misc --------------------------------------------------- -deb: - # build binary deb package - dpkg-buildpackage -us -uc -rfakeroot - -deb-src: - dpkg-source -b . - -$(DISTROS): deb-src - sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc ; \ - -debs: $(DISTROS) - clean: - -rm -f $(PROJECTNAME) - -find . -name '*.o' -o -name '*.so' -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 - - + -rm -f *.o *.so *.d -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean all install -include $(wildcard $(SRC:.cpp=.d)) diff --git a/plugins/webbox/Makefile b/plugins/webbox/Makefile index 861b5d4..39a2c8c 100644 --- a/plugins/webbox/Makefile +++ b/plugins/webbox/Makefile @@ -1,34 +1,12 @@ -DISTROS=debian10 -VERSION=$(shell dpkg-parsechangelog --show-field Version) -PROJECTNAME=webbox - -CXX=clang++-10 - -ifeq ($(shell which $(CXX)),) -CXX=clang++ -endif - -ifeq ($(shell which $(CXX)),) -CXX=g++-9 -endif +include ../../common.mk -ifeq ($(CXXFLAGS),) -#CXXFLAGS=-O2 -DNDEBUG -CXXFLAGS=-O0 -g -D_DEBUG -endif -# -fprofile-instr-generate -fcoverage-mapping -# gcc:--coverage +PROJECTNAME=webbox -CXXFLAGS+= -Wall -I. -I../.. +CXXFLAGS+= -fvisibility=hidden -fPIC -CXXFLAGS+= -pthread -fvisibility=hidden -fPIC -ifeq ($(CXX),clang++-10) -CXXFLAGS+=-std=c++20 #-stdlib=libc++ -else -CXXFLAGS+=-std=c++17 -endif +CXXFLAGS+= -I../.. -LIBS=\ +LDLIBS=\ -lcommon \ -lboost_context \ -lboost_coroutine \ @@ -41,21 +19,7 @@ LIBS=\ -lssl -lcrypto \ -ldl -ifeq ($(CXX),clang++-10) -LIBS+= \ --fuse-ld=lld-10 \ --lstdc++ -#-lc++ \ -#-lc++abi -#-lc++fs -#-lstdc++fs -else -LIBS+= \ --lstdc++ \ --lstdc++fs -endif - -LDFLAGS+=-L../../libcommon +LDFLAGS=-L../../libcommon PROGSRC=\ webbox.cpp @@ -67,12 +31,19 @@ all: $(PROJECTNAME).so $(PROJECTNAME).so: ../../libcommon/libcommon.a $(SRC:.cpp=.o) $(CXX) $(LDFLAGS) $^ -shared $(LDLIBS) $(LIBS) -o $@ +../../libcommon/libcommon.a: + cd ../.. && $(MAKE) libcommon/libcommon.a + %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< %.o: %.cpp %.d $(CXX) $(CXXFLAGS) -c $< -o $@ +# dependencies + +ADD_DEP=Makefile + install: mkdir -p $(DESTDIR)/usr/lib/webserver/plugins cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins @@ -84,31 +55,10 @@ install: htmlmin html/index.html $(DESTDIR)/usr/lib/webbox/html/index.html cleancss -o $(DESTDIR)/usr/lib/webbox/html/webbox.css html/webbox.css - # misc --------------------------------------------------- -deb: - # build binary deb package - dpkg-buildpackage -us -uc -rfakeroot - -deb-src: - dpkg-source -b . - -$(DISTROS): deb-src - sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc ; \ - -debs: $(DISTROS) - clean: - -rm -f $(PROJECTNAME) - -find . -name '*.o' -o -name '*.so' -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 - - + -rm -f *.o *.so *.d -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean all install -include $(wildcard $(SRC:.cpp=.d)) diff --git a/plugins/weblog/Makefile b/plugins/weblog/Makefile index a21b464..ca62ce8 100644 --- a/plugins/weblog/Makefile +++ b/plugins/weblog/Makefile @@ -1,34 +1,12 @@ -DISTROS=debian10 -VERSION=$(shell dpkg-parsechangelog --show-field Version) -PROJECTNAME=weblog - -CXX=clang++-10 - -ifeq ($(shell which $(CXX)),) -CXX=clang++ -endif - -ifeq ($(shell which $(CXX)),) -CXX=g++-9 -endif +include ../../common.mk -ifeq ($(CXXFLAGS),) -#CXXFLAGS=-O2 -DNDEBUG -CXXFLAGS=-O0 -g -D_DEBUG -endif -# -fprofile-instr-generate -fcoverage-mapping -# gcc:--coverage +PROJECTNAME=weblog -CXXFLAGS+= -Wall -I. -I../.. +CXXFLAGS+= -fvisibility=hidden -fPIC -CXXFLAGS+= -pthread -fvisibility=hidden -fPIC -ifeq ($(CXX),clang++-10) -CXXFLAGS+=-std=c++20 #-stdlib=libc++ -else -CXXFLAGS+=-std=c++17 -endif +CXXFLAGS+= -I../.. -LIBS=\ +LDLIBS=\ -lcommon \ -lboost_context \ -lboost_coroutine \ @@ -41,20 +19,6 @@ LIBS=\ -lssl -lcrypto \ -ldl -ifeq ($(CXX),clang++-10) -LIBS+= \ --fuse-ld=lld-10 \ --lstdc++ -#-lc++ \ -#-lc++abi -#-lc++fs -#-lstdc++fs -else -LIBS+= \ --lstdc++ \ --lstdc++fs -endif - LDFLAGS=-L../../libcommon PROGSRC=\ @@ -67,15 +31,15 @@ all: $(PROJECTNAME).so $(PROJECTNAME).so: ../../libcommon/libcommon.a $(SRC:.cpp=.o) $(CXX) $(LDFLAGS) $^ -shared $(LDLIBS) $(LIBS) -o $@ +../../libcommon/libcommon.a: + cd ../.. && $(MAKE) libcommon/libcommon.a + %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< %.o: %.cpp %.d $(CXX) $(CXXFLAGS) -c $< -o $@ -googletest/src/%.o: googletest/src/%.cc - $(CXX) $(CXXFLAGS) -c $< -o $@ - # dependencies ADD_DEP=Makefile @@ -85,29 +49,9 @@ install: cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins # misc --------------------------------------------------- -deb: - # build binary deb package - dpkg-buildpackage -us -uc -rfakeroot - -deb-src: - dpkg-source -b . - -$(DISTROS): deb-src - sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc ; \ - -debs: $(DISTROS) - clean: - -rm -f test-$(PROJECTNAME) $(PROJECTNAME) - -find . -name '*.o' -o -name '*.so' -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 - - + -rm -f *.o *.so *.d -.PHONY: clean all zip install deb deb-src debs all $(DISTROS) +.PHONY: clean install all -include $(wildcard $(SRC:.cpp=.d)) -- cgit v1.2.3