Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
220 lines (181 loc) · 8.24 KB
/
Copy pathMakefile
File metadata and controls
220 lines (181 loc) · 8.24 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# ps5-native-app-boilerplate - Linux/WSL build entry points.
# Copyright (C) 2026 BlackBearReloaded
# SPDX-License-Identifier: GPL-3.0-or-later
SHELL := /bin/bash
.DEFAULT_GOAL := app
-include .env
APP_DEFINITIONS ?= PS5TERM_OWNED_SSH PS5TERM_OWNED_SFTP PS5TERM_LINUX_SUBSYSTEM PS5TERM_LINUX_PERSISTENCE PS5TERM_LINUX_SHARED_FOLDER PS5TERM_LINUX_NETWORK
APP_INCLUDE_PATHS ?=
APP_STATIC_ARCHIVES ?=
APP_RUNTIME_MODULES ?=
PACBREW_PACKAGES ?=
PACBREW_INCLUDE_PATHS ?=
PACBREW_STATIC_ARCHIVES ?=
PS5_HOST ?=
FTP_PORT ?= 2121
DEPLOY_FORMAT ?= folder
PS5_FTP_USER ?= anonymous
PS5_FTP_PASSWORD ?= codex
DEPLOY_DRY_RUN ?= 0
TITLE_ID ?=
APP_NAME ?=
APP_CATEGORY ?= game
CONTENT_SUFFIX ?=
HOST_CXX ?= clang++
HOST_TEST_CXXFLAGS ?= -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror \
-ffunction-sections -fdata-sections
ifeq ($(shell uname -s),Darwin)
HOST_TEST_LDFLAGS ?= -Wl,-dead_strip
else
HOST_TEST_LDFLAGS ?= -Wl,--gc-sections
endif
GTEST_ARGS ?=
export APP_DEFINITIONS APP_INCLUDE_PATHS APP_STATIC_ARCHIVES APP_RUNTIME_MODULES
export PACBREW_PACKAGES PACBREW_INCLUDE_PATHS PACBREW_STATIC_ARCHIVES
export PS5_HOST FTP_PORT DEPLOY_FORMAT PS5_FTP_USER PS5_FTP_PASSWORD DEPLOY_DRY_RUN
export TITLE_ID APP_NAME APP_CATEGORY CONTENT_SUFFIX
RUNTIME := runtime/libc.prx
RUNTIME_INPUTS := tools/rebuild-libc.sh \
$(wildcard tooling/native/*.cpp tooling/native/*.hpp) \
$(wildcard tooling/native/runtime/*.txt)
HOST_UNIT_TEST := build/tests/demo_renderer_tests
.PHONY: all app build init doctor test test-deps test-unit test-integration libc deps pacbrew pacbrew-list assets-check format format-check tidy lint check ffpkg ffpfsc packages deploy undeploy clean distclean help
all: app
build: app
# The default app contains its own SSH server, so it only needs the pinned sources.
# Separately built payloads, and the SDK they need, are for legacy comparison builds.
ifneq (,$(filter PS5TERM_OWNED_SSH,$(APP_DEFINITIONS)))
APP_SERVICES := ssh-sources
else
APP_SERVICES := ssh shell
endif
.PHONY: ssh ssh-sources shell release test-terminal
ssh-sources:
@python3 tools/prepare-ssh.py --archives-only
ssh:
@bash tools/build-ssh.sh
shell:
@bash tools/build-backend.sh
release: app
@python3 tools/package-app.py
test-terminal:
@bash tools/test-terminal.sh
init:
@printf '%s\n' '==> [init] Configuring the application identity in sce_sys/param.json'
@bash tools/init-project.sh sce_sys/param.json
doctor:
@printf '%s\n' '==> [doctor] Checking the Linux/WSL host without changing it'
@bash tools/doctor.sh
test: test-unit test-integration test-terminal
test-deps:
@printf '%s\n' '==> [test-deps] Fetching the pinned host-only GoogleTest source'
@bash tools/setup-test-dependencies.sh >/dev/null
test-unit: $(HOST_UNIT_TEST)
@printf '%s\n' '==> [test-unit] Running host-native GoogleTest application tests'
@$(HOST_UNIT_TEST) $(GTEST_ARGS)
$(HOST_UNIT_TEST): tests/test_demo_renderer.cpp src/demo_renderer.cpp src/demo_renderer.hpp src/i18n.cpp src/i18n.hpp src/i18n_strings.inc src/font_atlas.hpp src/text_metrics.hpp tools/setup-test-dependencies.sh | test-deps
@printf '%s\n' '==> [test-unit] Compiling the host-native GoogleTest binary'
@mkdir -p -- $(@D)
@gtest=$$(bash tools/setup-test-dependencies.sh); \
$(HOST_CXX) -std=c++20 -O2 -pthread \
-isystem "$$gtest/googletest/include" -I"$$gtest/googletest" \
-c "$$gtest/googletest/src/gtest-all.cc" -o $(@D)/gtest-all.o; \
$(HOST_CXX) -std=c++20 -O2 -pthread \
-isystem "$$gtest/googletest/include" -I"$$gtest/googletest" \
-c "$$gtest/googletest/src/gtest_main.cc" -o $(@D)/gtest-main.o; \
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -pthread -Isrc \
-isystem "$$gtest/googletest/include" \
tests/test_demo_renderer.cpp src/demo_renderer.cpp src/i18n.cpp \
$(@D)/gtest-all.o $(@D)/gtest-main.o \
$(HOST_TEST_LDFLAGS) -o $@
test-integration:
@printf '%s\n' '==> [test-integration] Running host tooling integration tests'
@python3 -m unittest discover -s tests -p 'test_*.py' -v
deps: test-deps
@printf '%s\n' '==> [deps] Fetching declared native dependencies'
@bash tools/setup-native-dependencies.sh
@bash tools/setup-pacbrew-dependencies.sh --environment
pacbrew:
@printf '%s\n' '==> [pacbrew] Fetching the pinned prebuilt ports sysroot'
@bash tools/setup-pacbrew-dependencies.sh --all
pacbrew-list:
@printf '%s\n' '==> [pacbrew] Listing available pkg-config modules'
@bash tools/setup-pacbrew-dependencies.sh --list
assets-check:
@printf '%s\n' '==> [assets] Validating icon, backgrounds, and selection audio'
@bash tools/validate-assets.sh
libc:
@printf '%s\n' '==> [libc] Rebuilding and verifying the clean-room runtime'
@bash tools/rebuild-libc.sh
$(RUNTIME): $(RUNTIME_INPUTS)
@printf '%s\n' '==> [libc] Generating the missing or outdated runtime'
@bash tools/rebuild-libc.sh
app: $(APP_SERVICES) $(RUNTIME)
@printf '%s\n' '==> [app] Compiling, linking, signing, and assembling the app folder'
@bash tools/build.sh Folder
ffpkg: $(APP_SERVICES) $(RUNTIME)
@printf '%s\n' '==> [ffpkg] Building the app folder and UFS2 image'
@bash tools/build.sh Ffpkg
ffpfsc: $(APP_SERVICES) $(RUNTIME)
@printf '%s\n' '==> [ffpfsc] Building the app folder and compressed image'
@bash tools/build.sh Ffpfsc
packages: $(APP_SERVICES) $(RUNTIME)
@printf '%s\n' '==> [packages] Building the app folder and both package formats'
@bash tools/build.sh All
deploy:
@printf '%s\n' '==> [deploy] Building and publishing the selected app output over FTP'
@bash tools/deploy.sh
undeploy:
@printf '%s\n' '==> [undeploy] Removing staged development files for this title over FTP'
@bash tools/deploy.sh undeploy
format:
@printf '%s\n' '==> [format] Formatting C and C++ sources'
@bash tools/run_clang_format.sh
format-check:
@printf '%s\n' '==> [format] Checking C and C++ formatting'
@bash tools/run_clang_format.sh --check
tidy:
@printf '%s\n' '==> [tidy] Running Clang static analysis'
@bash tools/run_clang_tidy.sh
lint:
@printf '%s\n' '==> [lint] Running source, metadata, and shell checks'
@bash tools/lint.sh
check: lint test app
clean:
@printf '%s\n' '==> [clean] Removing generated build outputs'
@rm -rf -- build dist
@rm -f -- $(RUNTIME)
distclean: clean
@printf '%s\n' '==> [distclean] Removing downloaded dependency caches'
@rm -rf -- .deps
help:
@printf '%s\n' \
'make Build PS5Term with its bundled servers' \
'make init TITLE_ID=PPSA12345 APP_NAME="My App" Configure app identity' \
'make doctor Check required and optional Linux/WSL tools' \
'make ssh Build the legacy SSH payload for comparison builds' \
'make test Run all host unit and integration tests' \
'make test-deps Fetch verified host-only GoogleTest source' \
'make test-unit Run host-native GoogleTest application tests' \
'make test-integration Run host tooling integration tests' \
'make deps Fetch native dependencies into .deps/' \
'make pacbrew Fetch the pinned PacBrew ports sysroot' \
'make pacbrew-list List PacBrew pkg-config module names' \
'make assets-check Validate the current presentation assets' \
'make libc Force a deterministic runtime/libc.prx rebuild' \
'make format Apply the shared Clang formatting policy' \
'make format-check Check formatting without modifying files' \
'make tidy Run the shared Clang static-analysis policy' \
'make lint Run format, tidy, metadata, and shell checks' \
'make check Run lint and build the skeleton app' \
'make ffpkg Build the folder and UFS2 .ffpkg image' \
'make ffpfsc Build the folder and compressed .ffpfsc image' \
'make packages Build folder, .ffpkg, and .ffpfsc outputs' \
'make deploy PS5_HOST=<address> Build and FTP-deploy the app folder' \
'make undeploy PS5_HOST=<address> Remove this title from /data/homebrew' \
'Build variables: APP_DEFINITIONS, APP_INCLUDE_PATHS, APP_STATIC_ARCHIVES, APP_RUNTIME_MODULES' \
'PacBrew variables: PACBREW_PACKAGES, PACBREW_INCLUDE_PATHS, PACBREW_STATIC_ARCHIVES' \
'Deploy variables: FTP_PORT=2121, DEPLOY_FORMAT=folder|ffpfsc|ffpkg, DEPLOY_DRY_RUN=0|1' \
'Local defaults: Copy .env.example to the ignored .env file' \
'make clean Remove build/, dist/, and generated libc.prx' \
'make distclean Also remove the ignored .deps/ cache'