-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·69 lines (56 loc) · 1.58 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
# Varables
VENV = .venv
# PYTHON = $(VENV)/bin/python
# PIP = $(VENV)/bin/pip
PYTHON = python
PIP = pip
R = Rscript
# Dependencies & scripts
REQUIREMENTS = requirements.txt
PACKAGES = tidyverse corrplot gridExtra
BARCHART = vndb_barchartrace.py
QUERY = vndb_query.py
MINIMAL_QUERY = monthly_minimal.py
PLOT = vndb-plot.r
# Default target, run one by one
all:
$(MAKE) install
$(MAKE) clean
$(MAKE) barchart
$(MAKE) plot
run:
$(MAKE) clean
$(MAKE) barchart
$(MAKE) plot
install: $(VENV) $(PACKAGES) ## install dependencies for Python (venv) and R
$(PIP) install -r $(REQUIREMENTS)
$(R) -e "install.packages(c('$(PACKAGES)'), repos = 'https://cran.rstudio.com/')"
$(VENV):
virtualenv $(VENV)
source $(VENV)/bin/activate; \
$(PIP) install -r $(REQUIREMENTS)
query: gc # get data from VNDB query (private)
$(PYTHON) $(QUERY)
minimal: clean ## generate minimal monthly playlist
$(PYTHON) $(MINIMAL_QUERY)
barchart: clean ## format data to bar chart race style
$(PYTHON) $(BARCHART)
plot: $(BARCHART) $(PLOT) ## generate plots
$(R) $(PLOT)
-rm Rplots.pdf
# hidden full clean command
gc: clean
- rm output/*.csv
clean: ## clean up outputs (queries are preserved)
-rm output/barchartrace.csv Rplots.pdf
-rm output/*.png output/*.json output/monthly-minimal.csv
uninstall: ## uninstall dependencies
@echo "Cleaning up..."
@deactivate || true
rm -rf $(VENV)
pip cache purge || true
help: ## show this help
@echo "Specify a command:"
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-12s\033[m %s\n", $$1, $$2}'
@echo ""
.PHONY: help