Add config option to use dlmalloc instead of mheap
[vpp.git] / src / vppinfra.am
1 # Copyright (c) 2015 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 lib_LTLIBRARIES += libvppinfra.la
15
16 BUILT_SOURCES += vppinfra/config.h
17
18 vppinfra/config.h:
19         @echo "/** Autogenerated by Autotools **/" > $@
20         @echo "#ifndef included_clib_config_h" >> $@
21         @echo "#define included_clib_config_h" >> $@
22         @echo "#ifndef CLIB_LOG2_CACHE_LINE_BYTES " >> $@
23         @echo "#define CLIB_LOG2_CACHE_LINE_BYTES " @LOG2_CACHE_LINE_BYTES@ >> $@
24         @echo "#endif " >> $@
25         @echo "#endif " >> $@
26
27 TESTS = 
28
29 if ENABLE_TESTS
30 TESTS  +=  test_bihash_template \
31            test_bihash_vec88 \
32            test_cuckoo_bihash \
33            test_cuckoo_template\
34            test_dlist \
35            test_elf \
36            test_elog \
37            test_fifo \
38            test_flowhash_template \
39            test_format \
40            test_fpool \
41            test_hash \
42            test_heap \
43            test_longjmp \
44            test_macros \
45            test_maplog \
46            test_mheap \
47            test_pool_iterate \
48            test_ptclosure \
49            test_random \
50            test_random_isaac \
51            test_serialize \
52            test_slist \
53            test_socket \
54            test_time \
55            test_time_range \
56            test_timing_wheel \
57            test_tw_timer \
58            test_valloc \
59            test_vec \
60            test_zvec
61 endif
62
63 noinst_PROGRAMS = $(TESTS)
64 check_PROGRAMS  = $(TESTS)
65
66 test_bihash_template_SOURCES = vppinfra/test_bihash_template.c
67 test_bihash_vec88_SOURCES = vppinfra/test_bihash_vec88.c
68 test_cuckoo_template_SOURCES = vppinfra/test_cuckoo_template.c
69 test_cuckoo_bihash_SOURCES = vppinfra/test_cuckoo_bihash.c
70 test_dlist_SOURCES = vppinfra/test_dlist.c
71 test_elf_SOURCES = vppinfra/test_elf.c
72 test_elog_SOURCES = vppinfra/test_elog.c
73 test_fifo_SOURCES = vppinfra/test_fifo.c
74 test_flowhash_template_SOURCES = vppinfra/test_flowhash_template.c
75 test_format_SOURCES = vppinfra/test_format.c
76 test_fpool_SOURCES = vppinfra/test_fpool.c
77 test_hash_SOURCES = vppinfra/test_hash.c
78 test_heap_SOURCES = vppinfra/test_heap.c
79 test_longjmp_SOURCES = vppinfra/test_longjmp.c
80 test_macros_SOURCES = vppinfra/test_macros.c
81 test_maplog_SOURCES = vppinfra/test_maplog.c
82 test_mheap_SOURCES = vppinfra/test_mheap.c
83 test_pool_iterate_SOURCES = vppinfra/test_pool_iterate.c
84 test_ptclosure_SOURCES = vppinfra/test_ptclosure.c
85 test_random_isaac_SOURCES = vppinfra/test_random_isaac.c
86 test_random_SOURCES = vppinfra/test_random.c
87 test_serialize_SOURCES = vppinfra/test_serialize.c
88 test_slist_SOURCES = vppinfra/test_slist.c
89 test_socket_SOURCES = vppinfra/test_socket.c
90 test_time_SOURCES = vppinfra/test_time.c
91 test_time_range_SOURCES = vppinfra/test_time_range.c
92 test_timing_wheel_SOURCES = vppinfra/test_timing_wheel.c
93 test_tw_timer_SOURCES = vppinfra/test_tw_timer.c
94 test_valloc_SOURCES = vppinfra/test_valloc.c
95 test_vec_SOURCES = vppinfra/test_vec.c
96 test_zvec_SOURCES = vppinfra/test_zvec.c
97
98 # All unit tests use ASSERT for failure
99 # So we'll need -DDEBUG to enable ASSERTs
100 test_bihash_template_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
101 test_bihash_vec88_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
102 test_cuckoo_template_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
103 test_cuckoo_bihash_CPPFLAGS =   $(AM_CPPFLAGS) -DCLIB_DEBUG
104 test_dlist_CPPFLAGS =   $(AM_CPPFLAGS) -DCLIB_DEBUG
105 test_elf_CPPFLAGS =     $(AM_CPPFLAGS) -DCLIB_DEBUG
106 test_elog_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
107 test_fifo_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
108 test_flowhash_template_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
109 test_format_CPPFLAGS =  $(AM_CPPFLAGS) -DCLIB_DEBUG
110 test_fpool_CPPFLAGS =   $(AM_CPPFLAGS) -DCLIB_DEBUG
111 test_hash_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
112 test_heap_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
113 test_longjmp_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
114 test_macros_CPPFLAGS =  $(AM_CPPFLAGS) -DCLIB_DEBUG
115 test_maplog_CPPFLAGS =  $(AM_CPPFLAGS) -DCLIB_DEBUG
116 test_mheap_CPPFLAGS =   $(AM_CPPFLAGS) -DCLIB_DEBUG
117 test_pool_iterate_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
118 test_ptclosure_CPPFLAGS =       $(AM_CPPFLAGS) -DCLIB_DEBUG
119 test_random_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
120 test_random_isaac_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
121 test_serialize_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
122 test_slist_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
123 test_socket_CPPFLAGS =  $(AM_CPPFLAGS) -DCLIB_DEBUG
124 test_time_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
125 test_timing_wheel_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
126 test_tw_timer_CPPFLAGS =        $(AM_CPPFLAGS) -DCLIB_DEBUG
127 test_valloc_CPPFLAGS =  $(AM_CPPFLAGS) -DCLIB_DEBUG
128 test_vec_CPPFLAGS =     $(AM_CPPFLAGS) -DCLIB_DEBUG
129 test_zvec_CPPFLAGS =    $(AM_CPPFLAGS) -DCLIB_DEBUG
130
131 test_bihash_template_LDADD =    libvppinfra.la
132 test_bihash_vec88_LDADD =       libvppinfra.la
133 test_cuckoo_template_LDADD =    libvppinfra.la
134 test_cuckoo_bihash_LDADD =      libvppinfra.la
135 test_dlist_LDADD =      libvppinfra.la
136 test_elf_LDADD =        libvppinfra.la
137 test_elog_LDADD =       libvppinfra.la
138 test_fifo_LDADD =       libvppinfra.la
139 test_flowhash_template_LDADD =  libvppinfra.la
140 test_format_LDADD =     libvppinfra.la
141 test_fpool_LDADD =      libvppinfra.la
142 test_hash_LDADD =       libvppinfra.la
143 test_heap_LDADD =       libvppinfra.la
144 test_longjmp_LDADD =    libvppinfra.la
145 test_macros_LDADD =     libvppinfra.la
146 test_maplog_LDADD =     libvppinfra.la
147 test_mheap_LDADD =      libvppinfra.la
148 test_pool_iterate_LDADD =       libvppinfra.la
149 test_ptclosure_LDADD =  libvppinfra.la
150 test_random_isaac_LDADD =       libvppinfra.la
151 test_random_LDADD =     libvppinfra.la
152 test_serialize_LDADD =  libvppinfra.la
153 test_slist_LDADD =      libvppinfra.la
154 test_socket_LDADD =     libvppinfra.la
155 test_time_LDADD =       libvppinfra.la -lm
156 test_time_range_LDADD = libvppinfra.la -lm
157 test_timing_wheel_LDADD =       libvppinfra.la -lm
158 test_tw_timer_LDADD =   libvppinfra.la
159 test_valloc_LDADD =     libvppinfra.la
160 test_vec_LDADD =        libvppinfra.la
161 test_zvec_LDADD =       libvppinfra.la
162
163 test_bihash_template_LDFLAGS = -static
164 test_bihash_vec88_LDFLAGS = -static
165 test_cuckoo_template_LDFLAGS = -static
166 test_cuckoo_bihash_LDFLAGS = -static -lpthread
167 test_dlist_LDFLAGS = -static
168 test_elf_LDFLAGS = -static
169 test_elog_LDFLAGS = -static
170 test_fifo_LDFLAGS = -static
171 test_flowhash_template_LDFLAGS = -static
172 test_format_LDFLAGS = -static
173 test_fpool_LDFLAGS = -static
174 test_hash_LDFLAGS = -static
175 test_heap_LDFLAGS = -static
176 test_longjmp_LDFLAGS = -static
177 test_macros_LDFLAGS = -static
178 test_maplog_LDFLAGS = -static
179 test_mheap_LDFLAGS = -static
180 test_pool_iterate_LDFLAGS = -static
181 test_ptclosure_LDFLAGS = -static
182 test_random_isaac_LDFLAGS = -static
183 test_random_LDFLAGS = -static
184 test_serialize_LDFLAGS = -static
185 test_slist_LDFLAGS = -static
186 test_socket_LDFLAGS = -static
187 test_time_LDFLAGS = -static
188 test_time_range_LDFLAGS = -static
189 test_timing_wheel_LDFLAGS = -static
190 test_tw_timer_LDFLAGS = -static
191 test_valloc_LDFLAGS = -static
192 test_vec_LDFLAGS = -static
193 test_zvec_LDFLAGS = -static
194
195 # noinst_PROGRAMS += test_vhash
196 # test_vhash_SOURCES = vppinfra/test_vhash.c vppinfra/vhash.c
197 # test_vhash_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
198 # test_vhash_LDADD = libvppinfra.la
199 # test_vhash_LDFLAGS = -static
200
201 nobase_include_HEADERS = \
202   vppinfra/asm_mips.h \
203   vppinfra/asm_x86.h \
204   vppinfra/bihash_8_8.h \
205   vppinfra/bihash_vec8_8.h \
206   vppinfra/bihash_16_8.h \
207   vppinfra/bihash_24_8.h \
208   vppinfra/bihash_40_8.h \
209   vppinfra/bihash_48_8.h \
210   vppinfra/bihash_template.h \
211   vppinfra/bihash_template.c \
212   vppinfra/bitmap.h \
213   vppinfra/bitops.h \
214   vppinfra/byte_order.h \
215   vppinfra/cache.h \
216   vppinfra/config.h \
217   vppinfra/clib.h \
218   vppinfra/clib_error.h \
219   vppinfra/cpu.h \
220   vppinfra/crc32.h \
221   vppinfra/lb_hash_hash.h \
222   vppinfra/dlist.h \
223   vppinfra/elf.h \
224   vppinfra/elf_clib.h \
225   vppinfra/elog.h \
226   vppinfra/fheap.h \
227   vppinfra/error.h \
228   vppinfra/error_bootstrap.h \
229   vppinfra/fifo.h \
230   vppinfra/file.h \
231   vppinfra/flowhash_template.h \
232   vppinfra/flowhash_8_8.h \
233   vppinfra/flowhash_24_16.h \
234   vppinfra/format.h \
235   vppinfra/graph.h \
236   vppinfra/hash.h \
237   vppinfra/heap.h \
238   vppinfra/linux/sysfs.h \
239   vppinfra/linux/syscall.h \
240   vppinfra/lock.h \
241   vppinfra/longjmp.h \
242   vppinfra/macros.h \
243   vppinfra/maplog.h \
244   vppinfra/math.h \
245   vppinfra/mem.h \
246   vppinfra/memcpy_sse3.h \
247   vppinfra/memcpy_avx2.h \
248   vppinfra/memcpy_avx512.h \
249   vppinfra/mhash.h \
250   vppinfra/mheap.h \
251   vppinfra/os.h \
252   vppinfra/pipeline.h \
253   vppinfra/pool.h \
254   vppinfra/ptclosure.h \
255   vppinfra/random.h \
256   vppinfra/random_buffer.h \
257   vppinfra/random_isaac.h \
258   vppinfra/serialize.h \
259   vppinfra/slist.h \
260   vppinfra/smp.h \
261   vppinfra/socket.h \
262   vppinfra/sparse_vec.h \
263   vppinfra/string.h \
264   vppinfra/time.h \
265   vppinfra/time_range.h \
266   vppinfra/timing_wheel.h \
267   vppinfra/timer.h \
268   vppinfra/tw_timer_2t_1w_2048sl.h \
269   vppinfra/tw_timer_16t_2w_512sl.h \
270   vppinfra/tw_timer_16t_1w_2048sl.h \
271   vppinfra/tw_timer_4t_3w_256sl.h \
272   vppinfra/tw_timer_1t_3w_1024sl_ov.h \
273   vppinfra/tw_timer_template.h \
274   vppinfra/tw_timer_template.c \
275   vppinfra/types.h \
276   vppinfra/unix.h \
277   vppinfra/valloc.h \
278   vppinfra/vec.h \
279   vppinfra/vec_bootstrap.h \
280   vppinfra/vector.h \
281   vppinfra/vector_altivec.h \
282   vppinfra/vector_avx2.h \
283   vppinfra/vector_avx512.h \
284   vppinfra/vector_funcs.h \
285   vppinfra/vector_neon.h \
286   vppinfra/vector_sse42.h \
287   vppinfra/valgrind.h \
288   vppinfra/xxhash.h \
289   vppinfra/xy.h \
290   vppinfra/zvec.h
291
292 if ENABLE_DLMALLOC
293   nobase_include_HEADERS += \
294   vppinfra/dlmalloc.h
295 else
296   nobase_include_HEADERS +=  \
297   vppinfra/mheap_bootstrap.h 
298 endif
299
300 CLIB_CORE = \
301   vppinfra/asm_x86.c \
302   vppinfra/backtrace.c \
303   vppinfra/bihash_8_8.h \
304   vppinfra/bihash_vec8_8.h \
305   vppinfra/bihash_24_8.h \
306   vppinfra/bihash_template.h \
307   vppinfra/cpu.c \
308   vppinfra/elf.c \
309   vppinfra/elog.c \
310   vppinfra/error.c \
311   vppinfra/fifo.c \
312   vppinfra/fheap.c \
313   vppinfra/flowhash_8_8.h \
314   vppinfra/flowhash_24_16.h \
315   vppinfra/flowhash_template.h \
316   vppinfra/format.c \
317   vppinfra/pool.c \
318   vppinfra/graph.c \
319   vppinfra/hash.c \
320   vppinfra/heap.c \
321   vppinfra/longjmp.S \
322   vppinfra/macros.c \
323   vppinfra/mhash.c \
324   vppinfra/ptclosure.c \
325   vppinfra/random.c \
326   vppinfra/random_buffer.c \
327   vppinfra/random_isaac.c \
328   vppinfra/serialize.c \
329   vppinfra/slist.c \
330   vppinfra/std-formats.c \
331   vppinfra/string.c \
332   vppinfra/time.c \
333   vppinfra/time_range.c \
334   vppinfra/timing_wheel.c \
335   vppinfra/tw_timer_template.h \
336   vppinfra/tw_timer_2t_1w_2048sl.h \
337   vppinfra/tw_timer_2t_1w_2048sl.c \
338   vppinfra/tw_timer_16t_2w_512sl.h \
339   vppinfra/tw_timer_16t_2w_512sl.c \
340   vppinfra/tw_timer_16t_1w_2048sl.h \
341   vppinfra/tw_timer_16t_1w_2048sl.c \
342   vppinfra/tw_timer_4t_3w_256sl.h \
343   vppinfra/tw_timer_4t_3w_256sl.c \
344   vppinfra/tw_timer_1t_3w_1024sl_ov.h \
345   vppinfra/tw_timer_1t_3w_1024sl_ov.c \
346   vppinfra/unformat.c \
347   vppinfra/valloc.c \
348   vppinfra/vec.c \
349   vppinfra/vector.c \
350   vppinfra/zvec.c
351
352 if ENABLE_DLMALLOC
353   CLIB_CORE += \
354   vppinfra/mem_dlmalloc.c \
355   vppinfra/dlmalloc.c \
356   vppinfra/dlmalloc.h
357 else
358   CLIB_CORE += \
359   vppinfra/mheap.c \
360   vppinfra/mem_mheap.c 
361 endif
362
363 # Core plus Unix additions
364 libvppinfra_la_SOURCES =                        \
365   $(CLIB_CORE)                                  \
366   vppinfra/elf_clib.c                           \
367   vppinfra/linux/mem.c                          \
368   vppinfra/linux/sysfs.c                        \
369   vppinfra/maplog.c                             \
370   vppinfra/socket.c                             \
371   vppinfra/timer.c                              \
372   vppinfra/unix-formats.c                       \
373   vppinfra/unix-misc.c
374
375 bin_PROGRAMS = elftool
376
377 elftool_SOURCES = tools/elftool/elftool.c
378 elftool_CPPFLAGS = $(AM_CPPFLAGS)
379 elftool_LDADD = libvppinfra.la -lpthread -lrt -lm
380
381 # vi:syntax=automake