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