forked from libretro/mame2016-libretro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.libretro
202 lines (177 loc) · 5.77 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
###########################################################################
#
# Makefile.libretro
#
# Makefile for building MAME and derivatives as libretro core libraries
#
# Copyright (C) 2015 Libretro Team.
# Licensing should be regarded as the same as that of the MAME project,
# visit http://mamedev.org for more information.
#
#
# Okay, basically this file exists to do the following:
#
# 1. Determine $ARCH and $platform from the cmdline, the environment, or
# by figuring them out (as other libretro cores do).
# 2. Disable -Werror. MAME upstream builds with -Werror, which is great
# for developers but absolutely frustrating for users. From our POV,
# we're effectively users, and users who try to follow the bleeding
# edge no less. That means we get cut, and too often it's by some
# random warning upstream hasn't squashed.
# 3. Set PYTHON_EXECUTABLE on non-Apple platforms. Upstream assumes
# python (no prefix) is python2, which basically NEVER happens now on
# modern Linux systems, and isn't even common on Windows anymore. It
# should be python2 pretty much everywhere but Apple, and the exception
# there is mostly because Apple hates GPLv3.
# 4. Enable VERBOSE. Yes, MAME builds generate a metric crap-ton of
# output, but when builds fail it's nice to know why.
# 5. Rename $ARCH and unset it. Apple has a convention on the Mac of
# letting you use $ARCH to specify what CPU architectures to build
# for. This is at odds to how libretro uses it, and solving that on
# the libretro end is going to have to wait for a major overhaul of
# how cores are built. We're not ready to do that yet.
#
###########################################################################
###########################################################################
#
# LIBRETRO PREFERRED DEFAULT SETTINGS
#
###########################################################################
# Disable -Werror as libretro is effectively a MAME user, not a developer
NOWERROR ?= 1
# This needs to be python2 at the moment everywhere but OS X (fixed later)
PYTHON_EXECUTABLE ?= python2
# Cause the build system to regenerate itself, in case it changed
REGENIE ?= 1
# Spew much output developers need if MAME's build breaks for some reason
VERBOSE ?= 1
# You probably shouldn't need to set this anymore (find libretro section of
# scripts/toolchain.lua)
# PTR64 = 1
USE_BGFX ?= 0
###########################################################################
#
# 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 = REGENIE=$(REGENIE) VERBOSE=$(VERBOSE) NOWERROR=$(NOWERROR) OSD="retro"
ifneq ($(PYTHON_EXECUTABLE),)
BUILDFLAGS += PYTHON_EXECUTABLE=$(PYTHON_EXECUTABLE)
endif
ifeq ($(DEBUG),1)
BUILDFLAGS += CONFIG=libretrodbg
else
BUILDFLAGS += CONFIG=libretro
endif
###########################################################################
#
# PLATFORM FLAGS
#
###########################################################################
PLATFLAGS =
ifneq ($(PTR64),)
PLATFLAGS += PTR64=$(PTR64)
endif
ifneq ($(platform),)
PLATFLAGS += LIBRETRO_OS="$(platform)"
endif
ifeq ($(platform),win)
ifeq ($(MSYSTEM),MINGW64)
MINGW64 ?= /mingw64
PLATFLAGS += MINGW64="$(MINGW64)"
else ifeq ($(MSYSTEM),MINGW32)
MINGW32 ?= /mingw32
PLATFLAGS += MINGW32="$(MINGW32)"
endif
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
###########################################################################
#
# 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