• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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
385if WITH_PCRE2_8
386lib_LTLIBRARIES += libpcre2-8.la
387libpcre2_8_la_SOURCES = \
388  $(COMMON_SOURCES)
389nodist_libpcre2_8_la_SOURCES = \
390  $(NODIST_SOURCES)
391libpcre2_8_la_CFLAGS = \
392  -DPCRE2_CODE_UNIT_WIDTH=8 \
393  $(VISIBILITY_CFLAGS) \
394  $(CET_CFLAGS) \
395  $(AM_CFLAGS)
396libpcre2_8_la_LIBADD =
397endif # WITH_PCRE2_8
398
399if WITH_PCRE2_16
400lib_LTLIBRARIES += libpcre2-16.la
401libpcre2_16_la_SOURCES = \
402  $(COMMON_SOURCES)
403nodist_libpcre2_16_la_SOURCES = \
404  $(NODIST_SOURCES)
405libpcre2_16_la_CFLAGS = \
406  -DPCRE2_CODE_UNIT_WIDTH=16 \
407  $(VISIBILITY_CFLAGS) \
408  $(CET_CFLAGS) \
409  $(AM_CFLAGS)
410libpcre2_16_la_LIBADD =
411endif # WITH_PCRE2_16
412
413if WITH_PCRE2_32
414lib_LTLIBRARIES += libpcre2-32.la
415libpcre2_32_la_SOURCES = \
416  $(COMMON_SOURCES)
417nodist_libpcre2_32_la_SOURCES = \
418  $(NODIST_SOURCES)
419libpcre2_32_la_CFLAGS = \
420  -DPCRE2_CODE_UNIT_WIDTH=32 \
421  $(VISIBILITY_CFLAGS) \
422  $(CET_CFLAGS) \
423  $(AM_CFLAGS)
424libpcre2_32_la_LIBADD =
425endif # WITH_PCRE2_32
426
427# The pcre2_chartables.c.dist file is the default version of
428# pcre2_chartables.c, used unless --enable-rebuild-chartables is specified.
429
430EXTRA_DIST += src/pcre2_chartables.c.dist
431CLEANFILES += src/pcre2_chartables.c
432
433# The JIT compiler lives in a separate directory, but its files are #included
434# when pcre2_jit_compile.c is processed, so they must be distributed.
435
436EXTRA_DIST += \
437  src/sljit/sljitConfig.h \
438  src/sljit/sljitConfigInternal.h \
439  src/sljit/sljitExecAllocator.c \
440  src/sljit/sljitLir.c \
441  src/sljit/sljitLir.h \
442  src/sljit/sljitNativeARM_32.c \
443  src/sljit/sljitNativeARM_64.c \
444  src/sljit/sljitNativeARM_T2_32.c \
445  src/sljit/sljitNativeMIPS_32.c \
446  src/sljit/sljitNativeMIPS_64.c \
447  src/sljit/sljitNativeMIPS_common.c \
448  src/sljit/sljitNativePPC_32.c \
449  src/sljit/sljitNativePPC_64.c \
450  src/sljit/sljitNativePPC_common.c \
451  src/sljit/sljitNativeS390X.c \
452  src/sljit/sljitNativeSPARC_32.c \
453  src/sljit/sljitNativeSPARC_common.c \
454  src/sljit/sljitNativeX86_32.c \
455  src/sljit/sljitNativeX86_64.c \
456  src/sljit/sljitNativeX86_common.c \
457  src/sljit/sljitProtExecAllocator.c \
458  src/sljit/sljitUtils.c \
459  src/sljit/sljitWXExecAllocator.c
460
461# Some of the JIT sources are also in separate files that are #included.
462
463EXTRA_DIST += \
464  src/pcre2_jit_match.c \
465  src/pcre2_jit_misc.c
466
467if WITH_PCRE2_8
468libpcre2_8_la_LDFLAGS = $(EXTRA_LIBPCRE2_8_LDFLAGS)
469endif # WITH_PCRE2_8
470if WITH_PCRE2_16
471libpcre2_16_la_LDFLAGS = $(EXTRA_LIBPCRE2_16_LDFLAGS)
472endif # WITH_PCRE2_16
473if WITH_PCRE2_32
474libpcre2_32_la_LDFLAGS = $(EXTRA_LIBPCRE2_32_LDFLAGS)
475endif # WITH_PCRE2_32
476
477if WITH_VALGRIND
478if WITH_PCRE2_8
479libpcre2_8_la_CFLAGS += $(VALGRIND_CFLAGS)
480endif # WITH_PCRE2_8
481if WITH_PCRE2_16
482libpcre2_16_la_CFLAGS += $(VALGRIND_CFLAGS)
483endif # WITH_PCRE2_16
484if WITH_PCRE2_32
485libpcre2_32_la_CFLAGS += $(VALGRIND_CFLAGS)
486endif # WITH_PCRE2_32
487endif # WITH_VALGRIND
488
489if WITH_GCOV
490if WITH_PCRE2_8
491libpcre2_8_la_CFLAGS += $(GCOV_CFLAGS)
492endif # WITH_PCRE2_8
493if WITH_PCRE2_16
494libpcre2_16_la_CFLAGS += $(GCOV_CFLAGS)
495endif # WITH_PCRE2_16
496if WITH_PCRE2_32
497libpcre2_32_la_CFLAGS += $(GCOV_CFLAGS)
498endif # WITH_PCRE2_32
499endif # WITH_GCOV
500
501## A version of the 8-bit library that has a POSIX API.
502
503if WITH_PCRE2_8
504lib_LTLIBRARIES += libpcre2-posix.la
505libpcre2_posix_la_SOURCES = src/pcre2posix.c
506libpcre2_posix_la_CFLAGS = \
507  -DPCRE2_CODE_UNIT_WIDTH=8 \
508  $(VISIBILITY_CFLAGS) $(AM_CFLAGS)
509libpcre2_posix_la_LDFLAGS = $(EXTRA_LIBPCRE2_POSIX_LDFLAGS)
510libpcre2_posix_la_LIBADD = libpcre2-8.la
511if WITH_GCOV
512libpcre2_posix_la_CFLAGS += $(GCOV_CFLAGS)
513endif # WITH_GCOV
514endif # WITH_PCRE2_8
515
516## Build pcre2grep and optional fuzzer stuff if the 8-bit library is enabled
517
518if WITH_PCRE2_8
519bin_PROGRAMS += pcre2grep
520pcre2grep_SOURCES = src/pcre2grep.c
521pcre2grep_CFLAGS = $(AM_CFLAGS)
522pcre2grep_LDADD = $(LIBZ) $(LIBBZ2)
523pcre2grep_LDADD += libpcre2-8.la
524if WITH_GCOV
525pcre2grep_CFLAGS += $(GCOV_CFLAGS)
526pcre2grep_LDADD += $(GCOV_LIBS)
527endif # WITH_GCOV
528
529## If fuzzer support is enabled, build a non-distributed library containing the
530## fuzzing function. Also build the standalone checking binary from the same
531## source but using -DSTANDALONE.
532
533if WITH_FUZZ_SUPPORT
534noinst_LIBRARIES = .libs/libpcre2-fuzzsupport.a
535_libs_libpcre2_fuzzsupport_a_SOURCES = src/pcre2_fuzzsupport.c
536_libs_libpcre2_fuzzsupport_a_CFLAGS = $(AM_CFLAGS)
537_libs_libpcre2_fuzzsupport_a_LIBADD =
538
539noinst_PROGRAMS += pcre2fuzzcheck
540pcre2fuzzcheck_SOURCES = src/pcre2_fuzzsupport.c
541pcre2fuzzcheck_CFLAGS = -DSTANDALONE $(AM_CFLAGS)
542pcre2fuzzcheck_LDADD = libpcre2-8.la
543if WITH_GCOV
544pcre2fuzzcheck_CFLAGS += $(GCOV_CFLAGS)
545pcre2fuzzcheck_LDADD += $(GCOV_LIBS)
546endif # WITH_GCOV
547endif # WITH FUZZ_SUPPORT
548endif # WITH_PCRE2_8
549
550## -------- Testing ----------
551
552## If JIT support is enabled, arrange for the JIT test program to run.
553
554if WITH_JIT
555TESTS += pcre2_jit_test
556noinst_PROGRAMS += pcre2_jit_test
557pcre2_jit_test_SOURCES = src/pcre2_jit_test.c
558pcre2_jit_test_CFLAGS = $(AM_CFLAGS)
559pcre2_jit_test_LDADD =
560if WITH_PCRE2_8
561pcre2_jit_test_LDADD += libpcre2-8.la
562endif # WITH_PCRE2_8
563if WITH_PCRE2_16
564pcre2_jit_test_LDADD += libpcre2-16.la
565endif # WITH_PCRE2_16
566if WITH_PCRE2_32
567pcre2_jit_test_LDADD += libpcre2-32.la
568endif # WITH_PCRE2_32
569if WITH_GCOV
570pcre2_jit_test_CFLAGS += $(GCOV_CFLAGS)
571pcre2_jit_test_LDADD += $(GCOV_LIBS)
572endif # WITH_GCOV
573endif # WITH_JIT
574
575# Build the general pcre2test program. The file src/pcre2_printint.c is
576# #included by pcre2test as many times as needed, at different code unit
577# widths.
578
579bin_PROGRAMS += pcre2test
580EXTRA_DIST += src/pcre2_printint.c
581pcre2test_SOURCES = src/pcre2test.c
582pcre2test_CFLAGS = $(AM_CFLAGS)
583pcre2test_LDADD = $(LIBREADLINE)
584
585if WITH_PCRE2_8
586pcre2test_LDADD += libpcre2-8.la libpcre2-posix.la
587endif # WITH_PCRE2_8
588
589if WITH_PCRE2_16
590pcre2test_LDADD += libpcre2-16.la
591endif # WITH_PCRE2_16
592
593if WITH_PCRE2_32
594pcre2test_LDADD += libpcre2-32.la
595endif # WITH_PCRE2_32
596
597if WITH_VALGRIND
598pcre2test_CFLAGS += $(VALGRIND_CFLAGS)
599endif # WITH_VALGRIND
600
601if WITH_GCOV
602pcre2test_CFLAGS += $(GCOV_CFLAGS)
603pcre2test_LDADD += $(GCOV_LIBS)
604endif # WITH_GCOV
605
606## The main library tests. Each test is a binary plus a script that runs that
607## binary in various ways. We install these test binaries in case folks find it
608## helpful. The two .bat files are for running the tests under Windows.
609
610TESTS += RunTest
611EXTRA_DIST += RunTest.bat
612dist_noinst_SCRIPTS += RunTest
613
614## When the 8-bit library is configured, pcre2grep will have been built.
615
616if WITH_PCRE2_8
617TESTS += RunGrepTest
618EXTRA_DIST += RunGrepTest.bat
619dist_noinst_SCRIPTS += RunGrepTest
620endif # WITH_PCRE2_8
621
622## Distribute all the test data files
623
624EXTRA_DIST += \
625  testdata/grepbinary \
626  testdata/grepfilelist \
627  testdata/grepinput \
628  testdata/grepinput3 \
629  testdata/grepinput8 \
630  testdata/grepinputM \
631  testdata/grepinputv \
632  testdata/grepinputx \
633  testdata/greplist \
634  testdata/grepoutput \
635  testdata/grepoutput8 \
636  testdata/grepoutputC \
637  testdata/grepoutputCN \
638  testdata/grepoutputN \
639  testdata/greppatN4 \
640  testdata/testbtables \
641  testdata/testinput1 \
642  testdata/testinput2 \
643  testdata/testinput3 \
644  testdata/testinput4 \
645  testdata/testinput5 \
646  testdata/testinput6 \
647  testdata/testinput7 \
648  testdata/testinput8 \
649  testdata/testinput9 \
650  testdata/testinput10 \
651  testdata/testinput11 \
652  testdata/testinput12 \
653  testdata/testinput13 \
654  testdata/testinput14 \
655  testdata/testinput15 \
656  testdata/testinput16 \
657  testdata/testinput17 \
658  testdata/testinput18 \
659  testdata/testinput19 \
660  testdata/testinput20 \
661  testdata/testinput21 \
662  testdata/testinput22 \
663  testdata/testinput23 \
664  testdata/testinput24 \
665  testdata/testinput25 \
666  testdata/testinputEBC \
667  testdata/testoutput1 \
668  testdata/testoutput2 \
669  testdata/testoutput3 \
670  testdata/testoutput3A \
671  testdata/testoutput3B \
672  testdata/testoutput4 \
673  testdata/testoutput5 \
674  testdata/testoutput6 \
675  testdata/testoutput7 \
676  testdata/testoutput8-16-2 \
677  testdata/testoutput8-16-3 \
678  testdata/testoutput8-16-4 \
679  testdata/testoutput8-32-2 \
680  testdata/testoutput8-32-3 \
681  testdata/testoutput8-32-4 \
682  testdata/testoutput8-8-2 \
683  testdata/testoutput8-8-3 \
684  testdata/testoutput8-8-4 \
685  testdata/testoutput9 \
686  testdata/testoutput10 \
687  testdata/testoutput11-16 \
688  testdata/testoutput11-32 \
689  testdata/testoutput12-16 \
690  testdata/testoutput12-32 \
691  testdata/testoutput13 \
692  testdata/testoutput14-16 \
693  testdata/testoutput14-32 \
694  testdata/testoutput14-8 \
695  testdata/testoutput15 \
696  testdata/testoutput16 \
697  testdata/testoutput17 \
698  testdata/testoutput18 \
699  testdata/testoutput19 \
700  testdata/testoutput20 \
701  testdata/testoutput21 \
702  testdata/testoutput22-16 \
703  testdata/testoutput22-32 \
704  testdata/testoutput22-8 \
705  testdata/testoutput23 \
706  testdata/testoutput24 \
707  testdata/testoutput25 \
708  testdata/testoutputEBC \
709  testdata/valgrind-jit.supp \
710  testdata/wintestinput3 \
711  testdata/wintestoutput3 \
712  perltest.sh
713
714# RunTest and RunGrepTest should clean up after themselves, but just in case
715# they don't, add their working files to CLEANFILES.
716
717CLEANFILES += \
718        testSinput \
719        test3input \
720        test3output \
721        test3outputA \
722        test3outputB \
723        testtry \
724        teststdout \
725	teststderr \
726        teststderrgrep \
727        testtemp1grep \
728        testtemp2grep \
729        testtrygrep \
730        testNinputgrep
731
732## ------------ End of testing -------------
733
734
735# PCRE2 demonstration program. Not built automatcally. The point is that the
736# users should build it themselves. So just distribute the source.
737
738EXTRA_DIST += src/pcre2demo.c
739
740
741# We have .pc files for pkg-config users.
742
743pkgconfigdir = $(libdir)/pkgconfig
744pkgconfig_DATA =
745
746if WITH_PCRE2_8
747pkgconfig_DATA += libpcre2-8.pc libpcre2-posix.pc
748endif
749
750if WITH_PCRE2_16
751pkgconfig_DATA += libpcre2-16.pc
752endif
753
754if WITH_PCRE2_32
755pkgconfig_DATA += libpcre2-32.pc
756endif
757
758
759# gcov/lcov code coverage reporting
760#
761# Coverage reporting targets:
762#
763# coverage: Create a coverage report from 'make check'
764# coverage-baseline: Capture baseline coverage information
765# coverage-reset: This zeros the coverage counters only
766# coverage-report: This creates the coverage report only
767# coverage-clean-report: This removes the generated coverage report
768#   without cleaning the coverage data itself
769# coverage-clean-data: This removes the captured coverage data without
770#   removing the coverage files created at compile time (*.gcno)
771# coverage-clean: This cleans all coverage data including the generated
772#   coverage report.
773
774if WITH_GCOV
775COVERAGE_TEST_NAME = $(PACKAGE)
776COVERAGE_NAME = $(PACKAGE)-$(VERSION)
777COVERAGE_OUTPUT_FILE = $(COVERAGE_NAME)-coverage.info
778COVERAGE_OUTPUT_DIR = $(COVERAGE_NAME)-coverage
779COVERAGE_LCOV_EXTRA_FLAGS =
780COVERAGE_GENHTML_EXTRA_FLAGS =
781
782coverage_quiet = $(coverage_quiet_$(V))
783coverage_quiet_ = $(coverage_quiet_$(AM_DEFAULT_VERBOSITY))
784coverage_quiet_0 = --quiet
785
786coverage-check: all
787	-$(MAKE) $(AM_MAKEFLAGS) -k check
788
789coverage-baseline:
790	$(LCOV) $(coverage_quiet) \
791		--directory $(top_builddir) \
792		--output-file "$(COVERAGE_OUTPUT_FILE)" \
793		--capture \
794		--initial
795
796coverage-report:
797	$(LCOV) $(coverage_quiet) \
798		--directory $(top_builddir) \
799		--capture \
800		--output-file "$(COVERAGE_OUTPUT_FILE).tmp" \
801		--test-name "$(COVERAGE_TEST_NAME)" \
802		--no-checksum \
803		--compat-libtool \
804		$(COVERAGE_LCOV_EXTRA_FLAGS)
805	$(LCOV) $(coverage_quiet) \
806		--directory $(top_builddir) \
807		--output-file "$(COVERAGE_OUTPUT_FILE)" \
808		--remove "$(COVERAGE_OUTPUT_FILE).tmp" \
809		"/tmp/*" \
810		"/usr/include/*" \
811		"$(includedir)/*"
812	-@rm -f "$(COVERAGE_OUTPUT_FILE).tmp"
813	LANG=C $(GENHTML) $(coverage_quiet) \
814		--prefix $(top_builddir) \
815		--output-directory "$(COVERAGE_OUTPUT_DIR)" \
816		--title "$(PACKAGE) $(VERSION) Code Coverage Report" \
817		--show-details "$(COVERAGE_OUTPUT_FILE)" \
818		--legend \
819		$(COVERAGE_GENHTML_EXTRA_FLAGS)
820	@echo "Code coverage report written to file://$(abs_builddir)/$(COVERAGE_OUTPUT_DIR)/index.html"
821
822coverage-reset:
823	-$(LCOV) $(coverage_quiet) --zerocounters --directory $(top_builddir)
824
825coverage-clean-report:
826	-rm -f "$(COVERAGE_OUTPUT_FILE)" "$(COVERAGE_OUTPUT_FILE).tmp"
827	-rm -rf "$(COVERAGE_OUTPUT_DIR)"
828
829coverage-clean-data:
830	-find $(top_builddir) -name "*.gcda" -delete
831
832coverage-clean: coverage-reset coverage-clean-report coverage-clean-data
833	-find $(top_builddir) -name "*.gcno" -delete
834
835coverage-distclean: coverage-clean
836
837coverage: coverage-reset coverage-baseline coverage-check coverage-report
838clean-local: coverage-clean
839distclean-local: coverage-distclean
840
841.PHONY: coverage coverage-baseline coverage-check coverage-report coverage-reset coverage-clean-report coverage-clean-data coverage-clean coverage-distclean
842
843# Without coverage support, still arrange for 'make distclean' to get rid of
844# any coverage files that may have been left from a different configuration.
845
846else
847
848coverage:
849	@echo "Configuring with --enable-coverage is required to generate code coverage report."
850
851DISTCLEANFILES += src/*.gcda src/*.gcno
852
853distclean-local:
854	rm -rf $(PACKAGE)-$(VERSION)-coverage*
855
856endif # WITH_GCOV
857
858## CMake support
859
860EXTRA_DIST += \
861  cmake/COPYING-CMAKE-SCRIPTS \
862  cmake/FindPackageHandleStandardArgs.cmake \
863  cmake/FindReadline.cmake \
864  cmake/FindEditline.cmake \
865  CMakeLists.txt \
866  config-cmake.h.in
867
868## end Makefile.am
869