-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
123 lines (116 loc) · 4.82 KB
/
Makefile
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
# Copyright (C) 2019-2020 Tristan
# For conditions of distribution
# and use, see copyright notice in
# the COPYING file.
OUTPUTFILE = bin/server
CFLAGS = -O3 -Wall -g -Isrc
LDBROTLI = `pkg-config --static --libs libbrotlicommon libbrotlienc`
LDFLAGS = -pthread `pkg-config --static --libs openssl zlib libbrotlicommon libbrotlienc`
CC = c89
# unfortunately, because of the 'bin/build.txt' hack we can't use the '$^' macro, because bin/build.txt isn't accepted by ld, maybe a FIXME?
HTTPBINARIES = bin/http/parser.so \
bin/http/common.so \
bin/http/http1.so \
bin/http/header_list.so \
bin/http/response_headers.so \
bin/http/header_parser.so
HTTP2BINARIES = bin/http2/constants.so \
bin/http2/core.so \
bin/http2/dynamic_table.so \
bin/http2/frame.so \
bin/http2/hpack.so \
bin/http2/huffman.so \
bin/http2/static_table.so \
bin/http2/stream.so
GENERALBINARIES = bin/base/global_settings.so \
bin/base/thread_manager.so \
bin/client.so \
bin/config/reader.so \
bin/config/validation.so \
bin/handling/handlers.so \
bin/secure/implopenssl.so \
bin/server.so \
bin/threads.so \
bin/utils/encoders.so \
bin/utils/fileutil.so \
bin/utils/io.so \
bin/utils/mime.so \
bin/utils/util.so
SUBBINARIES = $(GENERALBINARIES) $(HTTPBINARIES) $(HTTP2BINARIES)
$(OUTPUTFILE): src/main.c bin/build.txt $(SUBBINARIES)
$(CC) $(CFLAGS) -DENCODERS_ENABLE_BROTLI -o $@ $< $(SUBBINARIES) $(LDFLAGS)
bin/build.txt: # a hack to create the bin folder only once
mkdir -p bin/base
mkdir -p bin/config
mkdir -p bin/handling
mkdir -p bin/http
mkdir -p bin/http2
mkdir -p bin/secure
mkdir -p bin/utils
touch bin/build.txt
# General Binaries
bin/base/global_settings.so: src/base/global_settings.c src/base/global_settings.h src/configuration/config.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/base/thread_manager.so: src/base/thread_manager.c src/base/thread_manager.h
$(CC) -o $@ -c $(CFLAGS) $< -pthread
bin/client.so: src/client.c src/client.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/config/reader.so: src/configuration/reader.c src/configuration/config.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/config/validation.so: src/configuration/validator.c src/configuration/config.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/handling/handlers.so: src/handling/handlers.c src/handling/handlers.h src/handling/fileserver.c src/handling/fallback_responses.c src/handling/handler_utils.c
$(CC) -o $@ -c $(CFLAGS) $<
bin/secure/implopenssl.so: src/secure/impl/implopenssl.c src/secure/tlsutil.h src/secure/impl/ossl-ocsp.c src/utils/fileutil.h
$(CC) -o $@ -c $(CFLAGS) $< $(LDFLAGS)
bin/threads.so: src/utils/threads.c src/utils/threads.h
$(CC) -o $@ -c $(CFLAGS) $< -pthread
bin/server.so: src/server.c src/server.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/utils/encoders.so: src/utils/encoders.c src/utils/encoders.h
$(CC) -o $@ -c $(CFLAGS) $< $(LDBROTLI) -DENCODERS_ENABLE_BROTLI
bin/utils/fileutil.so: src/utils/fileutil.c src/utils/fileutil.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/utils/io.so: src/utils/io.c src/utils/io.h src/secure/tlsutil.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/utils/mime.so: src/utils/mime.c src/utils/mime.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/utils/util.so: src/utils/util.c src/utils/util.h
$(CC) -o $@ -c $(CFLAGS) $<
# HTTP/1.x Binaries
bin/http/http1.so: src/http/http1.c src/http/http1.h bin/http/parser.so
$(CC) -o $@ -c $(CFLAGS) $<
bin/http/common.so: src/http/common.c src/http/common.h src/utils/io.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http/header_list.so: src/http/header_list.c src/http/header_list.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http/header_parser.so: src/http/header_parser.c src/http/header_parser.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http/parser.so: src/http/parser.c src/http/parser.h src/utils/io.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http/response_headers.so: src/http/response_headers.c src/http/response_headers.h
$(CC) -o $@ -c $(CFLAGS) $<
# HTTP/2 Binaries
bin/http2/constants.so: src/http2/constants.c src/http2/constants.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http2/core.so: src/http2/core.c src/http2/core.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http2/dynamic_table.so: src/http2/dynamic_table.c src/http2/dynamic_table.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http2/frame.so: src/http2/frame.c src/http2/frame.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http2/hpack.so: src/http2/hpack.c src/http2/hpack.h bin/http2/dynamic_table.so bin/http2/huffman.so
$(CC) -o $@ -c $(CFLAGS) $<
bin/http2/huffman.so: src/http2/huffman.c src/http2/huffman.h src/http2/huffman_table.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http2/static_table.so: src/http2/static_table.c src/http2/static_table.h
$(CC) -o $@ -c $(CFLAGS) $<
bin/http2/stream.so: src/http2/stream.c src/http2/stream.h
$(CC) -o $@ -c $(CFLAGS) $<
memtest:
valgrind --leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--verbose \
--log-file=memtest-out.txt \
$(OUTPUTFILE)