# Jam rules for Fweb

# Usage:

# include "Jamrules-fweb" ;
# FwebProducts main.c util.c : foo.fweb ;


#  Ideally we should not have to explicitely to use the *Products rules,
# but I don't know yet how to autocompute files to be produced.  Could this
# be a Jam limitation ?
#  For now the *Products rules are used to trigger the weave process.  They
# should be invoked by the same wrappers that should invoke *Products.

NOTFILE tex ;

# FIXME: something should be done to mark MODULES.tex and INDEX.tex
#  as side-products of the fweb run.

rule FwebProducts
{
	# tangle
	Depends $(<) : $(>) ;
	Depends all : $(<) ;
	Clean clean : $(<) ;

	# weave
	FwebLatex $(>:S=.tex) : $(>) ;
	Depends tex : $(>:S=.tex) ;
}

actions FwebProducts { ftangle $(>) }

rule FwebLatex
{
	Depends $(<) : $(>) ;
	Clean clean : $(<) MODULES.tex INDEX.tex ;
	# FIXME: the following should be autodetected by LatexDvi instead
	Depends $(<:S=.dvi) : MODULES.tex INDEX.tex ;

	Latex $(<) ;
}

actions FwebLatex { fweave $(>) }
