Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
133 lines (113 loc) · 5.91 KB
/
Copy pathMakefile
File metadata and controls
133 lines (113 loc) · 5.91 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
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
SHAREDIR = $(PREFIX)/share/openbox
ICONDIR = $(PREFIX)/share/icons/hicolor/scalable/apps
DESKTOPDIR = $(PREFIX)/share/applications
METAINFODIR = $(PREFIX)/share/metainfo
LICENSEDIR = $(PREFIX)/share/licenses/openbox
PYTHON_SOURCES = $(shell sed '/^[[:space:]]*#/d;/^[[:space:]]*$$/d' runtime_modules.txt)
# Interpreter for the dev-only contract/ratchet targets. Overridable so the
# same Makefile works on Windows, where `python3` is a Store alias (ADR 0048).
PYTHON ?= python3
DATA_FILES = index.html openbox.svg LICENSE assets/openbox-logo.png assets/placeholder-cover.svg assets/mame/scanlines.png assets/shaders/scanlines.slangp
STATIC_FILES = $(wildcard static/*.js) $(wildcard static/*.css) $(wildcard static/*.svg)
LOCALE_FILES = $(wildcard locales/*.json)
NATIVE_HOST = native_host
RUST_SERVER = target/release/openbox-server
.PHONY: install uninstall appimage check rust-check build-rust version-check dev-venv test-one native-host native-host-macos macos-app contracts ratchets
# Feature-regression ratchets (ADR 0060). Regenerates the frozen contracts in
# scripts/contracts/ after an intentional surface change. Run this only when a
# removal is deliberate; the gate then diffs the result against git.
contracts:
$(PYTHON) -B scripts/check_routes_contract.py --update
$(PYTHON) -B scripts/check_settings_contract.py --update
$(PYTHON) -B scripts/check_emulator_defs.py --update
$(PYTHON) -B scripts/check_frontend_modules.py --update
$(PYTHON) -B scripts/check_reliability_catalog.py --update
$(PYTHON) -B scripts/check_state_schema.py --update
$(PYTHON) -B scripts/check_api_contract.py --update
@echo "Contracts regenerated. Review the diff, then commit it with the change."
# Run only the feature-regression ratchets, without the coverage stage.
ratchets:
$(PYTHON) -B scripts/check_routes_contract.py
$(PYTHON) -B scripts/check_settings_contract.py
$(PYTHON) -B scripts/check_emulator_defs.py
$(PYTHON) -B scripts/check_frontend_modules.py
$(PYTHON) -B scripts/check_reliability_catalog.py
$(PYTHON) -B scripts/check_clock_coupling.py
$(PYTHON) -B scripts/check_exec_modes.py
$(PYTHON) -B scripts/check_state_schema.py
$(PYTHON) -B scripts/check_api_contract.py
$(PYTHON) -B scripts/check_backup_format.py
$(PYTHON) -B scripts/check_deprecations.py
$(PYTHON) -B scripts/check_api_paths.py
native-host:
gcc -O2 native/native_host.c -o $(NATIVE_HOST) $$(pkg-config --cflags --libs webkit2gtk-4.1)
# The macOS native host (WKWebView) and the app bundle that ships it.
native-host-macos:
bash scripts/build_native_host_macos.sh
macos-app:
bash scripts/build_macos_app.sh
dev-venv:
python3 -m venv .venv-dev
.venv-dev/bin/pip install --disable-pip-version-check -r requirements-dev.txt
# Full verification gate: ruff, runtime_modules, dependencies, api_contract,
# version_sync, frontend, i18n, csp, contract ratchets, py_compile, tests under
# coverage, coverage floors (total + web_app + changed-line + new-module), tokens.
# Dev-only dependencies live in .venv-dev; the runtime app stays dep-free.
check: dev-venv
python3 scripts/check_tests.py
# Rust workspace build & quality / supply-chain gates (ADR 0115).
build-rust:
cargo build --release -p openbox-cli
rust-check:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo deny check
cargo test --workspace
# A single test file, e.g. `make test-one TEST=tests/test_saves.py`.
test-one:
python3 -B $(TEST)
# Fails when the version in updates.py disagrees with any published spot.
version-check:
python3 scripts/check_version_sync.py
install: native-host
install -d $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(SHAREDIR)
install -d $(DESTDIR)$(SHAREDIR)/themes
install -d $(DESTDIR)$(ICONDIR)
install -Dm755 openbox.sh $(DESTDIR)$(BINDIR)/openbox
install -Dm755 openbox-native.sh $(DESTDIR)$(BINDIR)/openbox-native
install -d $(DESTDIR)$(DESKTOPDIR)
install -d $(DESTDIR)$(METAINFODIR)
install -d $(DESTDIR)$(LICENSEDIR)
install -Dm755 $(NATIVE_HOST) $(DESTDIR)$(SHAREDIR)/$(NATIVE_HOST)
if [ -x "$(RUST_SERVER)" ]; then install -Dm755 "$(RUST_SERVER)" "$(DESTDIR)$(SHAREDIR)/openbox-server"; fi
install -Dm644 openbox-release.pub $(DESTDIR)$(SHAREDIR)/openbox-release.pub
install -d $(DESTDIR)$(SHAREDIR)/emulator_defs
for f in emulator_defs/*.yaml; do install -Dm644 "$$f" "$(DESTDIR)$(SHAREDIR)/emulator_defs/"; done
install -Dm755 scripts/openbox-launcher.sh $(DESTDIR)$(SHAREDIR)/openbox-launcher.sh
# Runtime Python modules (web_app.py, the app/ modules, handlers/, pkg/) from
# runtime_modules.txt, mirroring the repo layout under the share dir.
for f in $(PYTHON_SOURCES); do install -Dm644 "$$f" "$(DESTDIR)$(SHAREDIR)/$$f"; done
# plugin_catalog.py resolves plugins/catalog.json relative to its own path.
install -Dm644 plugins/catalog.json $(DESTDIR)$(SHAREDIR)/plugins/catalog.json
for f in $(DATA_FILES); do install -Dm644 "$$f" "$(DESTDIR)$(SHAREDIR)/$$f"; done
for f in $(STATIC_FILES); do install -Dm644 "$$f" "$(DESTDIR)$(SHAREDIR)/$$f"; done
for f in $(LOCALE_FILES); do install -Dm644 "$$f" "$(DESTDIR)$(SHAREDIR)/$$f"; done
for f in themes/*.css; do install -Dm644 "$$f" "$(DESTDIR)$(SHAREDIR)/$$f"; done
install -Dm644 packaging/openbox.desktop $(DESTDIR)$(DESKTOPDIR)/io.openbox.GameLauncher.desktop
install -Dm644 openbox.svg $(DESTDIR)$(ICONDIR)/io.openbox.GameLauncher.svg
install -Dm644 packaging/openbox.metainfo.xml $(DESTDIR)$(METAINFODIR)/io.openbox.GameLauncher.metainfo.xml
install -Dm644 packaging/openbox.metainfo.xml $(DESTDIR)$(SHAREDIR)/openbox.metainfo.xml
install -Dm644 LICENSE $(DESTDIR)$(LICENSEDIR)/LICENSE
uninstall:
rm -f $(DESTDIR)$(BINDIR)/openbox
rm -f $(DESTDIR)$(BINDIR)/openbox-native
rm -rf $(DESTDIR)$(SHAREDIR)
rm -f $(DESTDIR)$(ICONDIR)/io.openbox.GameLauncher.svg
rm -f $(DESTDIR)$(DESKTOPDIR)/io.openbox.GameLauncher.desktop
rm -f $(DESTDIR)$(METAINFODIR)/io.openbox.GameLauncher.metainfo.xml
rm -rf $(DESTDIR)$(LICENSEDIR)
appimage:
bash scripts/build_appimage.sh