From 661a1d1d03ef6be78e23efb1d9235bc31ce5ace9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrizio=20Alonso=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 20 Feb 2025 18:00:00 -0600 Subject: [PATCH] Add makefile TARGET_RK3588 option and actions (#671) * Add makefile TARGET_RK3588 option and actions * Add support for TARGET_RK3588 in Makefile --- Makefile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Makefile b/Makefile index c40330eb2..3cdfc8305 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,9 @@ TARGET_N64 = 0 # Build and optimize for Raspberry Pi(s) TARGET_RPI ?= 0 +# Build and optimize for RK3588 processor +TARGET_RK3588 ?= 0 + # Makeflag to enable OSX fixes OSX_BUILD ?= 0 @@ -314,6 +317,17 @@ ifeq ($(TARGET_RPI),1) endif endif +ifeq ($(TARGET_RK3588),1) + $(info Compiling for RK3588) + DISCORD_SDK := 0 + COOPNET := 0 + machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown') + + # RK3588 in ARM64 (aarch64) mode + $(info ARM64 mode) + OPT_FLAGS := -march=armv8.2-a+crc+simd -mtune=cortex-a76 -O3 +endif + # Set BITS (32/64) to compile for OPT_FLAGS += $(BITS) @@ -358,6 +372,10 @@ ifeq ($(TARGET_RPI),1) # Define RPi to change SDL2 title & GLES2 hints DEFINES += USE_GLES=1 endif +ifeq ($(TARGET_RK3588),1) # Define RK3588 to change SDL2 title & GLES2 hints + DEFINES += USE_GLES=1 +endif + ifeq ($(OSX_BUILD),1) # Modify GFX & SDL2 for OSX GL DEFINES += OSX_BUILD=1 endif @@ -498,6 +516,10 @@ else # Linux builds/binary namer endif endif +ifeq ($(TARGET_RK3588),1) + EXE := $(BUILD_DIR)/sm64coopdx.arm +endif + ELF := $(BUILD_DIR)/$(TARGET).elf LIBULTRA := $(BUILD_DIR)/libultra.a LD_SCRIPT := sm64.ld @@ -775,6 +797,8 @@ else ifeq ($(findstring SDL,$(WINDOW_API)),SDL) BACKEND_LDFLAGS += -lglew32 -lglu32 -lopengl32 else ifeq ($(TARGET_RPI),1) BACKEND_LDFLAGS += -lGLESv2 + else ifeq ($(TARGET_RK3588),1) + BACKEND_LDFLAGS += -lGLESv2 else ifeq ($(OSX_BUILD),1) BACKEND_LDFLAGS += -framework OpenGL `pkg-config --libs glew` -mmacosx-version-min=$(MIN_MACOS_VERSION) EXTRA_CPP_FLAGS += -stdlib=libc++ -std=c++17 -mmacosx-version-min=$(MIN_MACOS_VERSION) @@ -882,6 +906,8 @@ ifeq ($(WINDOWS_BUILD),1) LDFLAGS += -T windows.ld else ifeq ($(TARGET_RPI),1) LDFLAGS := $(OPT_FLAGS) -lm $(BACKEND_LDFLAGS) -no-pie +else ifeq ($(TARGET_RK3588),1) + LDFLAGS := $(OPT_FLAGS) -lm $(BACKEND_LDFLAGS) -no-pie else ifeq ($(OSX_BUILD),1) LDFLAGS := -lm $(BACKEND_LDFLAGS) -lpthread else @@ -951,6 +977,8 @@ else ifeq ($(TARGET_RPI),1) else LDFLAGS += -Llib/lua/linux -l:liblua53-arm.a endif +else ifeq ($(TARGET_RK3588),1) + LDFLAGS += -Llib/lua/linux -l:liblua53-arm64.a else LDFLAGS += -Llib/lua/linux -l:liblua53.a -ldl endif @@ -980,6 +1008,8 @@ ifeq ($(COOPNET),1) else LDFLAGS += -Llib/coopnet/linux -l:libcoopnet-arm.a -l:libjuice-arm.a endif + else ifeq ($(TARGET_RK3588),1) + LDFLAGS += -Llib/coopnet/linux -l:libcoopnet-arm64.a -l:libjuice.a else LDFLAGS += -Llib/coopnet/linux -l:libcoopnet.a -l:libjuice.a endif @@ -1063,6 +1093,12 @@ ifeq ($(TARGET_RPI),1) CFLAGS += -DTARGET_RPI endif +# Check for rk3588 option +ifeq ($(TARGET_RK3588),1) + CC_CHECK_CFLAGS += -DTARGET_RK3588 + CFLAGS += -DTARGET_RK3588 +endif + # Check for texture fix option ifeq ($(TEXTURE_FIX),1) CC_CHECK_CFLAGS += -DTEXTURE_FIX