Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
185 lines (145 loc) · 7.56 KB
/
Copy pathMakefile
File metadata and controls
185 lines (145 loc) · 7.56 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
# Modified by vii from komaruworld/mocktail. See README "About this fork".
.DEFAULT_GOAL := all
.PHONY: all build release debug test apk install register-url-handler release-runtime portable portable-test standalone appimage flatpak flatpak-build run-flatpak run run-smoke run-unlimited run-game run-input run-resize run-network auto-run run-gles run-angle update-roblox update-auto update-auto-launch payload-status payload-rollback support-bundle bench bench-startup bench-compare clean submodules help
BUILD_DIR := build
TEST_BUILD_DIR ?= build-test
BINARY := $(BUILD_DIR)/mocktail
JOBS := $(shell nproc)
BUILD_TYPE ?= Release
LIBC ?= auto
MODE ?= standalone
CMAKE_TOOLCHAIN_FILE ?=
CMAKE_SYSROOT ?=
RELEASE_BUILD_DIR ?=
PORTABLE_MODE ?= standalone
PORTABLE_CANONICAL_MODE := $(if $(filter dynamic minimal,$(PORTABLE_MODE)),thin,$(if $(filter full static,$(PORTABLE_MODE)),standalone,$(PORTABLE_MODE)))
PORTABLE_DIR ?= dist/mocktail-linux-x86_64-glibc-$(PORTABLE_CANONICAL_MODE)
APPIMAGE ?= dist/Mocktail-x86_64.AppImage
APPIMAGE_FORMAT ?= classic
ANYLINUX_PACKAGER ?= quick-sharun
ANYLINUX_APPIMAGETOOL ?= appimagetool
PREFIX ?= /usr
FLATPAK_BUILD_DIR ?= build-flatpak
FLATPAK_MANIFEST ?= packaging/flatpak/io.github.CoderDayton.nightcap.json
FLATPAK_JOBS ?= 2
define build_native_runtime
@git submodule update --init --recursive
@cmake -S . -B "$(3)" \
-DCMAKE_BUILD_TYPE="$(1)" \
-DBUILD_TESTING="$(2)" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
$(if $(strip $(CMAKE_TOOLCHAIN_FILE)),-DCMAKE_TOOLCHAIN_FILE="$(CMAKE_TOOLCHAIN_FILE)") \
$(if $(strip $(CMAKE_SYSROOT)),-DCMAKE_SYSROOT="$(CMAKE_SYSROOT)")
@cmake --build "$(3)" -j"$(JOBS)"
endef
all: build ## Dynamic Release build
build: ## Build the dynamic Release runtime in build/
$(call build_native_runtime,$(BUILD_TYPE),OFF,$(BUILD_DIR))
release: ## Build AppImage (LIBC=auto|glibc|musl MODE=standalone|thin)
@MOCKTAIL_BUILD_JOBS="$(JOBS)" \
MOCKTAIL_BUILD_TYPE="$(BUILD_TYPE)" \
MOCKTAIL_RELEASE_BUILD_DIR="$(RELEASE_BUILD_DIR)" \
CMAKE_TOOLCHAIN_FILE="$(CMAKE_TOOLCHAIN_FILE)" \
CMAKE_SYSROOT="$(CMAKE_SYSROOT)" \
./scripts/build_release.sh --libc "$(LIBC)" --mode "$(MODE)"
debug: ## Debug build
$(call build_native_runtime,Debug,OFF,$(BUILD_DIR))
install: ## Install an already-built dynamic runtime (use: sudo make install)
@cmake --install "$(BUILD_DIR)" --prefix "$(PREFIX)"
register-url-handler: build ## Select this build for Roblox website links
@./scripts/register_url_handler.sh --set-default \
--executable "$(abspath $(BINARY))" \
--desktop-file "$(abspath packaging/io.github.CoderDayton.nightcap.desktop)"
test: ## Build and run all unit tests in build-test/
$(call build_native_runtime,Debug,ON,$(TEST_BUILD_DIR))
@ctest --test-dir "$(TEST_BUILD_DIR)" --output-on-failure -j"$(JOBS)"
apk: ## Extract libroblox.so and build (usage: make apk APK=/path/to/roblox.apk)
ifndef APK
$(error APK variable not set. Usage: make apk APK=/path/to/roblox-x86_64.apk)
endif
@./scripts/build.sh --apk "$(APK)" --build-type $(BUILD_TYPE) --jobs $(JOBS)
release-runtime: build
portable: appimage ## Build the portable AppImage
portable-test: release-runtime ## Verify portable packaging and relocation
@./tests/portable_packaging_test.sh
standalone: appimage ## Build the standalone x86-64 AppImage
appimage: release-runtime ## Build AppImage (APPIMAGE_FORMAT=classic|anylinux)
@MOCKTAIL_APPIMAGE_FORMAT="$(APPIMAGE_FORMAT)" \
MOCKTAIL_ANYLINUX_PACKAGER="$(ANYLINUX_PACKAGER)" \
MOCKTAIL_ANYLINUX_APPIMAGETOOL="$(ANYLINUX_APPIMAGETOOL)" \
./scripts/package_portable.sh --build-dir "$(BUILD_DIR)" \
--libc glibc --output "$(PORTABLE_DIR)" --mode "$(PORTABLE_MODE)" \
--appimage "$(APPIMAGE)"
flatpak: ## Build and install the local x86-64 Flatpak
@./scripts/build_flatpak.sh \
--build-dir "$(FLATPAK_BUILD_DIR)" \
--manifest "$(FLATPAK_MANIFEST)" \
--jobs "$(FLATPAK_JOBS)"
flatpak-build: ## Build the local Flatpak without installing it
@./scripts/build_flatpak.sh \
--no-install \
--build-dir "$(FLATPAK_BUILD_DIR)" \
--manifest "$(FLATPAK_MANIFEST)" \
--jobs "$(FLATPAK_JOBS)"
run-flatpak: ## Run the installed Flatpak
@flatpak run io.github.CoderDayton.nightcap
run: export MOCKTAIL_AUTO_EXIT_AFTER_PRESENT_MS = 0
run: build ## Run the native binary interactively until the window is closed
@$(BINARY)
run-smoke: export MOCKTAIL_AUTO_EXIT_AFTER_PRESENT_MS = 3000
run-smoke: release-runtime ## Run the short Vulkan lifecycle readiness gate
@./scripts/real_bringup_smoke.sh C
run-unlimited: export MOCKTAIL_FRAME_RATE_LIMIT = unlimited
run-unlimited: export MOCKTAIL_VSYNC = off
run-unlimited: export MOCKTAIL_AUTO_EXIT_AFTER_PRESENT_MS = 5000
run-unlimited: release-runtime ## Run 240-FPS/unthrottled Vulkan diagnostic mode
@./scripts/real_bringup_smoke.sh C
run-game: release-runtime ## Run local UGCGame/Vulkan gate (not an authenticated join)
@./scripts/real_bringup_smoke.sh GAME
run-input: release-runtime ## Run local GAME gate and route SDL mouse/touch through native input
@./scripts/real_bringup_smoke.sh INPUT
run-resize: release-runtime ## Run real SDL compositor resize and typed JNI surface-rebind gate
@./scripts/real_bringup_smoke.sh RESIZE
run-network: export MOCKTAIL_PLACE_ID = $(PLACE_ID)
run-network: release-runtime ## Run authenticated public-place gate (usage: make run-network PLACE_ID=...)
ifndef PLACE_ID
$(error PLACE_ID variable not set. Usage: make run-network PLACE_ID=positive-place-id)
endif
@./scripts/real_bringup_smoke.sh NETWORK
auto-run: ## Build/run loop with crash summaries
@./scripts/auto_runtime_loop.sh
run-gles: build ## Run strict system EGL/OpenGL ES 3 without Vulkan fallback
@$(BINARY) --graphics opengl
run-angle: build ## Run with ANGLE/Vulkan compatibility backend
@$(BINARY) --graphics angle-vulkan
update-roblox: ## Validate and import the current x86_64 Roblox bundle cached by Sober
@./scripts/update_roblox_payload.sh
update-auto: build ## Download latest Roblox, derive its ABI, run two canaries, then activate
@./$(BUILD_DIR)/mocktail_updater update
update-auto-launch: build ## Update Roblox and launch the verified current payload
@./$(BUILD_DIR)/mocktail_updater update
@./$(BINARY)
payload-status: build ## Show current and previous-good immutable payloads
@./$(BUILD_DIR)/mocktail_updater status
payload-rollback: build ## Atomically restore the previous-good payload
@./$(BUILD_DIR)/mocktail_updater rollback
support-bundle: ## Create a private sanitized diagnostics archive
@./scripts/collect_support_bundle.sh --context manual --reason manual-request
bench: build ## Simulated JNI session benchmark (ARGS="--profile ingame --json out.json")
@cmake --build "$(BUILD_DIR)" --target jnivm_session_benchmark -j"$(JOBS)"
@./$(BUILD_DIR)/jnivm_session_benchmark $(ARGS)
bench-compare: ## Benchmark BASE=<ref> against the working tree (MODE=sim|real|all)
@./scripts/bench_compare.sh --base "$(or $(BASE),HEAD)" --mode "$(or $(MODE),sim)" \
--profile "$(or $(PROFILE),ingame)" $(ARGS)
bench-startup: build ## Real startup, FPS, CPU, memory (HEAP=1, ARGS="--profile ingame")
@cmake --build "$(BUILD_DIR)" --target mocktail_heap_counter -j"$(JOBS)"
@python3 -I scripts/startup_benchmark.py run --bin "$(BINARY)" \
$(if $(filter 1,$(HEAP)),--heap-counter "$(BUILD_DIR)/libmocktail_heap_counter.so") $(ARGS)
submodules: ## Initialise git submodules (Vulkan-Headers)
@./scripts/add_submodules.sh
clean: ## Remove the build and test build directories
rm -rf $(BUILD_DIR) $(TEST_BUILD_DIR)
@echo "Build directories removed."
help: ## Show available targets
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-22s\033[0m %s\n", $$1, $$2}'