forked from libretro/vice-libretro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
473 lines (420 loc) · 16.3 KB
/
Makefile
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
CORE_DIR := .
INCFLAGS :=
SOURCES_C :=
SOURCES_CC :=
SOURCES_CXX :=
OBJECTS :=
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -s),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -s)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -s)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -s)),)
platform = win
endif
endif
ifeq ($(EMUTYPE),)
EMUTYPE = x64
endif
TARGET_NAME := vice_$(EMUTYPE)
# system platform
system_platform = unix
ifeq ($(shell uname -s),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -s)),)
system_platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
ifeq ($(shell uname -p),arm)
arch = arm
endif
else ifneq ($(findstring MINGW,$(shell uname -s)),)
system_platform = win
endif
# Unix
ifeq ($(platform), unix)
TARGET := $(TARGET_NAME)_libretro.so
LDFLAGS += -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--gc-sections
fpic = -fPIC
# Raspberry Pi 4
else ifneq (,$(findstring rpi4,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined
LDFLAGS += -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
CFLAGS += -march=armv8-a+crc+simd -mcpu=cortex-a72
CFLAGS += -DARM -DALIGN_DWORD
CXXFLAGS += $(CFLAGS)
# CrossPI
else ifeq ($(platform), crosspi)
CC = ~/RPI/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc
CXX =~/RPI/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -L~/RPI/usr/lib/arm-linux-gnueabihf -L~/RPI/lib -L~/RPI/lib/arm-linux-gnueabihf -shared -Wl,--no-undefined
CFLAGS += -DARM -DRPIPORT -DALIGN_DWORD -mstructure-size-boundary=32 -mthumb-interwork -falign-functions=16 -marm
CFLAGS += -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3 -O2 -pipe -fstack-protector
CFLAGS += -I~/RPI/usr/include/arm-linux-gnueabihf -I/home/tech/RPI/usr/include
CXXFLAGS += $(CFLAGS)
LDFLAGS += -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -L/home/tech/RPI/usr/lib
# Classic Platforms ####################
# Platform affix = classic_<ISA>_<µARCH>
# (armv7 a7, hard point, neon based) ###
# NESC, SNESC, C64 mini
else ifeq ($(platform), classic_armv7_a7)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
LDFLAGS := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
CFLAGS += -DARM -Ofast \
-flto=4 -fwhole-program -fuse-linker-plugin \
-fdata-sections -ffunction-sections -Wl,--gc-sections \
-fno-stack-protector -fno-ident -fomit-frame-pointer \
-falign-functions=1 -falign-jumps=1 -falign-loops=1 \
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
-fmerge-all-constants -fno-math-errno \
-marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CXXFLAGS += $(CFLAGS)
CPPFLAGS += $(CFLAGS)
ASFLAGS += $(CFLAGS)
ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1)
CFLAGS += -march=armv7-a
else
CFLAGS += -march=armv7ve
# If gcc is 5.0 or later
ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
LDFLAGS += -static-libgcc -static-libstdc++
endif
endif
# (armv8 a35, hard point, neon based) ###
# PS Classic
else ifeq ($(platform), classic_armv8_a35)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
LDFLAGS := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
CFLAGS += -DARM -Ofast \
-flto=4 -fwhole-program -fuse-linker-plugin \
-fdata-sections -ffunction-sections -Wl,--gc-sections \
-fno-stack-protector -fno-ident -fomit-frame-pointer \
-falign-functions=1 -falign-jumps=1 -falign-loops=1 \
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
-fmerge-all-constants -fno-math-errno \
-marm -mtune=cortex-a35 -mfpu=neon-fp-armv8 -mfloat-abi=hard
CXXFLAGS += $(CFLAGS)
CPPFLAGS += $(CFLAGS)
ASFLAGS += $(CFLAGS)
CFLAGS += -march=armv8-a
LDFLAGS += -static-libgcc -static-libstdc++
#######################################
# CTR (3DS)
else ifeq ($(platform), ctr)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT)
AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
DEFINES += -D_3DS -DARM11 -march=armv6k -mtune=mpcore -mfloat-abi=hard
CFLAGS += $(DEFINES) -I$(CTRULIB)/include
CXXFLAGS += $(CFLAGS)
STATIC_LINKING = 1
# Nintendo Switch (libnx)
else ifeq ($(platform), libnx)
include $(DEVKITPRO)/libnx/switch_rules
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CFLAGS += -O3 -fomit-frame-pointer -ffast-math -I$(DEVKITPRO)/libnx/include/ -Wl,--allow-multiple-definition
CFLAGS += -specs=$(DEVKITPRO)/libnx/switch.specs
CFLAGS += -D__SWITCH__ -DHAVE_LIBNX -DHAVE_GETPWUID=0 -DHAVE_GETCWD=1
CFLAGS += -march=armv8-a -mtune=cortex-a57 -mtp=soft -ffast-math -mcpu=cortex-a57+crc+fp+simd -ffunction-sections -fcommon
CFLAGS += -Ifrontend/switch -ftree-vectorize
CXXFLAGS += $(CFLAGS)
fpic = -fPIE
STATIC_LINKING=1
# OSX
else ifeq ($(platform), osx)
TARGET := $(TARGET_NAME)_libretro.dylib
LDFLAGS += -dynamiclib
fpic = -fPIC
MINVERSION :=
ifeq ($(arch),ppc)
COMMONFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
OSX_LT_MAVERICKS = YES
else
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
endif
ifeq ($(OSX_LT_MAVERICKS),YES)
MINVERSION = -mmacosx-version-min=10.4
else
fpic += -stdlib=libc++
endif
fpic += $(MINVERSION)
CFLAGS += -DHAVE_STRLCPY -DHAVE_VSNPRINTF -DHAVE_SNPRINTF -DHAVE_STPCPY -D_INTTYPES_H
CXXFLAGS += -DHAVE_STRLCPY -DHAVE_VSNPRINTF -DHAVE_SNPRINTF -DHAVE_STPCPY -D_INTTYPES_H
CFLAGS += -std=gnu99
ifeq ($(CROSS_COMPILE),1)
TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT)
CFLAGS += $(TARGET_RULE)
CXXFLAGS += $(TARGET_RULE)
LDFLAGS += $(TARGET_RULE)
endif
# iOS
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
COMMONFLAGS += -DHAVE_POSIX_MEMALIGN=1 -marm
MINVERSION :=
fpic = -fPIC
LDFLAGS += -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
ifeq ($(platform), ios-arm64)
CC = clang -arch arm64 -isysroot $(IOSSDK)
CXX = clang++ -arch arm64 -isysroot $(IOSSDK)
else
CC = clang -arch armv7 -isysroot $(IOSSDK)
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
endif
COMMONFLAGS += -DIOS
CFLAGS += -DHAVE_STRLCPY -DHAVE_VSNPRINTF -DHAVE_SNPRINTF -DHAVE_STPCPY -D_INTTYPES_H
CXXFLAGS += -DHAVE_STRLCPY -DHAVE_VSNPRINTF -DHAVE_SNPRINTF -DHAVE_STPCPY -D_INTTYPES_H
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
ifeq ($(OSX_LT_MAVERICKS),"YES")
MINVERSION = -miphoneos-version-min=5.0
endif
COMMONFLAGS += $(MINVERSION)
else ifeq ($(platform), tvos-arm64)
TARGET := $(TARGET_NAME)_libretro_tvos.dylib
COMMONFLAGS += -DHAVE_POSIX_MEMALIGN=1 -marm
fpic = -fPIC
LDFLAGS += -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
endif
COMMONFLAGS += -DIOS -DHAVE_STRLCPY -DHAVE_VSNPRINTF -DHAVE_SNPRINTF -DHAVE_STPCPY -D_INTTYPES_H
CFLAGS += $(COMMONFLAGS)
CXXFLAGS += $(COMMONFLAGS)
CC = clang -arch arm64 -isysroot $(IOSSDK)
CXX = clang++ -arch arm64 -isysroot $(IOSSDK)
else ifeq ($(platform), theos_ios)
DEPLOYMENT_IOSVERSION = 5.0
TARGET = iphone:latest:$(DEPLOYMENT_IOSVERSION)
ARCHS = armv7 armv7s
TARGET_IPHONEOS_DEPLOYMENT_VERSION=$(DEPLOYMENT_IOSVERSION)
THEOS_BUILD_DIR := objs
COMMONFLAGS += -DIOS
COMMONFLAGS += -DHAVE_POSIX_MEMALIGN=1 -marm
include $(THEOS)/makefiles/common.mk
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
# Blackberry
else ifeq ($(platform), qnx)
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -lcpp -lm -shared -Wl,-version-script=link.T
CC = qcc -Vgcc_ntoarmv7le
CC_AS = qcc -Vgcc_ntoarmv7le
CXX = QCC -Vgcc_ntoarmv7le_cpp
AR = QCC -Vgcc_ntoarmv7le
COMMONFLAGS += -D__BLACKBERRY_QNX__ -fexceptions -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
CFLAGS += -std=gnu99
# ANDROID STANDALONE TOOLCHAIN
else ifeq ($(platform), androidstc)
TARGET := $(TARGET_NAME)_libretro_android.so
CC = arm-linux-androideabi-gcc
CXX = arm-linux-androideabi-g++
LDFLAGS += -lstdc++ -llog -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
CFLAGS += -DHAVE_GETCWD=1 -DHAVE_MEMMOVE=1 -DHAVE_ATEXIT=1 -DARM -DALIGN_DWORD -DANDROID -mstructure-size-boundary=32 -mthumb-interwork -falign-functions=16 -marm
CFLAGS += -O2 -pipe -fstack-protector
CXXFLAGS += $(CFLAGS)
fpic = -fPIC
# ANDROID
else ifeq ($(platform), android)
ifeq ($(ANDROID_NDK_ARM),)
$(error ANDROID_NDK_ARM not set correctly.)
endif
ifeq ($(ANDROID_NDK_ROOT),)
$(error ANDROID_NDK_ROOT not set correctly.)
endif
TARGET := $(TARGET_NAME)_libretro_android.so
CC = $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc
CXX = $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++
#CFLAGS += -fPIC -fpic -ffunction-sections -funwind-tables
CFLAGS += -DHAVE_GETCWD=1 -DHAVE_MEMMOVE=1 -DHAVE_ATEXIT=1 -DARM -DALIGN_DWORD
COMMONFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -DANDROID -DALIGN_INTS -DALIGN_SHORTS
COMMONFLAGS += -I$(ANDROID_NDK_ROOT)/platforms/android-19/arch-arm/usr/include -I$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include
COMMONFLAGS += -I$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include
LDFLAGS += -llog -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
LDFLAGS += $(fpic) $(SHARED) -L$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/thumb
LDFLAGS += -L$(ANDROID_NDK_ROOT)/platforms/android-19/arch-arm/usr/lib --sysroot=$(ANDROID_NDK_ROOT)/platforms/android-19/arch-arm -march=armv7-a -mthumb -shared
LDFLAGS += -lc -ldl -lm -landroid -llog -lsupc++ $(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/thumb/libgnustl_static.a -lgcc
CXXFLAGS += $(CFLAGS)
fpic = -fPIC
# PSP
else ifeq ($(platform), psp1)
TARGET := $(TARGET_NAME)_libretro_psp1.a
CC = psp-gcc$(EXE_EXT)
CXX = psp-g++$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
COMMONFLAGS += -DPSP -G0 -I$(shell psp-config --pspsdk-path)/include
CFLAGS += -std=c99
CXXFLAGS += -std=c99
STATIC_LINKING = 1
# Vita
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_libretro_vita.a
CC = arm-vita-eabi-gcc$(EXE_EXT)
CXX = arm-vita-eabi-g++$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
COMMONFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
COMMONFLAGS += -DHAVE_STRTOUL -DVITA -fcommon
STATIC_LINKING = 1
# Emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
fpic := -fPIC
SHARED := -shared -s TOTAL_MEMORY=67108864
STATIC_LINKING = 1
COMMONFLAGS += -DHAVE_TIME_T_IN_TIME_H
# Wii
else ifeq ($(platform), wii)
TARGET := $(TARGET_NAME)_libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
COMMONFLAGS += -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
STATIC_LINKING = 1
# WiiU
else ifeq ($(platform), wiiu)
TARGET := $(TARGET_NAME)_libretro_wiiu.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
COMMONFLAGS += -DGEKKO -mwup -mcpu=750 -meabi -mhard-float
COMMONFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
COMMONFLAGS += -DHAVE_STRTOUL -DWIIU
STATIC_LINKING = 1
# Lightweight PS3 Homebrew SDK
else ifneq (,$(filter $(platform), ps3 psl1ght))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)g++$(EXE_EXT)
CC_AS = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)ar$(EXE_EXT)
OLD_GCC := 1
COMMONFLAGS += -D__POWERPC__ -D__ppc__ -D__PS3__ -DWORDS_BIGENDIAN=1 -D__unix__ -DHAVE_STRTOUL -D_NO_CPP_INLINES
ifeq ($(platform), psl1ght)
COMMONFLAGS += -D__PSL1GHT__
endif
STATIC_LINKING = 0
# GCW0
else ifeq ($(platform), gcw0)
TARGET := $(TARGET_NAME)_libretro.so
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
LDFLAGS += -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
fpic := -fPIC
OLD_GCC := 1
COMMONFLAGS += -DDINGUX -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
COMMONFLAGS += -DHAVE_SYS_TYPES_H -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L
CFLAGS += -std=c99
# ARM
else ifneq (,$(findstring armv,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined
LDFLAGS += -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
ifneq (,$(findstring neon,$(platform)))
CFLAGS += -mfpu=neon
HAVE_NEON = 1
endif
ifneq (,$(findstring softfloat,$(platform)))
CFLAGS += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
CFLAGS += -mfloat-abi=hard
endif
CFLAGS += -DARM -marm -DALIGN_DWORD -mthumb-interwork -falign-functions=16 -pipe -fstack-protector
# Wincross64
else ifeq ($(platform), wincross64)
AR = x86_64-w64-mingw32-ar
CC = x86_64-w64-mingw32-gcc
CXX = x86_64-w64-mingw32-g++
CFLAGS += -D__WIN32__
TARGET := $(TARGET_NAME)_libretro.dll
LDFLAGS += --shared -static-libgcc -static-libstdc++ -Wl,--version-script=$(CORE_DIR)/libretro/link.T -L/usr/x86_64-w64-mingw32/lib
LDFLAGS += -lws2_32 -luser32 -lwinmm -ladvapi32 -lshlwapi -lwsock32 -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -lmingw32 -shared -lgcc -lm -lmingw32
# Windows
else
CFLAGS += -D__WIN32__
TARGET := $(TARGET_NAME)_libretro.dll
LDFLAGS += --shared -static-libgcc -static-libstdc++ -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--gc-sections -L/usr/x86_64-w64-mingw32/lib
LDFLAGS += -lws2_32 -luser32 -lwinmm -ladvapi32 -lshlwapi -lwsock32 -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -lmingw32 -shared -lgcc -lm -lmingw32
endif
# Common
ifeq ($(DEBUG), 1)
COMMONFLAGS += -O0 -g
else
COMMONFLAGS += -O3 -DNDEBUG -Wno-format -Wno-format-security
LDFLAGS += -s
endif
# 7zip
ifneq ($(NO_7ZIP), 1)
COMMONFLAGS += -DHAVE_7ZIP -D_7ZIP_ST
endif
COMMONFLAGS += -DHAVE_CONFIG_H -MMD -D__LIBRETRO__
# VFS
ifneq ($(NO_LIBRETRO_VFS), 1)
COMMONFLAGS += -DUSE_LIBRETRO_VFS
endif
COMMONFLAGS += -DCORE_NAME=\"$(EMUTYPE)\"
include Makefile.common
$(info CFLAGS: $(CFLAGS) $(COMMONFLAGS))
$(info -------)
OBJECTS += $(patsubst %.cpp,%.o,$(SOURCES_CXX:.cc=.o)) $(SOURCES_C:.c=.o)
OBJECT_DEPS = $(OBJECTS:.o=.d)
CXXFLAGS += $(fpic) $(INCFLAGS) $(COMMONFLAGS)
CFLAGS += $(fpic) $(INCFLAGS) $(COMMONFLAGS)
LDFLAGS += -lm $(fpic)
# Ensure only a language version supported by all compilers is used
# Do not enforce C99 as some gcc-versions appear to not handle system-headers
# properly in that case.
#CFLAGS += -std=c99
CXXFLAGS += -std=c++98
ifeq ($(platform), theos_ios)
COMMON_FLAGS := -DIOS -DARM $(COMMON_DEFINES) $(INCFLAGS) -I$(THEOS_INCLUDE_PATH) -Wno-error
$(LIBRARY_NAME)_CFLAGS += $(CFLAGS) $(COMMON_FLAGS)
$(LIBRARY_NAME)_CXXFLAGS += $(CXXFLAGS) $(COMMON_FLAGS)
${LIBRARY_NAME}_FILES = $(SOURCES_CXX) $(SOURCES_C)
include $(THEOS_MAKE_PATH)/library.mk
else
all: $(TARGET)
$(TARGET): $(OBJECTS)
ifeq ($(platform), emscripten)
$(CXX) -r $(SHARED) -o $@ $(OBJECTS) $(LDFLAGS)
else ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
#STATIC_LINKING=1 and additional Makefile.common sources are incompatible for PS3 environment
else ifeq ($(platform), ps3)
$(AR) rcs $@ $(OBJECTS)
else
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
endif
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.o: %.cc
$(CXX) $(CXXFLAGS) -c -o $@ $<
-include $(OBJECT_DEPS)
clean:
rm -f $(OBJECTS) $(OBJECT_DEPS) $(TARGET)
objectclean:
rm -f $(OBJECTS) $(OBJECT_DEPS)
targetclean:
rm -f $(TARGET)
.PHONY: clean
endif