-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
45 lines (33 loc) · 1.18 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
# Makefile
CHDIR_SHELL := $(SHELL)
VIRTUALENV=venv_py27
GRAPHDIR = graphs/
vpath %.Rout ./src
objects=src/scrapper/download_scores.pyc cache/index cache/pages clean-data/unam-admission.csv
REQUIREMENTS=./src/scrapper/requirements.txt
define chdir
$(eval _D=$(firstword $(1) $(@D)))
$(info $(MAKE): cd $(_D)) $(eval SHELL = cd $(_D); $(CHDIR_SHELL))
endef
.PHONY: all virtualenv scrape charts clean png
all: virtualenv scrape charts png
virtualenv: src/scrapper/$(VIRTUALENV)/bin/activate
src/scrapper/$(VIRTUALENV)/bin/activate: $(REQUIREMENTS)
$(call chdir, src/scrapper)
test -d $(VIRTUALENV) || virtualenv --python=python2.7 $(VIRTUALENV)
. $(VIRTUALENV)/bin/activate; pip install -r requirements.txt
touch $(VIRTUALENV)/bin/activate
./clean-data/unam-admission.csv: ./src/scrapper/download_scores.py
$(call chdir, src/scrapper)
. $(VIRTUALENV)/bin/activate; python download_scores.py
scrape: ./clean-data/unam-admission.csv
charts: run-all.Rout
run-all.Rout: src/run-all.R
$(call chdir, src)
R CMD BATCH --no-save run-all.R
png: graphs/png/mecatronica.svg.png
graphs/png/mecatronica.svg.png: graphs/mecatronica.svg
$(call chdir, src)
./svgtopng.sh
clean :
-rm -f $(objects)