Skip to content

Commit

Permalink
Update Makefile to latest universal version
Browse files Browse the repository at this point in the history
This is from my settings-configs repo.
  • Loading branch information
joshuaulrich committed Jun 30, 2023
1 parent 8619698 commit fcb0ba8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ PKG_INST_FILE = $(R_LIB)/${PKG_NAME}/DESCRIPTION
PKG_R_FILES := $(wildcard ${PKG_PATH}/R/*.R)
PKG_RD_FILES := $(wildcard ${PKG_PATH}/man/*.Rd)
PKG_SRC_FILES := $(wildcard ${PKG_PATH}/src/*)
PKG_ALL_FILES := ${PKG_PATH}/DESCRIPTION ${PKG_PATH}/NAMESPACE \
${PKG_PATH}/inst/include/xts.h ${PKG_PATH}/inst/include/xtsAPI.h \
PKG_HEADER_FILES := $(wildcard ${PKG_PATH}/inst/include/*h)
PKG_ALL_FILES := ${PKG_PATH}/DESCRIPTION ${PKG_PATH}/NAMESPACE ${PKG_HEADER_FILES} \
$(PKG_R_FILES) $(PKG_RD_FILES) $(PKG_SRC_FILES) ${PKG_PATH}/.Rbuildignore

HTML_FILES := $(patsubst %.Rmd, %.html, $(wildcard *.Rmd)) \
Expand All @@ -35,7 +35,7 @@ BENCHMARK_FILE = ${PKG_PATH}/inst/benchmarks/benchmark.subset.R

.PHONY: docs build install check tests test clean

all: check #benchmark
all: cran

#man/*.Rd depend on R/*.R files
print:
Expand All @@ -56,24 +56,24 @@ $(PKG_INST_FILE): $(PKG_TARGZ)
# Run R CMD check
check: docs build
@_R_CHECK_CRAN_INCOMING_=false \
_XTS_TINYTEST_VERBOSE_=1 _XTS_TINYTEST_COLOR_=FALSE \
_PKG_TINYTEST_VERBOSE_=1 _PKG_TINYTEST_COLOR_=FALSE \
${R_HOME}/bin/R CMD check ${PKG_TARGZ} --no-vignettes

docs: ${PKG_R_FILES}
@${R_HOME}/bin/Rscript -e "roxygen2::roxygenize(roclets='rd')" \
&& sed -i '/^RoxygenNote/d' ${PKG_PATH}/DESCRIPTION \
&& /bin/rm ${PKG_PATH}/src/*.o \
&& /bin/rm ${PKG_PATH}/src/*.so
&& /bin/rm --force ${PKG_PATH}/src/*.o \
&& /bin/rm --force ${PKG_PATH}/src/*.so

# Check for CRAN
cran:
@${R_HOME}/bin/R CMD build ${PKG_PATH} && \
_XTS_TINYTEST_VERBOSE_=1 _XTS_TINYTEST_COLOR_=FALSE \
_PKG_TINYTEST_VERBOSE_=1 _PKG_TINYTEST_COLOR_=FALSE \
_R_CHECK_CRAN_INCOMING_=false ${R_HOME}/bin/R CMD check ${PKG_TARGZ} --as-cran

# Run unit test suite
tests: install ${UNIT_TEST_FILES}
@_XTS_TINYTEST_VERBOSE_=2 _XTS_TINYTEST_COLOR_=TRUE \
@_PKG_TINYTEST_VERBOSE_=2 _PKG_TINYTEST_COLOR_=TRUE \
${R_HOME}/bin/Rscript ${UNIT_TEST_SUITE}

html: $(HTML_FILES)
Expand All @@ -85,4 +85,4 @@ html: $(HTML_FILES)
R --slave -e "set.seed(100);rmarkdown::render('$<')"

clean:
$(RM) $(HTML_FILES) ${PKG_PATH}/src/*.o ${PKG_PATH}/src/*.so
/bin/rm --force $(HTML_FILES) ${PKG_PATH}/src/*.o ${PKG_PATH}/src/*.so
4 changes: 2 additions & 2 deletions tests/tinytest.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# run package unit tests
if (requireNamespace("tinytest", quietly = TRUE)) {
suppressPackageStartupMessages(library("xts"))
use_color <- as.logical(Sys.getenv("_XTS_TINYTEST_COLOR_", FALSE))
verbosity <- as.integer(Sys.getenv("_XTS_TINYTEST_VERBOSE_", 2))
use_color <- as.logical(Sys.getenv("_PKG_TINYTEST_COLOR_", FALSE))
verbosity <- as.integer(Sys.getenv("_PKG_TINYTEST_VERBOSE_", 2))
cat("tinytest colored output:", use_color,
"\ntinytest verbosity:", verbosity, "\n")
tinytest::test_package("xts", color = use_color, verbose = verbosity)
Expand Down

0 comments on commit fcb0ba8

Please sign in to comment.