-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
50 lines (43 loc) · 1.6 KB
/
Makefile
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
################################################################################
##
## Makefile
## Author: Jitao David Zhang <[email protected]>
## BEDA TRS, pRED, Hoffmann-La Roche AG
## Description: Makefile for building distributions etc.
## the Makefile provides the following targets:
##
## - make install calls R CMD INSTALL
## - make check calls devtools::check
## - make dist calls R CMD build
##
################################################################################
## conditional: choose R version depending on the BICOSN value
R=R
PKG := $(shell awk 'BEGIN{FS=":"}{if ($$1=="Package") {gsub(/ /, "",$$2);print $$2}}' DESCRIPTION)
PKG_VERSION=$(shell awk 'BEGIN{FS=":"}{if ($$1=="Version") {gsub(/ /, "",$$2);print $$2}}' DESCRIPTION)
PKG_ROOT_DIR=`pwd`
PKG_SRC_DIR=$(PKG_ROOT_DIR)/src
install:
@echo '====== Installing Package ======'
@(cd ..; ${R} CMD INSTALL $(PKG))
@echo '====== Installing finished ======'
@echo ' '
print:
@echo 'Package: ${PKG}'
@echo 'Version: ${PKG_VERSION}'
check: clean
@echo '====== Checking Package ======'
@(${R} -e "devtools::check()")
@echo '====== Checking finished ======'
@echo ' '
dist: clean
@echo '====== Building Distribution of $(PKG) ======'
@(cd ..; ${R} CMD build $(PKG))
@echo '====== Building finished ======'
@echo ' '
clean:
@echo '====== Cleaning Package ======'
@(rm -f $(PKG_SRC_DIR)/*.o $(PKG_SRC_DIR)/*.so)
@(find . -type f -name "*~" -exec rm '{}' \;)
@(find . -type f -name ".Rhistory" -exec rm '{}' \;)
@echo ' '