  # Shell scripts that call the example programs.
  check_SCRIPTS = \
    dom_build/make_check.sh \
-@@ -147,10 +164,10 @@ dist_noinst_DATA = \
+@@ -147,10 +166,10 @@ dist_noinst_DATA = \
  # 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' >>$@
-+	echo 'dom_read_write/.libs/dom_read_write "$(srcdir)/dom_read_write/example.xml" dom_read_write/example_output.xml >/dev/null' >>$@
++	echo 'cd dom_read_write && .libs/dom_read_write "example.xml" example_output.xml >/dev/null' >>$@
  	chmod +x $@
  
 -script_template = cd "$(srcdir)/<!progname!>" && "$(abs_builddir)/<!progname!>/<!progname!>" >/dev/null
-+script_template = cd "$(srcdir)/<!progname!>" && ".libs/<!progname!>" >/dev/null
++script_template = cd "<!progname!>" && ".libs/<!progname!>" >/dev/null
  standard_scripts = $(filter-out dom_read_write/make_check.sh,$(check_SCRIPTS))
  
  # All other script files are generated like so:
-@@ -162,3 +179,18 @@ $(standard_scripts): Makefile
+@@ -162,3 +181,18 @@ $(standard_scripts): Makefile
  CLEANFILES = \
    dom_read_write/example_output.xml \
    $(check_SCRIPTS)

 # Optional: auto-generate the ChangeLog file from the git log on make dist
 include $(top_srcdir)/macros/dist-changelog.am
diff --git a/examples/Makefile.am b/examples/Makefile.am
index d9541ca..c28b49c 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -36,6 +36,23 @@ check_PROGRAMS = \
   schemavalidation/schemavalidation \
   textreader/textreader
 

+	$(MKDIR_P) $(DESTDIR)/examples
+	cp --parents $(check_DOTLIBS) $(DESTDIR)/examples
+	cp --parents $(check_SCRIPTS) $(DESTDIR)/examples
+	cd $(srcdir) && cp --parents $(dist_noinst_DATA) $(DESTDIR)/examples
+	cp Makefile $(DESTDIR)/examples
+	$(MKDIR_P) $(DESTDIR)/macros
+	cp $(srcdir)/../macros/test-driver $(DESTDIR)/macros
