forked from libretro/mame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.libretro
174 lines (154 loc) · 4.13 KB
/
Makefile.libretro
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
VERBOSE ?= 1
RETRO ?= 1
NOWERROR ?= 1
CONFIG ?= libretro"
NO_USE_MIDI ?= 1
PTR64 ?= 1
TARGET ?= mame
# OS ?= linux
# TARGETOS ?= linux
PYTHON_EXECUTABLE ?= python2
REGENIE ?= 1
###########################################################################
#
# LIBRETRO PLATFORM GUESSING
#
# If the caller doesn't specify $platform and $ARCH, we guess
#
###########################################################################
UNAME_S = $(shell uname -s)
UNAME_M = $(shell uname -m)
ifeq ($(platform),)
platform = unix
ifeq ($(UNAME_S),)
platform = win
else ifneq ($(findstring MINGW,$(UNAME_S)),)
platform = win
else ifneq ($(findstring Darwin,$(UNAME_S)),)
platform = osx
else ifneq ($(findstring win,$(UNAME_S)),)
platform = win
endif
endif
ifeq ($(ARCH),)
LIBRETRO_CPU = $(ARCH)
endif
ifeq ($(LIBRETRO_CPU),)
ifeq ($(UNAME_M),)
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
LIBRETRO_CPU = x86_64
endif
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
LIBRETRO_CPU = x86_64
endif
else ifeq ($(UNAME_M),amd64)
LIBRETRO_CPU = x86_64
else
LIBRETRO_CPU = $(UNAME_M)
endif
endif
###########################################################################
#
# LIBRETRO PLATFORM-SPECIFIC CONFIGURATION
#
# Settings needed to get MAME to build everywhere we build it
#
###########################################################################
ifeq ($(platform), android)
#PTR64 = 0
# FIXME: Pass these to GENie and test...
# CROSS_BUILD = 1
# FORCE_DRC_C_BACKEND = 1
else ifeq ($(platform), osx)
PYTHON_EXECUTABLE = python
else ifneq (,$(findstring ios,$(platform)))
# PTR64 = 0
LIBRETRO_CPU=arm
PYTHON_EXECUTABLE = python
# FIXME: Pass these to GENie and test...
# CROSS_BUILD = 1
# FORCE_DRC_C_BACKEND = 1
endif
###########################################################################
#
# BUILD FLAGS
#
###########################################################################
BUILDFLAGS = RETRO=$(RETRO) REGENIE=$(REGENIE) VERBOSE=$(VERBOSE) NOWERROR=$(NOWERROR) OSD="retro" NO_USE_MIDI=$(NO_USE_MIDI)
ifneq ($(PYTHON_EXECUTABLE),)
BUILDFLAGS += PYTHON_EXECUTABLE=$(PYTHON_EXECUTABLE)
endif
ifeq ($(DEBUG),1)
BUILDFLAGS += CONFIG=libretrodbg
else
BUILDFLAGS += CONFIG=libretro
endif
###########################################################################
#
# PLATFORM FLAGS
#
###########################################################################
PLATFLAGS =
ifneq ($(platform),android)
ifneq ($(PTR64),)
PLATFLAGS += PTR64=$(PTR64)
endif
ifneq ($(platform),)
PLATFLAGS += LIBRETRO_OS="$(platform)"
endif
endif
ifeq ($(platform),win)
ifeq ($(MSYSTEM),MINGW64)
MINGW64 ?= /mingw64
PLATFLAGS += MINGW64="$(MINGW64)"
else ifeq ($(MSYSTEM),MINGW32)
MINGW32 ?= /mingw32
PLATFLAGS += MINGW32="$(MINGW32)"
endif
endif
ifeq ($(platform),android)
ANDROID_NDK_LLVM ?= /opt/ndk/toolchains/llvm-3.5/prebuilt/linux-x86_64
ANDROID_NDK_ARM ?= /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
ANDROID_NDK_ROOT ?= /opt/ndk
PLATFLAGS += TARGETOS="android-arm" gcc="android-arm"
PLATFLAGS += ANDROID_NDK_LLVM="$(ANDROID_NDK_LLVM)"
PLATFLAGS += ANDROID_NDK_ARM="$(ANDROID_NDK_ARM)"
PLATFLAGS += ANDROID_NDK_ROOT="$(ANDROID_NDK_ROOT)"
LIBRETRO_CPU :=
ARCH :=
LIBRETRO_OS :=
endif
ifneq ($(LIBRETRO_CPU),)
PLATFLAGS += ARCH="" LIBRETRO_CPU="$(LIBRETRO_CPU)"
endif
ifneq ($(FORCE_DRC_C_BACKEND),)
PLATFLAGS += FORCE_DRC_C_BACKEND="$(FORCE_DRC_C_BACKEND)"
endif
###########################################################################
#
# TARGET FLAGS
#
###########################################################################
TARGETFLAGS =
ifneq ($(TARGET),)
TARGETFLAGS += TARGET=$(TARGET)
endif
ifneq ($(SUBTARGET),)
TARGETFLAGS += SUBTARGET=$(SUBTARGET)
endif
ifneq ($(SOURCES),)
TARGETFLAGS += SOURCES=$(SOURCES)
endif
###########################################################################
#
# MAKE RULES
#
# We just call upstream GENie here with appropriate args
#
###########################################################################
all: build
build:
$(MAKE) $(BUILDFLAGS) $(PLATFLAGS) $(TARGETFLAGS)
clean:
$(MAKE) $(BUILDFLAGS) $(PLATFLAGS) $(TARGETFLAGS) clean
.PHONY: all build clean