include common.mk VERSION=$(shell dpkg-parsechangelog --show-field Version) DISTROS=debian11 ubuntu2204 ubuntu2210 PROJECTNAME=webserver TGZNAME=$(shell ls -t ../$(PROJECTNAME)-$(VERSION).tar.xz | head -n1 | sed -e 's,^../,,') PLUGINS= \ cgi \ fcgi \ redirect \ static-files \ statistics \ webbox \ weblog \ websocket CXXFLAGS+=-fPIE CXXFLAGS+=-gdwarf-4 LDLIBS+=\ -lreichwein \ -lboost_context \ -lboost_filesystem \ -lboost_timer \ -lboost_system \ -lcrypt \ -lssl -lcrypto \ -lpthread \ -ldl #-lboost_coroutine \ #-lboost_program_options \ #-lboost_thread \ #-lboost_regex \ LDFLAGS+=-pie PROGSRC=\ auth.cpp \ config.cpp \ http.cpp \ plugin.cpp \ privileges.cpp \ response.cpp \ statistics.cpp \ server.cpp \ webserver.cpp \ websocket.cpp SRC=$(PROGSRC) main.cpp build: $(PROJECTNAME) $(PLUGINS) all: build ./webserver -c webserver.conf $(PROJECTNAME): $(SRC:.cpp=.o) $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@ dep: $(SRC:.cpp=.d) %.d: %.cpp $(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $< %.o: %.cpp %.d $(CXX) $(CXXFLAGS) -c $< -o $@ $(PLUGINS): cd plugins/$@ && $(MAKE) # dependencies ADD_DEP=Makefile test: $(MAKE) -C tests install: mkdir -p $(DESTDIR)/usr/bin cp webserver $(DESTDIR)/usr/bin mkdir -p $(DESTDIR)/usr/lib/webserver/plugins set -e ; for i in $(PLUGINS) ; do make -C plugins/$$i install ; done mkdir -p $(DESTDIR)/usr/local/lib/webserver/plugins #mkdir -p $(DESTDIR)/etc #cp webserver.conf $(DESTDIR)/etc/webserver.conf # misc --------------------------------------------------- deb: # build binary deb package dpkg-buildpackage -rfakeroot deb-src: dh_clean dh_auto_clean dpkg-source -b -I.git -Iresult -Ifastcgi -Icgi-bin . $(DISTROS): deb-src sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webserver_$(VERSION).dsc -debsign result/$@/webserver_$(VERSION)_amd64.changes debs: $(DISTROS) upload: scp ../$(TGZNAME) antcom.de:/var/www/reichwein.it-download/ scp -r result antcom.de: scp -r remote-install.sh antcom.de: ssh antcom.de ./remote-install.sh $(PROJECTNAME) $(VERSION) ssh antcom.de rm -rf remote-install.sh result clean: -rm -f $(PROJECTNAME) -rm -f plugins/*.so -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 $(MAKE) -C tests clean -rm -rf result DISTFILES=$(shell git ls-files 2>/dev/null) ifeq ($(DISTFILES),) DISTFILES= \ .gitignore \ LICENSE.txt \ Makefile \ README.txt \ TODO \ auth.cpp \ auth.h \ common.mk \ config.cpp \ config.h \ debian/README.Debian \ debian/changelog \ debian/compat \ debian/control \ debian/copyright \ debian/example/banner256.png \ debian/example/favicon.ico \ debian/example/index.html \ debian/example/reichwein.css \ debian/rules \ debian/source/format \ debian/webserver.conf \ debian/webserver.dirs \ debian/webserver.docs \ debian/webserver.install \ debian/webserver.manpages \ debian/webserver.service \ http.cpp \ http.h \ install-webserver.sh \ main.cpp \ plugin.cpp \ plugin.h \ plugin_interface.h \ plugins/cgi/Makefile \ plugins/cgi/cgi.cpp \ plugins/cgi/cgi.h \ plugins/fcgi/Makefile \ plugins/fcgi/fastcgi.h \ plugins/fcgi/fcgi.cpp \ plugins/fcgi/fcgi.h \ plugins/fcgi/fcgiid.cpp \ plugins/fcgi/fcgiid.h \ plugins/fcgi/socket.cpp \ plugins/fcgi/socket.h \ plugins/redirect/Makefile \ plugins/redirect/redirect.cpp \ plugins/redirect/redirect.h \ plugins/static-files/Makefile \ plugins/static-files/static-files.cpp \ plugins/static-files/static-files.h \ plugins/statistics/Makefile \ plugins/statistics/statistics.cpp \ plugins/statistics/statistics.h \ plugins/webbox/Makefile \ plugins/webbox/html/checkbox-checked.png \ plugins/webbox/html/checkbox.png \ plugins/webbox/html/directory.png \ plugins/webbox/html/favicon.ico \ plugins/webbox/html/file.png \ plugins/webbox/html/index.html \ plugins/webbox/html/menu.png \ plugins/webbox/html/refresh-inverted.png \ plugins/webbox/html/webbox.css \ plugins/webbox/html/webbox.js \ plugins/webbox/webbox.cpp \ plugins/webbox/webbox.h \ plugins/weblog/Makefile \ plugins/weblog/html/blog.css \ plugins/weblog/html/favicon.ico \ plugins/weblog/procmail/procmail.sh \ plugins/weblog/procmail/procmailrc \ plugins/weblog/weblog.cpp \ plugins/weblog/weblog.h \ privileges.cpp \ privileges.h \ response.cpp \ response.h \ server.cpp \ server.h \ statistics.cpp \ statistics.h \ tests/Makefile \ tests/test-auth.cpp \ tests/test-config.cpp \ tests/test-environment.cpp \ tests/test-http.cpp \ tests/test-plugin.cpp \ tests/test-privileges.cpp \ tests/test-response.cpp \ tests/test-server.cpp \ tests/test-statistics.cpp \ tests/test-webserver.cpp \ websocket.cpp \ websocket.h \ webserver.1 \ webserver.conf \ webserver.cpp \ webserver.h endif dist: clean rm -rf $(PROJECTNAME)-$(VERSION) mkdir $(PROJECTNAME)-$(VERSION) cp --parents -r $(DISTFILES) $(PROJECTNAME)-$(VERSION) tar cfJ ../$(PROJECTNAME)-$(VERSION).tar.xz $(PROJECTNAME)-$(VERSION) rm -rf $(PROJECTNAME)-$(VERSION) ls -l ../$(PROJECTNAME)-$(VERSION).tar.xz dist-all: dist upload .PHONY: clean all zip test install deb deb-src debs all $(DISTROS) $(PLUGINS) -include $(wildcard $(SRC:.cpp=.d))