The R Project SVN R

Rev

Rev 8505 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#-*-Makefile-*-
#
# ${R_HOME}/doc/manual/Makefile.win

srcdir = .
top_srcdir = ../..
subdir = doc/manual

SOURCES_TEXI = R-FAQ.texi R-exts.texi R-intro.texi

OBJECTS_DVI = $(SOURCES_TEXI:.texi=.dvi)
OBJECTS_INFO = $(SOURCES_TEXI:.texi=.info)
OBJECTS_PDF = $(SOURCES_TEXI:.texi=.pdf)

R_PAPERSIZE = a4
# set the next to `ae' to omit the hyperlinks
R_RD4PDF = ae,hyper

MAKEINFO = makeinfo
PDFLATEX = pdflatex
PDFTEX = pdftex
MAKEINDEX = makeindex
TEXINDEX = texindex
RHOME=$(shell cd ../..; pwd)
R_PKGS=base ctest eda lqs modreg mva nls splines stepfun ts

pkgsrcs = $(R_PKGS:=-pkg.tex)

texiincludes = version.texi $(srcdir)/R-defs.texi

.SUFFIXES:
.SUFFIXES: .dvi .info .texi .pdf

all: pdf

pkg2tex.pl: $(top_srcdir)/tools/pkg2tex.in
    @sed -e 1d  $^ > $@

Rdnewer.pl: $(top_srcdir)/tools/Rdnewer.in
    @sed -e 1d  $^ > $@

.texi.pdf:
    $(PDFTEX) $<
    $(PDFTEX) $<

.texi.info:
    $(MAKEINFO)  -D UseExternalXrefs $<

info: $(OBJECTS_INFO)
R-exts.info: version.texi
R-intro.info: version.texi

pdf: refman.pdf $(OBJECTS_PDF)

refman.tex: refman.top $(srcdir)/refman.bot
    @echo "creating $@"
    @(opt="$${R_PAPERSIZE:-$(R_PAPERSIZE)}paper"; \
      echo "\\documentclass[$${opt}]{book}"; \
      opt="$${R_RD4PDF:-$(R_RD4PDF)}"; \
      echo "\\usepackage[$${opt}]{Rd}"; \
      cat $(srcdir)/refman.top; \
      for p in $(R_PKGS); do echo "\\input{$${p}-pkg.tex}"; done; \
      cat $(srcdir)/refman.bot) > $@

version.tex: ../../bin/Rterm.exe $(top_srcdir)/VERSION
    @echo "creating $(subdir)/$@"
    @(v=`cat $(top_srcdir)/VERSION`; \
      y=`cut -d/ -f1 < $(top_srcdir)/date-stamp`; \
      m=`cut -d/ -f2 < $(top_srcdir)/date-stamp`; \
      d=`cut -d/ -f3 < $(top_srcdir)/date-stamp`; \
      echo "$${v} ($${m} $${d}, $${y})") > $@

%-pkg.tex: FORCE Rdnewer.pl pkg2tex.pl
    @if perl Rdnewer.pl \
        "$(top_srcdir)/src/library/$*" "$@"; then \
      echo "collecting LaTeX docs for package \`$*' ..."; \
      (cd ../../src/gnuwin32/help && $(MAKE) RHOME=$(RHOME) latex-$*); \
      perl pkg2tex.pl $*; \
    fi
FORCE:

refman.pdf: refman.tex version.tex $(pkgsrcs) $(srcdir)/Rd.sty
    @echo " PDF/LaTeX documentation: reference index ..."
    @$(RM) -f *.aux refman.toc refman.ind
    @$(PDFLATEX) '\nonstopmode\input{refman.tex}'
    @$(MAKEINDEX) refman
    @$(PDFLATEX) '\nonstopmode\input{refman.tex}'
    @$(PDFLATEX) '\nonstopmode\input{refman.tex}'

R-exts.pdf: R-exts.texi $(texiincludes) 
    $(PDFTEX) R-exts.texi
    $(TEXINDEX) R-exts.cp R-exts.fn R-exts.vr
    $(PDFTEX) R-exts.texi
    $(PDFTEX) R-exts.texi

R-intro.pdf: R-intro.texi $(texiincludes) 
    $(PDFTEX) R-intro.texi
    $(TEXINDEX) R-intro.cp R-intro.fn R-intro.vr
    $(PDFTEX) R-intro.texi
    $(PDFTEX) R-intro.texi

version.texi: Makefile.win $(top_srcdir)/VERSION $(top_srcdir)/date-stamp
    @echo "creating $(subdir)/$@"
    @(v=`sed 's/\([^ ]*\).*/\1/' $(top_srcdir)/VERSION`; \
      v="$${v} (`sed 's|/| |g' $(top_srcdir)/date-stamp`)"; \
      echo "@set VERSION $${v}" > $@)


mostlyclean: clean
clean:
    @echo cleaning in doc/manual
    @-rm -f *.aux *.toc refman.i?? *.out *.log
    @-rm -f *.cp *.cps *.fn *.fns *.ky *.kys \
      *.out *.pg *.pgs *.tmp *.tp *.vr *.vrs \
      version.tex version.texi refman.tex *-pkg.tex 
distclean: clean
    @-rm -f pkg2tex.pl Rdnewer.pl *.pdf *.info*
maintainer-clean: distclean