# Jam rules for Cweb

# Usage:

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


#  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 ;

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

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

actions CwebProducts
{
	ctangle $(>)
}


rule CwebLatex
{
	Depends $(<) : $(>) ;
	Clean clean : $(<) $(<:S=.idx) $(<:S=.scn) ;
	# FIXME: the following should be autodetected by LatexDvi instead
	Depends $(<:S=.dvi) : $(<:S=.idx) $(<:S=.scn) ;

	Latex $(<) ;
}

actions CwebLatex { cweave $(>) }
