Apply PIE to nghttpx
[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         -I$(top_srcdir)/lib/includes \
39         -I$(top_builddir)/lib/includes \
40         -I$(top_srcdir)/lib \
41         -I$(top_srcdir)/src/includes \
42         -I$(top_srcdir)/third-party \
43         -I$(top_srcdir)/third-party/llhttp/include \
44         @LIBXML2_CFLAGS@ \
45         @LIBEV_CFLAGS@ \
46         @OPENSSL_CFLAGS@ \
47         @LIBCARES_CFLAGS@ \
48         @JANSSON_CFLAGS@ \
49         @ZLIB_CFLAGS@ \
50         @DEFS@ \
51         -fPIE
52
53 LDADD = $(top_builddir)/lib/libnghttp2.la \
54         $(top_builddir)/third-party/liburl-parser.la \
55         $(top_builddir)/third-party/libllhttp.la \
56         @JEMALLOC_LIBS@ \
57         @LIBXML2_LIBS@ \
58         @LIBEV_LIBS@ \
59         @OPENSSL_LIBS@ \
60         @LIBCARES_LIBS@ \
61         @SYSTEMD_LIBS@ \
62         @JANSSON_LIBS@ \
63         @ZLIB_LIBS@ \
64         @APPLDFLAGS@
65
66 if ENABLE_APP
67
68 bin_PROGRAMS += nghttp nghttpd nghttpx
69
70 HELPER_OBJECTS = util.cc \
71         http2.cc timegm.c app_helper.cc nghttp2_gzip.c
72 HELPER_HFILES = util.h \
73         http2.h timegm.h app_helper.h nghttp2_config.h \
74         nghttp2_gzip.h network.h
75
76 HTML_PARSER_OBJECTS =
77 HTML_PARSER_HFILES = HtmlParser.h
78
79 if HAVE_LIBXML2
80 HTML_PARSER_OBJECTS += HtmlParser.cc
81 endif # HAVE_LIBXML2
82
83 nghttp_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttp.cc nghttp.h \
84         ${HTML_PARSER_OBJECTS} ${HTML_PARSER_HFILES} \
85         tls.cc tls.h
86
87 nghttpd_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttpd.cc \
88         tls.cc tls.h \
89         HttpServer.cc HttpServer.h
90
91 bin_PROGRAMS += h2load
92
93 h2load_SOURCES = util.cc util.h \
94         http2.cc http2.h h2load.cc h2load.h \
95         timegm.c timegm.h \
96         tls.cc tls.h \
97         h2load_session.h \
98         h2load_http2_session.cc h2load_http2_session.h \
99         h2load_http1_session.cc h2load_http1_session.h
100
101 NGHTTPX_SRCS = \
102         util.cc util.h http2.cc http2.h timegm.c timegm.h base64.h \
103         app_helper.cc app_helper.h \
104         tls.cc tls.h \
105         shrpx_config.cc shrpx_config.h \
106         shrpx_error.h \
107         shrpx_accept_handler.cc shrpx_accept_handler.h \
108         shrpx_connection_handler.cc shrpx_connection_handler.h \
109         shrpx_client_handler.cc shrpx_client_handler.h \
110         shrpx_upstream.h \
111         shrpx_http2_upstream.cc shrpx_http2_upstream.h \
112         shrpx_https_upstream.cc shrpx_https_upstream.h \
113         shrpx_downstream.cc shrpx_downstream.h \
114         shrpx_downstream_connection.cc shrpx_downstream_connection.h \
115         shrpx_http_downstream_connection.cc shrpx_http_downstream_connection.h \
116         shrpx_http2_downstream_connection.cc shrpx_http2_downstream_connection.h \
117         shrpx_http2_session.cc shrpx_http2_session.h \
118         shrpx_downstream_queue.cc shrpx_downstream_queue.h \
119         shrpx_log.cc shrpx_log.h \
120         shrpx_http.cc shrpx_http.h \
121         shrpx_io_control.cc shrpx_io_control.h \
122         shrpx_tls.cc shrpx_tls.h \
123         shrpx_worker.cc shrpx_worker.h \
124         shrpx_log_config.cc shrpx_log_config.h \
125         shrpx_connect_blocker.cc shrpx_connect_blocker.h \
126         shrpx_live_check.cc shrpx_live_check.h \
127         shrpx_downstream_connection_pool.cc shrpx_downstream_connection_pool.h \
128         shrpx_rate_limit.cc shrpx_rate_limit.h \
129         shrpx_connection.cc shrpx_connection.h \
130         shrpx_memcached_dispatcher.cc shrpx_memcached_dispatcher.h \
131         shrpx_memcached_connection.cc shrpx_memcached_connection.h \
132         shrpx_memcached_request.h \
133         shrpx_memcached_result.h \
134         shrpx_worker_process.cc shrpx_worker_process.h \
135         shrpx_process.h \
136         shrpx_signal.cc shrpx_signal.h \
137         shrpx_router.cc shrpx_router.h \
138         shrpx_api_downstream_connection.cc shrpx_api_downstream_connection.h \
139         shrpx_health_monitor_downstream_connection.cc \
140         shrpx_health_monitor_downstream_connection.h \
141         shrpx_exec.cc shrpx_exec.h \
142         shrpx_dns_resolver.cc shrpx_dns_resolver.h \
143         shrpx_dual_dns_resolver.cc shrpx_dual_dns_resolver.h \
144         shrpx_dns_tracker.cc shrpx_dns_tracker.h \
145         buffer.h memchunk.h template.h allocator.h \
146         xsi_strerror.c xsi_strerror.h
147
148 if HAVE_MRUBY
149 NGHTTPX_SRCS += \
150         shrpx_mruby.cc shrpx_mruby.h \
151         shrpx_mruby_module.cc shrpx_mruby_module.h \
152         shrpx_mruby_module_env.cc shrpx_mruby_module_env.h \
153         shrpx_mruby_module_request.cc shrpx_mruby_module_request.h \
154         shrpx_mruby_module_response.cc shrpx_mruby_module_response.h
155 endif # HAVE_MRUBY
156
157 noinst_LIBRARIES = libnghttpx.a
158 libnghttpx_a_SOURCES = ${NGHTTPX_SRCS}
159 libnghttpx_a_CPPFLAGS = ${AM_CPPFLAGS}
160
161 nghttpx_SOURCES = shrpx.cc shrpx.h
162 nghttpx_CPPFLAGS = ${libnghttpx_a_CPPFLAGS}
163 nghttpx_LDADD = libnghttpx.a ${LDADD}
164 nghttpx_LDFLAGS = -pie
165
166 if HAVE_MRUBY
167 libnghttpx_a_CPPFLAGS += \
168         -I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@
169 nghttpx_LDADD += -L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@
170 endif # HAVE_MRUBY
171
172 if HAVE_NEVERBLEED
173 libnghttpx_a_CPPFLAGS += -I${top_srcdir}/third-party/neverbleed
174 nghttpx_LDADD += ${top_builddir}/third-party/libneverbleed.la
175 endif # HAVE_NEVERBLEED
176
177 if HAVE_CUNIT
178 check_PROGRAMS += nghttpx-unittest
179 nghttpx_unittest_SOURCES = shrpx-unittest.cc \
180         shrpx_tls_test.cc shrpx_tls_test.h \
181         shrpx_downstream_test.cc shrpx_downstream_test.h \
182         shrpx_config_test.cc shrpx_config_test.h \
183         shrpx_worker_test.cc shrpx_worker_test.h \
184         shrpx_http_test.cc shrpx_http_test.h \
185         shrpx_router_test.cc shrpx_router_test.h \
186         http2_test.cc http2_test.h \
187         util_test.cc util_test.h \
188         nghttp2_gzip_test.c nghttp2_gzip_test.h \
189         nghttp2_gzip.c nghttp2_gzip.h \
190         buffer_test.cc buffer_test.h \
191         memchunk_test.cc memchunk_test.h \
192         template_test.cc template_test.h \
193         base64_test.cc base64_test.h
194 nghttpx_unittest_CPPFLAGS = ${AM_CPPFLAGS} \
195         -DNGHTTP2_SRC_DIR=\"$(top_srcdir)/src\"
196 nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} @CUNIT_LIBS@ @TESTLDADD@
197
198 if HAVE_MRUBY
199 nghttpx_unittest_CPPFLAGS += \
200         -I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@
201 nghttpx_unittest_LDADD += \
202         -L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@
203 endif # HAVE_MRUBY
204
205 if HAVE_NEVERBLEED
206 nghttpx_unittest_CPPFLAGS += -I${top_srcdir}/third-party/neverbleed
207 nghttpx_unittest_LDADD += ${top_builddir}/third-party/libneverbleed.la
208 endif # HAVE_NEVERBLEED
209
210 TESTS += nghttpx-unittest
211 endif # HAVE_CUNIT
212
213 endif # ENABLE_APP
214
215 if ENABLE_HPACK_TOOLS
216
217 bin_PROGRAMS += inflatehd deflatehd
218
219 HPACK_TOOLS_COMMON_SRCS = comp_helper.c comp_helper.h
220
221 inflatehd_SOURCES = inflatehd.cc $(HPACK_TOOLS_COMMON_SRCS)
222
223 deflatehd_SOURCES = deflatehd.cc $(HPACK_TOOLS_COMMON_SRCS)
224
225 endif # ENABLE_HPACK_TOOLS
226
227 if ENABLE_ASIO_LIB
228
229 pkgconfigdir = $(libdir)/pkgconfig
230 pkgconfig_DATA = libnghttp2_asio.pc
231 DISTCLEANFILES = $(pkgconfig_DATA)
232
233 lib_LTLIBRARIES = libnghttp2_asio.la
234
235 libnghttp2_asio_la_SOURCES = \
236         util.cc util.h http2.cc http2.h \
237         tls.cc tls.h \
238         ssl_compat.h \
239         timegm.c timegm.h \
240         asio_common.cc asio_common.h \
241         asio_io_service_pool.cc asio_io_service_pool.h \
242         asio_server_http2.cc \
243         asio_server_http2_impl.cc asio_server_http2_impl.h \
244         asio_server.cc asio_server.h \
245         asio_server_http2_handler.cc asio_server_http2_handler.h \
246         asio_server_connection.h \
247         asio_server_request.cc \
248         asio_server_request_impl.cc asio_server_request_impl.h \
249         asio_server_response.cc \
250         asio_server_response_impl.cc asio_server_response_impl.h \
251         asio_server_stream.cc asio_server_stream.h \
252         asio_server_serve_mux.cc asio_server_serve_mux.h \
253         asio_server_request_handler.cc asio_server_request_handler.h \
254         asio_server_tls_context.cc asio_server_tls_context.h \
255         asio_client_session.cc \
256         asio_client_session_impl.cc asio_client_session_impl.h \
257         asio_client_session_tcp_impl.cc asio_client_session_tcp_impl.h \
258         asio_client_session_tls_impl.cc asio_client_session_tls_impl.h \
259         asio_client_response.cc \
260         asio_client_response_impl.cc asio_client_response_impl.h \
261         asio_client_request.cc \
262         asio_client_request_impl.cc asio_client_request_impl.h \
263         asio_client_stream.cc asio_client_stream.h \
264         asio_client_tls_context.cc asio_client_tls_context.h
265
266 libnghttp2_asio_la_CPPFLAGS = ${AM_CPPFLAGS} ${BOOST_CPPFLAGS} -fPIE
267 libnghttp2_asio_la_LDFLAGS = -no-undefined -version-info 1:0:0 -pie
268 libnghttp2_asio_la_LIBADD = \
269         $(top_builddir)/lib/libnghttp2.la \
270         $(top_builddir)/third-party/liburl-parser.la \
271         $(top_builddir)/third-party/libllhttp.la \
272         @OPENSSL_LIBS@ \
273         ${BOOST_LDFLAGS} \
274         ${BOOST_ASIO_LIB} \
275         ${BOOST_THREAD_LIB} \
276         ${BOOST_SYSTEM_LIB}
277
278 endif # ENABLE_ASIO_LIB