The R Project SVN R

Rev

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

#
# ${R_HOME}/doc/manual/Makefile

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

top_builddir = ../..
subdir = doc/manual

include $(top_builddir)/Makeconf

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = \
    EQN README \
    Makefile.in Makefile.win \
    R-defs.texi R-exts.texi dir texinfo.tex \
    Rd.sty lib2tex.in \
    omsaer.fd omsaett.fd omscmtt.fd \
    refman.top.in refman.bot
SUBDIRS = ae pdf

MAKEINFO = @MAKEINFO@
TEXI2DVI = $(top_srcdir)/tools/texi2dvi
TEXI2PDF = $(TEXI2DVI) --pdf
PDFLATEX = @PDFLATEX@

infodir = @infodir@
INSTALL_INFO = @INSTALL_INFO@

# set the next to `.' if your LaTeX lacks the ae font package
AE = @AE@
# set the next to `ae' to omit the hyperlinks
PDF = pdf

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

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

all: Makefile lib2tex R dvi

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    @cd $(top_builddir) && \
      CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
      $(SHELL) ./config.status
lib2tex: $(srcdir)/lib2tex.in $(top_builddir)/config.status
    @cd $(top_builddir) && \
      CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
      $(SHELL) ./config.status
    @chmod +x $@

R:
    @if [ "$(srcdir)" != "." ]; then \
      $(MAKE) rhome=$(top_builddir) install-tex; \
    fi

.texi.dvi:
    TEXINPUTS="$(srcdir):$$TEXINPUTS" $(TEXI2DVI) $<
.texi.info:
    $(MAKEINFO) -I$(srcdir) $<
.texi.pdf:
    TEXINPUTS="$(srcdir):$$TEXINPUTS" $(TEXI2PDF) $<

dvi: refman.dvi R-exts.dvi
refman.dvi: refman.tex version.tex $(pkgsrcs) $(srcdir)/Rd.sty
    @echo "LaTeX documentation: Reference Index ..."
    @rm -f *.aux refman.toc refman.ind
    @TEXINPUTS="$(srcdir)/$(AE):$(srcdir):$$TEXINPUTS" \
      $(LATEX) '\nonstopmode\input{refman.tex}'
    @$(MAKEINDEX) refman
    @TEXINPUTS="$(srcdir)/$(AE):$(srcdir):$$TEXINPUTS" \
      $(LATEX) '\nonstopmode\input{refman.tex}'
refman.tex: lib2tex refman.top $(srcdir)/refman.bot
    @echo "creating $(subdir)/$@"
    @(cat refman.top; \
      for p in $(R_PKGS); do echo "\\input{$${p}-pkg.tex}"; done; \
      cat $(srcdir)/refman.bot) > $@
refman.top: $(srcdir)/refman.top.in $(top_builddir)/config.status
    @cd $(top_builddir) && \
      CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
      $(SHELL) ./config.status
version.tex: $(top_srcdir)/date-stamp $(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
    @echo "Collecting components of $@ ..."
    @cd $(top_builddir)/src/library && \
      OPTS="--latex" $(MAKE) PKGS="$*" DOCS
    ./lib2tex $*
FORCE:
R-exts.dvi: R-exts.texi version.texi $(srcdir)/texinfo.tex

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

info: R-exts.info
R-exts.info: R-exts.texi version.texi

pdf: refman.pdf R-exts.pdf
refman.pdf: refman.tex version.tex $(pkgsrcs) $(srcdir)/$(PDF)/Rd.sty
    @echo "PDF LaTeX documentation: Reference Index ..."
    @rm -f *.aux refman.toc refman.ind
    @TEXINPUTS="$(srcdir)/$(PDF):$(srcdir):$$TEXINPUTS" \
      $(PDFLATEX) '\nonstopmode\input{refman.tex}'
    @$(MAKEINDEX) refman
    @TEXINPUTS="$(srcdir)/$(PDF):$(srcdir):$$TEXINPUTS" \
      $(PDFLATEX) '\nonstopmode\input{refman.tex}'
    @TEXINPUTS="$(srcdir)/$(PDF):$(srcdir):$$TEXINPUTS" \
      $(PDFLATEX) '\nonstopmode\input{refman.tex}'
R-exts.pdf: R-exts.texi version.texi $(srcdir)/texinfo.tex

install: installdirs install-tex
    @echo "Installing doc/manual ..."
installdirs:
    @$(MKINSTALLDIRS) $(rhome)/doc/manual
install-strip: install
install-dvi: dvi
    @$(MKINSTALLDIRS) $(rhome)/doc/dvi
    @for f in *.dvi; do \
      $(INSTALL_DATA) $${f} $(rhome)/doc/dvi; \
    done
install-info: info $(infodir)/dir
    @for f in R-exts.info*; do \
      $(INSTALL_DATA) $${f} $(infodir); \
    done
    @$(INSTALL_INFO) --info-dir=$(infodir) $(infodir)/R-exts.info \
      || echo "You need to adjust $(infodir)/dir manually"
install-pdf: pdf
    @$(MKINSTALLDIRS) $(rhome)/doc/pdf
    @for f in *.pdf; do \
      $(INSTALL_DATA) $${f} $(rhome)/doc/pdf; \
    done
install-tex:
    @for f in $(srcdir)/Rd.sty; do \
      $(INSTALL_DATA) $${f} $(rhome)/doc/manual ; \
    done

$(infodir)/dir:
    @$(MKINSTALLDIRS) -p $(infodir)
    $(INSTALL_DATA) $(srcdir)/dir $(infodir)

uninstall:
    @echo "Uninstalling doc/manual ..."
    @rm -rf $(rhome)/doc/manual
uninstall-dvi:
    @-rm -f $(rhome)/doc/dvi/*
    @-rmdir $(rhome)/doc/dvi
uninstall-info:
    @$(INSTALL_INFO) --remove \
      --info-dir=$(infodir) $(infodir)/R-exts.info \
      || echo "You need to adjust $(infodir)/dir manually"
    @rm -f $(infodir)/R-exts.info*
uninstall-pdf:
    @-rm -f $(rhome)/doc/pdf/*
    @-rmdir $(rhome)/doc/pdf

mostlyclean: clean
clean:
    @echo cleaning in doc/manual
    @if [ "$(srcdir)" != "." ]; then \
      rm -f Rd.sty Rd2dvi.tex; \
    fi
    @-rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.info* *.ky *.kys \
      *.log *.out *.pdf *.pg *.pgs *.ps *.ps-2 *.tmp *.toc *.tp  \
      *.vr *.vrs *-pkg.tex refman.i?? refman.tex version.tex \
      version.texi
distclean: clean
    @-rm -f Makefile lib2tex refman.top
maintainer-clean: distclean

distdir: $(DISTFILES)
    @for f in $(DISTFILES); do \
      test -f $(distdir)/$${f} \
        || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
        || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
        done
    @for d in $(SUBDIRS) man; do \
      if test -d $(srcdir)/$${d}; then \
        ((cd $(srcdir); $(TAR) -c -f - --exclude=CVS $${d}) \
            | (cd $(distdir); $(TAR) -x -f -)) \
          || exit 1; \
      fi; \
    done