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