blob: 0cec83d3725f5634ba3178ec1c41ed1167a3d879 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
include common.mk
VERSION=$(shell dpkg-parsechangelog --show-field Version)
DISTROS=debian10 ubuntu2004 ubuntu2010
PROJECTNAME=webserver
PLUGINS= \
cgi \
fcgi \
redirect \
static-files \
statistics \
webbox \
weblog
CXXFLAGS+=-fPIE -DVERSION=\"$(VERSION)\"
LDLIBS+=\
-lcommon \
-lboost_context \
-lboost_filesystem \
-lboost_timer \
-lboost_system \
-lcrypt \
-lpthread \
-lssl -lcrypto \
-ldl
#-lboost_coroutine \
#-lboost_program_options \
#-lboost_thread \
#-lboost_regex \
LDFLAGS+=-pie -Llibcommon
PROGSRC=\
auth.cpp \
base64.cpp \
config.cpp \
http.cpp \
https.cpp \
os.cpp \
plugin.cpp \
privileges.cpp \
response.cpp \
statistics.cpp \
server.cpp
SRC=$(PROGSRC) webserver.cpp
build: $(PROJECTNAME) $(PLUGINS)
all: build
./webserver -c webserver.conf
$(PROJECTNAME): libcommon/libcommon.a $(SRC:.cpp=.o)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
libcommon/libcommon.a:
$(MAKE) -C libcommon
$(PLUGINS):
cd plugins/$@ && $(MAKE)
%.d: %.cpp
$(CXX) $(CXXFLAGS) -MM -MP -MF $@ -c $<
%.o: %.cpp %.d
$(CXX) $(CXXFLAGS) -c $< -o $@
# 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)
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
for i in libcommon tests ; do $(MAKE) -C $$i clean ; done
DISTFILES= \
archive.h \
auth.cpp \
auth.h \
base64.cpp \
base64.h \
config.cpp \
config.h \
http.cpp \
http.h \
https.cpp \
https.h \
os.cpp \
os.h \
plugin.cpp \
plugin.h \
plugin_interface.h \
privileges.cpp \
privileges.h \
response.cpp \
response.h \
server.cpp \
server.h \
statistics.cpp \
statistics.h \
tests/Makefile \
tests/test-webserver.cpp \
webserver.cpp \
webserver.1 \
README.txt \
LICENSE.txt \
Makefile \
common.mk \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/README.Debian \
debian/rules \
debian/source/format \
debian/webserver.conf \
debian/webserver.dirs \
debian/webserver.docs \
debian/webserver.install \
debian/webserver.manpages \
debian/webserver.service \
libcommon/Makefile \
libcommon/mime.h \
libcommon/mime.cpp \
libcommon/file.h \
libcommon/file.cpp \
libcommon/stringutil.h \
libcommon/stringutil.cpp \
libcommon/tempfile.h \
libcommon/tempfile.cpp \
plugins/cgi/cgi.h \
plugins/cgi/Makefile \
plugins/cgi/cgi.cpp \
plugins/fcgi/Makefile \
plugins/fcgi/fastcgi.h \
plugins/fcgi/fcgi.h \
plugins/fcgi/fcgi.cpp \
plugins/fcgi/fcgiid.h \
plugins/fcgi/fcgiid.cpp \
plugins/fcgi/socket.h \
plugins/fcgi/socket.cpp \
plugins/webbox/webbox.h \
plugins/webbox/html/refresh-inverted.png \
plugins/webbox/html/directory.png \
plugins/webbox/html/file.png \
plugins/webbox/html/menu.png \
plugins/webbox/html/webbox.css \
plugins/webbox/html/favicon.ico \
plugins/webbox/html/index.html \
plugins/webbox/html/webbox.js \
plugins/webbox/html/checkbox.png \
plugins/webbox/html/checkbox-checked.png \
plugins/webbox/Makefile \
plugins/webbox/webbox.cpp \
plugins/weblog/weblog.h \
plugins/weblog/procmail/procmailrc \
plugins/weblog/procmail/procmail.sh \
plugins/weblog/Makefile \
plugins/weblog/weblog.cpp \
plugins/redirect/Makefile \
plugins/redirect/redirect.h \
plugins/redirect/redirect.cpp \
plugins/static-files/static-files.h \
plugins/static-files/static-files.cpp \
plugins/static-files/Makefile \
plugins/statistics/statistics.h \
plugins/statistics/Makefile \
plugins/statistics/statistics.cpp
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
.PHONY: clean all zip test install deb deb-src debs all $(DISTROS) $(PLUGINS)
-include $(wildcard $(SRC:.cpp=.d))
|