2013-11-22 22:39:07 +00:00
|
|
|
DEBUG = 0
|
2012-07-01 17:15:22 +00:00
|
|
|
|
2013-09-15 21:10:24 +00:00
|
|
|
ifneq ($(EMSCRIPTEN),)
|
|
|
|
platform = emscripten
|
|
|
|
endif
|
|
|
|
|
2012-07-01 17:15:22 +00:00
|
|
|
ifeq ($(platform),)
|
|
|
|
platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
platform = osx
|
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2012-08-18 15:02:20 +00:00
|
|
|
# system platform
|
|
|
|
system_platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
EXE_EXT = .exe
|
|
|
|
system_platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
system_platform = osx
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
system_platform = win
|
|
|
|
endif
|
|
|
|
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET_NAME := gambatte
|
2012-07-01 17:15:22 +00:00
|
|
|
|
|
|
|
ifeq ($(platform), unix)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.so
|
2012-07-01 17:15:22 +00:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,-version-script=libretro/link.T
|
|
|
|
else ifeq ($(platform), osx)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dylib
|
2012-07-01 17:15:22 +00:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
2014-10-23 07:57:46 +00:00
|
|
|
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
|
|
|
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
|
|
|
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
2014-04-26 02:32:58 +00:00
|
|
|
fpic += -mmacosx-version-min=10.5
|
|
|
|
endif
|
2013-03-17 23:04:58 +00:00
|
|
|
else ifeq ($(platform), ios)
|
2013-05-18 01:44:56 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
2013-03-17 23:04:58 +00:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
|
|
|
|
2014-10-23 07:57:46 +00:00
|
|
|
ifeq ($(IOSSDK),)
|
|
|
|
IOSSDK := $(shell xcrun -sdk iphoneos -show-sdk-path)
|
|
|
|
endif
|
|
|
|
|
2014-04-26 02:32:58 +00:00
|
|
|
CC = clang -arch armv7 -isysroot $(IOSSDK)
|
|
|
|
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
|
2014-10-23 07:57:46 +00:00
|
|
|
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
|
|
|
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
|
|
|
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
2014-04-26 02:32:58 +00:00
|
|
|
CC += -miphoneos-version-min=5.0
|
|
|
|
CXX += -miphoneos-version-min=5.0
|
|
|
|
PLATFORM_DEFINES := -miphoneos-version-min=5.0
|
|
|
|
endif
|
2013-03-25 07:00:40 +00:00
|
|
|
else ifeq ($(platform), qnx)
|
2013-04-30 13:53:08 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
2013-03-25 07:00:40 +00:00
|
|
|
fpic := -fPIC
|
2013-03-29 16:18:23 +00:00
|
|
|
SHARED := -lcpp -lm -shared -Wl,-version-script=libretro/link.T
|
2013-03-25 07:00:40 +00:00
|
|
|
CC = qcc -Vgcc_ntoarmv7le
|
2013-03-29 16:18:23 +00:00
|
|
|
CXX = QCC -Vgcc_ntoarmv7le_cpp
|
2013-03-25 07:00:40 +00:00
|
|
|
AR = QCC -Vgcc_ntoarmv7le
|
2013-07-14 01:36:28 +00:00
|
|
|
PLATFORM_DEFINES := -D__BLACKBERRY_QNX__ -fexceptions -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
|
2012-07-01 17:15:22 +00:00
|
|
|
else ifeq ($(platform), ps3)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
2013-11-07 00:32:19 +00:00
|
|
|
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
2012-07-01 17:15:22 +00:00
|
|
|
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
|
|
|
|
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
|
|
|
|
PLATFORM_DEFINES := -D__CELLOS_LV2__
|
2013-05-18 15:51:30 +00:00
|
|
|
STATIC_LINKING = 1
|
2012-07-01 17:15:22 +00:00
|
|
|
else ifeq ($(platform), sncps3)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
2012-07-01 17:15:22 +00:00
|
|
|
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
|
|
|
CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
|
|
|
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
|
|
|
|
PLATFORM_DEFINES := -D__CELLOS_LV2__
|
2013-05-18 15:51:30 +00:00
|
|
|
STATIC_LINKING = 1
|
2012-07-01 17:17:34 +00:00
|
|
|
else ifeq ($(platform), psl1ght)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_psl1ght.a
|
2012-08-18 15:02:20 +00:00
|
|
|
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
|
|
|
|
CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
|
|
|
|
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
|
2012-07-01 17:17:34 +00:00
|
|
|
PLATFORM_DEFINES := -D__CELLOS_LV2__
|
2013-05-18 15:51:30 +00:00
|
|
|
STATIC_LINKING = 1
|
2012-11-23 20:31:28 +00:00
|
|
|
else ifeq ($(platform), psp1)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_psp1.a
|
2012-11-23 20:31:28 +00:00
|
|
|
CC = psp-gcc$(EXE_EXT)
|
|
|
|
CXX = psp-g++$(EXE_EXT)
|
|
|
|
AR = psp-ar$(EXE_EXT)
|
2014-03-07 11:51:52 +00:00
|
|
|
PLATFORM_DEFINES := -DPSP -DCC_RESAMPLER
|
2014-03-01 01:26:37 +00:00
|
|
|
CFLAGS += -G0
|
|
|
|
CXXFLAGS += -G0
|
|
|
|
STATIC_LINKING = 1
|
2012-07-01 17:15:22 +00:00
|
|
|
else ifeq ($(platform), xenon)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_xenon360.a
|
2012-08-18 15:02:20 +00:00
|
|
|
CC = xenon-gcc$(EXE_EXT)
|
|
|
|
CXX = xenon-g++$(EXE_EXT)
|
|
|
|
AR = xenon-ar$(EXE_EXT)
|
2012-07-01 17:15:22 +00:00
|
|
|
PLATFORM_DEFINES := -D__LIBXENON__
|
2013-05-18 15:51:30 +00:00
|
|
|
STATIC_LINKING = 1
|
2012-09-01 01:15:03 +00:00
|
|
|
else ifeq ($(platform), ngc)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ngc.a
|
2012-09-01 01:15:03 +00:00
|
|
|
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 -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
|
2013-05-18 15:51:30 +00:00
|
|
|
STATIC_LINKING = 1
|
2012-07-01 17:15:22 +00:00
|
|
|
else ifeq ($(platform), wii)
|
2013-04-17 16:43:54 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_wii.a
|
2012-08-18 15:02:20 +00:00
|
|
|
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
|
|
|
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
|
|
|
|
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
|
2012-09-01 01:15:03 +00:00
|
|
|
PLATFORM_DEFINES += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
|
2013-05-18 15:51:30 +00:00
|
|
|
STATIC_LINKING = 1
|
2013-07-14 01:36:28 +00:00
|
|
|
else ifneq (,$(findstring armv,$(platform)))
|
|
|
|
TARGET := $(TARGET_NAME)_libretro.so
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,-version-script=libretro/link.T
|
|
|
|
CC = gcc
|
|
|
|
CXX = g++
|
|
|
|
ifneq (,$(findstring cortexa8,$(platform)))
|
|
|
|
PLATFORM_DEFINES += -marm -mcpu=cortex-a8
|
|
|
|
else ifneq (,$(findstring cortexa9,$(platform)))
|
|
|
|
PLATFORM_DEFINES += -marm -mcpu=cortex-a9
|
|
|
|
endif
|
|
|
|
PLATFORM_DEFINES += -marm
|
|
|
|
ifneq (,$(findstring neon,$(platform)))
|
|
|
|
PLATFORM_DEFINES += -mfpu=neon
|
|
|
|
HAVE_NEON = 1
|
|
|
|
endif
|
|
|
|
ifneq (,$(findstring softfloat,$(platform)))
|
|
|
|
PLATFORM_DEFINES += -mfloat-abi=softfp
|
|
|
|
else ifneq (,$(findstring hardfloat,$(platform)))
|
|
|
|
PLATFORM_DEFINES += -mfloat-abi=hard
|
|
|
|
endif
|
|
|
|
PLATFORM_DEFINES += -DARM
|
2013-09-15 21:10:24 +00:00
|
|
|
else ifeq ($(platform), emscripten)
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
2012-07-01 17:15:22 +00:00
|
|
|
else
|
2013-05-18 15:51:30 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
2012-07-01 17:15:22 +00:00
|
|
|
CC = gcc
|
|
|
|
CXX = g++
|
|
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,-no-undefined -Wl,-version-script=libretro/link.T
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
|
|
|
CXXFLAGS += -O0 -g
|
2013-09-15 21:10:24 +00:00
|
|
|
else ifeq ($(platform), emscripten)
|
|
|
|
CFLAGS += -O2
|
|
|
|
CXXFLAGS += -O2 -fno-exceptions -fno-rtti -DHAVE_STDINT_H
|
2012-07-01 17:15:22 +00:00
|
|
|
else
|
|
|
|
CFLAGS += -O3
|
|
|
|
CXXFLAGS += -O3 -fno-exceptions -fno-rtti -DHAVE_STDINT_H
|
|
|
|
endif
|
|
|
|
|
2014-11-02 02:01:24 +00:00
|
|
|
CORE_DIR := src
|
2012-07-01 17:15:22 +00:00
|
|
|
|
2014-11-02 02:01:24 +00:00
|
|
|
include Makefile.common
|
2012-07-01 17:15:22 +00:00
|
|
|
|
2014-11-02 02:01:24 +00:00
|
|
|
OBJS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o)
|
2012-07-01 17:15:22 +00:00
|
|
|
|
2013-11-22 21:01:44 +00:00
|
|
|
DEFINES := -D__LIBRETRO__ $(PLATFORM_DEFINES) -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DINLINE=inline -DVIDEO_RGB565
|
2012-07-01 17:15:22 +00:00
|
|
|
|
|
|
|
CFLAGS += $(CODE_DEFINES) $(fpic) $(DEFINES)
|
|
|
|
CXXFLAGS += $(fpic) $(DEFINES)
|
|
|
|
|
|
|
|
LIBS :=
|
|
|
|
|
2013-04-03 23:58:35 +00:00
|
|
|
all: $(TARGET)
|
|
|
|
|
2012-07-01 17:15:22 +00:00
|
|
|
$(TARGET): $(OBJS)
|
2013-05-18 15:51:30 +00:00
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
2012-07-01 17:15:22 +00:00
|
|
|
$(AR) rcs $@ $(OBJS)
|
|
|
|
else
|
|
|
|
$(CXX) -o $@ $(SHARED) $(OBJS) $(LDFLAGS) $(LIBS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
%.o: %.cpp
|
2014-11-02 02:01:24 +00:00
|
|
|
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCFLAGS)
|
2012-07-01 17:15:22 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
2014-11-02 02:01:24 +00:00
|
|
|
$(CC) -c -o $@ $< $(CFLAGS) $(INCFLAGS)
|
2012-07-01 17:15:22 +00:00
|
|
|
|
2012-09-01 01:15:03 +00:00
|
|
|
clean-objs:
|
|
|
|
rm -f $(OBJS)
|
|
|
|
|
2012-07-01 17:15:22 +00:00
|
|
|
clean:
|
|
|
|
rm -f $(OBJS)
|
|
|
|
rm -f $(TARGET)
|
|
|
|
|
2012-09-01 01:15:03 +00:00
|
|
|
.PHONY: clean clean-objs
|
2012-07-01 17:15:22 +00:00
|
|
|
|