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