-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (47 loc) · 2.06 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
# Makefile
# Default target
all: build server
BOLD := $(shell tput bold)
GREEN := $(shell tput setaf 2)
RESET := $(shell tput sgr0)
RED := $(shell tput setaf 1)
export PYTHONPATH := $(PWD)/src:$(PYTHONPATH)
update-submodules:
@echo "$(BOLD)$(GREEN)>> Updating submodules <<$(RESET)"
git submodule update --init --recursive
# Check if the virtual environment is activated and not the default Conda environment
check-venv:
@if [ -n "$$VIRTUAL_ENV" ]; then \
echo "$(BOLD)$(GREEN)>> Virtual environment is activated (venv) <<$(RESET)"; \
elif [ -n "$$CONDA_PREFIX" ] && [ "$$CONDA_PREFIX" != "$$(conda info --base)" ]; then \
echo "$(BOLD)$(GREEN)>> Conda environment is activated and not the default Conda environment <<$(RESET)"; \
elif [ -n "$$PYENV_VIRTUAL_ENV" ]; then \
echo "$(BOLD)$(GREEN)>> Virtual environment is activated (pyenv) <<$(RESET)"; \
elif [ -n "$$PIPENV_ACTIVE" ]; then \
echo "$(BOLD)$(GREEN)>> Virtual environment is activated (pipenv) <<$(RESET)"; \
else \
echo "$(BOLD)$(RED)>> Error: Virtual environment not activated. Please activate your virtual environment of choice. <<$(RESET)"; \
exit 1; \
fi
dependencies:
@echo "$(BOLD)$(GREEN)>> Installing dependencies <<$(RESET)"
python -m pip install --upgrade pip
pip install wheel
# Install dependencies from requirements.txt
build: check-venv dependencies update-submodules # WARNING comment `update-submodules` if you are working on the submodule from the main project
@echo "$(BOLD)$(GREEN)>> Building the visualgo wheel <<$(RESET)"
./scripts/build.sh
server:
@if [ -z "$$(ls -A src/wasm-scripts/*.whl 2>/dev/null)" ]; then \
echo "$(BOLD)$(RED)No .whl file found in src/wasm-scripts/, run 'make build'$(RESET)"; \
else \
echo "$(BOLD)$(GREEN)>> Starting the Visualgo html page <<$(RESET)"; \
./scripts/start_server.sh; \
fi
clean:
@echo "$(BOLD)$(GREEN)>>Cleaning up <<$(RESET)"
rm -rf src/wasm-scripts/*.whl
cd Visualgo-PyPI; make clean
@echo "$(BOLD)$(GREEN)Project Visualgo cleaned correctly.$(RESET)"
# Define phony targets
.PHONY: all check-venv build run clean tests freeze