xref: /aosp_15_r20/external/libxml2/Makefile.am (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1## Process this file with automake to produce Makefile.in
2
3ACLOCAL_AMFLAGS = -I m4
4
5SUBDIRS = include . doc example xstc
6if WITH_PYTHON
7SUBDIRS += python
8endif
9if WITH_GLOB
10SUBDIRS += fuzz
11endif
12
13DIST_SUBDIRS = include . doc example fuzz python xstc
14
15AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include -DSYSCONFDIR='"$(sysconfdir)"'
16
17check_PROGRAMS = \
18	runsuite \
19	runtest \
20	runxmlconf \
21	testModule \
22	testapi \
23	testchar \
24	testdict \
25	testlimits \
26	testparser \
27	testrecurse
28
29bin_PROGRAMS = xmllint xmlcatalog
30
31bin_SCRIPTS = xml2-config
32
33lib_LTLIBRARIES = libxml2.la
34libxml2_la_CFLAGS = $(AM_CFLAGS) $(XML_PRIVATE_CFLAGS)
35libxml2_la_LIBADD = $(XML_PRIVATE_LIBS)
36
37libxml2_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
38		     -version-info $(LIBXML_VERSION_INFO)
39if USE_VERSION_SCRIPT
40libxml2_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
41endif
42
43libxml2_la_SOURCES = buf.c chvalid.c dict.c entities.c encoding.c error.c \
44		     globals.c hash.c list.c parser.c parserInternals.c \
45		     SAX2.c threads.c tree.c uri.c valid.c xmlIO.c \
46		     xmlmemory.c xmlstring.c
47if WITH_C14N_SOURCES
48libxml2_la_SOURCES += c14n.c
49endif
50if WITH_CATALOG_SOURCES
51libxml2_la_SOURCES += catalog.c
52endif
53if WITH_DEBUG_SOURCES
54libxml2_la_SOURCES += debugXML.c
55endif
56if WITH_HTML_SOURCES
57libxml2_la_SOURCES += HTMLparser.c HTMLtree.c
58endif
59if WITH_HTTP_SOURCES
60libxml2_la_SOURCES += nanohttp.c
61endif
62if WITH_LEGACY_SOURCES
63libxml2_la_SOURCES += legacy.c
64endif
65if WITH_LZMA_SOURCES
66libxml2_la_SOURCES += xzlib.c
67endif
68if WITH_MODULES_SOURCES
69libxml2_la_SOURCES += xmlmodule.c
70endif
71if WITH_OUTPUT_SOURCES
72libxml2_la_SOURCES += xmlsave.c
73endif
74if WITH_PATTERN_SOURCES
75libxml2_la_SOURCES += pattern.c
76endif
77if WITH_READER_SOURCES
78libxml2_la_SOURCES += xmlreader.c
79endif
80if WITH_REGEXPS_SOURCES
81libxml2_la_SOURCES += xmlregexp.c xmlunicode.c
82endif
83if WITH_SCHEMAS_SOURCES
84libxml2_la_SOURCES += relaxng.c xmlschemas.c xmlschemastypes.c
85if !WITH_XPATH_SOURCES
86libxml2_la_SOURCES += xpath.c
87endif
88endif
89if WITH_SCHEMATRON_SOURCES
90libxml2_la_SOURCES += schematron.c
91endif
92if WITH_WRITER_SOURCES
93libxml2_la_SOURCES += xmlwriter.c
94endif
95if WITH_XINCLUDE_SOURCES
96libxml2_la_SOURCES += xinclude.c
97endif
98if WITH_XPATH_SOURCES
99libxml2_la_SOURCES += xpath.c
100endif
101if WITH_XPTR_SOURCES
102libxml2_la_SOURCES += xlink.c xpointer.c
103endif
104
105DEPS = libxml2.la
106LDADDS = libxml2.la
107
108runtest_SOURCES=runtest.c
109runtest_DEPENDENCIES = $(DEPS)
110runtest_LDADD= $(THREAD_LIBS) $(LDADDS)
111
112testrecurse_SOURCES=testrecurse.c
113testrecurse_DEPENDENCIES = $(DEPS)
114testrecurse_LDADD= $(LDADDS)
115
116testlimits_SOURCES=testlimits.c
117testlimits_DEPENDENCIES = $(DEPS)
118testlimits_LDADD= $(LDADDS)
119
120testchar_SOURCES=testchar.c
121testchar_DEPENDENCIES = $(DEPS)
122testchar_LDADD= $(LDADDS)
123
124testdict_SOURCES=testdict.c
125testdict_DEPENDENCIES = $(DEPS)
126testdict_LDADD= $(LDADDS)
127
128testparser_SOURCES=testparser.c
129testparser_DEPENDENCIES = $(DEPS)
130testparser_LDADD= $(LDADDS)
131
132runsuite_SOURCES=runsuite.c
133runsuite_DEPENDENCIES = $(DEPS)
134runsuite_LDADD= $(LDADDS)
135
136xmllint_SOURCES = xmllint.c shell.c
137xmllint_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS) $(ICONV_CFLAGS)
138xmllint_DEPENDENCIES = $(DEPS)
139xmllint_LDADD=  $(RDL_LIBS) $(LDADDS)
140
141xmlcatalog_SOURCES=xmlcatalog.c
142xmlcatalog_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS) $(ICONV_CFLAGS)
143xmlcatalog_DEPENDENCIES = $(DEPS)
144xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS)
145
146testModule_SOURCES=testModule.c
147testModule_DEPENDENCIES = $(DEPS)
148testModule_LDADD= $(LDADDS)
149
150noinst_LTLIBRARIES = testdso.la
151testdso_la_SOURCES = testdso.c
152testdso_la_LDFLAGS = $(AM_LDFLAGS) \
153		     -module -no-undefined -avoid-version -rpath $(libdir)
154
155# that one forces the rebuild when "make rebuild" is run on doc/
156rebuild_testapi:
157	-@(if [ "$(PYTHON)" != "" ] ; then \
158	    $(PYTHON) $(srcdir)/tools/gentest.py $(srcdir) ; fi )
159
160testapi_SOURCES=testapi.c
161testapi_DEPENDENCIES = $(DEPS)
162testapi_LDADD= $(LDADDS)
163
164runxmlconf_SOURCES=runxmlconf.c
165runxmlconf_DEPENDENCIES = $(DEPS)
166runxmlconf_LDADD= $(LDADDS)
167
168check-local:
169	[ -d test   ] || $(LN_S) $(srcdir)/test   .
170	[ -d result ] || $(LN_S) $(srcdir)/result .
171	$(CHECKER) ./runtest$(EXEEXT)
172	$(CHECKER) ./testrecurse$(EXEEXT)
173	$(CHECKER) ./testapi$(EXEEXT)
174	$(CHECKER) ./testchar$(EXEEXT)
175	$(CHECKER) ./testdict$(EXEEXT)
176	$(CHECKER) ./testparser$(EXEEXT)
177	$(CHECKER) ./testModule$(EXEEXT)
178	$(CHECKER) ./runxmlconf$(EXEEXT)
179	$(CHECKER) ./runsuite$(EXEEXT)
180if WITH_DEBUG_SOURCES
181	test/scripts/test.sh ./xmllint$(EXEEXT)
182endif
183if WITH_CATALOG_SOURCES
184	ASAN_OPTIONS=detect_leaks=0 test/catalogs/test.sh ./xmlcatalog$(EXEEXT)
185endif
186
187# Compatibility name of the check target
188runtests: check
189
190check-valgrind valgrind:
191	@echo '## Running the regression tests under Valgrind'
192	@echo '## Go get a cup of coffee it is gonna take a while ...'
193	$(MAKE) CHECKER='valgrind -q' check
194
195asan:
196	@echo '## rebuilding for ASAN'
197	./configure CFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" CXXFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" LDFLAGS="-fsanitize=address,undefined" CC="clang" CXX="clang++" --disable-shared ; OptimOff  ; $(MAKE) clean ; $(MAKE)
198
199cleanup:
200	-@(find . -name .\#\* -exec rm {} \;)
201	-@(find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;)
202	-@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm -f {} \;)
203
204dist-hook: cleanup
205	(cd $(srcdir) ; tar -cf - --exclude .git win32 os400 test result) | (cd $(distdir); tar xf -)
206
207CLEANFILES = runsuite.log runxmlconf.log test.out *.gcda *.gcno *.res
208DISTCLEANFILES = COPYING missing.lst
209
210EXTRA_DIST = Copyright libxml2-config.cmake.in autogen.sh \
211	     libxml.h iso8859x.inc \
212	     tools/gentest.py \
213	     tools/genChRanges.py tools/genEscape.py tools/genUnicode.py \
214	     libxml2.syms timsort.h \
215	     README.zOS README.md \
216	     CMakeLists.txt config.h.cmake.in libxml2-config.cmake.cmake.in \
217	     meson.build meson_options.txt
218
219
220pkgconfigdir = $(libdir)/pkgconfig
221pkgconfig_DATA = libxml-2.0.pc
222
223cmakedir = $(libdir)/cmake/libxml2
224cmake_DATA = libxml2-config.cmake
225
226tst: tst.c
227	$(CC) $(CFLAGS) -Iinclude -o tst tst.c .libs/libxml2.a -lpthread -lm -lz -llzma
228
229sparse: clean
230	$(MAKE) CC=cgcc
231
232#
233# Coverage support, largely borrowed from libvirt
234# Both binaries comes from the lcov package in Fedora
235#
236LCOV = /usr/bin/lcov
237GENHTML = /usr/bin/genhtml
238
239cov: clean-cov
240	if [ "`echo $(AM_LDFLAGS) | grep coverage`" = "" ] ; then \
241	    echo not configured with coverage; exit 1 ; fi
242	if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \
243	    echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi
244	-@($(MAKE) check)
245	-@(./runsuite$(EXEEXT))
246	mkdir $(top_builddir)/coverage
247	$(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir)
248	$(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr*
249	rm $(top_builddir)/coverage/libxml2.info.tmp
250	$(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info
251	echo "Coverage report is in $(top_builddir)/coverage/index.html"
252
253clean-cov:
254	rm -rf $(top_builddir)/coverage
255
256