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 61nodist_cmake_DATA = \ 62 cmake/autotools/expat.cmake \ 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__linux.cmake.in \ 72 cmake/autotools/expat__macos.cmake.in \ 73 cmake/autotools/expat__windows.cmake.in \ 74 cmake/autotools/expat-noconfig__linux.cmake.in \ 75 cmake/autotools/expat-noconfig__macos.cmake.in \ 76 cmake/autotools/expat-noconfig__windows.cmake.in \ 77 cmake/autotools/expat-package-init.cmake \ 78 cmake/mingw-toolchain.cmake \ 79 \ 80 CMakeLists.txt \ 81 CMake.README \ 82 ConfigureChecks.cmake \ 83 expat.pc.cmake \ 84 expat_config.h.cmake 85 86_EXTRA_DIST_WINDOWS = \ 87 win32/build_expat_iss.bat \ 88 win32/expat.iss \ 89 win32/MANIFEST.txt \ 90 win32/README.txt \ 91 win32/version.rc.cmake 92 93EXTRA_DIST = \ 94 $(_EXTRA_DIST_CMAKE) \ 95 $(_EXTRA_DIST_WINDOWS) \ 96 \ 97 conftools/expat.m4 \ 98 conftools/get-version.sh \ 99 \ 100 fuzz/xml_lpm_fuzzer.cpp \ 101 fuzz/xml_lpm_fuzzer.proto \ 102 fuzz/xml_parsebuffer_fuzzer.c \ 103 fuzz/xml_parse_fuzzer.c \ 104 \ 105 xmlwf/xmlwf_helpgen.py \ 106 xmlwf/xmlwf_helpgen.sh \ 107 \ 108 buildconf.sh \ 109 Changes \ 110 README.md \ 111 \ 112 fix-xmltest-log.sh \ 113 test-driver-wrapper.sh 114 115 116.PHONY: buildlib 117buildlib: 118 @echo 'ERROR: Running "make buildlib LIBRARY=libexpatw.la"' >&2 119 @echo 'ERROR: is no longer supported. INSTEAD please:' >&2 120 @echo 'ERROR:' >&2 121 @echo 'ERROR: * Mass-patch Makefile.am, e.g.' >&2 122 @echo 'ERROR: # find . -name Makefile.am -exec sed \' >&2 123 @echo 'ERROR: -e "s,libexpat\.la,libexpatw.la," \' >&2 124 @echo 'ERROR: -e "s,libexpat_la,libexpatw_la," \' >&2 125 @echo 'ERROR: -i.bak {} +' >&2 126 @echo 'ERROR:' >&2 127 @echo 'ERROR: * Run automake to re-generate Makefile.in files' >&2 128 @echo 'ERROR:' >&2 129 @echo 'ERROR: * Use "./configure --without-xmlwf" and/or' >&2 130 @echo 'ERROR: "make -C lib all install" to bypass compilation' >&2 131 @echo 'ERROR: of xmlwf (e.g. with -DXML_UNICODE)' >&2 132 @echo 'ERROR:' >&2 133 @false 134 135 136.PHONY: run-benchmark 137run-benchmark: 138 $(MAKE) -C tests/benchmark 139 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 140 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_attr.xml 4096 3 141 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_cdata.xml 4096 3 142 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_comment.xml 4096 3 143 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_tag.xml 4096 3 144 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/aaaaaa_text.xml 4096 3 145 146.PHONY: download-xmlts-zip 147download-xmlts-zip: 148 if test "$(XMLTS_ZIP)" = ""; then \ 149 wget --output-document=tests/xmlts.zip \ 150 https://www.w3.org/XML/Test/xmlts20080827.zip; \ 151 else \ 152 cp $(XMLTS_ZIP) tests/xmlts.zip; \ 153 fi 154 155tests/xmlts.zip: 156 $(MAKE) download-xmlts-zip 157 158.PHONY: extract-xmlts-zip 159extract-xmlts-zip: tests/xmlts.zip 160 [ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip # vpath workaround 161 cd tests && unzip -q xmlts.zip 162 163tests/xmlconf: tests/xmlts.zip 164 $(MAKE) extract-xmlts-zip 165 166.PHONY: run-xmltest 167run-xmltest: tests/xmlconf 168if WITH_XMLWF 169 [ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip # vpath workaround 170 $(MAKE) -C lib 171 $(MAKE) -C xmlwf 172 $(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log 173 $(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log 174 diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log 175else 176 @echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2 177 @echo 'ERROR: Please re-configure without --without-xmlwf.' >&2 178 @false 179endif 180 181.PHONY: qa 182qa: 183 QA_COMPILER=clang QA_SANITIZER=address ./qa.sh 184 QA_COMPILER=clang QA_SANITIZER=memory ./qa.sh 185 QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh 186 QA_COMPILER=gcc QA_PROCESSOR=gcov ./qa.sh 187