-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (120 loc) · 4.47 KB
/
Makefile
File metadata and controls
143 lines (120 loc) · 4.47 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Continuous Verification Framework - processing and managing verification results.
# Repository: https://github.com/ispras/cv
#
# Copyright © 2025 Vitalii Mordan, ISP RAS
#
# SPDX-License-Identifier: Apache-2.0
cpu_cores=$(shell nproc)
# Additional tools.
cvv="cvv"
# Directories
root_dir=$(shell pwd)
install_dir=tools
cvv_dir=${install_dir}/${cvv}
project_dir=cv
tools_config_file=${install_dir}/config.json
# Repositories
cvv_repo_1="https://gitlab.ispras.ru/verification/cvv.git"
cvv_repo_2="https://github.com/ispras/cv-visualizer.git"
# Aux constants.
cvv_branch=master
all: build
download-cvv:
@$(call download_tool,${cvv},${cvv_dir},${cvv_repo_1},${cvv_repo_2})
@cd ${cvv_dir}; git checkout ${cvv_branch}; git pull
build-cvv: download-cvv
@echo "*** Building ${cvv} ***"
@echo "from web.development import *" > ${cvv_dir}/web/web/settings.py
@echo "{}" > ${cvv_dir}/web/web/db.json
build: build-cvv
@echo "*** Building has been completed ***"
download: download-cvv
@echo "*** Downloading has been completed ***"
check-deploy-dir:
@$(call check_dir,${DEPLOY_DIR},DEPLOY_DIR)
install-cvv: build-cvv check-deploy-dir
@echo "*** Installing ${cvv} ***"
@mkdir -p ${DEPLOY_DIR}/${install_dir}
@rm -rf ${DEPLOY_DIR}/${cvv_dir}
@cp -r ${cvv_dir} ${DEPLOY_DIR}/${cvv_dir}
@$(call shrink_installation,${DEPLOY_DIR}/${cvv_dir})
deploy-cvv: build-cvv check-deploy-dir
@echo "*** Deploying ${cvv} web-interface ***"
@rm -rf ${DEPLOY_DIR}
@mkdir -p ${DEPLOY_DIR}
@cp -r ${cvv_dir} ${DEPLOY_DIR}
@$(call shrink_installation,${DEPLOY_DIR})
install-scripts: check-deploy-dir
@mkdir -p ${DEPLOY_DIR}/${install_dir}
@cp ${tools_config_file} ${DEPLOY_DIR}/${install_dir}
@cp -r ${root_dir}/${project_dir} ${DEPLOY_DIR}
install-witness-visualizer: check-deploy-dir build-cvv install-scripts
@mkdir -p ${DEPLOY_DIR}/${install_dir}
@rm -rf ${DEPLOY_DIR}/${cvv_dir}
@cp -r ${cvv_dir} ${DEPLOY_DIR}/${cvv_dir}
@rm -rf ${DEPLOY_DIR}/${cvv_dir}/web/static/codemirror
@rm -rf ${DEPLOY_DIR}/${cvv_dir}/web/static/calendar
@rm -rf ${DEPLOY_DIR}/${cvv_dir}/web/static/jstree
@rm -rf ${DEPLOY_DIR}/${cvv_dir}/web/static/js/population.js
@echo "*** Witness Visualizer has been successfully installed into the directory ${DEPLOY_DIR} ***"
install-mea: check-deploy-dir
@mkdir -p ${DEPLOY_DIR}/${install_dir}
@cp ${tools_config_file} ${DEPLOY_DIR}/${install_dir}
@mkdir -p ${DEPLOY_DIR}/${project_dir}/components
@cp -r ${root_dir}/${project_dir}/mea ${DEPLOY_DIR}/${project_dir}
@cp -r ${root_dir}/${project_dir}/models ${DEPLOY_DIR}/${project_dir}
@cp -r ${root_dir}/${project_dir}/aux ${DEPLOY_DIR}/${project_dir}
@cp ${root_dir}/${project_dir}/components/__init__.py ${DEPLOY_DIR}/${project_dir}/components
@cp ${root_dir}/${project_dir}/components/component.py ${DEPLOY_DIR}/${project_dir}/components
@cp ${root_dir}/${project_dir}/components/mea.py ${DEPLOY_DIR}/${project_dir}/components
@cp ${root_dir}/${project_dir}/mea.py ${DEPLOY_DIR}/${project_dir}/
@echo "*** MEA has been successfully installed into the directory ${DEPLOY_DIR} ***"
install: check-deploy-dir install-cvv install-scripts
@echo "*** Successfully installed into the directory ${DEPLOY_DIR}' ***"
clean:
@echo "*** Removing old installation ***"
@rm -rf ${cvv_dir}
# download_tool(name, path, repository_1, mirror_repository)
define download_tool
if [ -d "$2" ]; then \
echo "*** Tool $1 is already downloaded in directory $2 ***"; \
else \
echo "*** Downloading tool $1 into directory $2 ***"; \
if ! git clone --recursive "$3" "$2"; then \
echo "*** Primary repo failed, trying fallback: $4 ***"; \
if ! git clone --recursive "$4" "$2"; then \
echo "*** ERROR: Failed to download tool $1 from both sources ***"; \
exit 1; \
fi; \
fi; \
fi; \
cd "$2" && git fetch --all --tags --prune
endef
# $1 - absolute directory path, $2 - env variable name, $3 - aux options
define check_dir
if [ -n "$1" ]; then \
if [ "$1" -ef "${root_dir}" ]; then \
echo "Specified directory path '$1' is the same as current directory"; \
false ; \
else \
if [ "$3" = "is_exist" ] ; then \
if [ -d "$1" ] ; then \
true ; \
else \
echo "Specified directory path '$1' does not exist. Add correct path to the '$2' environment variable"; \
false; \
fi ; \
else \
true ; \
fi \
fi ; \
else \
echo "Required variable '$2' was not specified"; \
false; \
fi
endef
# $1 - deploy directory
define shrink_installation
echo "Removing aux files in directory '$1'"
@cd ${1} && rm -rf .git .idea
endef