Repository navigation
Expand file tree
/
Copy pathMakefile.backup.old
More file actions
105 lines (89 loc) · 2.64 KB
/
Copy pathMakefile.backup.old
File metadata and controls
105 lines (89 loc) · 2.64 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
# --- 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