# Jam rules for Funnelweb

# Usage:

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


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

#  note: we attempt to emulate standard UN*X behaviour by using the .lis
# output file, which we do not leave behind.

rule FunnelwebProducts
{
	Depends $(<) : $(>) ;
	Depends all : $(<) ;
	Clean clean : $(<) ;

	# weave
	FunnelwebTex $(>:S=.tex) : $(>) ;
	FunnelwebHtml $(>:S=.html) : $(>) ;
	Depends tex : $(>:S=.tex) ;
	Depends html : $(>:S=.html) ;
}

actions FunnelwebProducts
{
	# tangle
	fw +L $(>)
	cat $(>:S=.lis)
	rm -f $(>:S=.lis)
}

rule FunnelwebTex
{
	Depends $(<) : $(>) ;
	Clean clean : $(<) ;

	Tex $(<) ;
}

actions FunnelwebTex
{
	fw +L -O +T $(>)
	cat $(>:S=.lis)
	rm -f $(>:S=.lis)
}

rule FunnelwebHtml
{
	Depends $(<) : $(>) ;
	Clean clean : $(<) ;
}

actions FunnelwebHtml
{
	fw +L -O +U $(>)
	cat $(>:S=.lis)
	rm -f $(>:S=.lis)
}
