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