2014-06-29  Yavor Doganov  <yavor@gnu.org>

	Default to makeinfo for generating manuals in HTML format.
	* Documentation/GNUmakefile (GNUSTEP_TEXI2HTML_FLAGS): Use
	--init-file which works with both texi2html and makeinfo/5.x.
	* Instance/documentation/texi.make (GNUSTEP_TEXI2HTML): Define
	as `makeinfo --html'.
	(GNUSTEP_TEXI2HTML_FLAGS): Wrap into another make
	conditional as by default it is not needed for makeinfo.
	(HTMLTARGET): New variable, define conditionally based on the
	program/options used.
	(internal_doc_all_, $(GNUSTEP_INSTANCE).html): Replace hardcoded
	target with $(HTMLTARGET).
	(internal-doc-install_, internal_doc_uninstall_): Handle the case
	of makeinfo-generated documentation.
	* Documentation/news.texi:
	* Documentation/releasenotes.texi: Update.


--- a/Documentation/GNUmakefile
+++ b/Documentation/GNUmakefile
@@ -167,7 +167,7 @@ include $(GNUSTEP_MAKEFILES)/documentation.make
 
 include ../Version
 
-GNUSTEP_TEXI2HTML_FLAGS += -init_file gnustep.init
+GNUSTEP_TEXI2HTML_FLAGS += --init-file gnustep.init
 
 # Typing 'make regenerate' should build all, then install the files
 # top-level.  This is mostly for making gnustep-make releases.
--- a/Documentation/news.texi
+++ b/Documentation/news.texi
@@ -9,14 +9,33 @@
 The currently released version is @samp{@value{GNUSTEP-MAKE-VERSION}}.
 @end ifclear
 
+@section Changes in version @samp{2.6.7}
+
+@itemize @bullet
+@item
+As of this release, the default program for generating HTML manuals from
+Texinfo documents is @command{makeinfo}.
+@itemize @minus
+@item
+To revert to the old behaviour, set the variable GNUSTEP_TEXI2HTML to
+@command{texi2html} in your makefiles.
+@item
+If you prefer non-split (monolithic) output, set GNUSTEP_TEXI2HTML_FLAGS
+to @option{--no-split}.  This will work for both @command{makeinfo} and
+@command{texi2html}.
+@end itemize
+@item
+Minor bugfixes.
+@end itemize
+
+@ifclear ANNOUNCE-ONLY
+
 @section Changes in version @samp{2.6.6}
 
 Debian packaging support
 
 Minor bugfixes.
 
-@ifclear ANNOUNCE-ONLY
-
 @section Changes in version @samp{2.6.5}
 
 Bugfix for non-fragile ABI test
--- a/Documentation/releasenotes.texi
+++ b/Documentation/releasenotes.texi
@@ -4,6 +4,24 @@ The release notes include descriptions of API changes, behavior
 changes and other information that might help developers and users
 migrate to using a newer version of the make system.
 
+@section Version 2.6.7
+
+@itemize @bullet
+@item
+The default program for generating HTML from Texinfo documents is
+@command{makeinfo}.  All four combinations (makeinfo, texi2html, split
+and monolithic output) are available.
+@itemize @minus
+@item
+To revert to the old behaviour, set the variable GNUSTEP_TEXI2HTML to
+@command{texi2html} in your makefiles.
+@item
+If you prefer non-split (monolithic) output, set GNUSTEP_TEXI2HTML_FLAGS
+to @option{--no-split}.  This will work for both @command{makeinfo} and
+@command{texi2html}.
+@end itemize
+@end itemize
+
 @section Version 2.6.6
 
 Debian packagge generation support added.
--- a/Instance/Documentation/texi.make
+++ b/Instance/Documentation/texi.make
@@ -1,4 +1,4 @@
-#   -*-makefile-*-
+#   -*-makefile-gmake-*-
 #   Instance/Documentation/texi.make
 #
 #   Instance Makefile rules to build Texinfo documentation.
@@ -55,15 +55,28 @@ ifeq ($(GNUSTEP_TEXI2PDF_FLAGS),)
 endif
 
 ifeq ($(GNUSTEP_TEXI2HTML),)
-  GNUSTEP_TEXI2HTML = texi2html
+  GNUSTEP_TEXI2HTML = makeinfo --html
 endif
+ifeq ($(GNUSTEP_TEXI2HTML),texi2html)
 ifeq ($(GNUSTEP_TEXI2HTML_FLAGS),)
   GNUSTEP_TEXI2HTML_FLAGS = -split_chapter -expandinfo
 endif
+endif
+
+# Make sure to have the correct .html targets if different
+# programs/options are used, otherwise the HTML documentation is being
+# generated again in the install rule as it is considered out-of-date.
+ifeq ($(GNUSTEP_TEXI2HTML),texi2html)
+HTMLTARGET := $(GNUSTEP_INSTANCE).html
+else ifneq (,$(findstring no-split,$(GNUSTEP_TEXI2HTML_FLAGS)))
+HTMLTARGET := $(GNUSTEP_INSTANCE).html
+else
+HTMLTARGET := $(GNUSTEP_INSTANCE)/index.html
+endif
 
 internal-doc-all_:: $(GNUSTEP_INSTANCE).info \
                     $(GNUSTEP_INSTANCE).pdf \
-                    $(GNUSTEP_INSTANCE).html
+                    $(HTMLTARGET)
 
 internal-textdoc-all_:: $(GNUSTEP_INSTANCE)
 
@@ -91,7 +104,7 @@ $(GNUSTEP_INSTANCE).pdf: $(TEXI_FILES)
 # Some versions of texi2html placed the html files in a subdirectory,
 # so after running it we try to move any from the subdirectory to
 # where they are expected.
-$(GNUSTEP_INSTANCE).html: $(TEXI_FILES)
+$(HTMLTARGET): $(TEXI_FILES)
 	-$(GNUSTEP_TEXI2HTML) \
                 $(GNUSTEP_TEXI2HTML_FLAGS) $(ADDITIONAL_TEXI2HTML_FLAGS) \
 		$(GNUSTEP_INSTANCE).texi; \
@@ -150,9 +163,21 @@ internal-doc-install_:: $(GNUSTEP_DOC_INFO)
 	if [ -f $(GNUSTEP_INSTANCE).html ]; then \
 	  $(INSTALL_DATA) $(GNUSTEP_INSTANCE).html \
 	                  $(GNUSTEP_DOC)/$(DOC_INSTALL_DIR); \
+	fi
+	if [ -f $(GNUSTEP_INSTANCE)_1.html ]; then \
 	  $(INSTALL_DATA) $(GNUSTEP_INSTANCE)_*.html \
 	                  $(GNUSTEP_DOC)/$(DOC_INSTALL_DIR); \
 	fi
+# Recent makeinfo (5.x) will not produce index.html for documents
+# which wrap their @top/@menu within @ifinfo or any other conditional
+# that hides them, while makeinfo (4.x) will fail with an error.  Such
+# documents are broken anyway and have to be fixed.
+	if [ -f $(GNUSTEP_INSTANCE)/index.html ]; then \
+	  $(MKINSTALLDIRS) \
+	    $(GNUSTEP_DOC)/$(DOC_INSTALL_DIR)/$(GNUSTEP_INSTANCE); \
+	  $(INSTALL_DATA) $(GNUSTEP_INSTANCE)/*.html \
+	    $(GNUSTEP_DOC)/$(DOC_INSTALL_DIR)/$(GNUSTEP_INSTANCE); \
+	fi
 
 $(GNUSTEP_DOC_INFO):
 	$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)
@@ -166,6 +191,8 @@ internal-doc-uninstall_::
           $(GNUSTEP_DOC)/$(DOC_INSTALL_DIR)/$(GNUSTEP_INSTANCE)_*.html
 	rm -f \
           $(GNUSTEP_DOC)/$(DOC_INSTALL_DIR)/$(GNUSTEP_INSTANCE).html
+	rm -f \
+	  $(GNUSTEP_DOC)/$(DOC_INSTALL_DIR)/$(GNUSTEP_INSTANCE)/*.html
 
 #
 # textdoc targets - these should be merged with the doc targets
