Debian Codegraph @

Makefile

raw symbols SCIP
1 DEBUG = 0
2 FRONTEND_SUPPORTS_RGB565 = 1
3
4 CORE_DIR := .
5
6 SPACE :=
7 SPACE := $(SPACE) $(SPACE)
8 BACKSLASH :=
9 BACKSLASH := \$(BACKSLASH)
10 filter_out1 = $(filter-out $(firstword $1),$1)
11 filter_out2 = $(call filter_out1,$(call filter_out1,$1))
12 unixpath = $(subst \,/,$1)
13 unixcygpath = /$(subst :,,$(call unixpath,$1))
14
15 # system platform
16 ifeq ($(platform),)
17 platform = unix
18 ifeq ($(shell uname -s),)
19 EXE_EXT = .exe
20 platform = win
21 else ifneq ($(findstring Darwin,$(shell uname -s)),)
22 platform = osx
23 arch = intel
24 ifeq ($(shell uname -p),arm64)
25 arch = arm
26 endif
27 ifeq ($(shell uname -p),powerpc)
28 arch = ppc
29 endif
30 else ifneq ($(findstring MINGW,$(shell uname -s)),)
31 platform = win
32 endif
33 else ifneq (,$(findstring armv,$(platform)))
34 ifeq (,$(findstring classic_,$(platform)))
35 override platform += unix
36 endif
37 else ifneq (,$(findstring rpi,$(platform)))
38 override platform += unix
39 endif
40
41 NEED_BPP = 16
42 NEED_BLIP = 1
43 NEED_STEREO_SOUND = 1
44
45 prefix := /usr
46 libdir := $(prefix)/lib
47
48 LIBRETRO_DIR := libretro
49
50 TARGET_NAME := mednafen_wswan
51
52 # GIT HASH
53 GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
54 ifneq ($(GIT_VERSION)," unknown")
55 FLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
56 endif
57
58 # Unix
59 ifneq (,$(findstring unix,$(platform)))
60 TARGET := $(TARGET_NAME)_libretro.so
61 fpic := -fPIC
62 SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
63
64 # Raspberry Pi
65 ifneq (,$(findstring rpi,$(platform)))
66 FLAGS += -fomit-frame-pointer -ffast-math
67 ifneq (,$(findstring rpi1,$(platform)))
68 FLAGS += -march=armv6j -mfpu=vfp -mfloat-abi=hard -marm
69 else ifneq (,$(findstring rpi2,$(platform)))
70 FLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm
71 else ifneq (,$(findstring rpi3,$(platform)))
72 ifneq (,$(findstring rpi3_64,$(platform)))
73 FLAGS += -mcpu=cortex-a53 -mtune=cortex-a53
74 else
75 FLAGS += -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -marm
76 endif
77 else ifneq (,$(findstring rpi4,$(platform)))
78 FLAGS += -mcpu=cortex-a72 -mtune=cortex-a72
79 endif
80 endif
81
82 # (armv8 a35, hard point, neon based) ###
83 # PlayStation Classic
84 else ifeq ($(platform), classic_armv8_a35)
85 TARGET := $(TARGET_NAME)_libretro.so
86 fpic := -fPIC
87 SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
88 CFLAGS += -DARM -Ofast \
89 -fuse-linker-plugin \
90 -fno-stack-protector -fno-ident -fomit-frame-pointer \
91 -fmerge-all-constants -ffast-math -funroll-all-loops \
92 -marm -mcpu=cortex-a35 -mfpu=neon-fp-armv8 -mfloat-abi=hard
93 CXXFLAGS += $(CFLAGS)
94 CPPFLAGS += $(CFLAGS)
95 HAVE_NEON = 1
96 ARCH = arm
97 LDFLAGS += -lrt
98 LDFLAGS += -marm -mcpu=cortex-a35 -mfpu=neon-fp-armv8 -mfloat-abi=hard -Ofast -flto -fuse-linker-plugin
99 #######################################
100
101 # OS X
102 else ifeq ($(platform), osx)
103 TARGET := $(TARGET_NAME)_libretro.dylib
104 fpic := -fPIC
105 SHARED := -dynamiclib
106 ifeq ($(arch),ppc)
107 ENDIANNESS_DEFINES := -DMSB_FIRST
108 OLD_GCC := 1
109 endif
110 OSXVER = `sw_vers -productVersion | cut -d. -f 2`
111 OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
112 MINVERSION += -mmacosx-version-min=10.7
113 ifeq ($(OSX_LT_MAVERICKS),"YES")
114 else
115 fpic += -stdlib=libc++
116 endif
117 ifeq ($(CROSS_COMPILE),1)
118 TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT)
119 CFLAGS += $(TARGET_RULE)
120 CXXFLAGS += $(TARGET_RULE)
121 LDFLAGS += $(TARGET_RULE)
122 endif
123 fpic += $(MINVERSION)
124 # iOS
125 else ifneq (,$(findstring ios,$(platform)))
126 TARGET := $(TARGET_NAME)_libretro_ios.dylib
127 fpic := -fPIC
128 SHARED := -dynamiclib
129 MINVERSION :=
130 ifeq ($(IOSSDK),)
131 IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
132 endif
133 ifeq ($(platform), ios-arm64)
134 CC = cc -arch arm64 -isysroot $(IOSSDK)
135 CXX = c++ -arch arm64 -isysroot $(IOSSDK)
136 else
137 CC = cc -arch armv7 -isysroot $(IOSSDK)
138 CXX = c++ -arch armv7 -isysroot $(IOSSDK)
139 endif
140 ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
141 MINVERSION = -miphoneos-version-min=8.0
142 else
143 MINVERSION = -miphoneos-version-min=5.0
144 endif
145 LDFLAGS += $(MINVERSION)
146 FLAGS += $(MINVERSION)
147
148 # tvOS
149 else ifeq ($(platform), tvos-arm64)
150 TARGET := $(TARGET_NAME)_libretro_tvos.dylib
151 fpic := -fPIC
152 SHARED := -dynamiclib
153
154 ifeq ($(IOSSDK),)
155 IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
156 endif
157 CC = cc -arch arm64 -isysroot $(IOSSDK)
158 CXX = c++ -arch arm64 -isysroot $(IOSSDK)
159 MINVER = -mappletvos-version-min=11.0
160 LDFLAGS += $(MINVER)
161 FLAGS += $(MINVER)
162 CC += $(MINVER)
163 CXX += $(MINVER)
164
165 # QNX
166 else ifeq ($(platform), qnx)
167 TARGET := $(TARGET_NAME)_libretro_$(platform).so
168 fpic := -fPIC
169 SHARED := -lcpp -lm -shared -Wl,--no-undefined -Wl,--version-script=link.T
170 CC = qcc -Vgcc_ntoarmv7le
171 CXX = QCC -Vgcc_ntoarmv7le_cpp
172 AR = QCC -Vgcc_ntoarmv7le
173 FLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
174
175 # Lightweight PS3 Homebrew SDK
176 else ifneq (,$(filter $(platform), ps3 psl1ght))
177 TARGET := $(TARGET_NAME)_libretro_$(platform).a
178 ENDIANNESS_DEFINES := -DMSB_FIRST
179 STATIC_LINKING = 1
180 CC = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)gcc$(EXE_EXT)
181 CXX = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)g++$(EXE_EXT)
182 AR = $(PS3DEV)/ppu/bin/ppu-$(COMMONLV)ar$(EXE_EXT)
183 ifeq ($(platform), psl1ght)
184 FLAGS += -D__PSL1GHT__
185 endif
186 OLD_GCC := 1
187 FLAGS += -D__PS3__ -DARCH_POWERPC_ALTIVEC
188
189 # PS2
190 else ifeq ($(platform), ps2)
191 TARGET := $(TARGET_NAME)_libretro_$(platform).a
192 CC = mips64r5900el-ps2-elf-gcc$(EXE_EXT)
193 CXX = mips64r5900el-ps2-elf-g++$(EXE_EXT)
194 AR = mips64r5900el-ps2-elf-ar$(EXE_EXT)
195 FLAGS += -DPS2 -G0 -DABGR1555
196 STATIC_LINKING = 1
197 OLD_GCC = 1
198
199 # PSP
200 else ifeq ($(platform), psp1)
201 TARGET := $(TARGET_NAME)_libretro_$(platform).a
202 CC = psp-gcc$(EXE_EXT)
203 CXX = psp-g++$(EXE_EXT)
204 AR = psp-ar$(EXE_EXT)
205 FLAGS += -DPSP -G0
206 STATIC_LINKING = 1
207
208 # Vita
209 else ifeq ($(platform), vita)
210 TARGET := $(TARGET_NAME)_libretro_$(platform).a
211 CC = arm-vita-eabi-gcc$(EXE_EXT)
212 CXX = arm-vita-eabi-g++$(EXE_EXT)
213 AR = arm-vita-eabi-ar$(EXE_EXT)
214 FLAGS += -DVITA
215 STATIC_LINKING = 1
216
217 # CTR (3DS)
218 else ifeq ($(platform), ctr)
219 TARGET := $(TARGET_NAME)_libretro_$(platform).a
220 CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
221 CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT)
222 AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
223 ENDIANNESS_DEFINES := -DLSB_FIRST
224 FLAGS += -DARM11 -D_3DS
225 FLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard
226 FLAGS += -mword-relocations
227 FLAGS += -fomit-frame-pointer -fstrict-aliasing -ffast-math
228 FLAGS += -fno-rtti
229 FLAGS += -fno-exceptions -DDISABLE_EXCEPTIONS
230 STATIC_LINKING = 1
231
232 # Xbox 360
233 else ifeq ($(platform), xenon)
234 TARGET := $(TARGET_NAME)_libretro_xenon360.a
235 CC = xenon-gcc$(EXE_EXT)
236 CXX = xenon-g++$(EXE_EXT)
237 AR = xenon-ar$(EXE_EXT)
238 ENDIANNESS_DEFINES += -D__LIBXENON__ -m32 -D__ppc__ -DMSB_FIRST
239 STATIC_LINKING = 1
240
241 # Nintendo Game Cube / Wii / WiiU
242 else ifneq (,$(filter $(platform), ngc wii wiiu))
243 TARGET := $(TARGET_NAME)_libretro_$(platform).a
244 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
245 CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
246 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
247 ENDIANNESS_DEFINES += -DGEKKO -mcpu=750 -meabi -mhard-float -DMSB_FIRST
248 EXTRA_INCLUDES := -I$(DEVKITPRO)/libogc/include
249 STATIC_LINKING = 1
250
251 # Nintendo WiiU
252 ifneq (,$(findstring wiiu,$(platform)))
253 ENDIANNESS_DEFINES += -DWIIU -DHW_RVL -ffunction-sections -fdata-sections -D__wiiu__ -D__wut__
254
255 # Nintendo Wii
256 else ifneq (,$(findstring wii,$(platform)))
257 ENDIANNESS_DEFINES += -DHW_RVL -mrvl
258
259 # Nintendo Game Cube
260 else ifneq (,$(findstring ngc,$(platform)))
261 ENDIANNESS_DEFINES += -DHW_DOL -mrvl
262 endif
263
264 # Nintendo Switch (libnx)
265 else ifeq ($(platform), libnx)
266 include $(DEVKITPRO)/libnx/switch_rules
267 EXT=a
268 TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
269 DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL
270 CFLAGS := $(DEFINES) -g \
271 -O3 \
272 -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -Wl,--allow-multiple-definition -specs=$(LIBNX)/switch.specs
273 CFLAGS += $(INCDIRS)
274 CFLAGS += $(INCLUDE) -D__SWITCH__ -DHAVE_LIBNX -DARM -march=armv8-a -mtune=cortex-a57 -mtp=soft -fomit-frame-pointer -ffast-math
275 CXXFLAGS := $(ASFLAGS) $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
276 CFLAGS += -std=gnu11
277 STATIC_LINKING = 1
278
279 # Classic Platforms ####################
280 # Platform affix = classic_<ISA>_<µARCH>
281 # Help at https://modmyclassic.com/comp
282
283 # (armv7 a7, hard point, neon based) ###
284 # NESC, SNESC, C64 mini
285 else ifeq ($(platform), classic_armv7_a7)
286 TARGET := $(TARGET_NAME)_libretro.so
287 fpic := -fPIC
288 SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
289 PLATFORM_DEFINES += -Ofast \
290 -flto=4 -fwhole-program -fuse-linker-plugin \
291 -fdata-sections -ffunction-sections -Wl,--gc-sections \
292 -fno-stack-protector -fno-ident -fomit-frame-pointer \
293 -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
294 -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
295 -fmerge-all-constants -fno-math-errno \
296 -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
297 HAVE_NEON = 1
298 ARCH = arm
299 LDFLAGS += -marm -mtune=cortex-a7 -mfpu=neon-vfpv4
300 ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1)
301 CFLAGS += -march=armv7-a
302 else
303 CFLAGS += -march=armv7ve
304 # If gcc is 5.0 or later
305 ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
306 LDFLAGS += -static-libgcc -static-libstdc++
307 endif
308 endif
309 #######################################
310
311 # Emscripten
312 else ifeq ($(platform), emscripten)
313 TARGET := $(TARGET_NAME)_libretro_$(platform).bc
314 STATIC_LINKING = 1
315
316 #GCW 0
317 else ifeq ($(platform), gcw0)
318 TARGET := $(TARGET_NAME)_libretro.so
319 CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
320 CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
321 AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
322 fpic := -fPIC
323 SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
324 FLAGS += -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
325
326 #MIYOO
327 else ifeq ($(platform), miyoo)
328 TARGET := $(TARGET_NAME)_libretro.so
329 CC = /opt/miyoo/usr/bin/arm-linux-gcc
330 CXX = /opt/miyoo/usr/bin/arm-linux-g++
331 AR = /opt/miyoo/usr/bin/arm-linux-ar
332 fpic := -fPIC
333 SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
334 FLAGS += -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s
335
336 # Windows MSVC 2017 all architectures
337 else ifneq (,$(findstring windows_msvc2017,$(platform)))
338
339 PlatformSuffix = $(subst windows_msvc2017_,,$(platform))
340 ifneq (,$(findstring desktop,$(PlatformSuffix)))
341 WinPartition = desktop
342 MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -FS
343 LDFLAGS += -MANIFEST -LTCG:incremental -NXCOMPAT -DYNAMICBASE -DEBUG -OPT:REF -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MANIFESTUAC:"level='asInvoker' uiAccess='false'" -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1
344 LIBS += kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
345 else ifneq (,$(findstring uwp,$(PlatformSuffix)))
346 WinPartition = uwp
347 MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WINDLL -D_UNICODE -DUNICODE -D__WRL_NO_DEFAULT_LIB__ -EHsc -FS
348 LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -LTCG -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
349 LIBS += WindowsApp.lib
350 endif
351
352 CFLAGS += $(MSVC2017CompileFlags)
353 CXXFLAGS += $(MSVC2017CompileFlags)
354
355 TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix))
356
357 CC = cl.exe
358 CXX = cl.exe
359 LD = link.exe
360
361 reg_query = $(call filter_out2,$(subst $2,,$(shell reg query "$2" -v "$1" 2>nul)))
362 fix_path = $(subst $(SPACE),\ ,$(subst \,/,$1))
363
364 ProgramFiles86w := $(shell cmd //c "echo %PROGRAMFILES(x86)%")
365 ProgramFiles86 := $(shell cygpath "$(ProgramFiles86w)")
366
367 WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
368 WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
369 WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
370 WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
371 WindowsSdkDir := $(WindowsSdkDir)
372
373 WindowsSDKVersion ?= $(firstword $(foreach folder,$(subst $(subst \,/,$(WindowsSdkDir)Include/),,$(wildcard $(call fix_path,$(WindowsSdkDir)Include\*))),$(if $(wildcard $(call fix_path,$(WindowsSdkDir)Include/$(folder)/um/Windows.h)),$(folder),)))$(BACKSLASH)
374 WindowsSDKVersion := $(WindowsSDKVersion)
375
376 VsInstallBuildTools = $(ProgramFiles86)/Microsoft Visual Studio/2017/BuildTools
377 VsInstallEnterprise = $(ProgramFiles86)/Microsoft Visual Studio/2017/Enterprise
378 VsInstallProfessional = $(ProgramFiles86)/Microsoft Visual Studio/2017/Professional
379 VsInstallCommunity = $(ProgramFiles86)/Microsoft Visual Studio/2017/Community
380
381 VsInstallRoot ?= $(shell if [ -d "$(VsInstallBuildTools)" ]; then echo "$(VsInstallBuildTools)"; fi)
382 ifeq ($(VsInstallRoot), )
383 VsInstallRoot = $(shell if [ -d "$(VsInstallEnterprise)" ]; then echo "$(VsInstallEnterprise)"; fi)
384 endif
385 ifeq ($(VsInstallRoot), )
386 VsInstallRoot = $(shell if [ -d "$(VsInstallProfessional)" ]; then echo "$(VsInstallProfessional)"; fi)
387 endif
388 ifeq ($(VsInstallRoot), )
389 VsInstallRoot = $(shell if [ -d "$(VsInstallCommunity)" ]; then echo "$(VsInstallCommunity)"; fi)
390 endif
391 VsInstallRoot := $(VsInstallRoot)
392
393 VcCompilerToolsVer := $(shell cat "$(VsInstallRoot)/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | grep -o '[0-9\.]*')
394 VcCompilerToolsDir := $(VsInstallRoot)/VC/Tools/MSVC/$(VcCompilerToolsVer)
395
396 WindowsSDKSharedIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\shared")
397 WindowsSDKUCRTIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\ucrt")
398 WindowsSDKUMIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\um")
399 WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)")
400 WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)")
401
402 # For some reason the HostX86 compiler doesn't like compiling for x64
403 # ("no such file" opening a shared library), and vice-versa.
404 # Work around it for now by using the strictly x86 compiler for x86, and x64 for x64.
405 # NOTE: What about ARM?
406 ifneq (,$(findstring x64,$(TargetArchMoniker)))
407 VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX64
408 else
409 VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX86
410 endif
411
412 PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)/$(TargetArchMoniker)"):$(PATH)
413 PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE")
414 INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/include")
415 LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/lib/$(TargetArchMoniker)")
416 ifneq (,$(findstring uwp,$(PlatformSuffix)))
417 LIB := $(shell IFS=$$'\n'; cygpath -w "$(LIB)/store")
418 endif
419
420 export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
421 export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
422 TARGET := $(TARGET_NAME)_libretro.dll
423 LDFLAGS += -DLL
424
425 # Windows MSVC 2010 x64
426 else ifeq ($(platform), windows_msvc2010_x64)
427 CC = cl.exe
428 CXX = cl.exe
429
430 NO_GCC := 1
431 PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin/amd64"):$(PATH)
432 PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
433 LIB := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/lib/amd64")
434 INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/include")
435
436 WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')
437 WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')
438
439 WindowsSDKIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include")
440 WindowsSDKGlIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\gl")
441 WindowsSDKLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\x64")
442
443 INCFLAGS_PLATFORM = -I"$(WindowsSDKIncludeDir)"
444 export INCLUDE := $(INCLUDE);$(WindowsSDKIncludeDir);$(WindowsSDKGlIncludeDir)
445 export LIB := $(LIB);$(WindowsSDKLibDir)
446 TARGET := $(TARGET_NAME)_libretro.dll
447 LDFLAGS += -DLL
448 # Windows MSVC 2010 x86
449 else ifeq ($(platform), windows_msvc2010_x86)
450 CC = cl.exe
451 CXX = cl.exe
452
453 NO_GCC := 1
454 PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin"):$(PATH)
455 PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
456 LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS100COMNTOOLS)../../VC/lib")
457 INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/include")
458
459 WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')
460 WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')
461
462 WindowsSDKIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include")
463 WindowsSDKGlIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\gl")
464 WindowsSDKLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib")
465
466 INCFLAGS_PLATFORM = -I"$(WindowsSDKIncludeDir)"
467 export INCLUDE := $(INCLUDE);$(WindowsSDKIncludeDir);$(WindowsSDKGlIncludeDir)
468 export LIB := $(LIB);$(WindowsSDKLibDir)
469 TARGET := $(TARGET_NAME)_libretro.dll
470 LDFLAGS += -DLL
471
472 # Windows MSVC 2005 x86
473 else ifeq ($(platform), windows_msvc2005_x86)
474 CC = cl.exe
475 CXX = cl.exe
476
477 PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH)
478 PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE")
479 INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/include")
480 LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS80COMNTOOLS)../../VC/lib")
481 BIN := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin")
482
483 WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3" -v "Install Dir" | grep -o '[A-Z]:\\.*')
484
485 WindowsSDKIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include")
486 WindowsSDKAtlIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\atl")
487 WindowsSDKCrtIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\crt")
488 WindowsSDKGlIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\gl")
489 WindowsSDKMfcIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\mfc")
490 WindowsSDKLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib")
491
492 export INCLUDE := $(INCLUDE);$(WindowsSDKIncludeDir);$(WindowsSDKAtlIncludeDir);$(WindowsSDKCrtIncludeDir);$(WindowsSDKGlIncludeDir);$(WindowsSDKMfcIncludeDir);libretro-common/include/compat/msvc
493 export LIB := $(LIB);$(WindowsSDKLibDir)
494 TARGET := $(TARGET_NAME)_libretro.dll
495 LDFLAGS += -DLL
496 CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
497 LIBS =
498
499 # Windows MSVC 2003 Xbox 1
500 else ifeq ($(platform), xbox1_msvc2003)
501 TARGET := $(TARGET_NAME)_libretro_xdk1.lib
502 CC = CL.exe
503 CXX = CL.exe
504 LD = lib.exe
505
506 export INCLUDE := $(XDK)/xbox/include
507 export LIB := $(XDK)/xbox/lib
508 PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
509 CFLAGS += -D_XBOX -D_XBOX1
510 CXXFLAGS += -D_XBOX -D_XBOX1
511 STATIC_LINKING=1
512
513 # Windows MSVC 2003 x86
514 else ifeq ($(platform), windows_msvc2003_x86)
515 CC = cl.exe
516 CXX = cl.exe
517
518 PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
519 PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
520 INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/include")
521 LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/lib")
522 BIN := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin")
523
524 WindowsSdkDir := $(INETSDK)
525
526 export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
527 export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
528 TARGET := $(TARGET_NAME)_libretro.dll
529 LDFLAGS += -DLL
530 CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
531 WINDOWS_VERSION=1
532
533 # Windows
534 else
535 TARGET := $(TARGET_NAME)_libretro.dll
536 CC ?= gcc
537 CXX ?= g++
538 SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
539 LDFLAGS += -static-libgcc -static-libstdc++ -lwinmm
540 endif
541
542 include Makefile.common
543
544 ifneq (,$(findstring msvc,$(platform)))
545 WARNINGS :=
546 else
547 WARNINGS := -Wall \
548 -Wno-sign-compare \
549 -Wno-unused-variable \
550 -Wno-unused-function \
551 -Wno-uninitialized \
552 $(NEW_GCC_WARNING_FLAGS) \
553 -Wno-strict-aliasing
554 EXTRA_GCC_FLAGS := -funroll-loops
555 endif
556
557 ifeq ($(NO_GCC),1)
558 EXTRA_GCC_FLAGS :=
559 WARNINGS :=
560 endif
561
562 OBJECTS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o)
563
564 all: $(TARGET)
565
566 ifeq ($(DEBUG),1)
567 FLAGS += -O0 -g
568 else
569 FLAGS += -O2 -DNDEBUG $(EXTRA_GCC_FLAGS)
570 endif
571
572 ifneq (,$(findstring msvc,$(platform)))
573 ifeq ($(DEBUG), 1)
574 CFLAGS += -MTd
575 CXXFLAGS += -MTd
576 else
577 CFLAGS += -MT
578 CXXFLAGS += -MT
579 endif
580 endif
581
582 LDFLAGS += $(fpic) $(SHARED)
583 FLAGS += $(fpic) $(NEW_GCC_FLAGS)
584 FLAGS += $(INCFLAGS) $(INCFLAGS_PLATFORM)
585
586 FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION_NUMERIC=931 -DMPC_FIXED_POINT -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -D_LOW_ACCURACY_ $(EXTRA_INCLUDES)
587
588 ifneq (,$(findstring msvc,$(platform)))
589 FLAGS += -DINLINE="_inline"
590 else
591 FLAGS += -DINLINE="inline"
592 endif
593
594 CXXFLAGS += $(FLAGS)
595 CFLAGS += $(FLAGS)
596
597 OBJOUT = -o
598 LINKOUT = -o
599
600 ifneq (,$(findstring msvc,$(platform)))
601 OBJOUT = -Fo
602 LINKOUT = -out:
603 ifeq ($(STATIC_LINKING),1)
604 LD ?= lib.exe
605 STATIC_LINKING=0
606 else
607 LD = link.exe
608 endif
609 else
610 LD = $(CXX)
611 endif
612
613 $(TARGET): $(OBJECTS)
614 ifeq ($(STATIC_LINKING), 1)
615 $(AR) rcs $@ $(OBJECTS)
616 else
617 $(LD) $(LINKOUT)$@ $^ $(LDFLAGS) $(LIBS)
618 endif
619
620 %.o: %.cpp
621 $(CXX) -c $(OBJOUT)$@ $< $(CPPFLAGS) $(CXXFLAGS)
622
623 %.o: %.c
624 $(CC) -c $(OBJOUT)$@ $< $(CPPFLAGS) $(CFLAGS)
625
626 clean:
627 rm -f $(TARGET) $(OBJECTS)
628
629 install:
630 install -D -m 755 $(TARGET) $(DESTDIR)$(libdir)/$(LIBRETRO_DIR)/$(TARGET)
631
632 uninstall:
633 rm $(DESTDIR)$(libdir)/$(LIBRETRO_DIR)/$(TARGET)
634
635 .PHONY: clean install uninstall