1# libts Makefile.am
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
21noinst_PROGRAMS = mkdfa CompileParseRules
22check_PROGRAMS = test_geometry test_X509HostnameValidator test_tscore
23
24if EXPENSIVE_TESTS
25check_PROGRAMS += test_atomic test_freelist
26endif
27
28TESTS_ENVIRONMENT = LSAN_OPTIONS=suppressions=$(abs_top_srcdir)/ci/asan_leak_suppression/unit_tests.txt
29
30TESTS = $(check_PROGRAMS)
31
32lib_LTLIBRARIES = libtscore.la
33
34AM_CPPFLAGS += \
35	$(iocore_include_dirs) \
36	-I$(abs_top_srcdir)/include \
37	-I$(abs_top_srcdir)/lib \
38	$(TS_INCLUDES) \
39	@YAMLCPP_INCLUDES@
40
41libtscore_la_LDFLAGS = -no-undefined -version-info @TS_LIBTOOL_VERSION@ @YAMLCPP_LDFLAGS@
42libtscore_la_LIBADD = \
43	$(top_builddir)/src/tscpp/util/libtscpputil.la \
44	@HWLOC_LIBS@ \
45	@LIBOBJS@ \
46	@LIBPCRE@ \
47	@OPENSSL_LIBS@ \
48	@LIBRESOLV@ \
49	@LIBCAP@ \
50	@YAMLCPP_LIBS@ \
51	-lc
52
53libtscore_la_SOURCES = \
54	AcidPtr.cc \
55	Arena.cc \
56	ArgParser.cc \
57	BaseLogFile.cc \
58	BufferWriterFormat.cc \
59	ConsistentHash.cc \
60	ContFlags.cc \
61	CryptoHash.cc \
62	Diags.cc \
63	Errata.cc \
64	EventNotify.cc \
65	Extendible.cc \
66	fastlz.c \
67	Hash.cc \
68	HashFNV.cc \
69	HashMD5.cc \
70	HashSip.cc \
71	HostLookup.cc \
72	hugepages.cc \
73	ink_args.cc \
74	ink_assert.cc \
75	ink_base64.cc \
76	ink_cap.cc \
77	ink_code.cc \
78	ink_defs.cc \
79	InkErrno.cc \
80	ink_error.cc \
81	ink_file.cc \
82	ink_hrtime.cc \
83	ink_inet.cc \
84	ink_memory.cc \
85	ink_mutex.cc \
86	ink_queue.cc \
87	ink_queue_utils.cc \
88	ink_rand.cc \
89	ink_res_init.cc \
90	ink_res_mkquery.cc \
91	ink_resource.cc \
92	ink_rwlock.cc \
93	ink_sock.cc \
94	ink_sprintf.cc \
95	ink_stack_trace.cc \
96	ink_string.cc \
97	ink_string++.cc \
98	ink_sys_control.cc \
99	ink_syslog.cc \
100	ink_thread.cc \
101	ink_time.cc \
102	ink_uuid.cc \
103	IpMap.cc \
104	IpMapConf.cc \
105	JeAllocator.cc \
106	Layout.cc \
107	llqueue.cc \
108	lockfile.cc \
109	MatcherUtils.cc \
110	MemArena.cc \
111	MMH.cc \
112	ParseRules.cc \
113	RbTree.cc \
114	Regex.cc \
115	Regression.cc \
116	runroot.cc \
117	signals.cc \
118	SourceLocation.cc \
119	TextBuffer.cc \
120	Tokenizer.cc \
121	ts_file.cc \
122	Version.cc \
123	X509HostnameValidator.cc
124
125if HAS_HKDF
126if OPENSSL_IS_BORINGSSL
127HKDF_impl = HKDF_boringssl.cc
128else
129HKDF_impl = HKDF_openssl.cc
130endif
131libtscore_la_SOURCES += \
132  $(HKDF_impl)
133endif
134
135BufferWriterFormat.o : AM_CPPFLAGS += -Wno-char-subscripts
136
137# Special hacks to generate the parser rules
138$(srcdir)/ParseRules.cc: ParseRulesCType
139
140ParseRulesCType: CompileParseRules
141	LSAN_OPTIONS='detect_leaks=0' ./CompileParseRules
142
143mkdfa_SOURCES = mkdfa.c
144
145test_atomic_SOURCES = test_atomic.cc
146test_atomic_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la @LIBPCRE@
147
148test_freelist_SOURCES = test_freelist.cc
149test_freelist_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la @LIBPCRE@
150
151test_geometry_SOURCES = test_geometry.cc
152test_geometry_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la @LIBPCRE@
153
154test_X509HostnameValidator_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_top_srcdir)/tests/include
155test_X509HostnameValidator_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la @LIBPCRE@ @OPENSSL_LIBS@
156test_X509HostnameValidator_SOURCES = unit_tests/test_X509HostnameValidator.cc
157
158test_tscore_CPPFLAGS = $(AM_CPPFLAGS)\
159	-I$(abs_top_srcdir)/tests/include
160
161test_tscore_CXXFLAGS = -Wno-array-bounds $(AM_CXXFLAGS)
162test_tscore_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la $(top_builddir)/iocore/eventsystem/libinkevent.a @OPENSSL_LIBS@
163test_tscore_SOURCES = \
164	unit_tests/unit_test_main.cc \
165	unit_tests/test_AcidPtr.cc \
166	unit_tests/test_arena.cc \
167	unit_tests/test_ArgParser.cc \
168	unit_tests/test_BufferWriter.cc \
169	unit_tests/test_BufferWriterFormat.cc \
170	unit_tests/test_Extendible.cc \
171	unit_tests/test_History.cc \
172	unit_tests/test_ink_inet.cc \
173	unit_tests/test_ink_memory.cc \
174	unit_tests/test_IntrusiveHashMap.cc \
175	unit_tests/test_IntrusivePtr.cc \
176	unit_tests/test_IpMap.cc \
177	unit_tests/test_layout.cc \
178	unit_tests/test_List.cc \
179	unit_tests/test_MemArena.cc \
180	unit_tests/test_MT_hashtable.cc \
181  unit_tests/test_ParseRules.cc \
182	unit_tests/test_PriorityQueue.cc \
183	unit_tests/test_Ptr.cc \
184	unit_tests/test_Regex.cc \
185	unit_tests/test_Scalar.cc \
186	unit_tests/test_scoped_resource.cc \
187	unit_tests/test_Tokenizer.cc \
188	unit_tests/test_ts_file.cc \
189	unit_tests/test_Version.cc \
190	unit_tests/test_Errata.cc
191
192if HAS_HKDF
193test_tscore_SOURCES += \
194	unit_tests/test_HKDF.cc
195endif
196
197CompileParseRules_SOURCES = CompileParseRules.cc
198
199clean-local:
200	rm -f ParseRulesCType ParseRulesCTypeToLower ParseRulesCTypeToUpper
201
202clang-tidy-local: $(DIST_SOURCES)
203	$(CXX_Clang_Tidy)
204