summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-06-06 13:58:22 +0200
committerRoland Reichwein <mail@reichwein.it>2020-06-06 13:58:22 +0200
commitd0db131a73933d0a6c65bab59d1e0e4f6a185338 (patch)
tree06edad4d845c8ba4102843fc3b306d7b5cc485d6 /Makefile
parent343922258d57261021daca42eb488c1205ae491c (diff)
Code cleanup, use gcc 8 on debian 10
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile62
1 files changed, 13 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 64ae413..353e1e3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
-DISTROS=debian10 ubuntu1910 ubuntu2004
+include common.mk
+
VERSION=$(shell dpkg-parsechangelog --show-field Version)
+
+DISTROS=debian10 ubuntu1910 ubuntu2004
PROJECTNAME=webserver
PLUGINS= \
cgi \
@@ -10,37 +13,9 @@ PLUGINS= \
webbox \
weblog
-CXX=clang++-10
-
-ifeq ($(shell which $(CXX)),)
-CXX=clang++
-endif
-
-ifeq ($(shell which $(CXX)),)
-CXX=g++-9
-endif
+CXXFLAGS+=-fPIE -DVERSION=\"$(VERSION)\"
-ifeq ($(shell which $(CXX)),)
-CXX=g++
-endif
-
-ifeq ($(CXXFLAGS),)
-#CXXFLAGS=-O2 -DNDEBUG
-CXXFLAGS=-O0 -g -D_DEBUG
-endif
-# -fprofile-instr-generate -fcoverage-mapping
-# gcc:--coverage
-
-CXXFLAGS+=-Wall -I. -DVERSION=\"$(VERSION)\" -fPIE
-
-CXXFLAGS+=-pthread
-ifeq ($(CXX),clang++-10)
-CXXFLAGS+=-std=c++20 #-stdlib=libc++
-else
-CXXFLAGS+=-std=c++17
-endif
-
-LIBS=\
+LDLIBS+=\
-lcommon \
-lboost_context \
-lboost_filesystem \
@@ -56,20 +31,6 @@ LIBS=\
#-lboost_thread \
#-lboost_regex \
-ifeq ($(CXX),clang++-10)
-LIBS+= \
--fuse-ld=lld-10 \
--lstdc++
-#-lc++ \
-#-lc++abi
-#-lc++fs
-#-lstdc++fs
-else
-LIBS+= \
--lstdc++ \
--lstdc++fs
-endif
-
LDFLAGS+=-pie -Llibcommon
PROGSRC=\
@@ -87,8 +48,7 @@ PROGSRC=\
SRC=$(PROGSRC) webserver.cpp
-build: $(PROJECTNAME)
- +set -e ; for i in $(PLUGINS) ; do make -C plugins/$$i ; done
+build: $(PROJECTNAME) $(PLUGINS)
all: build
./webserver -c webserver.conf
@@ -99,6 +59,9 @@ $(PROJECTNAME): libcommon/libcommon.a $(SRC:.cpp=.o)
libcommon/libcommon.a:
$(MAKE) -C libcommon
+$(PLUGINS):
+ cd plugins/$@ && $(MAKE)
+
%.d: %.cpp
$(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $<
@@ -146,7 +109,7 @@ debs: $(DISTROS)
clean:
-rm -f $(PROJECTNAME)
-rm -f plugins/*.so
- -find . -name '*.o' -o -name '*.d' -o -name '*.gcno' -o -name '*.gcda' | xargs rm -f
+ -find . -name '*.o' -o -name '*.d' -o -name '*.gcno' -o -name '*.gcda' -o -name '*.so' | xargs rm -f
#for i in $(PLUGINS) ; do $(MAKE) -C plugins/$$i clean ; done
for i in libcommon tests ; do $(MAKE) -C $$i clean ; done
@@ -182,6 +145,7 @@ DISTFILES= \
README.txt \
LICENSE.txt \
Makefile \
+ common.mk \
googletest \
googlemock \
debian/changelog \
@@ -253,6 +217,6 @@ dist: clean
rm -rf $(PROJECTNAME)-$(VERSION)
ls -l ../$(PROJECTNAME)-$(VERSION).tar.xz
-.PHONY: clean all zip test install deb deb-src debs all $(DISTROS)
+.PHONY: clean all zip test install deb deb-src debs all $(DISTROS) $(PLUGINS)
-include $(wildcard $(SRC:.cpp=.d))