xref: /freebsd/contrib/expat/Makefile.am (revision a91a2465)
1#
2#                          __  __            _
3#                       ___\ \/ /_ __   __ _| |_
4#                      / _ \\  /| '_ \ / _` | __|
5#                     |  __//  \| |_) | (_| | |_
6#                      \___/_/\_\ .__/ \__,_|\__|
7#                               |_| XML parser
8#
9# Copyright (c) 2017-2023 Sebastian Pipping <sebastian@pipping.org>
10# Copyright (c) 2018      KangLin <kl222@126.com>
11# Copyright (c) 2022      Johnny Jazeix <jazeix@gmail.com>
12# Copyright (c) 2023      Sony Corporation / Snild Dolkow <snild@sony.com>
13# Licensed under the MIT license:
14#
15# Permission is  hereby granted,  free of charge,  to any  person obtaining
16# a  copy  of  this  software   and  associated  documentation  files  (the
17# "Software"),  to  deal in  the  Software  without restriction,  including
18# without  limitation the  rights  to use,  copy,  modify, merge,  publish,
19# distribute, sublicense, and/or sell copies of the Software, and to permit
20# persons  to whom  the Software  is  furnished to  do so,  subject to  the
21# following conditions:
22#
23# The above copyright  notice and this permission notice  shall be included
24# in all copies or substantial portions of the Software.
25#
26# THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
27# EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
28# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
29# NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
30# DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
31# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
32# USE OR OTHER DEALINGS IN THE SOFTWARE.
33
34AUTOMAKE_OPTIONS = \
35    dist-bzip2 \
36    dist-lzip \
37    dist-xz \
38    foreign \
39    subdir-objects
40
41ACLOCAL_AMFLAGS = -I m4
42LIBTOOLFLAGS = --verbose
43
44SUBDIRS = lib # lib goes first to build first
45if WITH_EXAMPLES
46SUBDIRS += examples
47endif
48if WITH_TESTS
49SUBDIRS += tests
50endif
51if WITH_XMLWF
52SUBDIRS += xmlwf doc
53endif
54
55pkgconfig_DATA = expat.pc
56pkgconfigdir = $(libdir)/pkgconfig
57
58
59dist_cmake_DATA = \
60    cmake/autotools/expat.cmake
61
62nodist_cmake_DATA = \
63    cmake/autotools/expat-config-version.cmake \
64    cmake/autotools/expat-noconfig.cmake \
65    cmake/expat-config.cmake
66
67cmakedir = $(libdir)/cmake/expat-@PACKAGE_VERSION@
68
69
70_EXTRA_DIST_CMAKE = \
71    cmake/autotools/expat-noconfig__linux.cmake.in \
72    cmake/autotools/expat-noconfig__macos.cmake.in \
73    cmake/autotools/expat-noconfig__windows.cmake.in \
74    cmake/autotools/expat-package-init.cmake \
75    cmake/mingw-toolchain.cmake \
76    \
77    CMakeLists.txt \
78    CMake.README \
79    ConfigureChecks.cmake \
80    expat.pc.cmake \
81    expat_config.h.cmake
82
83_EXTRA_DIST_WINDOWS = \
84    win32/build_expat_iss.bat \
85    win32/expat.iss \
86    win32/MANIFEST.txt \
87    win32/README.txt \
88    win32/version.rc.cmake
89
90EXTRA_DIST = \
91    $(_EXTRA_DIST_CMAKE) \
92    $(_EXTRA_DIST_WINDOWS) \
93    \
94    conftools/expat.m4 \
95    conftools/get-version.sh \
96    \
97    fuzz/xml_parsebuffer_fuzzer.c \
98    fuzz/xml_parse_fuzzer.c \
99    \
100    xmlwf/xmlwf_helpgen.py \
101    xmlwf/xmlwf_helpgen.sh \
102    \
103    buildconf.sh \
104    Changes \
105    README.md \
106    \
107    fix-xmltest-log.sh \
108    test-driver-wrapper.sh
109
110
111.PHONY: buildlib
112buildlib:
113	@echo 'ERROR: Running "make buildlib LIBRARY=libexpatw.la"' >&2
114	@echo 'ERROR: is no longer supported.  INSTEAD please:' >&2
115	@echo 'ERROR:' >&2
116	@echo 'ERROR:  * Mass-patch Makefile.am, e.g.' >&2
117	@echo 'ERROR:    # find -name Makefile.am -exec sed \' >&2
118	@echo 'ERROR:          -e "s,libexpat\.la,libexpatw.la," \' >&2
119	@echo 'ERROR:          -e "s,libexpat_la,libexpatw_la," \' >&2
120	@echo 'ERROR:          -i {} +' >&2
121	@echo 'ERROR:' >&2
122	@echo 'ERROR:  * Run automake to re-generate Makefile.in files' >&2
123	@echo 'ERROR:' >&2
124	@echo 'ERROR:  * Use "./configure --without-xmlwf" and/or' >&2
125	@echo 'ERROR:    "make -C lib all install" to bypass compilation' >&2
126	@echo 'ERROR:    of xmlwf (e.g. with -DXML_UNICODE)' >&2
127	@echo 'ERROR:' >&2
128	@false
129
130
131.PHONY: run-benchmark
132run-benchmark:
133	$(MAKE) -C tests/benchmark
134	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
135	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_attr.xml 4096 3
136	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_cdata.xml 4096 3
137	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_comment.xml 4096 3
138	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_tag.xml 4096 3
139	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_text.xml 4096 3
140
141.PHONY: download-xmlts-zip
142download-xmlts-zip:
143	if test "$(XMLTS_ZIP)" = ""; then \
144		wget --output-document=tests/xmlts.zip \
145			https://www.w3.org/XML/Test/xmlts20080827.zip; \
146	else \
147		cp $(XMLTS_ZIP) tests/xmlts.zip; \
148	fi
149
150tests/xmlts.zip:
151	$(MAKE) download-xmlts-zip
152
153.PHONY: extract-xmlts-zip
154extract-xmlts-zip: tests/xmlts.zip
155	[ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip  # vpath workaround
156	cd tests && unzip -q xmlts.zip
157
158tests/xmlconf: tests/xmlts.zip
159	$(MAKE) extract-xmlts-zip
160
161.PHONY: run-xmltest
162run-xmltest: tests/xmlconf
163if WITH_XMLWF
164	[ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip  # vpath workaround
165	$(MAKE) -C lib
166	$(MAKE) -C xmlwf
167	$(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log
168	$(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log
169	diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log
170else
171	@echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2
172	@echo 'ERROR: Please re-configure without --without-xmlwf.' >&2
173	@false
174endif
175
176.PHONY: qa
177qa:
178	QA_COMPILER=clang QA_SANITIZER=address   ./qa.sh
179	QA_COMPILER=clang QA_SANITIZER=memory    ./qa.sh
180	QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh
181	QA_COMPILER=gcc   QA_PROCESSOR=gcov      ./qa.sh
182