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