Commit c63a3948 authored by Kjell Ahlstedt's avatar Kjell Ahlstedt

Add examples/Makefile.am. Let 'make check' run the examples.

* examples/Makefile.am: New file. Let 'make check' both compile and run the
example programs.
* Makefile.am: Call examples/Makefile. Move all 'examples' stuff to
examples/Makefile.am.
* configure.ac: Remove --enable-examples. Generate examples/Makefile.
* .gitignore: Ignore make-check-sh. Bug #678390.
parent 949e0ecb
......@@ -59,6 +59,7 @@ stamp-h?
/examples/sax_parser_entities/sax_parser_entities
/examples/schemavalidation/schemavalidation
/examples/textreader/textreader
/examples/*/make-check-sh
# macros
/macros/compile-binding.am
......
2012-06-19 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
Add examples/Makefile.am. Let 'make check' run the examples.
* examples/Makefile.am: New file. Let 'make check' both compile and run the
example programs.
* Makefile.am: Call examples/Makefile. Move all 'examples' stuff to
examples/Makefile.am.
* configure.ac: Remove --enable-examples. Generate examples/Makefile.
* .gitignore: Ignore make-check-sh. Bug #678390.
2012-06-19 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
Example programs: Fix return codes and print errors on std::cerr.
......
SUBDIRS = . examples
ACLOCAL_AMFLAGS = -I macros ${ACLOCAL_FLAGS}
DISTCHECK_CONFIGURE_FLAGS = --enable-warnings=fatal
......@@ -13,23 +15,6 @@ libxml___libxml___@LIBXMLXX_API_VERSION@_la_LDFLAGS = \
libxml___libxml___@LIBXMLXX_API_VERSION@_la_LIBADD = $(LIBXMLXX_LIBS)
libxml___libxml___@LIBXMLXX_API_VERSION@_la_SOURCES = $(cc_sources) $(h_sources_public)
if ENABLE_EXAMPLES
noinst_PROGRAMS = examples/dom_build/dom_build \
examples/dom_parse_entities/dom_parse_entities \
examples/dom_parser/dom_parser \
examples/dom_parser_raw/dom_parser_raw \
examples/dom_read_write/dom_read_write \
examples/dom_xpath/dom_xpath \
examples/dtdvalidation/dtdvalidation \
examples/import_node/import_node \
examples/sax_exception/sax_exception \
examples/sax_parser/sax_parser \
examples/sax_parser_build_dom/sax_parser_build_dom \
examples/sax_parser_entities/sax_parser_entities \
examples/schemavalidation/schemavalidation \
examples/textreader/textreader
endif
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I. $(LIBXMLXX_CFLAGS)
AM_CXXFLAGS = $(LIBXMLXX_WXXFLAGS)
DEFS = @DEFS@ -DLIBXMLPP_BUILD
......@@ -121,73 +106,6 @@ library_nodes_include_HEADERS = $(h_nodes_sources_public)
library_parsers_include_HEADERS = $(h_parsers_sources_public)
library_validators_include_HEADERS = $(h_validators_sources_public)
if ENABLE_EXAMPLES
examples_dom_build_dom_build_SOURCES = examples/dom_build/main.cc
examples_dom_parse_entities_dom_parse_entities_SOURCES = \
examples/dom_parse_entities/main.cc
examples_dom_parser_dom_parser_SOURCES = examples/dom_parser/main.cc
examples_dom_parser_raw_dom_parser_raw_SOURCES = examples/dom_parser_raw/main.cc
examples_dom_read_write_dom_read_write_SOURCES = examples/dom_read_write/main.cc
examples_dom_xpath_dom_xpath_SOURCES = examples/dom_xpath/main.cc
examples_dtdvalidation_dtdvalidation_SOURCES = examples/dtdvalidation/main.cc
examples_import_node_import_node_SOURCES = examples/import_node/main.cc
examples_sax_exception_sax_exception_SOURCES = examples/sax_exception/main.cc \
examples/sax_exception/myparser.cc \
examples/sax_exception/myparser.h
examples_sax_parser_sax_parser_SOURCES = examples/sax_parser/main.cc \
examples/sax_parser/myparser.cc \
examples/sax_parser/myparser.h
examples_sax_parser_build_dom_sax_parser_build_dom_SOURCES = \
examples/sax_parser_build_dom/main.cc \
examples/sax_parser_build_dom/svgparser.cc \
examples/sax_parser_build_dom/svgparser.h \
examples/sax_parser_build_dom/svgdocument.cc \
examples/sax_parser_build_dom/svgdocument.h \
examples/sax_parser_build_dom/svgelement.cc \
examples/sax_parser_build_dom/svgelement.h \
examples/sax_parser_build_dom/svgpath.h \
examples/sax_parser_build_dom/svggroup.h
examples_sax_parser_entities_sax_parser_entities_SOURCES = \
examples/sax_parser_entities/main.cc \
examples/sax_parser_entities/myparser.cc \
examples/sax_parser_entities/myparser.h
examples_schemavalidation_schemavalidation_SOURCES = \
examples/schemavalidation/main.cc
examples_textreader_textreader_SOURCES = examples/textreader/main.cc
examples_ldadd = libxml++/libxml++-$(LIBXMLXX_API_VERSION).la $(LIBXMLXX_LIBS)
examples_dom_build_dom_build_LDADD = \
$(examples_ldadd)
examples_dom_parse_entities_dom_parse_entities_LDADD = \
$(examples_ldadd)
examples_dom_parser_dom_parser_LDADD = \
$(examples_ldadd)
examples_dom_parser_raw_dom_parser_raw_LDADD = \
$(examples_ldadd)
examples_dom_read_write_dom_read_write_LDADD = \
$(examples_ldadd)
examples_dom_xpath_dom_xpath_LDADD = \
$(examples_ldadd)
examples_dtdvalidation_dtdvalidation_LDADD = \
$(examples_ldadd)
examples_import_node_import_node_LDADD = \
$(examples_ldadd)
examples_sax_exception_sax_exception_LDADD = \
$(examples_ldadd)
examples_sax_parser_sax_parser_LDADD = \
$(examples_ldadd)
examples_sax_parser_build_dom_sax_parser_build_dom_LDADD = \
$(examples_ldadd)
examples_sax_parser_entities_sax_parser_entities_LDADD = \
$(examples_ldadd)
examples_schemavalidation_schemavalidation_LDADD = \
$(examples_ldadd)
examples_textreader_textreader_LDADD = \
$(examples_ldadd)
endif # ENABLE_EXAMPLES
docs/manual/libxml++.xml: docs/manual/libxml++_without_code.xml docs/manual/insert_example_code.pl
$(AM_V_GEN)$(PERL) -- docs/manual/insert_example_code.pl examples $< >$@
......@@ -231,30 +149,6 @@ dist_noinst_DATA += libxml++config.h.in \
$(manual_html_files) \
docs/manual/libxml++.xml \
docs/manual/libxml++_without_code.xml \
examples/README \
examples/dom_parser/example.xml \
examples/dom_parser/example_with_namespace.xml \
examples/dom_parser/example_invalid.xml \
examples/dom_parser/example.dtd \
examples/dom_parser_raw/example.xml \
examples/dom_parser_raw/example.dtd \
examples/dom_parse_entities/example.xml \
examples/dom_parse_entities/example.dtd \
examples/dom_read_write/README \
examples/dom_read_write/example.xml \
examples/dom_read_write/example.dtd \
examples/dom_xpath/example.xml \
examples/dtdvalidation/example.dtd \
examples/import_node/example1.xml \
examples/import_node/example2.xml \
examples/sax_parser/example.xml \
examples/sax_parser_entities/example.xml \
examples/sax_exception/example.xml \
examples/sax_parser_build_dom/README \
examples/sax_parser_build_dom/example.xml \
examples/schemavalidation/example.xml \
examples/schemavalidation/example.xsd \
examples/textreader/example.xml \
MSVC_Net2005/blank.cpp \
MSVC_Net2005/libxml++.sln \
MSVC_Net2005/README \
......
......@@ -34,14 +34,6 @@ PKG_CHECK_MODULES([LIBXMLXX], [$LIBXMLXX_MODULES])
AC_LANG([C++])
AC_CHECK_HEADERS([string list map], [], [AC_MSG_ERROR([required headers not found])])
AC_ARG_ENABLE([examples],
[AS_HELP_STRING([--enable-examples],
[build the examples])],
[enable_examples=$enableval],
[enable_examples=yes])
AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = xyes])
MM_ARG_ENABLE_DOCUMENTATION
MM_ARG_WITH_TAGFILE_DOC([glibmm-2.4.tag], [glibmm-2.4])
......@@ -60,6 +52,7 @@ MM_CHECK_PERL()
AC_DEFINE([LIBXMLCPP_EXCEPTIONS_ENABLED],[1], [This is always set. This is only for backwards compatibility.])
AC_CONFIG_FILES([Makefile
examples/Makefile
docs/reference/Doxyfile
MSVC_Net2005/libxml++/libxml++.rc
MSVC_Net2008/libxml++/libxml++.rc
......
## Copyright (C) 2012 The libxml++ development team
##
## This file is part of libxml++.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library. If not, see <http://www.gnu.org/licenses/>.
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I. $(LIBXMLXX_CFLAGS)
AM_CXXFLAGS = $(LIBXMLXX_WXXFLAGS)
LDADD = $(top_builddir)/libxml++/libxml++-$(LIBXMLXX_API_VERSION).la $(LIBXMLXX_LIBS)
check_PROGRAMS = \
dom_build/dom_build \
dom_parse_entities/dom_parse_entities \
dom_parser/dom_parser \
dom_parser_raw/dom_parser_raw \
dom_read_write/dom_read_write \
dom_xpath/dom_xpath \
dtdvalidation/dtdvalidation \
import_node/import_node \
sax_exception/sax_exception \
sax_parser/sax_parser \
sax_parser_build_dom/sax_parser_build_dom \
sax_parser_entities/sax_parser_entities \
schemavalidation/schemavalidation \
textreader/textreader
# Shell scripts that call the example programs.
check_SCRIPTS = $(addsuffix make-check-sh,$(dir $(check_PROGRAMS)))
TESTS = $(check_SCRIPTS)
dom_build_dom_build_SOURCES = \
dom_build/main.cc
dom_parse_entities_dom_parse_entities_SOURCES = \
dom_parse_entities/main.cc
dom_parser_dom_parser_SOURCES = \
dom_parser/main.cc
dom_parser_raw_dom_parser_raw_SOURCES = \
dom_parser_raw/main.cc
dom_read_write_dom_read_write_SOURCES = \
dom_read_write/main.cc
dom_xpath_dom_xpath_SOURCES = \
dom_xpath/main.cc
dtdvalidation_dtdvalidation_SOURCES = \
dtdvalidation/main.cc
import_node_import_node_SOURCES = \
import_node/main.cc
sax_exception_sax_exception_SOURCES = \
sax_exception/main.cc \
sax_exception/myparser.cc \
sax_exception/myparser.h
sax_parser_sax_parser_SOURCES = \
sax_parser/main.cc \
sax_parser/myparser.cc \
sax_parser/myparser.h
sax_parser_build_dom_sax_parser_build_dom_SOURCES = \
sax_parser_build_dom/main.cc \
sax_parser_build_dom/svgparser.cc \
sax_parser_build_dom/svgparser.h \
sax_parser_build_dom/svgdocument.cc \
sax_parser_build_dom/svgdocument.h \
sax_parser_build_dom/svgelement.cc \
sax_parser_build_dom/svgelement.h \
sax_parser_build_dom/svgpath.h \
sax_parser_build_dom/svggroup.h
sax_parser_entities_sax_parser_entities_SOURCES = \
sax_parser_entities/main.cc \
sax_parser_entities/myparser.cc \
sax_parser_entities/myparser.h
schemavalidation_schemavalidation_SOURCES = \
schemavalidation/main.cc
textreader_textreader_SOURCES = \
textreader/main.cc
dist_noinst_DATA = \
README \
dom_parse_entities/example.xml \
dom_parse_entities/example.dtd \
dom_parser/example.xml \
dom_parser/example_with_namespace.xml \
dom_parser/example_invalid.xml \
dom_parser/example.dtd \
dom_parser_raw/example.xml \
dom_parser_raw/example_invalid.xml \
dom_parser_raw/example.dtd \
dom_read_write/README \
dom_read_write/example.xml \
dom_read_write/example.dtd \
dom_xpath/example.xml \
dtdvalidation/example.dtd \
import_node/example1.xml \
import_node/example2.xml \
sax_exception/example.xml \
sax_parser/example.xml \
sax_parser_build_dom/README \
sax_parser_build_dom/example.xml \
sax_parser_entities/example.xml \
schemavalidation/example.xml \
schemavalidation/example.xsd \
textreader/example.xml
# Build the shell scripts that call the example programs.
#
# Some programs can find their input file(s) only if the current directory,
# when they are executed, is the program's own source directory.
# To make these program invocations as consistent as possible, and to avoid
# having to specify parameters for the programs, most programs are executed
# from their own source directory.
# dom_read_write shall write its output file in the build directory,
# which may or may not be the same as the source directory.
# Here it's necessary to specify parameters when the input file and the output
# file are located in different directories.
dom_read_write/make-check-sh: Makefile
echo '# Generated and used by "make check"' >$@
echo 'dom_read_write/dom_read_write "$(srcdir)/dom_read_write/example.xml" dom_read_write/example_output.xml >/dev/null' >>$@
chmod +x $@
script_template = cd "$(srcdir)/<!progname!>" && "$(abs_builddir)/<!progname!>/<!progname!>" >/dev/null
standard_scripts = $(filter-out dom_read_write/make-check-sh,$(check_SCRIPTS))
# All other script files are generated like so:
$(standard_scripts): Makefile
echo '# Generated and used by "make check"' >$@
echo '$(subst <!progname!>,$(subst /make-check-sh,,$@),$(script_template))' >>$@
chmod +x $@
CLEANFILES = \
dom_read_write/example_output.xml \
$(check_SCRIPTS)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment