Created
June 12, 2020 08:35
-
-
Save rkrug/a4e845e61de7e102e044bf8d4bcd7343 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## R parts based on https://github.com/yihui/knitr/blob/master/Makefile | |
PKGNAME := $(shell sed -n "s/^Package: *\([^ ]*\)/\1/p" DESCRIPTION) | |
PKGVERS := $(shell sed -n "s/^Version: *\([^ ]*\)/\1/p" DESCRIPTION) | |
PKGSRC := $(shell basename `pwd`) | |
########### Package ########### | |
#### | |
docs: figs_vignette | |
Rscript -e "devtools::document(roclets = c('rd', 'collate', 'namespace', 'vignette'))" | |
build: figs_vignette | |
cd ..;\ | |
R CMD build $(PKGSRC) | |
#### | |
build-cran: figs_vignette | |
cd ..;\ | |
R CMD build $(PKGSRC) | |
#### | |
install: build | |
cd ..;\ | |
R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz | |
#### | |
check: build-cran | |
cd ..;\ | |
R CMD check $(PKGNAME)_$(PKGVERS).tar.gz --as-cran | |
clean_check: | |
$(RM) -r ./../$(PKGNAME).Rcheck/ | |
#### | |
check-rhub: build-cran | |
@Rscript -e "x <- rhub::check_for_cran(email = '[email protected]', path = './../$(PKGNAME)_$(PKGVERS).tar.gz')" | |
check-rhub-live: build-cran | |
@Rscript -e "x <- rhub::check_for_cran(email = '[email protected]', path = './../$(PKGNAME)_$(PKGVERS).tar.gz', show_status = TRUE)" | |
#### | |
test: | |
@Rscript -e "devtools::test()" | |
#### | |
############# Help targets ############# | |
list_variables: | |
@echo | |
@echo "#############################################" | |
@echo "## Variables ################################" | |
make -pn | grep -A1 "^# makefile"| grep -v "^#\|^--" | sort | uniq | |
@echo "#############################################" | |
@echo "" | |
## from https://stackoverflow.com/a/26339924/632423 | |
list_targets: | |
@echo | |
@echo "#############################################" | |
@echo "## Targets ###############################" | |
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | |
@echo "#############################################" | |
@echo | |
list: list_variables list_targets | |
############# | |
.PHONY: list list_variables list_targets clean_check build-cran build test check-rhub-live check-rhub docs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment