#-*- Makefile -*-

include MkRules

RVER = $(shell cut -d' ' -f1 ../../VERSION | sed -n 1p)
#RPREFIX = $(shell ../../tools/GETRWVERSION ../../VERSION)
RPREFIX = $(shell ../../bin$(R_ARCH)/Rscript fixed/rwver.R)
SEDVER = -e s/@RVER@/$(RVER)/g -e s/@RWVER@/$(RPREFIX)/g

all: rw-FAQ ../../doc/html/rw-FAQ.html

../../doc/html/rw-FAQ.html: rw-FAQ.texi ../../VERSION ../../doc/manual/Rman.css
	@echo "making rw-FAQ.html"
	@$(SED) $(SEDVER) $< | \
	  makeinfo --no-split --html --no-headers --number-sections --css-include=../../doc/manual/Rman.css -o $@ 

rw-FAQ: rw-FAQ.texi ../../VERSION
	@echo "making rw-FAQ"
	@$(SED) $(SEDVER) $< | \
	  makeinfo --no-headers --number-sections -o $@

rw-FAQ.pdf: rw-FAQ.texi ../../VERSION
	@$(SED) $(SEDVER) $< > tmp.texi
	@$(TEXI2DVI) --pdf tmp.texi
	@$(TEXI2DVI) --pdf tmp.texi
	@mv tmp.pdf $@
	@rm tmp.*