Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
441 lines (389 loc) · 24.5 KB
/
Copy pathMakefile
File metadata and controls
441 lines (389 loc) · 24.5 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# 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 ?=
APP_INCLUDE_PATHS ?=
APP_STATIC_ARCHIVES ?=
# The build script's path filter rejects '+', so the SDK's C++ runtime archives
# are copied into the dependency cache under names without it. Refresh with tools/refresh-sdk-archives.sh.
APP_STATIC_ARCHIVES += .deps/native/cxx/libcxx.a .deps/native/cxx/libcxxabi.a .deps/native/cxx/libunwind.a
APP_RUNTIME_MODULES ?=
SOFTWARE_AUDIO ?= 0
BITMAP_SUBTITLES ?= $(SOFTWARE_AUDIO)
GPU_MENU ?= 0
VOICE_SEARCH ?= $(GPU_MENU)
HOST_VOICE_SEARCH ?= 1
export GPU_MENU
ifeq ($(GPU_MENU),1)
APP_DEFINITIONS += SLOPFIN_GPU_MENU
APP_INCLUDE_PATHS += .deps/gpu/radv-release/include build/gpu
endif
ifeq ($(SOFTWARE_AUDIO),1)
APP_DEFINITIONS += SLOPFIN_SOFTWARE_AUDIO
endif
VOICE_ARCHIVES := libwhisper.a libggml.a libggml-cpu.a libggml-base.a
ifeq ($(VOICE_SEARCH),1)
APP_DEFINITIONS += SLOPFIN_VOICE_SEARCH
APP_INCLUDE_PATHS += .deps/voice/install-ps5/include
APP_STATIC_ARCHIVES += $(addprefix .deps/voice/install-ps5/lib/,$(VOICE_ARCHIVES))
VOICE_NATIVE_DEPS := .deps/voice/install-ps5/lib/libwhisper.a
endif
ifeq ($(HOST_VOICE_SEARCH),1)
VOICE_HOST_DEPS := .deps/voice/install-host/lib/libwhisper.a
VOICE_HOST_FLAGS := -DSLOPFIN_VOICE_SEARCH -I.deps/voice/install-host/include
VOICE_HOST_LIBS := $(addprefix .deps/voice/install-host/lib/,$(VOICE_ARCHIVES))
endif
ifeq ($(BITMAP_SUBTITLES),1)
APP_DEFINITIONS += SLOPFIN_BITMAP_SUBTITLES
endif
ifneq ($(filter 1,$(SOFTWARE_AUDIO) $(BITMAP_SUBTITLES)),)
APP_INCLUDE_PATHS += .deps/audio/install/include
APP_STATIC_ARCHIVES += .deps/audio/install/lib/libavcodec.a .deps/audio/install/lib/libswresample.a .deps/audio/install/lib/libavutil.a
endif
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_CC ?= clang
HOST_TEST_CXXFLAGS ?= -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror \
-ffunction-sections -fdata-sections
HOST_TEST_LDFLAGS ?= -Wl,--gc-sections
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
# ---------------------------------------------------------------- host build
# The Linux preview: the same renderer, screens, input handling and Jellyfin
# client, on a backend that implements the PS5 C ABI over SDL2 and POSIX.
# See docs/development/HOST_BUILD.md. player.cpp and audio.cpp stay on the console; host/
# supplies a stand-in so the playback overlay is drivable here.
HOST_BIN := build/host/slopfin
HOST_SRC := \
host/host_main.cpp host/host_platform.cpp host/host_player.cpp \
src/app.cpp src/gfx.cpp src/text.cpp src/icons.cpp src/images.cpp \
src/ime.cpp src/voice_search.cpp src/http.cpp src/web_transport.cpp src/jellyfin.cpp src/json.cpp src/pad.cpp \
src/bigalloc.cpp src/config.cpp src/bitmap_subtitles.cpp src/subtitles.cpp src/telemetry.cpp \
src/reporter.cpp src/trace.cpp src/crash.cpp src/warm.cpp src/ui_common.cpp src/account.cpp src/background.cpp src/dashboard.cpp src/seerr.cpp src/update.cpp src/update_package.cpp
HOST_CXXFLAGS ?= -std=c++20 -O2 -g -DSLOPFIN_HOST -Wall -Wextra \
-Wno-unused-parameter -pthread $(shell pkg-config --cflags sdl2)
HOST_LDFLAGS ?= -pthread $(shell pkg-config --libs sdl2 libcurl) -lz
HOST_CXXFLAGS += $(VOICE_HOST_FLAGS)
HOST_LDFLAGS += $(VOICE_HOST_LIBS)
RUNTIME := runtime/libc.prx
RUNTIME_INPUTS := tools/rebuild-libc.sh \
$(wildcard tooling/native/*.cpp tooling/native/*.hpp) \
$(wildcard tooling/native/runtime/*.txt)
.PHONY: all app build init doctor test 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 host host-run
all: app
build: app
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
host: $(HOST_BIN)
$(HOST_BIN): $(HOST_SRC) $(wildcard src/*.hpp host/*.hpp) $(VOICE_HOST_DEPS)
@printf '%s\n' '==> [host] Building the Linux preview'
@mkdir -p -- $(@D)
@$(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_SRC) $(HOST_LDFLAGS) -o $@
host-run: $(HOST_BIN)
@./$(HOST_BIN) $(HOST_ARGS)
test: test-unit test-integration test-server-network
.PHONY: test-playback test-updates
test-playback: test-updates test-services $(VOICE_HOST_DEPS)
@mkdir -p build/tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -DSLOPFIN_HOST -Isrc tests/test_app_shutdown.cpp $(HOST_TEST_LDFLAGS) -o build/tests/app_shutdown_tests
@build/tests/app_shutdown_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -DSLOPFIN_HOST -Isrc tests/test_config.cpp src/config.cpp src/json.cpp -o build/tests/config_tests
@build/tests/config_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_icons.cpp src/icons.cpp -o build/tests/icon_tests
@build/tests/icon_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_audio_buffer_gate.cpp -o build/tests/audio_buffer_gate_tests
@build/tests/audio_buffer_gate_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -pthread -Isrc tests/test_images_retry.cpp $(HOST_TEST_LDFLAGS) -o build/tests/images_retry_tests
@build/tests/images_retry_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_adts_frames.cpp -o build/tests/adts_frames_tests
@build/tests/adts_frames_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -pthread -Isrc tests/test_packet_queue.cpp -o build/tests/packet_queue_tests
@build/tests/packet_queue_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_hevc_base_layer.cpp -o build/tests/hevc_base_layer_tests
@build/tests/hevc_base_layer_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -pthread -Isrc tests/test_audio_backpressure.cpp $(HOST_TEST_LDFLAGS) -o build/tests/audio_backpressure_tests
@build/tests/audio_backpressure_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_media_bitrate.cpp -o build/tests/media_bitrate_tests
@build/tests/media_bitrate_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_telemetry.cpp -o build/tests/telemetry_tests
@build/tests/telemetry_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -pthread -Isrc tests/test_reporter.cpp src/json.cpp $(HOST_TEST_LDFLAGS) -o build/tests/reporter_tests
@build/tests/reporter_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_negotiation.cpp src/json.cpp $(HOST_TEST_LDFLAGS) -o build/tests/negotiation_tests
@build/tests/negotiation_tests
@mkdir -p build/tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_playback.cpp -o build/tests/playback_tests
@build/tests/playback_tests
$(HOST_CXX) -std=c++20 -O2 -pthread -ffunction-sections -fdata-sections tests/test_audio_lifetime.cpp $(HOST_TEST_LDFLAGS) -o build/tests/audio_lifetime_tests
@build/tests/audio_lifetime_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_subtitles.cpp src/subtitles.cpp -o build/tests/subtitle_tests
@build/tests/subtitle_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_tsdemux.cpp src/tsdemux.cpp -o build/tests/tsdemux_tests
@build/tests/tsdemux_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_ac3.cpp -o build/tests/ac3_tests
@build/tests/ac3_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_iec61937.cpp -o build/tests/iec61937_tests
@build/tests/iec61937_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_video_sps.cpp -o build/tests/video_sps_tests
@build/tests/video_sps_tests
@mkdir -p build/tests/crash
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -fno-omit-frame-pointer -DSLOPFIN_HOST -Isrc \
tests/test_crash_report.cpp src/crash.cpp -o build/tests/crash_report_tests
@cd build/tests/crash && ../crash_report_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_hdr.cpp -o build/tests/hdr_tests
@build/tests/hdr_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_video_scale.cpp -o build/tests/video_scale_tests
@build/tests/video_scale_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_playback_url.cpp -o build/tests/playback_url_tests
@build/tests/playback_url_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_cadence.cpp -o build/tests/cadence_tests
@build/tests/cadence_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_motion.cpp -o build/tests/motion_tests
@build/tests/motion_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_ime.cpp -o build/tests/ime_tests
@build/tests/ime_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_server_address.cpp -o build/tests/server_address_tests
@build/tests/server_address_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_search_sections.cpp -o build/tests/search_sections_tests
@build/tests/search_sections_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_voice_search.cpp -o build/tests/voice_search_tests
@build/tests/voice_search_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) $(VOICE_HOST_FLAGS) -Wno-unused-function -Wno-unused-parameter -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_voice_search_backend.cpp src/config.cpp src/json.cpp src/web_transport.cpp src/trace.cpp src/crash.cpp host/host_platform.cpp $(HOST_LDFLAGS) $(HOST_TEST_LDFLAGS) -o build/tests/voice_search_backend_tests
@build/tests/voice_search_backend_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -Wno-unused-parameter -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_voice_search_ui.cpp $(filter-out src/app.cpp host/host_main.cpp src/voice_search.cpp src/ime.cpp,$(HOST_SRC)) $(HOST_LDFLAGS) $(HOST_TEST_LDFLAGS) -o build/tests/voice_search_ui_tests
@SLOPFIN_DATA="$(CURDIR)/build/tests/voice-ui-config" SLOPFIN_ASSETS="$(CURDIR)/assets" build/tests/voice_search_ui_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -Wno-unused-parameter -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_seerr_search_ui.cpp $(filter-out src/app.cpp host/host_main.cpp src/seerr.cpp src/voice_search.cpp src/ime.cpp,$(HOST_SRC)) $(HOST_LDFLAGS) $(HOST_TEST_LDFLAGS) -o build/tests/seerr_search_ui_tests
@SLOPFIN_DATA="$(CURDIR)/build/tests/discover-ui-config" SLOPFIN_ASSETS="$(CURDIR)/assets" build/tests/seerr_search_ui_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -pthread -Isrc tests/test_web_native.cpp src/web_transport.cpp -o build/tests/web_native_tests
@build/tests/web_native_tests
@build/tests/web_native_tests fail-certificates
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_seek.cpp -o build/tests/seek_tests
@build/tests/seek_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_home_rows.cpp -o build/tests/home_rows_tests
@build/tests/home_rows_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_stream_clock.cpp -o build/tests/stream_clock_tests
@build/tests/stream_clock_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_subtitle_timing.cpp src/subtitles.cpp -o build/tests/subtitle_timing_tests
@build/tests/subtitle_timing_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_details_sheet.cpp -o build/tests/details_sheet_tests
@build/tests/details_sheet_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_delivery_summary.cpp -o build/tests/delivery_summary_tests
@build/tests/delivery_summary_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_autoplay.cpp -o build/tests/autoplay_tests
@build/tests/autoplay_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_subtitle_style.cpp -o build/tests/subtitle_style_tests
@build/tests/subtitle_style_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_picture_subtitle_layout.cpp -o build/tests/picture_subtitle_layout_tests
@build/tests/picture_subtitle_layout_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -Wno-unused-parameter -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_subtitle_render.cpp src/gfx.cpp src/text.cpp src/bigalloc.cpp host/host_platform.cpp $(shell pkg-config --libs sdl2) -lz -o build/tests/subtitle_render_tests
@SLOPFIN_ASSETS="$(CURDIR)/assets" build/tests/subtitle_render_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_intro_metadata.cpp src/json.cpp -o build/tests/intro_metadata_tests
@build/tests/intro_metadata_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_avatar_crop.cpp -o build/tests/avatar_crop_tests
@build/tests/avatar_crop_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_rounded_render.cpp src/gfx.cpp src/bigalloc.cpp host/host_platform.cpp $(shell pkg-config --libs sdl2) -lz $(HOST_TEST_LDFLAGS) -o build/tests/rounded_render_tests
@build/tests/rounded_render_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_avatar_editor.cpp src/gfx.cpp src/text.cpp src/icons.cpp src/images.cpp src/pad.cpp src/bigalloc.cpp src/config.cpp src/json.cpp src/ui_common.cpp src/background.cpp src/ime.cpp src/jellyfin.cpp src/http.cpp src/web_transport.cpp src/trace.cpp src/crash.cpp host/host_platform.cpp $(shell pkg-config --libs sdl2 libcurl) -lz $(HOST_TEST_LDFLAGS) -o build/tests/avatar_editor_tests
@SLOPFIN_DATA="$(CURDIR)/build/tests/avatar-config" SLOPFIN_ASSETS="$(CURDIR)/assets" build/tests/avatar_editor_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_session.cpp src/jellyfin.cpp src/http.cpp src/web_transport.cpp src/json.cpp src/config.cpp src/trace.cpp src/crash.cpp host/host_platform.cpp $(shell pkg-config --libs sdl2 libcurl) -lz $(HOST_TEST_LDFLAGS) -o build/tests/session_tests
@build/tests/session_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) $(VOICE_HOST_FLAGS) -Wno-unused-function -Wno-unused-parameter -pthread -DSLOPFIN_HOST $(shell pkg-config --cflags sdl2) -Isrc tests/test_player_controls.cpp $(filter-out src/app.cpp host/host_main.cpp,$(HOST_SRC)) $(HOST_LDFLAGS) $(HOST_TEST_LDFLAGS) -o build/tests/player_controls_tests
@rm -rf build/tests/player-controls-config
@SLOPFIN_DATA="$(CURDIR)/build/tests/player-controls-config" SLOPFIN_ASSETS="$(CURDIR)/assets" build/tests/player_controls_tests
# Compatibility alias for contributors using the standard unit-test target.
test-unit: test-playback
test-updates:
@mkdir -p build/tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_update_package.cpp src/update_package.cpp src/json.cpp -o build/tests/update_package_tests
@build/tests/update_package_tests
$(HOST_CC) -std=c11 -D_DEFAULT_SOURCE -O2 -Wall -Wextra -Wpedantic -Werror -Isrc tests/test_update_transaction.c -o build/tests/update_transaction_tests
$(HOST_CC) -std=c11 -D_DEFAULT_SOURCE -O2 -Wall -Wextra -Wpedantic -Werror -Isrc tests/test_update_close.c -o build/tests/update_close_tests
@build/tests/update_close_tests
test-integration: test-updates test-native-tools
@printf '%s\n' '==> [test-integration] Running host tooling integration tests'
@python3 -m unittest discover -s tests -p 'test_*.py' -v
.PHONY: test-native-tools
test-native-tools:
@mkdir -p build/tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Itooling/native tests/test_self_container.cpp tooling/native/self_container.cpp -lz -o build/tests/self_container_tests
@build/tests/self_container_tests
$(HOST_CC) -std=c11 -O2 -Wall -Wextra -Wpedantic -Werror tests/test_pkg_canary.c -o build/tests/pkg_canary_tests
@build/tests/pkg_canary_tests
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
sdk-archives:
@bash tools/setup-native-dependencies.sh >/dev/null
@bash tools/refresh-sdk-archives.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
# Raw payload data uses .bin so native packagers do not sign it as a module.
SANDBOX_ELF := assets/slopfin-sandbox.bin
$(SANDBOX_ELF): payloads/sandbox/main.c
@printf '%s\n' '==> [payload] Building the picture picker sandbox payload'
@PS5_PAYLOAD_SDK=$(CURDIR)/.deps/native/ps5-payload-sdk $(MAKE) -s -C payloads/sandbox slopfin-sandbox.elf
@cp payloads/sandbox/slopfin-sandbox.elf $@
@rm -f assets/slopfin-sandbox.elf
UPDATE_ELF := assets/slopfin-update.bin
$(UPDATE_ELF): payloads/updater/main.c $(wildcard src/update/*.h)
@printf '%s\n' '==> [payload] Building the app update helper'
@PS5_PAYLOAD_SDK=$(CURDIR)/.deps/native/ps5-payload-sdk $(MAKE) -s -C payloads/updater slopfin-update.elf
@cp payloads/updater/slopfin-update.elf $@
PKG_UPDATE_ELF := assets/slopfin-pkg-update.bin
$(PKG_UPDATE_ELF): payloads/pkg-updater/main.c $(wildcard src/update/*.h)
@printf '%s\n' '==> [payload] Building the package update helper'
@PS5_PAYLOAD_SDK=$(CURDIR)/.deps/native/ps5-payload-sdk $(MAKE) -s -C payloads/pkg-updater slopfin-pkg-update.elf
@cp payloads/pkg-updater/slopfin-pkg-update.elf $@
STORAGE_ELF := assets/slopfin-storage.bin
$(STORAGE_ELF): payloads/storage/main.c $(wildcard src/update/*.h)
@printf '%s\n' '==> [payload] Building the update storage helper'
@PS5_PAYLOAD_SDK=$(CURDIR)/.deps/native/ps5-payload-sdk $(MAKE) -s -C payloads/storage slopfin-storage.elf
@cp payloads/storage/slopfin-storage.elf $@
.deps/voice/install-ps5/lib/libwhisper.a: tools/build-voice-search.sh tools/prepare-voice-search.py | sdk-archives
@bash tools/build-voice-search.sh ps5
.deps/voice/install-host/lib/libwhisper.a: tools/build-voice-search.sh
@bash tools/build-voice-search.sh host
app: sdk-archives $(RUNTIME) $(SANDBOX_ELF) $(UPDATE_ELF) $(PKG_UPDATE_ELF) $(STORAGE_ELF) $(VOICE_NATIVE_DEPS)
@printf '%s\n' '==> [app] Compiling, linking, signing, and assembling the app folder'
@bash tools/build.sh Folder
ffpkg: sdk-archives $(RUNTIME) $(SANDBOX_ELF) $(UPDATE_ELF) $(PKG_UPDATE_ELF) $(STORAGE_ELF) $(VOICE_NATIVE_DEPS)
@printf '%s\n' '==> [ffpkg] Building the app folder and UFS2 image'
@bash tools/build.sh Ffpkg
ffpfsc: sdk-archives $(RUNTIME) $(SANDBOX_ELF) $(UPDATE_ELF) $(PKG_UPDATE_ELF) $(STORAGE_ELF) $(VOICE_NATIVE_DEPS)
@printf '%s\n' '==> [ffpfsc] Building the app folder and compressed image'
@bash tools/build.sh Ffpfsc
packages: sdk-archives $(RUNTIME) $(SANDBOX_ELF) $(UPDATE_ELF) $(PKG_UPDATE_ELF) $(STORAGE_ELF) $(VOICE_NATIVE_DEPS)
@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 host 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 Generate libc.prx and build the SlopFin folder' \
'make init TITLE_ID=PPSA12345 APP_NAME="My App" Configure app identity' \
'make doctor Check required and optional Linux/WSL tools' \
'make test Run app model, tooling and network tests' \
'make test-unit Run playback and app model 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 app' \
'make ffpkg Build the folder and UFS2 .ffpkg image' \
'make fpkg Build and verify a native PS5 debug .pkg' \
'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 tools/env.example to the ignored .env file' \
'make host Build the Linux preview into build/host/slopfin' \
'make host-run Build and run it (HOST_ARGS=... to pass flags)' \
'make clean Remove build/, dist/, and generated libc.prx' \
'make distclean Also remove the ignored .deps/ cache'
.PHONY: sdk-archives test-server-network
test-server-network:
@mkdir -p build/tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -DSLOPFIN_HOST -Isrc tests/test_web_transport.cpp src/http.cpp src/web_transport.cpp src/json.cpp $(shell pkg-config --libs libcurl) -pthread -o build/tests/web_transport_tests
@python3 tools/test-server-network.py build/tests/web_transport_tests
.PHONY: fpkg
fpkg: app
@bash tools/build-native-pkg.sh
.PHONY: test-services
test-services:
@mkdir -p build/tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_update_storage.cpp -o build/tests/update_storage_tests
@build/tests/update_storage_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -DSLOPFIN_HOST -Isrc tests/test_app_files.cpp -o build/tests/app_files_tests
$(HOST_CC) -std=c11 -D_DEFAULT_SOURCE -O2 -Wall -Wextra -Wpedantic -Werror -Isrc tests/test_pkg_request.c -o build/tests/pkg_request_tests
@build/tests/pkg_request_tests
@build/tests/app_files_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -DSLOPFIN_HOST -Isrc tests/test_image_cache.cpp -o build/tests/image_cache_tests
@build/tests/image_cache_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_stream_failure.cpp -o build/tests/stream_failure_tests
@build/tests/stream_failure_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_direct_play.cpp -o build/tests/direct_play_tests
@build/tests/direct_play_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc -Itests tests/test_audio_route.cpp -o build/tests/audio_route_tests
@build/tests/audio_route_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_direct_source.cpp src/direct_source.cpp src/mkv.cpp src/mp4.cpp -o build/tests/direct_source_tests
@build/tests/direct_source_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -pthread -Isrc tests/test_background.cpp src/background.cpp -o build/tests/background_tests
@build/tests/background_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Isrc tests/test_update_download.cpp -o build/tests/update_download_tests
@build/tests/update_download_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -DSLOPFIN_HOST -Wno-unused-function -pthread -Isrc tests/test_update_state.cpp $(HOST_TEST_LDFLAGS) -o build/tests/update_state_tests
@build/tests/update_state_tests
$(HOST_CXX) $(HOST_TEST_CXXFLAGS) -Wno-unused-function -pthread -Isrc tests/test_seerr.cpp src/json.cpp $(HOST_TEST_LDFLAGS) -o build/tests/seerr_tests
@build/tests/seerr_tests
.PHONY: test-bitmap-subtitles
test-bitmap-subtitles:
@bash tools/test-bitmap-subtitles.sh