blob: b1adb6f415b70610f63391aff1e9b12a460d770a [file] [log] [blame]
Elliott Hughes5b808042021-10-01 10:56:10 -07001## Process this file with automake to produce Makefile.in.
2
3AUTOMAKE_OPTIONS = subdir-objects
4ACLOCAL_AMFLAGS = -I m4
5
6## This seems to have become necessary for building in non-source directory.
7
8AM_CPPFLAGS="-I$(srcdir)/src"
9
10## Specify the documentation files that are distributed.
11
12dist_doc_DATA = \
13 AUTHORS \
14 COPYING \
15 ChangeLog \
16 LICENCE \
17 NEWS \
18 README \
19 doc/pcre2.txt \
20 doc/pcre2-config.txt \
21 doc/pcre2grep.txt \
22 doc/pcre2test.txt
23
24dist_html_DATA = \
25 doc/html/NON-AUTOTOOLS-BUILD.txt \
26 doc/html/README.txt \
27 doc/html/index.html \
28 doc/html/pcre2-config.html \
29 doc/html/pcre2.html \
30 doc/html/pcre2_callout_enumerate.html \
31 doc/html/pcre2_code_copy.html \
32 doc/html/pcre2_code_copy_with_tables.html \
33 doc/html/pcre2_code_free.html \
34 doc/html/pcre2_compile.html \
35 doc/html/pcre2_compile_context_copy.html \
36 doc/html/pcre2_compile_context_create.html \
37 doc/html/pcre2_compile_context_free.html \
38 doc/html/pcre2_config.html \
39 doc/html/pcre2_convert_context_copy.html \
40 doc/html/pcre2_convert_context_create.html \
41 doc/html/pcre2_convert_context_free.html \
42 doc/html/pcre2_converted_pattern_free.html \
43 doc/html/pcre2_dfa_match.html \
44 doc/html/pcre2_general_context_copy.html \
45 doc/html/pcre2_general_context_create.html \
46 doc/html/pcre2_general_context_free.html \
47 doc/html/pcre2_get_error_message.html \
48 doc/html/pcre2_get_mark.html \
49 doc/html/pcre2_get_match_data_size.html \
50 doc/html/pcre2_get_ovector_count.html \
51 doc/html/pcre2_get_ovector_pointer.html \
52 doc/html/pcre2_get_startchar.html \
53 doc/html/pcre2_jit_compile.html \
54 doc/html/pcre2_jit_free_unused_memory.html \
55 doc/html/pcre2_jit_match.html \
56 doc/html/pcre2_jit_stack_assign.html \
57 doc/html/pcre2_jit_stack_create.html \
58 doc/html/pcre2_jit_stack_free.html \
59 doc/html/pcre2_maketables.html \
60 doc/html/pcre2_maketables_free.html \
61 doc/html/pcre2_match.html \
62 doc/html/pcre2_match_context_copy.html \
63 doc/html/pcre2_match_context_create.html \
64 doc/html/pcre2_match_context_free.html \
65 doc/html/pcre2_match_data_create.html \
66 doc/html/pcre2_match_data_create_from_pattern.html \
67 doc/html/pcre2_match_data_free.html \
68 doc/html/pcre2_pattern_convert.html \
69 doc/html/pcre2_pattern_info.html \
70 doc/html/pcre2_serialize_decode.html \
71 doc/html/pcre2_serialize_encode.html \
72 doc/html/pcre2_serialize_free.html \
73 doc/html/pcre2_serialize_get_number_of_codes.html \
74 doc/html/pcre2_set_bsr.html \
75 doc/html/pcre2_set_callout.html \
76 doc/html/pcre2_set_character_tables.html \
77 doc/html/pcre2_set_compile_extra_options.html \
78 doc/html/pcre2_set_compile_recursion_guard.html \
79 doc/html/pcre2_set_depth_limit.html \
80 doc/html/pcre2_set_glob_escape.html \
81 doc/html/pcre2_set_glob_separator.html \
82 doc/html/pcre2_set_heap_limit.html \
83 doc/html/pcre2_set_match_limit.html \
84 doc/html/pcre2_set_max_pattern_length.html \
85 doc/html/pcre2_set_offset_limit.html \
86 doc/html/pcre2_set_newline.html \
87 doc/html/pcre2_set_parens_nest_limit.html \
88 doc/html/pcre2_set_recursion_limit.html \
89 doc/html/pcre2_set_recursion_memory_management.html \
90 doc/html/pcre2_set_substitute_callout.html \
91 doc/html/pcre2_substitute.html \
92 doc/html/pcre2_substring_copy_byname.html \
93 doc/html/pcre2_substring_copy_bynumber.html \
94 doc/html/pcre2_substring_free.html \
95 doc/html/pcre2_substring_get_byname.html \
96 doc/html/pcre2_substring_get_bynumber.html \
97 doc/html/pcre2_substring_length_byname.html \
98 doc/html/pcre2_substring_length_bynumber.html \
99 doc/html/pcre2_substring_list_free.html \
100 doc/html/pcre2_substring_list_get.html \
101 doc/html/pcre2_substring_nametable_scan.html \
102 doc/html/pcre2_substring_number_from_name.html \
103 doc/html/pcre2api.html \
104 doc/html/pcre2build.html \
105 doc/html/pcre2callout.html \
106 doc/html/pcre2compat.html \
107 doc/html/pcre2convert.html \
108 doc/html/pcre2demo.html \
109 doc/html/pcre2grep.html \
110 doc/html/pcre2jit.html \
111 doc/html/pcre2limits.html \
112 doc/html/pcre2matching.html \
113 doc/html/pcre2partial.html \
114 doc/html/pcre2pattern.html \
115 doc/html/pcre2perform.html \
116 doc/html/pcre2posix.html \
117 doc/html/pcre2sample.html \
118 doc/html/pcre2serialize.html \
119 doc/html/pcre2syntax.html \
120 doc/html/pcre2test.html \
121 doc/html/pcre2unicode.html
122
123dist_man_MANS = \
124 doc/pcre2-config.1 \
125 doc/pcre2.3 \
126 doc/pcre2_callout_enumerate.3 \
127 doc/pcre2_code_copy.3 \
128 doc/pcre2_code_copy_with_tables.3 \
129 doc/pcre2_code_free.3 \
130 doc/pcre2_compile.3 \
131 doc/pcre2_compile_context_copy.3 \
132 doc/pcre2_compile_context_create.3 \
133 doc/pcre2_compile_context_free.3 \
134 doc/pcre2_config.3 \
135 doc/pcre2_convert_context_copy.3 \
136 doc/pcre2_convert_context_create.3 \
137 doc/pcre2_convert_context_free.3 \
138 doc/pcre2_converted_pattern_free.3 \
139 doc/pcre2_dfa_match.3 \
140 doc/pcre2_general_context_copy.3 \
141 doc/pcre2_general_context_create.3 \
142 doc/pcre2_general_context_free.3 \
143 doc/pcre2_get_error_message.3 \
144 doc/pcre2_get_mark.3 \
145 doc/pcre2_get_match_data_size.3 \
146 doc/pcre2_get_ovector_count.3 \
147 doc/pcre2_get_ovector_pointer.3 \
148 doc/pcre2_get_startchar.3 \
149 doc/pcre2_jit_compile.3 \
150 doc/pcre2_jit_free_unused_memory.3 \
151 doc/pcre2_jit_match.3 \
152 doc/pcre2_jit_stack_assign.3 \
153 doc/pcre2_jit_stack_create.3 \
154 doc/pcre2_jit_stack_free.3 \
155 doc/pcre2_maketables.3 \
156 doc/pcre2_maketables_free.3 \
157 doc/pcre2_match.3 \
158 doc/pcre2_match_context_copy.3 \
159 doc/pcre2_match_context_create.3 \
160 doc/pcre2_match_context_free.3 \
161 doc/pcre2_match_data_create.3 \
162 doc/pcre2_match_data_create_from_pattern.3 \
163 doc/pcre2_match_data_free.3 \
164 doc/pcre2_pattern_convert.3 \
165 doc/pcre2_pattern_info.3 \
166 doc/pcre2_serialize_decode.3 \
167 doc/pcre2_serialize_encode.3 \
168 doc/pcre2_serialize_free.3 \
169 doc/pcre2_serialize_get_number_of_codes.3 \
170 doc/pcre2_set_bsr.3 \
171 doc/pcre2_set_callout.3 \
172 doc/pcre2_set_character_tables.3 \
173 doc/pcre2_set_compile_extra_options.3 \
174 doc/pcre2_set_compile_recursion_guard.3 \
175 doc/pcre2_set_depth_limit.3 \
176 doc/pcre2_set_glob_escape.3 \
177 doc/pcre2_set_glob_separator.3 \
178 doc/pcre2_set_heap_limit.3 \
179 doc/pcre2_set_match_limit.3 \
180 doc/pcre2_set_max_pattern_length.3 \
181 doc/pcre2_set_offset_limit.3 \
182 doc/pcre2_set_newline.3 \
183 doc/pcre2_set_parens_nest_limit.3 \
184 doc/pcre2_set_recursion_limit.3 \
185 doc/pcre2_set_recursion_memory_management.3 \
186 doc/pcre2_set_substitute_callout.3 \
187 doc/pcre2_substitute.3 \
188 doc/pcre2_substring_copy_byname.3 \
189 doc/pcre2_substring_copy_bynumber.3 \
190 doc/pcre2_substring_free.3 \
191 doc/pcre2_substring_get_byname.3 \
192 doc/pcre2_substring_get_bynumber.3 \
193 doc/pcre2_substring_length_byname.3 \
194 doc/pcre2_substring_length_bynumber.3 \
195 doc/pcre2_substring_list_free.3 \
196 doc/pcre2_substring_list_get.3 \
197 doc/pcre2_substring_nametable_scan.3 \
198 doc/pcre2_substring_number_from_name.3 \
199 doc/pcre2api.3 \
200 doc/pcre2build.3 \
201 doc/pcre2callout.3 \
202 doc/pcre2compat.3 \
203 doc/pcre2convert.3 \
204 doc/pcre2demo.3 \
205 doc/pcre2grep.1 \
206 doc/pcre2jit.3 \
207 doc/pcre2limits.3 \
208 doc/pcre2matching.3 \
209 doc/pcre2partial.3 \
210 doc/pcre2pattern.3 \
211 doc/pcre2perform.3 \
212 doc/pcre2posix.3 \
213 doc/pcre2sample.3 \
214 doc/pcre2serialize.3 \
215 doc/pcre2syntax.3 \
216 doc/pcre2test.1 \
217 doc/pcre2unicode.3
218
219# The Libtool libraries to install. We'll add to this later.
220
221lib_LTLIBRARIES =
222
223# Unit tests you want to run when people type 'make check'.
224# TESTS is for binary unit tests, check_SCRIPTS for script-based tests
225
226TESTS =
227check_SCRIPTS =
228dist_noinst_SCRIPTS =
229
230# Some of the binaries we make are to be installed, and others are
231# (non-user-visible) helper programs needed to build the libraries.
232
233bin_PROGRAMS =
234noinst_PROGRAMS =
235
236# Additional files to delete on 'make clean', 'make distclean',
237# and 'make maintainer-clean'.
238
239CLEANFILES =
240DISTCLEANFILES = src/config.h.in~
241MAINTAINERCLEANFILES =
242
243# Additional files to bundle with the distribution, over and above what
244# the Autotools include by default.
245
246EXTRA_DIST =
247
248# These files contain additional m4 macros that are used by autoconf.
249
250EXTRA_DIST += \
251 m4/ax_pthread.m4 m4/pcre2_visibility.m4
252
253# These files contain maintenance information
254
255EXTRA_DIST += \
256 NON-AUTOTOOLS-BUILD \
257 HACKING
258
259# These files are used in the preparation of a release
260
261EXTRA_DIST += \
262 PrepareRelease \
263 CheckMan \
264 CleanTxt \
265 Detrail \
266 132html \
267 doc/index.html.src
268
269# These files are usable versions of pcre2.h and config.h that are distributed
270# for the benefit of people who are building PCRE2 manually, without the
271# Autotools support.
272
273EXTRA_DIST += \
274 src/pcre2.h.generic \
275 src/config.h.generic
276
277# The only difference between pcre2.h.in and pcre2.h is the setting of the PCRE
278# version number. Therefore, we can create the generic version just by copying.
279
280src/pcre2.h.generic: src/pcre2.h.in configure.ac
281 rm -f $@
282 cp -p src/pcre2.h $@
283
284# It is more complicated for config.h.generic. We need the version that results
285# from a default configuration so as to get all the default values for PCRE
286# configuration macros such as MATCH_LIMIT and NEWLINE. We can get this by
287# doing a configure in a temporary directory. However, some trickery is needed,
288# because the source directory may already be configured. If you just try
289# running configure in a new directory, it complains. For this reason, we move
290# config.status out of the way while doing the default configuration. The
291# resulting config.h is munged by perl to put #ifdefs round any #defines for
292# macros with values, and to #undef all boolean macros such as HAVE_xxx and
293# SUPPORT_xxx. We also get rid of any gcc-specific visibility settings. Make
294# sure that PCRE2_EXP_DEFN is unset (in case it has visibility settings).
295
296src/config.h.generic: configure.ac
297 rm -rf $@ _generic
298 mkdir _generic
299 cs=$(srcdir)/config.status; test ! -f $$cs || mv -f $$cs $$cs.aside
300 cd _generic && $(abs_top_srcdir)/configure || :
301 cs=$(srcdir)/config.status; test ! -f $$cs.aside || mv -f $$cs.aside $$cs
302 test -f _generic/src/config.h
303 perl -n \
304 -e 'BEGIN{$$blank=0;}' \
305 -e 'if(/PCRE2_EXP_DEFN/){print"/* #undef PCRE2_EXP_DEFN */\n";$$blank=0;next;}' \
306 -e 'if(/to make a symbol visible/){next;}' \
307 -e 'if(/__attribute__ \(\(visibility/){next;}' \
308 -e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
309 -e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
310 -e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
311 -e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
312 _generic/src/config.h >$@
313 rm -rf _generic
314
315MAINTAINERCLEANFILES += src/pcre2.h.generic src/config.h.generic
316
317# These are the header files we'll install. We do not distribute pcre2.h
318# because it is generated from pcre2.h.in.
319
320nodist_include_HEADERS = src/pcre2.h
321include_HEADERS = src/pcre2posix.h
322
323# This is the "config" script.
324
325bin_SCRIPTS = pcre2-config
326
327## ---------------------------------------------------------------
328## The pcre2_dftables program is used to rebuild character tables before
329## compiling PCRE2, if --enable-rebuild-chartables is specified. It is not an
330## installed program. The default (when --enable-rebuild-chartables is not
331## specified) is to copy a distributed set of tables that are defined for ASCII
332## code. In this case, pcre2_dftables is not needed.
333
334if WITH_REBUILD_CHARTABLES
335noinst_PROGRAMS += pcre2_dftables
336pcre2_dftables_SOURCES = src/pcre2_dftables.c
337src/pcre2_chartables.c: pcre2_dftables$(EXEEXT)
338 rm -f $@
339 ./pcre2_dftables$(EXEEXT) $@
340else
341src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.dist
342 rm -f $@
343 $(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.dist $(abs_builddir)/src/pcre2_chartables.c
344endif # WITH_REBUILD_CHARTABLES
345
346BUILT_SOURCES = src/pcre2_chartables.c
347NODIST_SOURCES = src/pcre2_chartables.c
348
349## Define the list of common sources, then arrange to build whichever of the
350## 8-, 16-, or 32-bit libraries are configured.
351
352COMMON_SOURCES = \
353 src/pcre2_auto_possess.c \
354 src/pcre2_compile.c \
355 src/pcre2_config.c \
356 src/pcre2_context.c \
357 src/pcre2_convert.c \
358 src/pcre2_dfa_match.c \
359 src/pcre2_error.c \
360 src/pcre2_extuni.c \
361 src/pcre2_find_bracket.c \
362 src/pcre2_internal.h \
363 src/pcre2_intmodedep.h \
364 src/pcre2_jit_compile.c \
365 src/pcre2_jit_neon_inc.h \
366 src/pcre2_jit_simd_inc.h \
367 src/pcre2_maketables.c \
368 src/pcre2_match.c \
369 src/pcre2_match_data.c \
370 src/pcre2_newline.c \
371 src/pcre2_ord2utf.c \
372 src/pcre2_pattern_info.c \
373 src/pcre2_script_run.c \
374 src/pcre2_serialize.c \
375 src/pcre2_string_utils.c \
376 src/pcre2_study.c \
377 src/pcre2_substitute.c \
378 src/pcre2_substring.c \
379 src/pcre2_tables.c \
380 src/pcre2_ucd.c \
381 src/pcre2_ucp.h \
382 src/pcre2_valid_utf.c \
383 src/pcre2_xclass.c
384
Elliott Hughes4e19c8e2022-04-15 15:11:02 -0700385# The pcre2_ucptables.c file is #included by pcre2_tables.c
386
387EXTRA_DIST += src/pcre2_ucptables.c
388
Elliott Hughes5b808042021-10-01 10:56:10 -0700389if WITH_PCRE2_8
390lib_LTLIBRARIES += libpcre2-8.la
391libpcre2_8_la_SOURCES = \
392 $(COMMON_SOURCES)
393nodist_libpcre2_8_la_SOURCES = \
394 $(NODIST_SOURCES)
395libpcre2_8_la_CFLAGS = \
396 -DPCRE2_CODE_UNIT_WIDTH=8 \
397 $(VISIBILITY_CFLAGS) \
398 $(CET_CFLAGS) \
399 $(AM_CFLAGS)
400libpcre2_8_la_LIBADD =
401endif # WITH_PCRE2_8
402
403if WITH_PCRE2_16
404lib_LTLIBRARIES += libpcre2-16.la
405libpcre2_16_la_SOURCES = \
406 $(COMMON_SOURCES)
407nodist_libpcre2_16_la_SOURCES = \
408 $(NODIST_SOURCES)
409libpcre2_16_la_CFLAGS = \
410 -DPCRE2_CODE_UNIT_WIDTH=16 \
411 $(VISIBILITY_CFLAGS) \
412 $(CET_CFLAGS) \
413 $(AM_CFLAGS)
414libpcre2_16_la_LIBADD =
415endif # WITH_PCRE2_16
416
417if WITH_PCRE2_32
418lib_LTLIBRARIES += libpcre2-32.la
419libpcre2_32_la_SOURCES = \
420 $(COMMON_SOURCES)
421nodist_libpcre2_32_la_SOURCES = \
422 $(NODIST_SOURCES)
423libpcre2_32_la_CFLAGS = \
424 -DPCRE2_CODE_UNIT_WIDTH=32 \
425 $(VISIBILITY_CFLAGS) \
426 $(CET_CFLAGS) \
427 $(AM_CFLAGS)
428libpcre2_32_la_LIBADD =
429endif # WITH_PCRE2_32
430
431# The pcre2_chartables.c.dist file is the default version of
432# pcre2_chartables.c, used unless --enable-rebuild-chartables is specified.
433
434EXTRA_DIST += src/pcre2_chartables.c.dist
435CLEANFILES += src/pcre2_chartables.c
436
437# The JIT compiler lives in a separate directory, but its files are #included
438# when pcre2_jit_compile.c is processed, so they must be distributed.
439
440EXTRA_DIST += \
441 src/sljit/sljitConfig.h \
442 src/sljit/sljitConfigInternal.h \
443 src/sljit/sljitExecAllocator.c \
444 src/sljit/sljitLir.c \
445 src/sljit/sljitLir.h \
446 src/sljit/sljitNativeARM_32.c \
447 src/sljit/sljitNativeARM_64.c \
448 src/sljit/sljitNativeARM_T2_32.c \
449 src/sljit/sljitNativeMIPS_32.c \
450 src/sljit/sljitNativeMIPS_64.c \
451 src/sljit/sljitNativeMIPS_common.c \
452 src/sljit/sljitNativePPC_32.c \
453 src/sljit/sljitNativePPC_64.c \
454 src/sljit/sljitNativePPC_common.c \
455 src/sljit/sljitNativeS390X.c \
456 src/sljit/sljitNativeSPARC_32.c \
457 src/sljit/sljitNativeSPARC_common.c \
458 src/sljit/sljitNativeX86_32.c \
459 src/sljit/sljitNativeX86_64.c \
460 src/sljit/sljitNativeX86_common.c \
461 src/sljit/sljitProtExecAllocator.c \
462 src/sljit/sljitUtils.c \
463 src/sljit/sljitWXExecAllocator.c
464
465# Some of the JIT sources are also in separate files that are #included.
466
467EXTRA_DIST += \
468 src/pcre2_jit_match.c \
469 src/pcre2_jit_misc.c
470
471if WITH_PCRE2_8
472libpcre2_8_la_LDFLAGS = $(EXTRA_LIBPCRE2_8_LDFLAGS)
473endif # WITH_PCRE2_8
474if WITH_PCRE2_16
475libpcre2_16_la_LDFLAGS = $(EXTRA_LIBPCRE2_16_LDFLAGS)
476endif # WITH_PCRE2_16
477if WITH_PCRE2_32
478libpcre2_32_la_LDFLAGS = $(EXTRA_LIBPCRE2_32_LDFLAGS)
479endif # WITH_PCRE2_32
480
481if WITH_VALGRIND
482if WITH_PCRE2_8
483libpcre2_8_la_CFLAGS += $(VALGRIND_CFLAGS)
484endif # WITH_PCRE2_8
485if WITH_PCRE2_16
486libpcre2_16_la_CFLAGS += $(VALGRIND_CFLAGS)
487endif # WITH_PCRE2_16
488if WITH_PCRE2_32
489libpcre2_32_la_CFLAGS += $(VALGRIND_CFLAGS)
490endif # WITH_PCRE2_32
491endif # WITH_VALGRIND
492
493if WITH_GCOV
494if WITH_PCRE2_8
495libpcre2_8_la_CFLAGS += $(GCOV_CFLAGS)
496endif # WITH_PCRE2_8
497if WITH_PCRE2_16
498libpcre2_16_la_CFLAGS += $(GCOV_CFLAGS)
499endif # WITH_PCRE2_16
500if WITH_PCRE2_32
501libpcre2_32_la_CFLAGS += $(GCOV_CFLAGS)
502endif # WITH_PCRE2_32
503endif # WITH_GCOV
504
505## A version of the 8-bit library that has a POSIX API.
506
507if WITH_PCRE2_8
508lib_LTLIBRARIES += libpcre2-posix.la
509libpcre2_posix_la_SOURCES = src/pcre2posix.c
510libpcre2_posix_la_CFLAGS = \
511 -DPCRE2_CODE_UNIT_WIDTH=8 \
512 $(VISIBILITY_CFLAGS) $(AM_CFLAGS)
513libpcre2_posix_la_LDFLAGS = $(EXTRA_LIBPCRE2_POSIX_LDFLAGS)
514libpcre2_posix_la_LIBADD = libpcre2-8.la
515if WITH_GCOV
516libpcre2_posix_la_CFLAGS += $(GCOV_CFLAGS)
517endif # WITH_GCOV
518endif # WITH_PCRE2_8
519
520## Build pcre2grep and optional fuzzer stuff if the 8-bit library is enabled
521
522if WITH_PCRE2_8
523bin_PROGRAMS += pcre2grep
524pcre2grep_SOURCES = src/pcre2grep.c
525pcre2grep_CFLAGS = $(AM_CFLAGS)
526pcre2grep_LDADD = $(LIBZ) $(LIBBZ2)
527pcre2grep_LDADD += libpcre2-8.la
528if WITH_GCOV
529pcre2grep_CFLAGS += $(GCOV_CFLAGS)
530pcre2grep_LDADD += $(GCOV_LIBS)
531endif # WITH_GCOV
532
533## If fuzzer support is enabled, build a non-distributed library containing the
534## fuzzing function. Also build the standalone checking binary from the same
535## source but using -DSTANDALONE.
536
537if WITH_FUZZ_SUPPORT
538noinst_LIBRARIES = .libs/libpcre2-fuzzsupport.a
539_libs_libpcre2_fuzzsupport_a_SOURCES = src/pcre2_fuzzsupport.c
540_libs_libpcre2_fuzzsupport_a_CFLAGS = $(AM_CFLAGS)
541_libs_libpcre2_fuzzsupport_a_LIBADD =
542
543noinst_PROGRAMS += pcre2fuzzcheck
544pcre2fuzzcheck_SOURCES = src/pcre2_fuzzsupport.c
545pcre2fuzzcheck_CFLAGS = -DSTANDALONE $(AM_CFLAGS)
546pcre2fuzzcheck_LDADD = libpcre2-8.la
547if WITH_GCOV
548pcre2fuzzcheck_CFLAGS += $(GCOV_CFLAGS)
549pcre2fuzzcheck_LDADD += $(GCOV_LIBS)
550endif # WITH_GCOV
551endif # WITH FUZZ_SUPPORT
552endif # WITH_PCRE2_8
553
554## -------- Testing ----------
555
556## If JIT support is enabled, arrange for the JIT test program to run.
557
558if WITH_JIT
559TESTS += pcre2_jit_test
560noinst_PROGRAMS += pcre2_jit_test
561pcre2_jit_test_SOURCES = src/pcre2_jit_test.c
562pcre2_jit_test_CFLAGS = $(AM_CFLAGS)
563pcre2_jit_test_LDADD =
564if WITH_PCRE2_8
565pcre2_jit_test_LDADD += libpcre2-8.la
566endif # WITH_PCRE2_8
567if WITH_PCRE2_16
568pcre2_jit_test_LDADD += libpcre2-16.la
569endif # WITH_PCRE2_16
570if WITH_PCRE2_32
571pcre2_jit_test_LDADD += libpcre2-32.la
572endif # WITH_PCRE2_32
573if WITH_GCOV
574pcre2_jit_test_CFLAGS += $(GCOV_CFLAGS)
575pcre2_jit_test_LDADD += $(GCOV_LIBS)
576endif # WITH_GCOV
577endif # WITH_JIT
578
579# Build the general pcre2test program. The file src/pcre2_printint.c is
580# #included by pcre2test as many times as needed, at different code unit
581# widths.
582
583bin_PROGRAMS += pcre2test
584EXTRA_DIST += src/pcre2_printint.c
585pcre2test_SOURCES = src/pcre2test.c
586pcre2test_CFLAGS = $(AM_CFLAGS)
587pcre2test_LDADD = $(LIBREADLINE)
588
589if WITH_PCRE2_8
590pcre2test_LDADD += libpcre2-8.la libpcre2-posix.la
591endif # WITH_PCRE2_8
592
593if WITH_PCRE2_16
594pcre2test_LDADD += libpcre2-16.la
595endif # WITH_PCRE2_16
596
597if WITH_PCRE2_32
598pcre2test_LDADD += libpcre2-32.la
599endif # WITH_PCRE2_32
600
601if WITH_VALGRIND
602pcre2test_CFLAGS += $(VALGRIND_CFLAGS)
603endif # WITH_VALGRIND
604
605if WITH_GCOV
606pcre2test_CFLAGS += $(GCOV_CFLAGS)
607pcre2test_LDADD += $(GCOV_LIBS)
608endif # WITH_GCOV
609
610## The main library tests. Each test is a binary plus a script that runs that
611## binary in various ways. We install these test binaries in case folks find it
612## helpful. The two .bat files are for running the tests under Windows.
613
614TESTS += RunTest
615EXTRA_DIST += RunTest.bat
616dist_noinst_SCRIPTS += RunTest
617
618## When the 8-bit library is configured, pcre2grep will have been built.
619
620if WITH_PCRE2_8
621TESTS += RunGrepTest
622EXTRA_DIST += RunGrepTest.bat
623dist_noinst_SCRIPTS += RunGrepTest
624endif # WITH_PCRE2_8
625
626## Distribute all the test data files
627
628EXTRA_DIST += \
629 testdata/grepbinary \
630 testdata/grepfilelist \
631 testdata/grepinput \
632 testdata/grepinput3 \
633 testdata/grepinput8 \
634 testdata/grepinputM \
635 testdata/grepinputv \
636 testdata/grepinputx \
637 testdata/greplist \
638 testdata/grepoutput \
639 testdata/grepoutput8 \
640 testdata/grepoutputC \
641 testdata/grepoutputCN \
642 testdata/grepoutputN \
643 testdata/greppatN4 \
644 testdata/testbtables \
645 testdata/testinput1 \
646 testdata/testinput2 \
647 testdata/testinput3 \
648 testdata/testinput4 \
649 testdata/testinput5 \
650 testdata/testinput6 \
651 testdata/testinput7 \
652 testdata/testinput8 \
653 testdata/testinput9 \
654 testdata/testinput10 \
655 testdata/testinput11 \
656 testdata/testinput12 \
657 testdata/testinput13 \
658 testdata/testinput14 \
659 testdata/testinput15 \
660 testdata/testinput16 \
661 testdata/testinput17 \
662 testdata/testinput18 \
663 testdata/testinput19 \
664 testdata/testinput20 \
665 testdata/testinput21 \
666 testdata/testinput22 \
667 testdata/testinput23 \
668 testdata/testinput24 \
669 testdata/testinput25 \
Elliott Hughes4e19c8e2022-04-15 15:11:02 -0700670 testdata/testinput26 \
Elliott Hughes5b808042021-10-01 10:56:10 -0700671 testdata/testinputEBC \
672 testdata/testoutput1 \
673 testdata/testoutput2 \
674 testdata/testoutput3 \
675 testdata/testoutput3A \
676 testdata/testoutput3B \
677 testdata/testoutput4 \
678 testdata/testoutput5 \
679 testdata/testoutput6 \
680 testdata/testoutput7 \
681 testdata/testoutput8-16-2 \
682 testdata/testoutput8-16-3 \
683 testdata/testoutput8-16-4 \
684 testdata/testoutput8-32-2 \
685 testdata/testoutput8-32-3 \
686 testdata/testoutput8-32-4 \
687 testdata/testoutput8-8-2 \
688 testdata/testoutput8-8-3 \
689 testdata/testoutput8-8-4 \
690 testdata/testoutput9 \
691 testdata/testoutput10 \
692 testdata/testoutput11-16 \
693 testdata/testoutput11-32 \
694 testdata/testoutput12-16 \
695 testdata/testoutput12-32 \
696 testdata/testoutput13 \
697 testdata/testoutput14-16 \
698 testdata/testoutput14-32 \
699 testdata/testoutput14-8 \
700 testdata/testoutput15 \
701 testdata/testoutput16 \
702 testdata/testoutput17 \
703 testdata/testoutput18 \
704 testdata/testoutput19 \
705 testdata/testoutput20 \
706 testdata/testoutput21 \
707 testdata/testoutput22-16 \
708 testdata/testoutput22-32 \
709 testdata/testoutput22-8 \
710 testdata/testoutput23 \
711 testdata/testoutput24 \
712 testdata/testoutput25 \
Elliott Hughes4e19c8e2022-04-15 15:11:02 -0700713 testdata/testoutput26 \
Elliott Hughes5b808042021-10-01 10:56:10 -0700714 testdata/testoutputEBC \
715 testdata/valgrind-jit.supp \
716 testdata/wintestinput3 \
717 testdata/wintestoutput3 \
718 perltest.sh
719
720# RunTest and RunGrepTest should clean up after themselves, but just in case
721# they don't, add their working files to CLEANFILES.
722
723CLEANFILES += \
724 testSinput \
725 test3input \
726 test3output \
727 test3outputA \
728 test3outputB \
729 testtry \
730 teststdout \
731 teststderr \
732 teststderrgrep \
733 testtemp1grep \
734 testtemp2grep \
735 testtrygrep \
736 testNinputgrep
737
738## ------------ End of testing -------------
739
740
741# PCRE2 demonstration program. Not built automatcally. The point is that the
742# users should build it themselves. So just distribute the source.
743
744EXTRA_DIST += src/pcre2demo.c
745
746
747# We have .pc files for pkg-config users.
748
749pkgconfigdir = $(libdir)/pkgconfig
750pkgconfig_DATA =
751
752if WITH_PCRE2_8
753pkgconfig_DATA += libpcre2-8.pc libpcre2-posix.pc
754endif
755
756if WITH_PCRE2_16
757pkgconfig_DATA += libpcre2-16.pc
758endif
759
760if WITH_PCRE2_32
761pkgconfig_DATA += libpcre2-32.pc
762endif
763
764
765# gcov/lcov code coverage reporting
766#
767# Coverage reporting targets:
768#
769# coverage: Create a coverage report from 'make check'
770# coverage-baseline: Capture baseline coverage information
771# coverage-reset: This zeros the coverage counters only
772# coverage-report: This creates the coverage report only
773# coverage-clean-report: This removes the generated coverage report
774# without cleaning the coverage data itself
775# coverage-clean-data: This removes the captured coverage data without
776# removing the coverage files created at compile time (*.gcno)
777# coverage-clean: This cleans all coverage data including the generated
778# coverage report.
779
780if WITH_GCOV
781COVERAGE_TEST_NAME = $(PACKAGE)
782COVERAGE_NAME = $(PACKAGE)-$(VERSION)
783COVERAGE_OUTPUT_FILE = $(COVERAGE_NAME)-coverage.info
784COVERAGE_OUTPUT_DIR = $(COVERAGE_NAME)-coverage
785COVERAGE_LCOV_EXTRA_FLAGS =
786COVERAGE_GENHTML_EXTRA_FLAGS =
787
788coverage_quiet = $(coverage_quiet_$(V))
789coverage_quiet_ = $(coverage_quiet_$(AM_DEFAULT_VERBOSITY))
790coverage_quiet_0 = --quiet
791
792coverage-check: all
793 -$(MAKE) $(AM_MAKEFLAGS) -k check
794
795coverage-baseline:
796 $(LCOV) $(coverage_quiet) \
797 --directory $(top_builddir) \
798 --output-file "$(COVERAGE_OUTPUT_FILE)" \
799 --capture \
800 --initial
801
802coverage-report:
803 $(LCOV) $(coverage_quiet) \
804 --directory $(top_builddir) \
805 --capture \
806 --output-file "$(COVERAGE_OUTPUT_FILE).tmp" \
807 --test-name "$(COVERAGE_TEST_NAME)" \
808 --no-checksum \
809 --compat-libtool \
810 $(COVERAGE_LCOV_EXTRA_FLAGS)
811 $(LCOV) $(coverage_quiet) \
812 --directory $(top_builddir) \
813 --output-file "$(COVERAGE_OUTPUT_FILE)" \
814 --remove "$(COVERAGE_OUTPUT_FILE).tmp" \
815 "/tmp/*" \
816 "/usr/include/*" \
817 "$(includedir)/*"
818 -@rm -f "$(COVERAGE_OUTPUT_FILE).tmp"
819 LANG=C $(GENHTML) $(coverage_quiet) \
820 --prefix $(top_builddir) \
821 --output-directory "$(COVERAGE_OUTPUT_DIR)" \
822 --title "$(PACKAGE) $(VERSION) Code Coverage Report" \
823 --show-details "$(COVERAGE_OUTPUT_FILE)" \
824 --legend \
825 $(COVERAGE_GENHTML_EXTRA_FLAGS)
826 @echo "Code coverage report written to file://$(abs_builddir)/$(COVERAGE_OUTPUT_DIR)/index.html"
827
828coverage-reset:
829 -$(LCOV) $(coverage_quiet) --zerocounters --directory $(top_builddir)
830
831coverage-clean-report:
832 -rm -f "$(COVERAGE_OUTPUT_FILE)" "$(COVERAGE_OUTPUT_FILE).tmp"
833 -rm -rf "$(COVERAGE_OUTPUT_DIR)"
834
835coverage-clean-data:
836 -find $(top_builddir) -name "*.gcda" -delete
837
838coverage-clean: coverage-reset coverage-clean-report coverage-clean-data
839 -find $(top_builddir) -name "*.gcno" -delete
840
841coverage-distclean: coverage-clean
842
843coverage: coverage-reset coverage-baseline coverage-check coverage-report
844clean-local: coverage-clean
845distclean-local: coverage-distclean
846
847.PHONY: coverage coverage-baseline coverage-check coverage-report coverage-reset coverage-clean-report coverage-clean-data coverage-clean coverage-distclean
848
849# Without coverage support, still arrange for 'make distclean' to get rid of
850# any coverage files that may have been left from a different configuration.
851
852else
853
854coverage:
855 @echo "Configuring with --enable-coverage is required to generate code coverage report."
856
857DISTCLEANFILES += src/*.gcda src/*.gcno
858
859distclean-local:
860 rm -rf $(PACKAGE)-$(VERSION)-coverage*
861
862endif # WITH_GCOV
863
864## CMake support
865
866EXTRA_DIST += \
867 cmake/COPYING-CMAKE-SCRIPTS \
868 cmake/FindEditline.cmake \
869 cmake/FindPackageHandleStandardArgs.cmake \
870 cmake/FindReadline.cmake \
871 cmake/pcre2-config-version.cmake.in \
872 cmake/pcre2-config.cmake.in \
873 CMakeLists.txt \
874 config-cmake.h.in
875
876## end Makefile.am