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