Make Makefile.devel more useful for the users of the released tarball.
diff --git a/ChangeLog b/ChangeLog
index ded5769..4ca0259 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2016-12-03  Bruno Haible  <bruno@clisp.org>
 
+	Make Makefile.devel more useful for the users of the released tarball.
+	* Makefile.devel (srclib/Makefile.gnulib): Don't force this target.
+	(gnulib-clean): New target.
+	(totally-clean): New target. Do the removals from autogen.sh. Also,
+	remove lib/aliases*.gperf, lib/canonical*.h, man/iconvctl.3.html,
+	man/iconv_open_into.3.html.
+	* autogen.sh: Invoke target gnulib-clean before srclib/Makefile.gnulib.
+	Invoke target totally-clean before all.
+	* preload/Makefile.devel (totally-clean): New target.
+
+2016-12-03  Bruno Haible  <bruno@clisp.org>
+
 	Modernize configure.ac.
 	* configure.ac: Use 2-argument AC_INIT. Avoid an AM_INIT_AUTOMAKE
 	warning.
diff --git a/Makefile.devel b/Makefile.devel
index 3aafa96..c145b9c 100644
--- a/Makefile.devel
+++ b/Makefile.devel
@@ -80,7 +80,7 @@
   xalloc \
   libiconv-misc
 
-srclib/Makefile.gnulib : force
+srclib/Makefile.gnulib :
 	if test -n "$$GNULIB_TOOL"; then \
 	  $$GNULIB_TOOL --lib=libicrt --source-base=srclib --m4-base=srcm4 --makefile-name=Makefile.gnulib --no-libtool --local-dir=gnulib-local --no-vc-files \
 	    --import $(GNULIB_MODULES); \
@@ -199,4 +199,35 @@
 	$(RM) $@-t
 
 
+gnulib-clean : force
+# Move srclib/Makefile.gnulib away, so that the target 'srclib/Makefile.gnulib' will actually do something.
+	if test -f srclib/Makefile.gnulib; then \
+	  mv srclib/Makefile.gnulib srclib/Makefile.gnulib~; \
+	fi
+# No need to remove the stale files. gnulib-tool does this itself, thank to srclib/gnulib-comp.m4.
+#	find srclib '(' -name '*.h' -o -name '*.c' -o -name '*.valgrind' ')' -exec rm -f '{}' ';'
+#	rm -rf srcm4
+
+totally-clean : force
+	rm -f srclib/Makefile.in
+	rm -f $(CONFIGURES) config.h.in include/iconv.h.build.in
+	rm -f lib/aliases.gperf lib/aliases_sysaix.gperf lib/aliases_syshpux.gperf lib/aliases_sysosf1.gperf lib/aliases_syssolaris.gperf
+	rm -f lib/aliases.h lib/aliases_sysaix.h lib/aliases_syshpux.h lib/aliases_sysosf1.h lib/aliases_syssolaris.h
+	rm -f lib/aliases_aix.h lib/aliases_aix_sysaix.h
+	rm -f lib/aliases_osf1.h lib/aliases_osf1_sysosf1.h
+	rm -f lib/aliases_dos.h
+	rm -f lib/aliases_extra.h
+	rm -f lib/canonical.h lib/canonical_sysaix.h lib/canonical_syshpux.h lib/canonical_sysosf1.h lib/canonical_syssolaris.h
+	rm -f lib/canonical_aix.h lib/canonical_aix_sysaix.h
+	rm -f lib/canonical_osf1.h lib/canonical_osf1_sysosf1.h
+	rm -f lib/canonical_dos.h
+	rm -f lib/canonical_extra.h
+	rm -f lib/canonical_local.h lib/canonical_local_sysaix.h lib/canonical_local_syshpux.h lib/canonical_local_sysosf1.h lib/canonical_local_syssolaris.h
+	rm -f lib/flags.h
+	rm -f lib/translit.h
+	rm -f man/iconv.1.html man/iconv.3.html man/iconv_close.3.html man/iconv_open.3.html man/iconvctl.3.html man/iconv_open_into.3.html
+	cd libcharset && $(MAKE) -f Makefile.devel totally-clean
+	cd preload && $(MAKE) -f Makefile.devel totally-clean
+
+
 force :
