Reinvoking the build

Consider the following project.spec:

Load user.conf

Phony default -do {
	file copy -force default.conf $BUILDDIR/user.conf
}
Phony debug -do {
	file copy -force debug.conf $BUILDDIR/user.conf
}

The user configuration is loaded from user.conf, which is assumed to be created externally. Two phony targets (actions) also exist which can set a specific configuration. It is now possible to set the configuration and rebuild with the command line:

$ tmake default all

It might be desirable for the single action to both update the configuration and rebuild, i.e. tmake default. One way to do this may be with a recursive invocation of tmake:

Load user.conf

Phony default -do {
	file copy -force default.conf $BUILDDIR/user.conf
	run [info nameofexecutable] $::argv0 all
}

However this is cumbersome and inefficient. A better way to achieve this is to have the rule re-add a new target.

Load user.conf

Phony default -do {
	file copy -force default.conf $BUILDDIR/user.conf
	add-build-targets all
}

In this case, once the rule has run, a new target is added to the build, as if added on the original command line. If the target was already on the command line, this has no effect.

See also:

The results of the search are