# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # SDL3 build rules: JoeyLib programs as native programs for the machine that # builds them, through the hosted core and its SDL3 backend (src/hosted, # src/hosted/sdl3). The rules are make/hosted.mk's; this file says what is # SDL3's. A project reaches it through make/project.mk. # # Built with the host's own compiler. Programs link the static SDL3 the # installer builds (SDL3_DIR), so they run without an SDL3 on the machine. A # program is a native executable NAME (no extension), in bin/ or in its own # bin/NAME/ with its DATA beside it, JoeyLib's install convention: the port # makes the executable's folder the current directory when the window opens. PLATFORM := sdl3 include $(dir $(lastword $(MAKEFILE_LIST)))/common.mk SDL3_LIB := $(SDL3_DIR)/lib/libSDL3.a $(call requireTool,$(SDL3_LIB),toolchain:sdl3) SDL3_PKG_CONFIG := PKG_CONFIG_PATH=$(SDL3_DIR)/lib/pkgconfig pkg-config HOSTED_CC := $(HOST_CC) HOSTED_AR := ar HOSTED_BACKEND := sdl3 HOSTED_DEFINES := -DJOEYLIB_PLATFORM_HOSTED -DJOEYLIB_HOSTED_SDL3 HOSTED_SDK_CFLAGS := $(shell $(SDL3_PKG_CONFIG) --cflags sdl3) -DHOSTED_WINDOW_ICON HOSTED_LINK := $(shell $(SDL3_PKG_CONFIG) --static --libs sdl3) PROGRAM_EXT := # A program is relinked when SDL changes. HOSTED_PROGRAM_DEPS := $(SDL3_LIB) # Its icon on its window (HOSTED_WINDOW_ICON): SDL3_ICON_SIZE pixels square, # baked to C and compiled, which the backend gives SDL_SetWindowIcon. SDL3_ICON_SIZE := 64 HOSTED_ICON = $(call programIconDir,$(1))/icon.o HOSTED_ICON_BAKE = $(ICON_BAKE) c $(call programIcon,$(1)) $(call programIconDir,$(1))/icon.c $(SDL3_ICON_SIZE) && $(HOSTED_CC) $(COMMON_CFLAGS) -c $(call programIconDir,$(1))/icon.c -o $(call HOSTED_ICON,$(1)) HOSTED_ICON_LINK = $(call HOSTED_ICON,$(1)) include $(REPO_DIR)/make/hosted.mk