diff --git a/autogen.sh b/autogen.sh
index aa8602f..8b9a394 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -60,20 +60,11 @@
   fi
   # Skip the gnulib-tool step if gnulib-tool was not found.
   if test -n "$GNULIB_TOOL"; then
-    make -f Makefile.devel srclib/Makefile.gnulib GNULIB_TOOL="$GNULIB_TOOL"
+    make -f Makefile.devel gnulib-clean srclib/Makefile.gnulib GNULIB_TOOL="$GNULIB_TOOL"
   fi
 fi
 
-rm -f configure config.h.in include/iconv.h.build.in
-rm -f lib/aliases.h lib/aliases_sysaix.h lib/aliases_syshpux.h lib/aliases_sysosf1.h lib/aliases_syssolaris.h
-rm -f lib/aliases_aix.h lib/aliases_aix_sysaix.h
-rm -f lib/aliases_osf1.h lib/aliases_osf1_sysosf1.h
-rm -f lib/aliases_dos.h
-rm -f lib/aliases_extra.h
-rm -f lib/flags.h
-rm -f lib/translit.h
-rm -f man/iconv.1.html man/iconv.3.html man/iconv_close.3.html man/iconv_open.3.html
-make -f Makefile.devel
+make -f Makefile.devel totally-clean all
 
 (cd libcharset
  ./autogen.sh
diff --git a/libcharset/ChangeLog b/libcharset/ChangeLog
index 1385bc2..5b18add 100644
--- a/libcharset/ChangeLog
+++ b/libcharset/ChangeLog
@@ -1,5 +1,11 @@
 2016-12-03  Bruno Haible  <bruno@clisp.org>
 
+	Make Makefile.devel more useful for the users of the released tarball.
+	* Makefile.devel (totally-clean): New target.
+	* autogen.sh: Invoke it and 'all'.
+
+2016-12-03  Bruno Haible  <bruno@clisp.org>
+
 	Modernize configure.ac.
 	* configure.ac: Require autoconf >= 2.60. Use 2-argument AC_INIT.
 	Use AC_CONFIG_SRCDIR.
diff --git a/libcharset/Makefile.devel b/libcharset/Makefile.devel
index f92ad57..ff30d9c 100644
--- a/libcharset/Makefile.devel
+++ b/libcharset/Makefile.devel
@@ -28,4 +28,7 @@
 	    -e '/#define _LOCALCHARSET_H/r include/export.h' \
 	  < $< > $@
 
+totally-clean : force
+	rm -f autoconf/aclocal.m4 configure config.h.in include/localcharset.h.build.in
+
 force :
diff --git a/libcharset/autogen.sh b/libcharset/autogen.sh
index 9d30f58..be2eccb 100755
--- a/libcharset/autogen.sh
+++ b/libcharset/autogen.sh
@@ -2,9 +2,9 @@
 # Convenience script for regenerating all aclocal.m4, config.h.in, Makefile.in,
 # configure files with new versions of autoconf or automake.
 #
-# This script requires autoconf-2.63..2.68 and automake-1.11 in the PATH.
+# This script requires autoconf-2.63..2.69 and automake-1.11..1.15 in the PATH.
 
-# Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc.
+# Copyright (C) 2003-2007, 2009-2010, 2016 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,5 +21,4 @@
 
 # Usage: ./autogen.sh
 
-rm -f autoconf/aclocal.m4 configure config.h.in include/localcharset.h.build.in
-make -f Makefile.devel
+make -f Makefile.devel totally-clean all
diff --git a/preload/Makefile.devel b/preload/Makefile.devel
index 15781d9..30b8fda 100644
--- a/preload/Makefile.devel
+++ b/preload/Makefile.devel
@@ -18,4 +18,7 @@
 configure : configure.ac aclocal.m4
 	$(AUTOCONF)
 
+totally-clean : all
+	rm -f aclocal.m4 configure
+
 force :