-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (45 loc) · 1.38 KB
/
Copy pathMakefile
File metadata and controls
63 lines (45 loc) · 1.38 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
# ? Makefile for Fly-in Project
VENV = venv
PYTHON = python3
PYTHON_PIP = ./$(VENV)/bin/python3
PIP = ./$(VENV)/bin/pip
MYPY = ./$(VENV)/bin/mypy
FLAKE8 = ./$(VENV)/bin/flake8
MAP = maps/easy/01_linear_path.txt
PROGRAM_NAME = fly-in
PDB_COMMAND = $(PYTHON_PIP) -m pdb $(PROGRAM_NAME).py
MYPY_FLAGS = --warn-return-any --warn-unused-ignores --ignore-missing-imports \
--disallow-untyped-defs --check-untyped-defs
LINT_COMMAND = $(FLAKE8) . --exclude $(VENV) & $(MYPY) . $(MYPY_FLAGS) --exclude $(VENV)
CREATE_VENV = $(PYTHON) -m venv $(VENV)
INSTALL_DEPS = $(PIP) install -r requirements.txt
UPDATE_PIP = $(PYTHON_PIP) -m pip install --upgrade pip
INSTALL_STAMP = .install_done
CLEAN_COMMAND = rm -rf $$(find . -name "__pycache__" -o -name ".mypy_cache") $(VENV) $(INSTALL_STAMP)
# ? Install a Python package using pip
install: $(INSTALL_STAMP)
$(INSTALL_STAMP): requirements.txt
@echo "Create virtual environment..."
@$(CREATE_VENV)
@echo "Updating pip..."
@$(UPDATE_PIP)
@echo "Installing dependencies..."
@$(INSTALL_DEPS)
@echo "Dependencies installed successfully."
@touch $(INSTALL_STAMP)
# ? Run the program
run: install
@clear
@$(PYTHON_PIP) $(PROGRAM_NAME).py $(MAP)
# ? Debug the program
debug: install
@clear
@$(PDB_COMMAND)
# ? Clean the program
clean:
@$(CLEAN_COMMAND)
@echo "Program cleaned successfully."
# ? Lint the program
lint: install
@clear
@$(LINT_COMMAND)