-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (61 loc) · 2.41 KB
/
Copy pathMakefile
File metadata and controls
69 lines (61 loc) · 2.41 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
# ------------------------------------------------------------
# RunUpdates Makefile
# ------------------------------------------------------------
PYTHON := python3
BUILD_SCRIPT := scripts/build.py
INSTALL_SCRIPT := scripts/install.sh
PROJECT := RunUpdates
PREFIX ?= /opt/RunUpdates
VENV := .venv
# ------------------------------------------------------------
# Build the frozen binary
# ------------------------------------------------------------
build:
$(PYTHON) $(BUILD_SCRIPT) .
# ------------------------------------------------------------
# Install to system prefix
# ------------------------------------------------------------
install:
@echo "Installing $(PROJECT) to $(PREFIX)"
@chmod +x $(INSTALL_SCRIPT)
$(INSTALL_SCRIPT) --prefix $(PREFIX)
# ------------------------------------------------------------
# Uninstall
# ------------------------------------------------------------
uninstall:
@echo "Removing $(PREFIX)"
rm -rf $(PREFIX)
systemctl --user disable runupdates.service || true
systemctl --user disable runupdates.timer || true
systemctl --user daemon-reload
# ------------------------------------------------------------
# Clean build artifacts
# ------------------------------------------------------------
clean:
rm -rf build dist release
find . -name "__pycache__" -type d -exec rm -rf {} +
rm -rf ~/.cache/pyinstaller
# ------------------------------------------------------------
# Full rebuild
# ------------------------------------------------------------
rebuild: clean build
# ------------------------------------------------------------
# Release build (version bump optional)
# ------------------------------------------------------------
release:
$(PYTHON) $(BUILD_SCRIPT) --release .
# ------------------------------------------------------------
# Create and initialize the virtual environment
# ------------------------------------------------------------
venv:
@if [ ! -d "$(VENV)" ]; then \
echo "Creating virtual environment in $(VENV)"; \
$(PYTHON) -m venv $(VENV); \
fi
@echo "Activating virtual environment and installing dependencies"
@. $(VENV)/bin/activate && \
pip install --upgrade pip && \
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi && \
if [ -f pyproject.toml ]; then pip install .; fi && \
pip install pyinstaller
@echo "Virtual environment ready in $(VENV)"