-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
75 lines (58 loc) · 1.64 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
72
73
74
75
# Makefile for the Turing Change Point Dataset
#
# Author: G.J.J. van den Burg
# Copyright (c) 2019, The Alan Turing Institute
# License: See LICENSE file.
#
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
DATA_DIR=./datasets
UTIL_DIR=./utils
VENV_DIR=./venv
EXPORT_DIR=./export
.PHONY: all clean collect verify validate test export
all: test
################
# Main targets #
################
collect: venv
source $(VENV_DIR)/bin/activate && python build_tcpd.py -v collect
##############
# Validation #
##############
test: verify validate
verify: venv collect $(UTIL_DIR)/check_checksums.py ./checksums.json
@echo "Verifying datasets ..."
source $(VENV_DIR)/bin/activate && \
python $(UTIL_DIR)/check_checksums.py -v -c ./checksums.json -d $(DATA_DIR)
validate: venv collect $(UTIL_DIR)/validate_dataset.py ./schema.json
@echo "Validating datasets"
source $(VENV_DIR)/bin/activate && \
python $(UTIL_DIR)/validate_dataset.py -v -s ./schema.json -d $(DATA_DIR)
####################
# Utility commands #
####################
export: test
mkdir -p $(EXPORT_DIR)
cp -v $(DATA_DIR)/*/*.json $(EXPORT_DIR)
###########
# Cleanup #
###########
clean:
if [ -d $(VENV_DIR) ] ; then \
source $(VENV_DIR)/bin/activate && python build_tcpd.py -v clean ; \
fi
rm -rf $(VENV_DIR)
rm -rf $(EXPORT_DIR)
##############
# Virtualenv #
##############
venv: $(VENV_DIR)/bin/activate
$(VENV_DIR)/bin/activate:
test -d $(VENV_DIR) || python -m venv $(VENV_DIR)
source $(VENV_DIR)/bin/activate && \
pip install wheel && \
pip install -r ./requirements.txt
touch $(VENV_DIR)/bin/activate