#
# $Revision: 1.4 $
#
# Commonrules for building multiple versions of commands with different flags.
#
# Rules of use described in `cmdcommondefs'.
#

#
# Common targets.  The basic idea is that a make in the current (base)
# directory will descend into subdirectories if necessary; in the leaf
# (alternate version) directories it will not.
#
rmtargets!$(COMMONPREF)$$@

clobber!$(COMMONPREF)$$@

clean!$(COMMONPREF)$$@
	$(ALTVERSIONS_MAKERULE)

install!$(VERSION)install
	$(ALTVERSIONS_MAKERULE)

cmdbase!$(COMMANDS)
.ORDER: cmdbase $(ALTVERSIONS)

include $(COMMONRULES)

#
# Create the alternate version directory with tlink, descend into there
# and make.
#
$(ALTVERSIONS)!
	$(TLINK) -r $(TLINKXARGS) . $(.TARGET)
	rm -f $(.TARGET)/versiondefs
	ln -sf ../$(.TARGET)versiondefs $(.TARGET)/versiondefs;
	cd $(.TARGET); $(MAKE)

.MAKE:$(ALTVERSIONS)
