1# Makefile.am for Http
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#      http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing, software
14#  distributed under the License is distributed on an "AS IS" BASIS,
15#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16#  See the License for the specific language governing permissions and
17#  limitations under the License.
18
19include $(top_srcdir)/build/tidy.mk
20
21AM_CPPFLAGS += \
22	$(iocore_include_dirs) \
23	-I$(abs_top_srcdir)/include \
24	-I$(abs_top_srcdir)/lib \
25	-I$(abs_top_srcdir)/lib/records \
26	-I$(abs_top_srcdir)/proxy \
27	-I$(abs_top_srcdir)/mgmt \
28	-I$(abs_top_srcdir)/mgmt/utils \
29	-I$(abs_top_srcdir)/proxy/hdrs \
30	-I$(abs_top_srcdir)/proxy/shared \
31	-I$(abs_top_srcdir)/proxy/http \
32	$(TS_INCLUDES) \
33	@YAMLCPP_INCLUDES@
34
35noinst_LIBRARIES = libhttp_remap.a
36
37libhttp_remap_a_SOURCES = \
38	AclFiltering.cc \
39	AclFiltering.h \
40	NextHopSelectionStrategy.h \
41	NextHopSelectionStrategy.cc \
42	NextHopConsistentHash.h \
43	NextHopConsistentHash.cc \
44	NextHopHealthStatus.cc \
45	NextHopRoundRobin.h \
46	NextHopRoundRobin.cc \
47	NextHopStrategyFactory.h \
48	NextHopStrategyFactory.cc \
49	RemapConfig.cc \
50	RemapConfig.h \
51	RemapPluginInfo.cc \
52	RemapPluginInfo.h \
53	PluginDso.cc \
54	PluginFactory.cc \
55	PluginFactory.h \
56	RemapPlugins.cc \
57	RemapPlugins.h \
58	RemapProcessor.cc \
59	RemapProcessor.h \
60	UrlMapping.cc \
61	UrlMapping.h \
62	UrlMappingPathIndex.cc \
63	UrlMappingPathIndex.h \
64	UrlRewrite.cc \
65	UrlRewrite.h
66
67COMMON_PLUGINDSO_LDADDS = \
68	$(OPENSSL_LIBS) \
69	$(top_builddir)/iocore/eventsystem/libinkevent.a \
70	$(top_builddir)/lib/records/librecords_p.a \
71	$(top_builddir)/iocore/eventsystem/libinkevent.a \
72	$(top_builddir)/src/tscore/libtscore.la \
73	$(top_builddir)/mgmt/libmgmt_p.la \
74	$(top_builddir)/proxy/shared/libUglyLogStubs.a \
75	@HWLOC_LIBS@
76
77clang-tidy-local: $(libhttp_remap_a_SOURCES)
78	$(CXX_Clang_Tidy)
79
80TESTS = $(check_PROGRAMS)
81check_PROGRAMS =  test_PluginDso test_PluginFactory test_RemapPluginInfo test_NextHopStrategyFactory test_NextHopRoundRobin test_NextHopConsistentHash
82
83test_PluginDso_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_top_srcdir)/tests/include -DPLUGIN_DSO_TESTS
84test_PluginDso_LIBTOOLFLAGS = --preserve-dup-deps
85EXTRA_test_PluginDso_DEPENDENCIES = unit-tests/plugin_v1.la
86test_PluginDso_LDADD = $(COMMON_PLUGINDSO_LDADDS)
87test_PluginDso_LDFLAGS = $(AM_LDFLAGS)
88test_PluginDso_SOURCES = \
89	unit-tests/test_PluginDso.cc \
90	unit-tests/plugin_testing_common.cc \
91	PluginDso.cc
92
93test_PluginFactory_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_top_srcdir)/tests/include -DPLUGIN_DSO_TESTS
94test_PluginFactory_LIBTOOLFLAGS = --preserve-dup-deps
95EXTRA_test_PluginFactory_DEPENDENCIES = \
96	unit-tests/plugin_v1.la \
97	unit-tests/plugin_init_fail.la \
98	unit-tests/plugin_instinit_fail.la
99test_PluginFactory_LDADD = $(COMMON_PLUGINDSO_LDADDS)
100test_PluginFactory_LDFLAGS = $(AM_LDFLAGS)
101test_PluginFactory_SOURCES = \
102	unit-tests/test_PluginFactory.cc \
103	unit-tests/plugin_testing_common.cc \
104	PluginFactory.cc \
105	PluginDso.cc \
106	RemapPluginInfo.cc
107
108test_RemapPluginInfo_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_top_srcdir)/tests/include -DPLUGIN_DSO_TESTS
109test_RemapPluginInfo_LIBTOOLFLAGS = --preserve-dup-deps
110EXTRA_test_RemapPluginInfo_DEPENDENCIES = \
111	unit-tests/plugin_missing_init.la \
112	unit-tests/plugin_missing_doremap.la \
113	unit-tests/plugin_missing_deleteinstance.la \
114	unit-tests/plugin_required_cb.la \
115	unit-tests/plugin_missing_newinstance.la \
116	unit-tests/plugin_testing_calls.la
117test_RemapPluginInfo_LDADD = $(COMMON_PLUGINDSO_LDADDS)
118test_RemapPluginInfo_LDFLAGS = $(AM_LDFLAGS)
119test_RemapPluginInfo_SOURCES = \
120	unit-tests/plugin_testing_common.cc \
121	unit-tests/test_RemapPlugin.cc \
122	PluginDso.cc \
123	RemapPluginInfo.cc
124
125test_NextHopStrategyFactory_CPPFLAGS = \
126	$(AM_CPPFLAGS) \
127	-D_NH_UNIT_TESTS_ \
128	-DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
129	-I$(abs_top_srcdir)/tests/include \
130	$(TS_INCLUDES) \
131	@YAMLCPP_INCLUDES@
132
133test_NextHopStrategyFactory_LDADD = \
134  $(top_builddir)/src/tscpp/util/libtscpputil.la \
135  $(top_builddir)/src/tscore/libtscore.la \
136  $(top_builddir)/proxy/hdrs/libhdrs.a \
137  $(top_builddir)/iocore/eventsystem/libinkevent.a \
138  $(top_builddir)/lib/records/librecords_p.a \
139  $(top_builddir)/proxy/logging/liblogging.a \
140  $(top_builddir)/mgmt/libmgmt_p.la \
141  $(top_builddir)/iocore/utils/libinkutils.a \
142	@YAMLCPP_LIBS@ \
143	@HWLOC_LIBS@
144
145test_NextHopStrategyFactory_LDFLAGS = $(AM_LDFLAGS) -L$(top_builddir)/src/tscore/.libs -ltscore
146
147test_NextHopStrategyFactory_SOURCES = \
148	NextHopSelectionStrategy.cc \
149	NextHopStrategyFactory.cc \
150	NextHopRoundRobin.cc \
151	NextHopConsistentHash.cc \
152	NextHopHealthStatus.cc \
153	unit-tests/test_NextHopStrategyFactory.cc \
154	unit-tests/nexthop_test_stubs.cc
155
156test_NextHopRoundRobin_CPPFLAGS = \
157	$(AM_CPPFLAGS) \
158	-D_NH_UNIT_TESTS_ \
159	-DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
160	-I$(abs_top_srcdir)/tests/include \
161	$(TS_INCLUDES) \
162	@YAMLCPP_INCLUDES@
163
164test_NextHopRoundRobin_LDADD = \
165  $(top_builddir)/src/tscpp/util/libtscpputil.la \
166  $(top_builddir)/src/tscore/libtscore.la \
167  $(top_builddir)/proxy/hdrs/libhdrs.a \
168  $(top_builddir)/iocore/eventsystem/libinkevent.a \
169  $(top_builddir)/lib/records/librecords_p.a \
170  $(top_builddir)/proxy/logging/liblogging.a \
171  $(top_builddir)/mgmt/libmgmt_p.la \
172  $(top_builddir)/iocore/utils/libinkutils.a \
173	@YAMLCPP_LIBS@ \
174	@HWLOC_LIBS@
175
176test_NextHopRoundRobin_LDFLAGS = $(AM_LDFLAGS) -L$(top_builddir)/src/tscore/.libs -ltscore
177
178test_NextHopRoundRobin_SOURCES = \
179	NextHopSelectionStrategy.cc \
180	NextHopStrategyFactory.cc \
181	NextHopRoundRobin.cc \
182	NextHopConsistentHash.cc \
183	NextHopHealthStatus.cc \
184	unit-tests/test_NextHopRoundRobin.cc \
185	unit-tests/nexthop_test_stubs.cc
186
187test_NextHopConsistentHash_CPPFLAGS = \
188	$(AM_CPPFLAGS) \
189	-D_NH_UNIT_TESTS_ \
190	-DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
191	-I$(abs_top_srcdir)/tests/include \
192	$(TS_INCLUDES) \
193	@YAMLCPP_INCLUDES@
194
195test_NextHopConsistentHash_LDADD = \
196  $(top_builddir)/src/tscpp/util/libtscpputil.la \
197  $(top_builddir)/src/tscore/libtscore.la \
198  $(top_builddir)/proxy/hdrs/libhdrs.a \
199  $(top_builddir)/iocore/eventsystem/libinkevent.a \
200  $(top_builddir)/lib/records/librecords_p.a \
201  $(top_builddir)/proxy/logging/liblogging.a \
202  $(top_builddir)/mgmt/libmgmt_p.la \
203  $(top_builddir)/iocore/utils/libinkutils.a \
204	@YAMLCPP_LIBS@ \
205	@HWLOC_LIBS@
206
207test_NextHopConsistentHash_LDFLAGS = $(AM_LDFLAGS) -L$(top_builddir)/src/tscore/.libs -ltscore
208
209test_NextHopConsistentHash_SOURCES = \
210	NextHopSelectionStrategy.cc \
211	NextHopStrategyFactory.cc \
212	NextHopConsistentHash.cc \
213	NextHopHealthStatus.cc \
214	NextHopRoundRobin.cc \
215	unit-tests/test_NextHopConsistentHash.cc \
216	unit-tests/nexthop_test_stubs.cc
217
218DSO_LDFLAGS = \
219	-module \
220	-shared \
221	-avoid-version \
222	-export-symbols-regex '^(TSRemapInit|TSRemapDone|TSRemapDoRemap|TSRemapNewInstance|TSRemapDeleteInstance|TSRemapOSResponse|TSRemapPreConfigReload|TSRemapPostConfigReload|TSPluginInit|pluginDsoVersionTest|getPluginDebugObjectTest)$$'
223
224# Build plugins for unit testing the plugin (re)load.
225pkglib_LTLIBRARIES = \
226	unit-tests/plugin_v1.la \
227	unit-tests/plugin_v2.la \
228	unit-tests/plugin_init_fail.la \
229	unit-tests/plugin_instinit_fail.la \
230	unit-tests/plugin_required_cb.la \
231	unit-tests/plugin_missing_deleteinstance.la \
232	unit-tests/plugin_missing_doremap.la \
233	unit-tests/plugin_missing_init.la \
234	unit-tests/plugin_missing_newinstance.la \
235	unit-tests/plugin_testing_calls.la
236unit_tests_plugin_v1_la_SOURCES = unit-tests/plugin_misc_cb.cc
237unit_tests_plugin_v1_la_LDFLAGS = $(DSO_LDFLAGS)
238unit_tests_plugin_v1_la_CPPFLAGS = -DPLUGINDSOVER=1 $(AM_CPPFLAGS)
239unit_tests_plugin_v2_la_SOURCES = unit-tests/plugin_misc_cb.cc
240unit_tests_plugin_v2_la_LDFLAGS = $(DSO_LDFLAGS)
241unit_tests_plugin_v2_la_CPPFLAGS = -DPLUGINDSOVER=2 $(AM_CPPFLAGS)
242unit_tests_plugin_init_fail_la_SOURCES = unit-tests/plugin_init_fail.cc
243unit_tests_plugin_init_fail_la_LDFLAGS = $(DSO_LDFLAGS)
244unit_tests_plugin_init_fail_la_CPPFLAGS = $(AM_CPPFLAGS)
245unit_tests_plugin_instinit_fail_la_SOURCES = unit-tests/plugin_instinit_fail.cc
246unit_tests_plugin_instinit_fail_la_LDFLAGS = $(DSO_LDFLAGS)
247unit_tests_plugin_instinit_fail_la_CPPFLAGS = $(AM_CPPFLAGS)
248unit_tests_plugin_required_cb_la_SOURCES = unit-tests/plugin_required_cb.cc
249unit_tests_plugin_required_cb_la_LDFLAGS = $(DSO_LDFLAGS)
250unit_tests_plugin_required_cb_la_CPPFLAGS = -DPLUGINDSOVER=1 $(AM_CPPFLAGS)
251unit_tests_plugin_missing_deleteinstance_la_SOURCES = unit-tests/plugin_missing_deleteinstance.cc
252unit_tests_plugin_missing_deleteinstance_la_LDFLAGS = $(DSO_LDFLAGS)
253unit_tests_plugin_missing_deleteinstance_la_CPPFLAGS = -DPLUGINDSOVER=1 $(AM_CPPFLAGS)
254unit_tests_plugin_missing_doremap_la_SOURCES = unit-tests/plugin_missing_doremap.cc
255unit_tests_plugin_missing_doremap_la_LDFLAGS = $(DSO_LDFLAGS)
256unit_tests_plugin_missing_doremap_la_CPPFLAGS = -DPLUGINDSOVER=1 $(AM_CPPFLAGS)
257unit_tests_plugin_missing_init_la_SOURCES = unit-tests/plugin_missing_init.cc
258unit_tests_plugin_missing_init_la_LDFLAGS = $(DSO_LDFLAGS)
259unit_tests_plugin_missing_init_la_CPPFLAGS = -DPLUGINDSOVER=1 $(AM_CPPFLAGS)
260unit_tests_plugin_missing_newinstance_la_SOURCES = unit-tests/plugin_missing_newinstance.cc
261unit_tests_plugin_missing_newinstance_la_LDFLAGS = $(DSO_LDFLAGS)
262unit_tests_plugin_missing_newinstance_la_CPPFLAGS = -DPLUGINDSOVER=1 $(AM_CPPFLAGS)
263unit_tests_plugin_testing_calls_la_SOURCES = unit-tests/plugin_testing_calls.cc unit-tests/plugin_testing_common.cc
264unit_tests_plugin_testing_calls_la_LDFLAGS = $(DSO_LDFLAGS)
265unit_tests_plugin_testing_calls_la_CPPFLAGS = -DPLUGINDSOVER=1 $(AM_CPPFLAGS)
266