adding recursive targets to [auto]make

I wanted to add my own recursive target in addition to the recursive targets produced by automake. It was not easy.

At the first glance, it was an easy task. Generated Makefiles have a variable RECURSIVE_TARGETS with the list of the recursive targets. The only thing to do is to add my target to the list. Unfortunately, I failed.

Anyway, I found a possible solution. Now all automake files begins the following way:

## -- Process this file with automake to produce
include @top_srcdir@/config/

For my recursive target "html", common file "config/" defines the following:


ifneq ($(RECURSIVE_TARGETS),html-recursive)
	$(MAKE) $(AM_MAKEFLAGS) RECURSIVE_TARGETS=html-recursive html-recursive

html: html-recursive html-am

html-am: html-local


For the default recursive traversing, all standard targets should be defined: "html", "html-recursive", "html-am", "html-local".

The target "html" is an entry point.

I don't know what the target "html-am" is supposed to do. Probably "-am" targets are for internal use of automake. It is called when the variable "SUBDIRS" is not defined.

I might be wrong, but I think that for user actions should be performed in "html-local".

The most non-trivial moment is defining "html-recursive". I can't add the target name to the variable "RECURSIVE_TARGETS", but I can re-run make and specify anything what I want.