gambatte-libretro/Makefile.libretro

610 lines
20 KiB
Makefile
Raw Normal View History

2013-11-22 22:39:07 +00:00
DEBUG = 0
HAVE_NETWORK = 0
2017-08-28 11:49:05 +00:00
SPACE :=
SPACE := $(SPACE) $(SPACE)
BACKSLASH :=
BACKSLASH := \$(BACKSLASH)
filter_out1 = $(filter-out $(firstword $1),$1)
filter_out2 = $(call filter_out1,$(call filter_out1,$1))
2018-02-18 02:48:47 +00:00
unixpath = $(subst \,/,$1)
unixcygpath = /$(subst :,,$(call unixpath,$1))
2017-08-28 11:49:05 +00:00
# system platform
2017-04-22 03:41:40 +00:00
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -s),)
2017-04-22 03:41:40 +00:00
EXE_EXT = .exe
platform = win
else ifneq ($(findstring MINGW,$(shell uname -s)),)
2017-04-22 03:41:40 +00:00
platform = win
else ifneq ($(findstring Darwin,$(shell uname -s)),)
2017-04-22 22:23:37 +00:00
platform = osx
else ifneq ($(findstring win,$(shell uname -s)),)
platform = win
2017-04-22 03:41:40 +00:00
endif
else ifneq (,$(findstring armv,$(platform)))
override platform += unix
else ifneq (,$(findstring rpi,$(platform)))
override platform += unix
endif
2013-04-17 16:43:54 +00:00
TARGET_NAME := gambatte
version_script = libgambatte/libretro/link.T
core_installdir := $(prefix)/lib
2015-11-02 13:35:24 +00:00
ifeq ($(ARCHFLAGS),)
2017-04-22 03:41:40 +00:00
ifeq ($(archs),ppc)
ARCHFLAGS = -arch ppc -arch ppc64
else
ARCHFLAGS = -arch i386 -arch x86_64
endif
2015-11-02 13:35:24 +00:00
endif
2015-02-02 00:00:39 +00:00
# Unix
2017-04-22 03:41:40 +00:00
ifneq (,$(findstring unix,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,-version-script=$(version_script)
HAVE_NETWORK=1
2018-02-02 17:57:20 +00:00
ifneq (,$(findstring Haiku,$(shell uname -s)))
LDFLAGS += -lnetwork -lroot
endif
2017-04-22 03:41:40 +00:00
# Raspberry Pi
ifneq (,$(findstring rpi,$(platform)))
2017-04-22 22:23:37 +00:00
CFLAGS += -fomit-frame-pointer -ffast-math -marm
2017-04-22 03:41:40 +00:00
CXXFLAGS += $(CFLAGS)
ifneq (,$(findstring rpi1,$(platform)))
2017-04-22 22:23:37 +00:00
CFLAGS += -march=armv6j -mfpu=vfp -mfloat-abi=hard
2017-04-22 03:41:40 +00:00
else ifneq (,$(findstring rpi2,$(platform)))
2017-04-22 22:23:37 +00:00
CFLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
2017-04-22 03:41:40 +00:00
else ifneq (,$(findstring rpi3,$(platform)))
2017-04-22 22:23:37 +00:00
CFLAGS += -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
2017-04-22 03:41:40 +00:00
endif
endif
2015-02-02 00:00:39 +00:00
# OS X
else ifeq ($(platform), osx)
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
#fpic += -mmacosx-version-min=10.1
ifndef ($(NOUNIVERSAL))
CFLAGS += $(ARCHFLAGS)
CXXFLAGS += $(ARCHFLAGS)
LDFLAGS += $(ARCHFLAGS)
endif
HAVE_NETWORK=1
2013-03-17 23:04:58 +00:00
2015-02-02 00:00:39 +00:00
# iOS
2015-10-16 01:05:58 +00:00
else ifneq (,$(findstring ios,$(platform)))
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
2017-07-24 05:11:24 +00:00
ifeq ($(platform),ios-arm64)
CC = cc -arch arm64 -isysroot $(IOSSDK)
CXX = c++ -arch arm64 -isysroot $(IOSSDK)
else
CC = cc -arch armv7 -isysroot $(IOSSDK)
CXX = c++ -arch armv7 -isysroot $(IOSSDK)
endif
ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
2017-04-22 03:41:40 +00:00
CC += -miphoneos-version-min=8.0
CXX += -miphoneos-version-min=8.0
PLATFORM_DEFINES := -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CXX += -miphoneos-version-min=5.0
PLATFORM_DEFINES := -miphoneos-version-min=5.0
endif
HAVE_NETWORK=1
2014-10-23 07:57:46 +00:00
2015-02-02 00:00:39 +00:00
# Theos
2014-12-23 08:54:06 +00:00
else ifeq ($(platform), theos_ios)
2017-04-22 03:41:40 +00:00
DEPLOYMENT_IOSVERSION = 5.0
TARGET = iphone:latest:$(DEPLOYMENT_IOSVERSION)
ARCHS = armv7 armv7s
TARGET_IPHONEOS_DEPLOYMENT_VERSION=$(DEPLOYMENT_IOSVERSION)
THEOS_BUILD_DIR := objs
include $(THEOS)/makefiles/common.mk
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
HAVE_NETWORK=1
2015-02-02 00:00:39 +00:00
# QNX
else ifeq ($(platform), qnx)
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -lcpp -lm -shared -Wl,-version-script=$(version_script)
CC = qcc -Vgcc_ntoarmv7le
CXX = QCC -Vgcc_ntoarmv7le_cpp
AR = QCC -Vgcc_ntoarmv7le
PLATFORM_DEFINES := -D__BLACKBERRY_QNX__ -fexceptions -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
2015-02-02 00:00:39 +00:00
# PS3
2017-04-22 03:41:40 +00:00
else ifneq (,$(filter $(platform), ps3 sncps3 psl1ght))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
PLATFORM_DEFINES := -D__CELLOS_LV2__
STATIC_LINKING = 1
# sncps3
ifneq (,$(findstring sncps3,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
CXX = $(CC)
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
# PS3
else ifneq (,$(findstring ps3,$(platform)))
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
# Lightweight PS3 Homebrew SDK
else ifneq (,$(findstring psl1ght,$(platform)))
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
endif
2015-02-02 00:00:39 +00:00
# PSP
2012-11-23 20:31:28 +00:00
else ifeq ($(platform), psp1)
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = psp-gcc$(EXE_EXT)
CXX = psp-g++$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
PLATFORM_DEFINES := -DPSP -DCC_RESAMPLER -DCC_RESAMPLER_NO_HIGHPASS
CFLAGS += -G0
CXXFLAGS += -G0
STATIC_LINKING = 1
2015-02-02 00:00:39 +00:00
2015-08-31 19:22:09 +00:00
# Vita
else ifeq ($(platform), vita)
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = arm-vita-eabi-gcc$(EXE_EXT)
CXX = arm-vita-eabi-g++$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DCC_RESAMPLER -DCC_RESAMPLER_NO_HIGHPASS
CFLAGS += -DVITA
CXXFLAGS += -DVITA
STATIC_LINKING = 1
2015-08-31 19:22:09 +00:00
2015-04-01 22:03:38 +00:00
# CTR(3DS)
else ifeq ($(platform), ctr)
2017-04-22 03:41:40 +00:00
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)
PLATFORM_DEFINES := -DARM11 -D_3DS -DCC_RESAMPLER -DCC_RESAMPLER_NO_HIGHPASS
CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard
CFLAGS += -Wall -mword-relocations
CFLAGS += -fomit-frame-pointer -ffast-math
CXXFLAGS += $(CFLAGS)
STATIC_LINKING = 1
2015-04-01 22:03:38 +00:00
2017-02-10 04:31:06 +00:00
# DOS
else ifeq ($(platform), dos)
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = i686-pc-msdosdjgpp-gcc
CXX = i686-pc-msdosdjgpp-g++
AR = i686-pc-msdosdjgpp-ar
CFLAGS += -march=i386
CFLAGS += -Wall
CFLAGS += -fomit-frame-pointer -ffast-math
CXXFLAGS += $(CFLAGS)
STATIC_LINKING = 1
2016-02-25 14:47:58 +00:00
2015-02-02 00:00:39 +00:00
# Xbox 360
else ifeq ($(platform), xenon)
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)
CXX = xenon-g++$(EXE_EXT)
AR = xenon-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__LIBXENON__
STATIC_LINKING = 1
# Nintendo Game Cube / Wii / WiiU
else ifneq (,$(filter $(platform), ngc wii wiiu))
TARGET := $(TARGET_NAME)_libretro_$(platform).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)
PLATFORM_DEFINES += -DGEKKO -mcpu=750 -meabi -mhard-float
PLATFORM_DEFINES += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
STATIC_LINKING = 1
# Nintendo WiiU
ifneq (,$(findstring wiiu,$(platform)))
PLATFORM_DEFINES += -DWIIU -DHW_RVL -mwup
# Nintendo Wii
else ifneq (,$(findstring wii,$(platform)))
PLATFORM_DEFINES += -DHW_RVL -mrvl
# Nintendo Game Cube
else ifneq (,$(findstring ngc,$(platform)))
PLATFORM_DEFINES += -DHW_DOL -mrvl
endif
2015-02-02 00:00:39 +00:00
2018-01-04 21:59:59 +00:00
# Nintendo Switch (libtransistor)
else ifeq ($(platform), switch)
EXT=a
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
include $(LIBTRANSISTOR_HOME)/libtransistor.mk
STATIC_LINKING=1
2015-02-02 00:00:39 +00:00
# emscripten
2013-09-15 21:10:24 +00:00
else ifeq ($(platform), emscripten)
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
STATIC_LINKING = 1
2015-02-02 00:00:39 +00:00
2016-03-01 21:30:41 +00:00
# GCW0
else ifeq ($(platform), gcw0)
2017-04-22 03:41:40 +00:00
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
fpic := -fPIC
SHARED := -shared -Wl,-version-script=$(version_script)
PLATFORM_DEFINES := -DCC_RESAMPLER -DCC_RESAMPLER_NO_HIGHPASS
2017-07-02 05:20:55 +00:00
CFLAGS += -fomit-frame-pointer -march=mips32 -mtune=mips32r2 -mhard-float
2017-04-22 03:41:40 +00:00
CXXFLAGS += $(CFLAGS)
2017-09-15 13:33:07 +00:00
# Windows MSVC 2003 Xbox 1
else ifeq ($(platform), xbox1_msvc2003)
TARGET := $(TARGET_NAME)_libretro_xdk1.lib
2018-02-18 02:48:47 +00:00
CC = CL.exe
CXX = CL.exe
LD = lib.exe
2017-09-15 13:33:07 +00:00
export INCLUDE := $(INCLUDE);$(XDK)/xbox/include
export LIB := $(XDK)/xbox/lib
2018-02-18 02:48:47 +00:00
PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
2017-09-15 13:33:07 +00:00
PSS_STYLE :=2
CFLAGS += -D_XBOX -D_XBOX1
CXXFLAGS += -D_XBOX -D_XBOX1
STATIC_LINKING=1
HAS_GCC := 0
# Windows MSVC 2010 Xbox 360
else ifeq ($(platform), xbox360_msvc2010)
TARGET := $(TARGET_NAME)_libretro_xdk360.lib
MSVCBINDIRPREFIX = $(XEDK)/bin/win32
2017-09-16 04:02:47 +00:00
CC = "$(MSVCBINDIRPREFIX)/cl.exe"
CXX = "$(MSVCBINDIRPREFIX)/cl.exe"
LD = "$(MSVCBINDIRPREFIX)/lib.exe"
2017-09-15 13:33:07 +00:00
2017-09-16 04:02:47 +00:00
export INCLUDE := $(XEDK)/include/xbox
2017-09-15 13:33:07 +00:00
export LIB := $(XEDK)/lib/xbox
PSS_STYLE :=2
CFLAGS += -D_XBOX -D_XBOX360
CXXFLAGS += -D_XBOX -D_XBOX360
STATIC_LINKING=1
HAS_GCC := 0
2017-08-28 07:12:39 +00:00
# Windows MSVC 2017 all architectures
else ifneq (,$(findstring windows_msvc2017,$(platform)))
PlatformSuffix = $(subst windows_msvc2017_,,$(platform))
ifneq (,$(findstring desktop,$(PlatformSuffix)))
WinPartition = desktop
2017-08-29 01:29:50 +00:00
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
2017-08-28 07:12:39 +00:00
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
LIBS += kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
else ifneq (,$(findstring uwp,$(PlatformSuffix)))
WinPartition = uwp
2018-05-31 06:27:50 +00:00
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WINDLL -D_UNICODE -DUNICODE -D__WRL_NO_DEFAULT_LIB__ -EHsc
2017-08-28 07:12:39 +00:00
LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -LTCG -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
LIBS += WindowsApp.lib
endif
2017-08-29 01:29:50 +00:00
CFLAGS += $(MSVC2017CompileFlags)
CXXFLAGS += $(MSVC2017CompileFlags)
2017-08-28 07:12:39 +00:00
TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix))
CC = cl.exe
CXX = cl.exe
reg_query = $(call filter_out2,$(subst $2,,$(shell reg query "$2" -v "$1" 2>nul)))
fix_path = $(subst $(SPACE),\ ,$(subst \,/,$1))
ProgramFiles86w := $(shell cmd /c "echo %PROGRAMFILES(x86)%")
ProgramFiles86 := $(shell cygpath "$(ProgramFiles86w)")
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir := $(WindowsSdkDir)
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)
WindowsSDKVersion := $(WindowsSDKVersion)
VsInstallBuildTools = $(ProgramFiles86)/Microsoft Visual Studio/2017/BuildTools
VsInstallEnterprise = $(ProgramFiles86)/Microsoft Visual Studio/2017/Enterprise
VsInstallProfessional = $(ProgramFiles86)/Microsoft Visual Studio/2017/Professional
VsInstallCommunity = $(ProgramFiles86)/Microsoft Visual Studio/2017/Community
VsInstallRoot ?= $(shell if [ -d "$(VsInstallBuildTools)" ]; then echo "$(VsInstallBuildTools)"; fi)
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallEnterprise)" ]; then echo "$(VsInstallEnterprise)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallProfessional)" ]; then echo "$(VsInstallProfessional)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallCommunity)" ]; then echo "$(VsInstallCommunity)"; fi)
endif
VsInstallRoot := $(VsInstallRoot)
VcCompilerToolsVer := $(shell cat "$(VsInstallRoot)/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | grep -o '[0-9\.]*')
VcCompilerToolsDir := $(VsInstallRoot)/VC/Tools/MSVC/$(VcCompilerToolsVer)
WindowsSDKSharedIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\shared")
WindowsSDKUCRTIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\ucrt")
WindowsSDKUMIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\um")
WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)")
WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)")
# For some reason the HostX86 compiler doesn't like compiling for x64
# ("no such file" opening a shared library), and vice-versa.
# Work around it for now by using the strictly x86 compiler for x86, and x64 for x64.
# NOTE: What about ARM?
ifneq (,$(findstring x64,$(TargetArchMoniker)))
VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX64
else
VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX86
endif
PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)/$(TargetArchMoniker)"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/include")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/lib/$(TargetArchMoniker)")
2018-05-31 06:27:50 +00:00
ifneq (,$(findstring uwp,$(PlatformSuffix)))
LIB := $(shell IFS=$$'\n'; cygpath -w "$(LIB)/store")
endif
2017-08-28 07:12:39 +00:00
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
2017-07-02 05:26:35 +00:00
# Windows MSVC 2010 x64
else ifeq ($(platform), windows_msvc2010_x64)
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin/amd64"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
LIB := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/lib/amd64")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/include")
WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib/x64
WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib/x64
WindowsSdkDirInc := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
WindowsSdkDirInc ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
INCFLAGS_PLATFORM = -I"$(WindowsSdkDirInc)"
export INCLUDE := $(INCLUDE)
export LIB := $(LIB);$(WindowsSdkDir)
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
# Windows MSVC 2010 x86
else ifeq ($(platform), windows_msvc2010_x86)
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS100COMNTOOLS)../../VC/lib")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/include")
WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib
WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib
WindowsSdkDirInc := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
WindowsSdkDirInc ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
INCFLAGS_PLATFORM = -I"$(WindowsSdkDirInc)"
export INCLUDE := $(INCLUDE)
export LIB := $(LIB);$(WindowsSdkDir)
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
2017-08-05 11:55:50 +00:00
# Windows MSVC 2005 x86
else ifeq ($(platform), windows_msvc2005_x86)
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/include")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS80COMNTOOLS)../../VC/lib")
BIN := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin")
WindowsSdkDir := $(INETSDK)
2018-02-23 00:34:17 +00:00
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libgambatte/libretro-common/include/compat/msvc
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
LIBS =
# Windows MSVC 2003 x86
else ifeq ($(platform), windows_msvc2003_x86)
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
2018-02-23 00:34:50 +00:00
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/include")
2018-02-23 00:34:17 +00:00
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/lib")
BIN := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin")
WindowsSdkDir := $(INETSDK)
2017-08-05 11:55:50 +00:00
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libgambatte/libretro-common/include/compat/msvc
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
LIBS =
2015-02-02 00:00:39 +00:00
# Windows
else
2017-04-22 03:41:40 +00:00
TARGET := $(TARGET_NAME)_libretro.dll
2016-08-07 06:47:02 +00:00
HAVE_NETWORK=1
2017-04-22 03:41:40 +00:00
CC = gcc
CXX = g++
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,-no-undefined -Wl,-version-script=$(version_script)
2016-08-07 06:47:02 +00:00
LDFLAGS := -lws2_32
endif
ifeq ($(DEBUG), 1)
2017-09-15 13:33:07 +00:00
ifneq (,$(findstring msvc,$(platform)))
ifeq ($(STATIC_LINKING),1)
2018-05-31 06:42:31 +00:00
CFLAGS += -MTd
CXXFLAGS += -MTd
LDFLAGS += -DEBUG
else
CFLAGS += -MDd
CXXFLAGS += -MDd
LDFLAGS += -DEBUG
endif
2017-09-15 13:33:07 +00:00
CFLAGS += -Od -Zi -DDEBUG -D_DEBUG
CXXFLAGS += -Od -Zi -DDEBUG -D_DEBUG
else
CFLAGS += -O0 -g -DDEBUG
CXXFLAGS += -O0 -g -DDEBUG
endif
else
ifneq (,$(findstring msvc,$(platform)))
2018-05-31 06:42:31 +00:00
ifeq ($(STATIC_LINKING),1)
CFLAGS += -MT
CXXFLAGS += -MT
else
CFLAGS += -MD
CXXFLAGS += -MD
endif
2017-09-15 13:33:07 +00:00
CFLAGS += -O2 -DNDEBUG
CXXFLAGS += -O2 -DNDEBUG
else
CFLAGS += -O2 -DNDEBUG
CXXFLAGS += -O2 -DNDEBUG
endif
endif
ifeq (,$(findstring msvc,$(platform)))
CXXFLAGS += -fno-exceptions -fno-rtti
CXXFLAGS += -std=c++98
endif
CFLAGS += -DHAVE_STDINT_H
CXXFLAGS += -DHAVE_STDINT_H
ifneq ($(SANITIZER),)
2017-04-22 03:41:40 +00:00
CFLAGS += -fsanitize=$(SANITIZER)
CXXFLAGS += -fsanitize=$(SANITIZER)
LDFLAGS += -fsanitize=$(SANITIZER)
endif
CORE_DIR := libgambatte/src
2014-11-02 02:01:24 +00:00
include Makefile.common
2014-11-02 02:01:24 +00:00
OBJS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o)
DEFINES := -D__LIBRETRO__ $(PLATFORM_DEFINES) -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DINLINE=inline -DVIDEO_RGB565
ifeq ($(HAVE_NETWORK), 1)
2017-04-22 03:41:40 +00:00
DEFINES += -DHAVE_NETWORK
endif
CFLAGS += $(CODE_DEFINES) $(fpic) $(DEFINES)
CXXFLAGS += $(fpic) $(DEFINES)
2017-07-02 05:26:35 +00:00
OBJOUT = -o
LINKOUT = -o
2014-12-23 08:54:06 +00:00
2017-07-02 05:26:35 +00:00
ifneq (,$(findstring msvc,$(platform)))
OBJOUT = -Fo
LINKOUT = -out:
2017-09-15 13:33:07 +00:00
ifeq ($(STATIC_LINKING),1)
LD ?= lib.exe
STATIC_LINKING=0
else
2017-07-02 05:26:35 +00:00
LD = link.exe
2017-09-15 13:33:07 +00:00
endif
2017-07-02 05:26:35 +00:00
else
2017-07-02 05:51:38 +00:00
LD = $(CXX)
2017-07-02 05:26:35 +00:00
endif
2014-12-23 08:54:06 +00:00
2017-07-02 05:28:27 +00:00
INCFLAGS += $(INCFLAGS_PLATFORM)
2014-12-23 08:54:06 +00:00
ifeq ($(platform), theos_ios)
COMMON_FLAGS := -DIOS $(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
2013-04-03 23:58:35 +00:00
all: $(TARGET)
2015-11-02 13:35:24 +00:00
ifeq ($(platform), osx)
ifndef ($(NOUNIVERSAL))
CFLAGS += $(ARCHFLAGS)
CXXFLAGS += $(ARCHFLAGS)
LFLAGS += $(ARCHFLAGS)
endif
endif
$(TARGET): $(OBJS)
2013-05-18 15:51:30 +00:00
ifeq ($(STATIC_LINKING), 1)
2018-02-18 02:48:47 +00:00
ifneq (,$(findstring msvc,$(platform)))
$(LD) $(LINKOUT)$@ $(OBJECTS)
else
$(AR) rcs $@ $(OBJS)
2018-02-18 02:48:47 +00:00
endif
else
2017-07-02 05:26:35 +00:00
$(LD) $(LINKOUT)$@ $(SHARED) $(OBJS) $(LDFLAGS) $(LIBS)
endif
2017-07-02 05:26:35 +00:00
%.o: %.cpp
$(CXX) -c $(OBJOUT)$@ $< $(CPPFLAGS) $(CXXFLAGS) $(INCFLAGS)
%.o: %.c
$(CC) -c $(OBJOUT)$@ $< $(CPPFLAGS) $(CFLAGS) $(INCFLAGS)
2012-09-01 01:15:03 +00:00
clean-objs:
rm -f $(OBJS)
clean:
rm -f $(OBJS)
rm -f $(TARGET)
2012-09-01 01:15:03 +00:00
.PHONY: clean clean-objs
2014-12-23 08:54:06 +00:00
endif
install: $(TARGET)
install -D -m 755 $(TARGET) $(DESTDIR)$(core_installdir)/$(TARGET)
uninstall:
rm $(DESTDIR)$(core_installdir)/$(TARGET)