diff --git a/Makefile.backup.old b/Makefile.backup.old new file mode 100644 index 0000000..8c5732b --- /dev/null +++ b/Makefile.backup.old @@ -0,0 +1,105 @@ +# --- Global Variables --- +DEBUG ?= 0 +PSS_STYLE ?= 1 +EXTERNAL_ZLIB ?= 0 +HAVE_GRIFFIN ?= 1 +STATIC_LINKING ?= 0 +CORE_DIR := . +TARGET_NAME := supermodel + +# --- Platform Detection --- +ifeq ($(platform),) + platform = unix + ifeq ($(shell uname -a),) + platform = win + else ifneq ($(findstring MINGW,$(shell uname -a)),) + platform = win + else ifneq ($(findstring Darwin,$(shell uname -a)),) + platform = osx + else ifneq ($(findstring win,$(shell uname -a)),) + platform = win + endif +endif + +# --- Include Common Sources FIRST --- +# This populates SOURCES_C, SOURCES_CXX and base INCFLAGS +include Makefile.common + +# --- Include Platform Specifics SECOND --- +# This allows Windows/Unix/OSX files to APPEND to INCFLAGS and set CC/CXX/OBJOUT +ifneq (,$(findstring msvc,$(platform))) + include Makefile.windows +else ifneq (,$(findstring win,$(platform))) + include Makefile.windows +else ifneq (,$(findstring osx,$(platform))) + include Makefile.osx +else ifneq (,$(findstring android,$(platform))) + include Makefile.android +else ifneq (,$(findstring rpi5,$(platform))) + include Makefile.rpi64 +else ifneq (,$(findstring rpi4-64,$(platform))) + include Makefile.rpi64 +else ifneq (,$(findstring rpi64,$(platform))) + include Makefile.rpi64 +else + include Makefile.unix +endif + +# --- Safety Defaults (In case platform files miss them) --- +OBJOUT ?= -o +LINKOUT ?= -o + +# --- Flag Assembly --- +GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" +ifneq ($(GIT_VERSION)," unknown") + DEFINES += -DGIT_VERSION=\"$(GIT_VERSION)\" +endif + +OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o) + +# Combine defines from common file and platform settings +# Use += to ensure we don't wipe out GLEW_STATIC or other Windows flags +DEFINES += $(COREDEFINES) $(PLATFORM_DEFINES) -DSUPERMODEL_OSD_LIBRETRO + +ifeq ($(STATIC_LINKING),1) + DEFINES += -DSTATIC_LINKING +endif + +ifeq ($(platform), sncps3) + WARNING_DEFINES = +else ifneq (,$(findstring msvc,$(platform))) + WARNING_DEFINES = + LIBM := +else + WARNING_DEFINES = -Wno-write-strings +endif + +CFLAGS += $(fpic) $(WARNING_DEFINES) $(DEFINES) +CXXFLAGS += $(fpic) $(WARNING_DEFINES) $(DEFINES) +LDFLAGS += $(LIBM) + +# --- Build Rules --- +all: $(TARGET) + +$(TARGET): $(OBJECTS) +ifeq ($(STATIC_LINKING),1) +ifneq (,$(findstring msvc,$(platform))) + $(LD) $(LINKOUT)$@ $(OBJECTS) +else + $(AR) rcs $@ $(OBJECTS) +endif +else + $(LD) $(LINKOUT)$@ $(SHARED) $(OBJECTS) $(LDFLAGS) $(LIBS) +endif + +# THE FIX: Note the absence of space between $(OBJOUT) and $@ +%.o: %.cpp + $(CXX) -c $(OBJOUT)$@ $< $(CXXFLAGS) $(INCFLAGS) + +%.o: %.c + $(CC) -c $(OBJOUT)$@ $< $(CFLAGS) $(INCFLAGS) + +clean: + rm -f $(OBJECTS) + +.PHONY: clean \ No newline at end of file diff --git a/Makefile.android b/Makefiles/old_unified_makefile_backup/Makefile.android similarity index 100% rename from Makefile.android rename to Makefiles/old_unified_makefile_backup/Makefile.android diff --git a/Makefile.common b/Makefiles/old_unified_makefile_backup/Makefile.common similarity index 100% rename from Makefile.common rename to Makefiles/old_unified_makefile_backup/Makefile.common diff --git a/Makefile.osx b/Makefiles/old_unified_makefile_backup/Makefile.osx similarity index 74% rename from Makefile.osx rename to Makefiles/old_unified_makefile_backup/Makefile.osx index fad35cb..f538963 100644 --- a/Makefile.osx +++ b/Makefiles/old_unified_makefile_backup/Makefile.osx @@ -18,17 +18,36 @@ ifeq ($(platform), osx) fpic := -fPIC SHARED := -dynamiclib - # --- Toolchain Detection --- + # --- Toolchain Detection & Auto-Setup --- # For native macOS builds ifeq ($(shell uname -s),Darwin) CC ?= clang CXX ?= clang++ CLANG_CMD := clang else - # Cross-compile from Linux - CC ?= clang - CXX ?= clang++ - CLANG_CMD := clang + # Cross-compile from Linux using osxcross + # Auto-detect osxcross installation at /opt/osxcross + OSXCROSS_ROOT ?= /opt/osxcross + + ifeq ($(shell test -f $(OSXCROSS_ROOT)/target/bin/o64-clang && echo found),found) + # osxcross found at $(OSXCROSS_ROOT) + # Override CC/CXX to use osxcross (prevents system cc from being used) + override CC := $(OSXCROSS_ROOT)/target/bin/o64-clang + override CXX := $(OSXCROSS_ROOT)/target/bin/o64-clang++ + CLANG_CMD := $(OSXCROSS_ROOT)/target/bin/o64-clang + override LD := $(OSXCROSS_ROOT)/target/bin/o64-clang++ + + # Ensure osxcross tools are in PATH for the build process + export PATH := $(OSXCROSS_ROOT)/target/bin:$(PATH) + + # Auto-set MACOSX_SDK if not already set + ifeq ($(MACOSX_SDK),) + MACOSX_SDK := $(OSXCROSS_ROOT)/target/SDK/MacOSX12.0.sdk + endif + else + # osxcross not found - give helpful error message + $(error osxcross not found at $(OSXCROSS_ROOT). Please install osxcross there, or override with: make platform=osx OSXCROSS_ROOT=/path/to/osxcross) + endif endif LD := $(CXX) @@ -63,7 +82,7 @@ ifeq ($(platform), osx) LIBS := -framework OpenGL -framework CoreFoundation -lz # --- FileSystem Path Implementation --- - SOURCES_CXX += $(CORE_DIR)/Src/OSD/Unix/FileSystemPath.cpp + SOURCES_CXX += $(CORE_DIR)/Src/OSD/OSX/FileSystemPath.cpp # macOS doesn't support Legacy3D (old fixed-pipeline OpenGL) # Modern macOS requires at least OpenGL 3.2 which doesn't have fixed-pipeline functions diff --git a/Makefile.rpi64 b/Makefiles/old_unified_makefile_backup/Makefile.rpi64 similarity index 97% rename from Makefile.rpi64 rename to Makefiles/old_unified_makefile_backup/Makefile.rpi64 index d65ce06..30a7a1e 100644 --- a/Makefile.rpi64 +++ b/Makefiles/old_unified_makefile_backup/Makefile.rpi64 @@ -3,7 +3,7 @@ CC = aarch64-linux-gnu-gcc CXX = aarch64-linux-gnu-g++ LD = aarch64-linux-gnu-g++ -TARGET := $(TARGET_NAME)_libretro.so +TARGET := $(TARGET_NAME)_libretro_aarch64.so fpic := -fPIC SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,-no-undefined diff --git a/Makefile.unix b/Makefiles/old_unified_makefile_backup/Makefile.unix similarity index 100% rename from Makefile.unix rename to Makefiles/old_unified_makefile_backup/Makefile.unix diff --git a/Makefile.windows b/Makefiles/old_unified_makefile_backup/Makefile.windows similarity index 100% rename from Makefile.windows rename to Makefiles/old_unified_makefile_backup/Makefile.windows