xref: /freebsd/contrib/expat/Makefile.am (revision 7a7741af18d6c8a804cc643cb7ecda9d730c6aa6)
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# 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_parsebuffer_fuzzer.c \
100    fuzz/xml_parse_fuzzer.c \
101    \
102    xmlwf/xmlwf_helpgen.py \
103    xmlwf/xmlwf_helpgen.sh \
104    \
105    buildconf.sh \
106    Changes \
107    README.md \
108    \
109    fix-xmltest-log.sh \
110    test-driver-wrapper.sh
111
112
113.PHONY: buildlib
114buildlib:
115	@echo 'ERROR: Running "make buildlib LIBRARY=libexpatw.la"' >&2
116	@echo 'ERROR: is no longer supported.  INSTEAD please:' >&2
117	@echo 'ERROR:' >&2
118	@echo 'ERROR:  * Mass-patch Makefile.am, e.g.' >&2
119	@echo 'ERROR:    # find . -name Makefile.am -exec sed \' >&2
120	@echo 'ERROR:          -e "s,libexpat\.la,libexpatw.la," \' >&2
121	@echo 'ERROR:          -e "s,libexpat_la,libexpatw_la," \' >&2
122	@echo 'ERROR:          -i.bak {} +' >&2
123	@echo 'ERROR:' >&2
124	@echo 'ERROR:  * Run automake to re-generate Makefile.in files' >&2
125	@echo 'ERROR:' >&2
126	@echo 'ERROR:  * Use "./configure --without-xmlwf" and/or' >&2
127	@echo 'ERROR:    "make -C lib all install" to bypass compilation' >&2
128	@echo 'ERROR:    of xmlwf (e.g. with -DXML_UNICODE)' >&2
129	@echo 'ERROR:' >&2
130	@false
131
132
133.PHONY: run-benchmark
134run-benchmark:
135	$(MAKE) -C tests/benchmark
136	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
137	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_attr.xml 4096 3
138	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_cdata.xml 4096 3
139	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_comment.xml 4096 3
140	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_tag.xml 4096 3
141	./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_text.xml 4096 3
142
143.PHONY: download-xmlts-zip
144download-xmlts-zip:
145	if test "$(XMLTS_ZIP)" = ""; then \
146		wget --output-document=tests/xmlts.zip \
147			https://www.w3.org/XML/Test/xmlts20080827.zip; \
148	else \
149		cp $(XMLTS_ZIP) tests/xmlts.zip; \
150	fi
151
152tests/xmlts.zip:
153	$(MAKE) download-xmlts-zip
154
155.PHONY: extract-xmlts-zip
156extract-xmlts-zip: tests/xmlts.zip
157	[ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip  # vpath workaround
158	cd tests && unzip -q xmlts.zip
159
160tests/xmlconf: tests/xmlts.zip
161	$(MAKE) extract-xmlts-zip
162
163.PHONY: run-xmltest
164run-xmltest: tests/xmlconf
165if WITH_XMLWF
166	[ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip  # vpath workaround
167	$(MAKE) -C lib
168	$(MAKE) -C xmlwf
169	$(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log
170	$(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log
171	diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log
172else
173	@echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2
174	@echo 'ERROR: Please re-configure without --without-xmlwf.' >&2
175	@false
176endif
177
178.PHONY: qa
179qa:
180	QA_COMPILER=clang QA_SANITIZER=address   ./qa.sh
181	QA_COMPILER=clang QA_SANITIZER=memory    ./qa.sh
182	QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh
183	QA_COMPILER=gcc   QA_PROCESSOR=gcov      ./qa.sh
184