/usr/lib/R/site-library/pkgmaker/vignette.mk is in r-cran-pkgmaker 0.22-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | ## This Makefile was inspired from the RcppGSL package
## Copyright (C) 2011 Romain François and Edd Eddelbuettel
## It was modifed by Renaud Gaujoux to make it more generic and to generate the
## fake vignettes on the fly.
## Copyright (C) 2011 Renaud Gaujoux
## There is an old bug in texidvi that makes it not swallow the ~
## marker used to denote whitespace. This is actually due to fixing
## another bug whereby you could not run texidvi on directory names
## containing a tilde (as we happen to do for Debian builds of R
## alpha/beta/rc releases). The 'tilde' bug will go away as it
## reportedly has been squashed upstream but I am still bitten by it
## on Ubuntu so for now Dirk will insist on pdflatex and this helps.
#%AUTHOR_USER%#
#%MAKE_R_PACKAGE%#
ifndef MAKE_R_PACKAGE
$(error Required make variable 'MAKE_R_PACKAGE' is not defined.)
endif
#ifndef AUTHOR_USER
#$(error Required make variable 'AUTHOR_USER' is not defined.)
#endif
ifndef MAKEPDF
MAKEPDF=1
endif
##---------------------------------------------------------------------
## Everything below this should be generic and work for any package provided that
## they have the following directory inst/doc setting:
## - inst/vignettes/src: contains the Rnw files for normal vignettes
## - tests: contains R code to run unit tests that are run if not checking and
## produce the file <package>-unitTests.pdf
##---------------------------------------------------------------------
SRC_DIR=.
RNW_SRCS = #%RNW_SRCS%#
PDF_OBJS=$(RNW_SRCS:.Rnw=.pdf)
# allow redfining pdf targets in local mode
#%PDF_OBJS%#
TEX_OBJS=$(RNW_SRCS:.Rnw=.tex)
ifneq (${R_HOME},)
R_CHECK=1
else
R_CHECK=0
# Enabling local mode?
#%LOCAL_MODE%#
# in local mode: use pdflatex
ifdef LOCAL_MODE
USE_PDFLATEX=1
endif
export MAKE_R_PACKAGE
ifdef LOCAL_MODE
MAKEPDF=1
endif
# Type of pre-install:
# for back-compatibility
ifdef QUICK
quick=1
endif
ifdef quick
install=quick
endif
ifndef install
install=yes
endif
ifneq ('$(install)', 'no')
ifeq ('$(install)','yes')
# install in temporary directory at each run
TMP_INSTALL_DIR:=#%TMP_INSTALL_DIR%#
FORCE_INSTALL:=TRUE
else
ifeq ('$(install)','quick')
QUICK=1
FORCE_INSTALL:=FALSE
TMP_INSTALL_DIR:=tmplib
endif
endif
# export R_LIBS
export R_LIBS:=#%R_LIBS_DEV%#
endif # end install pkg
endif #end not R_CHECK
# Define command for temporary installation (used when make is directly called,
# i.e. when not in check/build/INSTALL)
ifdef TMP_INSTALL_DIR
define do_install
@if [ ! -d "$(TMP_INSTALL_DIR)/$(MAKE_R_PACKAGE)" ]; then \
echo "# Installing package '$(MAKE_R_PACKAGE)' in '$(TMP_INSTALL_DIR)' "; \
$(RSCRIPT) --vanilla --quiet -e "pkgmaker::quickinstall('..', '$(TMP_INSTALL_DIR)')" > Rinstall.log 2> Rinstall.err; \
if [ ! -d "$(TMP_INSTALL_DIR)/$(MAKE_R_PACKAGE)" ]; then \
echo "ERROR: Temporary installation failed: see files Rinstall.log and Rinstall.err"; \
echo "# Removing temporary library directory $(TMP_INSTALL_DIR)"; \
exit 1; \
else \
echo "# Package successfully installed"; \
fi \
fi
endef
else
define do_install
endef
endif
define showInfo
@echo "# Using R home: $(R_HOME)"
@echo "# Using R architecture: $(R_ARCH_BIN)"
@echo "# Using R bin directory: $(R_BIN)"
@echo "# Using R_LIBS: $(R_LIBS)"
endef
#%INST_TARGET%#
#ifdef INST_TARGET
define update_inst_doc
# Copying vignette source and output files to ../inst/doc
mkdir -p ../inst/doc
#cp -f $1 ../inst/doc
mv -f $2 ../inst/doc
endef
#else
#define update_inst_doc
# # Copying vignette output files to ../inst/doc
# mkdir -p ../inst/doc
# cp -f $2 ../inst/doc
#endef
#endif
all: init $(PDF_OBJS) do_clean
@echo "# All vignettes in 'vignettes' are up to date"
init:
# Generating vignettes for package '$(MAKE_R_PACKAGE)'
# DESCRIPTION file in: #%R_PACKAGE_DESCRIPTION%#
# User: #%VIGNETTE_USER%#
# Maintainer(s): #%VIGNETTE_MAINTAINERS%#
$(showInfo)
ifdef LOCAL_MODE
# Mode: Local Development [$(LOCAL_MODE)]
else
# Mode: Production
endif
ifneq ($(R_CHECK),0)
# R CMD check: TRUE
else
# R CMD check: FALSE
endif
ifdef INST_TARGET
# BuildVignettes: no (storing in ../inst/doc)
endif
# Detected vignettes: $(RNW_SRCS)
# Detected targets: $(PDF_OBJS)
clean:
rm -fr *.bbl *.run.xml *.blg *.aux *.out *-blx.bib \
*.log *.err Rplots.pdf tests-results tmplib vignette_*.mk vignette.mk \
cleveref.sty \
runit.*
ifndef LOCAL_MODE
rm -f $(TEX_OBJS)
endif
clean-all: clean
rm -fr $(TEX_OBJS) $(PDF_OBJS) $(MAKE_R_PACKAGE)-unitTests.Rnw
setvars:
ifeq (${R_BIN},)
R_BIN=#%R_BIN%#
endif
RPROG:=$(R_BIN)/R
RSCRIPT:=$(R_BIN)/Rscript
.SECONDARY: %.tex
do_clean:
ifndef QUICK
# Removing temporary install directory '$(TMP_INSTALL_DIR)'
@-rm -rf $(TMP_INSTALL_DIR);
endif
# only run tests if not checking: CRAN check run the tests separately
#ifdef INST_TARGET
../inst/doc/%-unitTests.pdf:
#else
#%-unitTests.pdf:
#endif
# Generating vignette for unit tests: $@
$(do_install)
$(RSCRIPT) --vanilla -e "pkgmaker::makeUnitVignette('package:$(MAKE_R_PACKAGE)', check=$(R_CHECK))" >> unitTests.log
ifdef LOCAL_MODE
$(eval VIGNETTE_BASENAME := $(shell basename $@ .pdf))
# Compact vignette file
$(RSCRIPT) --vanilla -e "pkgmaker::compactVignettes('$(VIGNETTE_BASENAME).pdf')"
endif
$(call update_inst_doc, $*-unitTests.Rnw, $*-unitTests.pdf)
# Generate .pdf from .Rnw
#ifdef INST_TARGET
../inst/doc/%.pdf: ${SRC_DIR}/%.Rnw
#else
#%.pdf: ${SRC_DIR}/%.Rnw
#endif
# Generating vignette $@ from ${SRC_DIR}/$*.Rnw
$(do_install)
# Compiling ${SRC_DIR}/$*.Rnw into $*.tex
$(RSCRIPT) --vanilla -e "pkgmaker::rnw('${SRC_DIR}/$*.Rnw', '$*.tex');"
# Generating pdf $@ from $*.tex
ifdef MAKEPDF
ifdef USE_PDFLATEX
# Using pdflatex
# LaTeX compilation 1/3
@pdflatex $* >> $*-pdflatex.log
# Compiling bibliography with bibtex
-bibtex $*
# LaTeX compilation 2/3
@pdflatex $* >> $*-pdflatex.log
# LaTeX compilation 3/3
@pdflatex $* >> $*-pdflatex.log
# Compact vignettes
$(RSCRIPT) --vanilla -e "pkgmaker::compactVignettes('$*.pdf')"
# Remove temporary LaTeX files (but keep the .tex)
rm -fr $*.toc $*.log $*.bbl $*.blg $*.aux $*.out $*-blx.bib
else
# Using tools::texi2dvi
# LaTeX compilation 1/2
$(RSCRIPT) --vanilla -e "tools::texi2dvi( '$*.tex', pdf = TRUE, clean = FALSE )"
# Compiling bibliography with bibtex
-bibtex $*
# LaTeX compilation 2/2
$(RSCRIPT) --vanilla -e "tools::texi2dvi( '$*.tex', pdf = TRUE, clean = TRUE )"
endif
endif
# Update fake vignette file ./$*.Rnw
$(RSCRIPT) --vanilla -e "pkgmaker::makeFakeVignette('${SRC_DIR}/$*.Rnw', '$*.Rnw')"
$(call update_inst_doc, $*.Rnw, $*.pdf)
|