-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (54 loc) · 2.52 KB
/
Copy pathMakefile
File metadata and controls
68 lines (54 loc) · 2.52 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
# GL Proxy build.
# Server -> Bionic arm64 (NDK r27c, API 29).
# Client -> host glibc (whatever WSL has).
NDK ?= /home/spooky/android-ndk-r27c
TC := $(NDK)/toolchains/llvm/prebuilt/linux-x86_64
CC_AND := $(TC)/bin/aarch64-linux-android29-clang
CC_HOST ?= cc
CC_ARM64 ?= aarch64-linux-gnu-gcc
OUT := build
INC := -Iinclude -Iclient -Iserver
CFLAGS_C := -O2 -fPIC -Wall -Wextra $(INC)
CFLAGS_S := -O2 -Wall -Wextra $(INC)
CLIENT_SRC := client/transport.c client/glesv2_stubs.c client/manual_stubs.c
SERVER_SRC := server/main.c server/dispatch_gen.c server/dispatch_manual.c \
server/egl_init.c server/gl_funcs.c server/dmabuf_output.c \
server/image_proxy.c
all: $(OUT)/libGLESv2_proxy.so $(OUT)/libGLESv2_proxy.arm64.so \
$(OUT)/libEGL_proxy.arm64.so $(OUT)/glproxy-srv $(OUT)/arm64_smoke
# arm64 EGL shim: includes gbm_shim.c (overrides gbm_surface_*) and
# wayland_shim.c (overrides wl_egl_window_* + does linux-dmabuf-v1
# wl_buffer attach). Depends on libGLESv2_proxy for glp_present.
$(OUT)/libEGL_proxy.arm64.so: client/egl_shim.c client/gbm_shim.c \
client/wayland_shim.c \
protocol/linux-dmabuf-unstable-v1-protocol.c \
$(OUT)/libGLESv2_proxy.arm64.so | $(OUT)
$(CC_ARM64) $(CFLAGS_C) -Iinclude -Iprotocol -shared -o $@ \
client/egl_shim.c client/gbm_shim.c client/wayland_shim.c \
protocol/linux-dmabuf-unstable-v1-protocol.c \
-L$(OUT) -l:libGLESv2_proxy.arm64.so -ldl \
-lwayland-client -lwayland-egl \
-Wl,-soname,libEGL.so.1
# Tiny arm64 client test: links our cross-built proxy as -lGLESv2 so this
# is an actual real-world ABI test, not a wire-fiddling test.
$(OUT)/arm64_smoke: tests/arm64_smoke.c $(OUT)/libGLESv2_proxy.arm64.so | $(OUT)
$(CC_ARM64) $(CFLAGS_S) -Iinclude -o $@ $< \
-L$(OUT) -l:libGLESv2_proxy.arm64.so \
-Wl,-rpath,. -Wl,-rpath,/tmp
$(OUT):
mkdir -p $(OUT)
# Client: x86-64 host glibc (for local smoke tests on WSL).
$(OUT)/libGLESv2_proxy.so: $(CLIENT_SRC) | $(OUT)
$(CC_HOST) $(CFLAGS_C) -shared -o $@ $^ -lpthread
# Client: arm64 glibc — drops onto the phone as libGLESv2 replacement.
$(OUT)/libGLESv2_proxy.arm64.so: $(CLIENT_SRC) | $(OUT)
$(CC_ARM64) $(CFLAGS_C) -shared -o $@ $^ -lpthread \
-Wl,-soname,libGLESv2.so.2
# Server: arm64 Android executable; runs in chroot, dlopens libGLES_mali.
$(OUT)/glproxy-srv: $(SERVER_SRC) | $(OUT)
$(CC_AND) $(CFLAGS_S) -o $@ $^ -ldl -llog
regen:
python3 codegen/gen.py
clean:
rm -rf $(OUT)
.PHONY: all clean regen