Upgrade to 1.46.0
[platform/upstream/nghttp2.git] / src / Makefile.am
1 # nghttp2 - HTTP/2 C Library
2
3 # Copyright (c) 2012 Tatsuhiro Tsujikawa
4
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
12
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
15
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 SUBDIRS = includes
24
25 EXTRA_DIST = \
26         CMakeLists.txt \
27         test.example.com.pem \
28         test.nghttp2.org.pem
29
30 bin_PROGRAMS =
31 check_PROGRAMS =
32 TESTS =
33
34 AM_CFLAGS = $(WARNCFLAGS) -fPIE
35 AM_CXXFLAGS = $(WARNCXXFLAGS) $(CXX1XCXXFLAGS)
36 AM_CPPFLAGS = \
37         -DPKGDATADIR='"$(pkgdatadir)"' \
38         -DPKGLIBDIR='"$(pkglibdir)"' \
39         -I$(top_srcdir)/lib/includes \
40         -I$(top_builddir)/lib/includes \
41         -I$(top_srcdir)/lib \
42         -I$(top_srcdir)/src/includes \
43         -I$(top_srcdir)/third-party \
44         -I$(top_srcdir)/third-party/llhttp/include \
45         @JEMALLOC_CFLAGS@ \
46         @LIBXML2_CFLAGS@ \
47         @LIBEV_CFLAGS@ \
48         @LIBNGHTTP3_CFLAGS@ \
49         @LIBNGTCP2_CRYPTO_OPENSSL_CFLAGS@ \
50         @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ \
51         @LIBNGTCP2_CFLAGS@ \
52         @OPENSSL_CFLAGS@ \
53         @LIBCARES_CFLAGS@ \
54         @JANSSON_CFLAGS@ \
55         @LIBBPF_CFLAGS@ \
56         @ZLIB_CFLAGS@ \
57         @EXTRA_DEFS@ \
58         @DEFS@ \
59         -fPIE
60 AM_LDFLAGS = @LIBTOOL_LDFLAGS@
61
62 LDADD = $(top_builddir)/lib/libnghttp2.la \
63         $(top_builddir)/third-party/liburl-parser.la \
64         $(top_builddir)/third-party/libllhttp.la \
65         @JEMALLOC_LIBS@ \
66         @LIBXML2_LIBS@ \
67         @LIBEV_LIBS@ \
68         @LIBNGHTTP3_LIBS@ \
69         @LIBNGTCP2_CRYPTO_OPENSSL_LIBS@ \
70         @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ \
71         @LIBNGTCP2_LIBS@ \
72         @OPENSSL_LIBS@ \
73         @LIBCARES_LIBS@ \
74         @SYSTEMD_LIBS@ \
75         @JANSSON_LIBS@ \
76         @LIBBPF_LIBS@ \
77         @ZLIB_LIBS@ \
78         @APPLDFLAGS@
79
80 if ENABLE_APP
81
82 bin_PROGRAMS += nghttp nghttpd nghttpx
83
84 HELPER_OBJECTS = util.cc \
85         http2.cc timegm.c app_helper.cc nghttp2_gzip.c
86 HELPER_HFILES = util.h \
87         http2.h timegm.h app_helper.h nghttp2_config.h \
88         nghttp2_gzip.h network.h
89
90 HTML_PARSER_OBJECTS =
91 HTML_PARSER_HFILES = HtmlParser.h
92
93 if HAVE_LIBXML2
94 HTML_PARSER_OBJECTS += HtmlParser.cc
95 endif # HAVE_LIBXML2
96
97 nghttp_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttp.cc nghttp.h \
98         ${HTML_PARSER_OBJECTS} ${HTML_PARSER_HFILES} \
99         tls.cc tls.h
100
101 nghttpd_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttpd.cc \
102         tls.cc tls.h \
103         HttpServer.cc HttpServer.h
104
105 bin_PROGRAMS += h2load
106
107 h2load_SOURCES = util.cc util.h \
108         http2.cc http2.h h2load.cc h2load.h \
109         timegm.c timegm.h \
110         tls.cc tls.h \
111         h2load_session.h \
112         h2load_http2_session.cc h2load_http2_session.h \
113         h2load_http1_session.cc h2load_http1_session.h
114
115 if ENABLE_HTTP3
116 h2load_SOURCES += \
117         h2load_http3_session.cc h2load_http3_session.h \
118         h2load_quic.cc h2load_quic.h \
119         quic.cc quic.h
120 endif # ENABLE_HTTP3
121
122 NGHTTPX_SRCS = \
123         util.cc util.h http2.cc http2.h timegm.c timegm.h base64.h \
124         app_helper.cc app_helper.h \
125         tls.cc tls.h \
126         shrpx_config.cc shrpx_config.h \
127         shrpx_error.h \
128         shrpx_accept_handler.cc shrpx_accept_handler.h \
129         shrpx_connection_handler.cc shrpx_connection_handler.h \
130         shrpx_client_handler.cc shrpx_client_handler.h \
131         shrpx_upstream.h \
132         shrpx_http2_upstream.cc shrpx_http2_upstream.h \
133         shrpx_https_upstream.cc shrpx_https_upstream.h \
134         shrpx_downstream.cc shrpx_downstream.h \
135         shrpx_downstream_connection.cc shrpx_downstream_connection.h \
136         shrpx_http_downstream_connection.cc shrpx_http_downstream_connection.h \
137         shrpx_http2_downstream_connection.cc shrpx_http2_downstream_connection.h \
138         shrpx_http2_session.cc shrpx_http2_session.h \
139         shrpx_downstream_queue.cc shrpx_downstream_queue.h \
140         shrpx_log.cc shrpx_log.h \
141         shrpx_http.cc shrpx_http.h \
142         shrpx_io_control.cc shrpx_io_control.h \
143         shrpx_tls.cc shrpx_tls.h \
144         shrpx_worker.cc shrpx_worker.h \
145         shrpx_log_config.cc shrpx_log_config.h \
146         shrpx_connect_blocker.cc shrpx_connect_blocker.h \
147         shrpx_live_check.cc shrpx_live_check.h \
148         shrpx_downstream_connection_pool.cc shrpx_downstream_connection_pool.h \
149         shrpx_rate_limit.cc shrpx_rate_limit.h \
150         shrpx_connection.cc shrpx_connection.h \
151         shrpx_memcached_dispatcher.cc shrpx_memcached_dispatcher.h \
152         shrpx_memcached_connection.cc shrpx_memcached_connection.h \
153         shrpx_memcached_request.h \
154         shrpx_memcached_result.h \
155         shrpx_worker_process.cc shrpx_worker_process.h \
156         shrpx_process.h \
157         shrpx_signal.cc shrpx_signal.h \
158         shrpx_router.cc shrpx_router.h \
159         shrpx_api_downstream_connection.cc shrpx_api_downstream_connection.h \
160         shrpx_health_monitor_downstream_connection.cc \
161         shrpx_health_monitor_downstream_connection.h \
162         shrpx_null_downstream_connection.cc shrpx_null_downstream_connection.h \
163         shrpx_exec.cc shrpx_exec.h \
164         shrpx_dns_resolver.cc shrpx_dns_resolver.h \
165         shrpx_dual_dns_resolver.cc shrpx_dual_dns_resolver.h \
166         shrpx_dns_tracker.cc shrpx_dns_tracker.h \
167         buffer.h memchunk.h template.h allocator.h \
168         xsi_strerror.c xsi_strerror.h
169
170 if HAVE_MRUBY
171 NGHTTPX_SRCS += \
172         shrpx_mruby.cc shrpx_mruby.h \
173         shrpx_mruby_module.cc shrpx_mruby_module.h \
174         shrpx_mruby_module_env.cc shrpx_mruby_module_env.h \
175         shrpx_mruby_module_request.cc shrpx_mruby_module_request.h \
176         shrpx_mruby_module_response.cc shrpx_mruby_module_response.h
177 endif # HAVE_MRUBY
178
179 if ENABLE_HTTP3
180 NGHTTPX_SRCS += \
181         shrpx_quic.cc shrpx_quic.h \
182         shrpx_quic_listener.cc shrpx_quic_listener.h \
183         shrpx_quic_connection_handler.cc shrpx_quic_connection_handler.h \
184         shrpx_http3_upstream.cc shrpx_http3_upstream.h \
185         http3.cc http3.h \
186         quic.cc quic.h
187 endif # ENABLE_HTTP3
188
189 noinst_LIBRARIES = libnghttpx.a
190 libnghttpx_a_SOURCES = ${NGHTTPX_SRCS}
191 libnghttpx_a_CPPFLAGS = ${AM_CPPFLAGS}
192
193 nghttpx_SOURCES = shrpx.cc shrpx.h
194 nghttpx_CPPFLAGS = ${libnghttpx_a_CPPFLAGS}
195 nghttpx_LDADD = libnghttpx.a ${LDADD}
196 nghttpx_LDFLAGS = -pie
197
198 if HAVE_MRUBY
199 libnghttpx_a_CPPFLAGS += \
200         -I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@
201 nghttpx_LDADD += -L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@
202 endif # HAVE_MRUBY
203
204 if HAVE_NEVERBLEED
205 libnghttpx_a_CPPFLAGS += -I${top_srcdir}/third-party/neverbleed
206 nghttpx_LDADD += ${top_builddir}/third-party/libneverbleed.la
207 endif # HAVE_NEVERBLEED
208
209 if HAVE_CUNIT
210 check_PROGRAMS += nghttpx-unittest
211 nghttpx_unittest_SOURCES = shrpx-unittest.cc \
212         shrpx_tls_test.cc shrpx_tls_test.h \
213         shrpx_downstream_test.cc shrpx_downstream_test.h \
214         shrpx_config_test.cc shrpx_config_test.h \
215         shrpx_worker_test.cc shrpx_worker_test.h \
216         shrpx_http_test.cc shrpx_http_test.h \
217         shrpx_router_test.cc shrpx_router_test.h \
218         http2_test.cc http2_test.h \
219         util_test.cc util_test.h \
220         nghttp2_gzip_test.c nghttp2_gzip_test.h \
221         nghttp2_gzip.c nghttp2_gzip.h \
222         buffer_test.cc buffer_test.h \
223         memchunk_test.cc memchunk_test.h \
224         template_test.cc template_test.h \
225         base64_test.cc base64_test.h
226 nghttpx_unittest_CPPFLAGS = ${AM_CPPFLAGS} \
227         -DNGHTTP2_SRC_DIR=\"$(top_srcdir)/src\"
228 nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} @CUNIT_LIBS@ @TESTLDADD@
229
230 if HAVE_MRUBY
231 nghttpx_unittest_CPPFLAGS += \
232         -I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@
233 nghttpx_unittest_LDADD += \
234         -L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@
235 endif # HAVE_MRUBY
236
237 if HAVE_NEVERBLEED
238 nghttpx_unittest_CPPFLAGS += -I${top_srcdir}/third-party/neverbleed
239 nghttpx_unittest_LDADD += ${top_builddir}/third-party/libneverbleed.la
240 endif # HAVE_NEVERBLEED
241
242 TESTS += nghttpx-unittest
243 endif # HAVE_CUNIT
244
245 endif # ENABLE_APP
246
247 if ENABLE_HPACK_TOOLS
248
249 bin_PROGRAMS += inflatehd deflatehd
250
251 HPACK_TOOLS_COMMON_SRCS = comp_helper.c comp_helper.h
252
253 inflatehd_SOURCES = inflatehd.cc $(HPACK_TOOLS_COMMON_SRCS)
254
255 deflatehd_SOURCES = deflatehd.cc $(HPACK_TOOLS_COMMON_SRCS)
256
257 endif # ENABLE_HPACK_TOOLS
258
259 if ENABLE_ASIO_LIB
260
261 pkgconfigdir = $(libdir)/pkgconfig
262 pkgconfig_DATA = libnghttp2_asio.pc
263 DISTCLEANFILES = $(pkgconfig_DATA)
264
265 lib_LTLIBRARIES = libnghttp2_asio.la
266
267 libnghttp2_asio_la_SOURCES = \
268         util.cc util.h http2.cc http2.h \
269         tls.cc tls.h \
270         ssl_compat.h \
271         timegm.c timegm.h \
272         asio_common.cc asio_common.h \
273         asio_io_service_pool.cc asio_io_service_pool.h \
274         asio_server_http2.cc \
275         asio_server_http2_impl.cc asio_server_http2_impl.h \
276         asio_server.cc asio_server.h \
277         asio_server_http2_handler.cc asio_server_http2_handler.h \
278         asio_server_connection.h \
279         asio_server_request.cc \
280         asio_server_request_impl.cc asio_server_request_impl.h \
281         asio_server_response.cc \
282         asio_server_response_impl.cc asio_server_response_impl.h \
283         asio_server_stream.cc asio_server_stream.h \
284         asio_server_serve_mux.cc asio_server_serve_mux.h \
285         asio_server_request_handler.cc asio_server_request_handler.h \
286         asio_server_tls_context.cc asio_server_tls_context.h \
287         asio_client_session.cc \
288         asio_client_session_impl.cc asio_client_session_impl.h \
289         asio_client_session_tcp_impl.cc asio_client_session_tcp_impl.h \
290         asio_client_session_tls_impl.cc asio_client_session_tls_impl.h \
291         asio_client_response.cc \
292         asio_client_response_impl.cc asio_client_response_impl.h \
293         asio_client_request.cc \
294         asio_client_request_impl.cc asio_client_request_impl.h \
295         asio_client_stream.cc asio_client_stream.h \
296         asio_client_tls_context.cc asio_client_tls_context.h
297
298
299 libnghttp2_asio_la_CPPFLAGS = ${AM_CPPFLAGS} ${BOOST_CPPFLAGS} -fPIE
300 libnghttp2_asio_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 1:0:0 -pie
301 libnghttp2_asio_la_LIBADD = \
302         $(top_builddir)/lib/libnghttp2.la \
303         $(top_builddir)/third-party/liburl-parser.la \
304         $(top_builddir)/third-party/libllhttp.la \
305         @OPENSSL_LIBS@ \
306         ${BOOST_LDFLAGS} \
307         ${BOOST_ASIO_LIB} \
308         ${BOOST_THREAD_LIB} \
309         ${BOOST_SYSTEM_LIB}
310
311 endif # ENABLE_ASIO_LIB