-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
107 lines (86 loc) · 2.74 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
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
# Makefile
SHELL := /bin/bash
PYTHON := python3
VENV := venv
PIP := $(VENV)/bin/pip
PYTEST := $(VENV)/bin/pytest
PYTHON_VENV := $(VENV)/bin/python
.PHONY: all clean build test package build-frontend build-backend
all: clean build test package
clean: clean-venv
$(PYTHON) tools/build.py clean
build: build-frontend build-backend
build-frontend:
$(PYTHON) tools/build.py frontend
build-backend:
$(PYTHON) tools/build.py backend
test: activate
$(PYTEST) tests/
activate: $(VENV)/bin/activate
source $(VENV)/bin/activate
$(VENV)/bin/activate:
@echo "Creating virtual environment..."
$(PYTHON) -m venv $(VENV)
@echo "Installing dependencies..."
$(PIP) install -e ".[test]"
package:
$(PYTHON) tools/build.py package
# Development targets
.PHONY: quick-update quick-restart logs logs-web kill-services
# Location of installed package
INSTALL_DIR := /usr/lib/python3/dist-packages/gecko_controller
# Quick update - copy changed files and restart services
quick-update:
@echo "Stopping services..."
sudo systemctl stop gecko-web gecko-controller
@echo "Copying updated files..."
sudo cp gecko_controller/display_socket.py $(INSTALL_DIR)/
# Add any other files you frequently modify:
sudo cp gecko_controller/controller.py $(INSTALL_DIR)/
sudo cp gecko_controller/web/app.py $(INSTALL_DIR)/web/
@echo "Starting services..."
sudo systemctl restart gecko-controller
sudo systemctl restart gecko-web
@echo "Done. Use 'make logs' to watch the logs"
# Just restart the services
quick-restart:
sudo systemctl restart gecko-controller
sudo systemctl restart gecko-web
kill-services:
sudo kill -9 `ps aux | grep opt/gecko | grep gecko_controller | head -n 1 | awk '{print $$2}'`
sudo kill -9 `ps aux | grep opt/gecko | grep gecko_controller | head -n 1 | awk '{print $$2}'`
# Watch the logs
logs:
journalctl --lines 50 -fu gecko-controller
logs-web:
journalctl --lines 50 -fu gecko-web
# Utility targets
.PHONY: version-check version-bump
version-check:
./tools/verify-versions.sh
version-bump:
./tools/bump-version.sh
# Help target
.PHONY: help
help:
@echo "Gecko Controller Build System"
@echo ""
@echo "Main targets:"
@echo " all - Clean, build, test, and package"
@echo " clean - Remove all build artifacts"
@echo " build - Build frontend and backend"
@echo " test - Run test suite"
@echo " package - Create Debian package"
@echo ""
@echo "Development targets:"
@echo " dev - Start development environment"
@echo " install-deps - Install all dependencies"
@echo ""
@echo "Utility targets:"
@echo " version-check - Verify version consistency"
@echo " version-bump - Bump version numbers"
# Clean virtual environment
.PHONY: clean-venv
clean-venv:
@echo "Removing virtual environment..."
rm -rf $(VENV)