-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
71 lines (63 loc) · 2.34 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
PROFILE := .Rprofile
INZIGHT := inzight
VIT := vit
DIR := $(shell pwd)
RCMD := R
CRAN := https://cran.rstudio.com
CPUS := $(shell getconf _NPROCESSORS_ONLN)
default: $(PROFILE) $(INZIGHT) $(VIT) update
@mkdir -p library
@$(RCMD) --slave -e "install.packages(c('iNZightRegression', 'iNZightPlots', 'iNZightTS', 'iNZightMR', 'vit', 'iNZightTools', 'FutureLearnData', 'iNZightModules', 'iNZight'), dependencies = TRUE, Ncpus = $(CPUS))" --args install
@echo
@echo "+---------------------------------------------------------------------------"
@echo "|"
@echo "| Yay! iNZightVIT has been installed to this directory :) "
@echo "|"
@echo "| You can either run \`inzight\` or \`vit\` from here,"
@echo "| or run \`make install\` if you want to be able to start it from anywhere."
@echo "|"
@echo "| To update iNZightVIT, run \`./update\` from this directory."
@echo "|"
@echo "| NOTE: you can delete the \`.clean\` directory if you want to,"
@echo "| but you won't be able to recover the build files."
@echo "|"
@echo "+---------------------------------------------------------------------------"
@echo
$(PROFILE):
@cp Rprofile.template $@
@sed -i 's|LIB_PATH|$(DIR)|g' $@
@sed -i 's|CRAN|$(CRAN)|' $@
@mkdir -p .clean && mv Rprofile.template .clean
$(INZIGHT):
@cp inzight.tmp $@
@sed -i 's|INSTALL_DIR|$(DIR)|' $@
@chmod +x $@
@mkdir -p .clean && mv inzight.tmp .clean
$(VIT):
@cp vit.tmp $@
@sed -i 's|INSTALL_DIR|$(DIR)|' $@
@chmod +x $@
@mkdir -p .clean && mv vit.tmp .clean
update:
@cp update.tmp $@
@sed -i 's|INSTALL_DIR|$(DIR)|' $@
@chmod +x $@
@mkdir -p .clean && mv update.tmp .clean
clean:
-@rm -rf library
-@rm .Rprofile $(INZIGHT) $(VIT) update
-@mv .clean/* ./ && rm -rf .clean
install:
@ln -is $(DIR)/$(INZIGHT) /usr/local/bin/$(INZIGHT)
@ln -is $(DIR)/$(VIT) /usr/local/bin/$(VIT)
@chmod +x /usr/local/bin/$(INZIGHT)
@chmod +x /usr/local/bin/$(VIT)
@echo "iNZightVIT has been installed."
@echo "You can run either \`$(INZIGHT)\` or \`$(VIT)\` from anywhere to launch."
@echo "To uninstall, simply run \`make uninstall\`."
uninstall:
@if [ -L /usr/local/bin/$(INZIGHT) ]; then rm -if /usr/local/bin/$(INZIGHT); fi;
@if [ -L /usr/local/bin/$(VIT) ]; then rm -if /usr/local/bin/$(VIT); fi;
@echo "iNZight has been uninstalled. To complete, just delete this folder."
@echo
@echo "Thank you for using iNZight!"