; This is the rule file for Rubber.
;
; Each rule is introduced by an identifier in square brackets and contains
; entries of the form "key = value". See the texinfo documentation for a
; precise description of the entries.

;-- XFig figures

[fig2dev-vec]
target = (.*)\.(eps|pdf)
source = \1.fig
cost = 0
rule = fig2dev

[fig2dev-bmp]
target = (.*)\.png
source = \1.fig
cost = 10
rule = fig2dev

[fig2dev-tex]
target = (.*)\.(eps|pstex|pdf|pdftex)_t
source = \1.fig
cost = 0
rule = fig2dev

;-- Metapost figures

[mpost]
target = (.*)\.[0-9]+
source = \1.mp
cost = 0
rule = mpost

;-- Rules using "convert" (from ImageMagick)

[convert-vec-vec]
target = (.*)\.(ps|eps|pdf|epdf)
source = \1.{ps,eps,pdf,epdf,wmf}
cost = 2
rule = shell
command = convert $source $target
message = converting $source into $target

[convert-bmp-vec]
target = (.*)\.(ps|eps|pdf|epdf)
source = \1.{bmp,gif,jbg,jbig,pct,pcx,pgm,pict,png,pnm,ppm,tga,tif,tiff,xbm,xcf,xpm}
cost = 8
rule = shell
command = convert $source $target
message = converting $source into $target

[convert-lossy-vec]
target = (.*)\.(ps|eps|pdf|epdf)
source = \1.{jpeg,jpg}
cost = 11
rule = shell
command = convert $source $target
message = converting $source into $target

[convert-bmp-bmp]
target = (.*).(gif|png|tif|bmp|tga|pcx)
source = \1.{bmp,gif,jbg,jbig,pct,pcx,pgm,pict,png,pnm,ppm,tga,tif,tiff,xbm,xcf,xpm}
cost = 2
rule = shell
command = convert $source $target
message = converting $source into $target

; more rules ?

;-- Bounding box extraction from gzipped EPS (built-in rule)

[eps_gz]
target = (.*\.e?ps).bb
source = \1.gz
cost = 0
rule = eps_gz

;-- Miscellaneous graphics converters

[epstopdf]
target = (.*)\.pdf
source = \1.eps
cost = 1
rule = shell
command = epstopdf --outfile=$target $source
message = converting $source to PDF

[sam2p]
target = (.*)\.(ps|eps|pdf)
source = \1.{bmp,gif,jpeg,jpg,lbm,pbm,pcx,pdf,pgm,png,pnm,ppm,ps,tga,tif,tiff,xpm}
cost = 7
rule = shell
command = sam2p $source $target
message = converting $source into $target

[dia]
target = (.*)\.eps
source = \1.dia
cost = 1
rule = shell
command = dia --export $target $source
message = converting $source to EPS
