2012-07-09 23:14:35 +02:00
|
|
|
DEBUG = 0
|
2012-07-10 19:15:26 +02:00
|
|
|
LOGSOUND = 0
|
2012-10-22 06:47:16 +02:00
|
|
|
FRONTEND_SUPPORTS_RGB565 = 1
|
2012-07-09 23:14:35 +02:00
|
|
|
|
|
|
|
|
2013-09-15 23:10:42 +02:00
|
|
|
ifneq ($(EMSCRIPTEN),)
|
|
|
|
platform = emscripten
|
|
|
|
endif
|
|
|
|
|
2012-07-09 23:14:35 +02: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
|
2014-04-14 05:47:00 +02:00
|
|
|
arch = intel
|
|
|
|
ifeq ($(shell uname -p),powerpc)
|
|
|
|
arch = ppc
|
|
|
|
endif
|
2012-07-09 23:14:35 +02:00
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2012-08-18 16:58:45 +02: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
|
2014-04-14 05:47:00 +02:00
|
|
|
arch = intel
|
|
|
|
ifeq ($(shell uname -p),powerpc)
|
|
|
|
arch = ppc
|
|
|
|
endif
|
2012-08-18 16:58:45 +02:00
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
system_platform = win
|
|
|
|
endif
|
|
|
|
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET_NAME := genesis_plus_gx
|
|
|
|
|
2012-07-09 23:14:35 +02:00
|
|
|
ifeq ($(platform), unix)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.so
|
2012-07-09 23:14:35 +02:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz
|
2014-04-29 23:49:47 +02:00
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2012-07-09 23:14:35 +02:00
|
|
|
PLATFORM_DEFINES := -DHAVE_ZLIB
|
|
|
|
else ifeq ($(platform), osx)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dylib
|
2014-04-14 05:47:00 +02:00
|
|
|
fpic := -fPIC
|
2012-07-09 23:14:35 +02:00
|
|
|
SHARED := -dynamiclib -lz
|
2014-04-29 23:49:47 +02:00
|
|
|
ifeq ($(arch),ppc)
|
2014-07-18 17:35:40 +02:00
|
|
|
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
|
2014-04-29 23:49:47 +02:00
|
|
|
else
|
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2014-04-14 05:47:00 +02:00
|
|
|
endif
|
2012-07-09 23:14:35 +02:00
|
|
|
PLATFORM_DEFINES := -DHAVE_ZLIB
|
2014-04-26 04:23:30 +02:00
|
|
|
|
2014-10-23 09:56:59 +02:00
|
|
|
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
|
|
|
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
|
|
|
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
2014-04-26 04:23:30 +02:00
|
|
|
fpic += -mmacosx-version-min=10.5
|
|
|
|
endif
|
2013-03-17 23:51:57 +01:00
|
|
|
else ifeq ($(platform), ios)
|
2013-05-18 03:46:19 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
2013-03-17 23:51:57 +01:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib -lz
|
2014-04-29 23:49:47 +02:00
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2014-04-26 04:23:30 +02:00
|
|
|
PLATFORM_DEFINES := -DHAVE_ZLIB
|
2013-03-17 23:51:57 +01:00
|
|
|
|
2014-10-23 09:56:59 +02:00
|
|
|
ifeq ($(IOSSDK),)
|
|
|
|
IOSSDK := $(shell xcrun -sdk iphoneos -show-sdk-path)
|
|
|
|
endif
|
|
|
|
|
2014-04-26 04:23:30 +02:00
|
|
|
CC = clang -arch armv7 -isysroot $(IOSSDK)
|
2014-10-23 09:56:59 +02:00
|
|
|
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
|
|
|
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
|
|
|
ifeq ($(OSX_LT_MAVERICKS),"YES")
|
2014-04-26 04:23:30 +02:00
|
|
|
CC += -miphoneos-version-min=5.0
|
|
|
|
PLATFORM_DEFINES += -miphoneos-version-min=5.0
|
|
|
|
endif
|
2013-03-25 07:10:32 +01:00
|
|
|
else ifeq ($(platform), qnx)
|
2013-04-30 15:54:26 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
2013-03-25 07:10:32 +01:00
|
|
|
fpic := -fPIC
|
2013-04-08 00:28:25 +02:00
|
|
|
SHARED := -lm -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz
|
2014-04-29 23:49:47 +02:00
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2013-03-25 07:10:32 +01:00
|
|
|
PLATFORM_DEFINES := -DHAVE_ZLIB
|
|
|
|
CC = qcc -Vgcc_ntoarmv7le
|
|
|
|
AR = qcc -Vgcc_ntoarmv7le
|
|
|
|
PLATFORM_DEFINES := -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
|
2012-07-09 23:14:35 +02:00
|
|
|
else ifeq ($(platform), ps3)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
2012-07-09 23:14:35 +02:00
|
|
|
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
|
|
|
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
|
2014-07-18 17:35:40 +02:00
|
|
|
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER -DBYTE_ORDER=BIG_ENDIAN
|
2013-05-18 17:49:57 +02:00
|
|
|
STATIC_LINKING = 1
|
|
|
|
else ifeq ($(platform), sncps3)
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
|
|
|
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
|
|
|
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
|
2014-07-18 17:35:40 +02:00
|
|
|
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER -DBYTE_ORDER=BIG_ENDIAN
|
2013-05-18 17:49:57 +02:00
|
|
|
STATIC_LINKING = 1
|
2012-07-09 23:14:35 +02:00
|
|
|
else ifeq ($(platform), psl1ght)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_psl1ght.a$(EXE_EXT)
|
2012-08-18 16:58:45 +02:00
|
|
|
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
|
|
|
|
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
|
2014-07-18 02:12:31 +02:00
|
|
|
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER
|
2013-05-18 17:49:57 +02:00
|
|
|
STATIC_LINKING = 1
|
2012-11-23 20:51:59 +01:00
|
|
|
else ifeq ($(platform), psp1)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_psp1.a$(EXE_EXT)
|
2012-11-23 20:51:59 +01:00
|
|
|
CC = psp-gcc$(EXE_EXT)
|
|
|
|
AR = psp-ar$(EXE_EXT)
|
2014-04-29 23:49:47 +02:00
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2012-11-23 20:51:59 +01:00
|
|
|
PLATFORM_DEFINES := -DPSP
|
2012-11-24 04:34:19 +01:00
|
|
|
CFLAGS += -G0
|
2013-05-18 17:49:57 +02:00
|
|
|
STATIC_LINKING = 1
|
2012-07-09 23:14:35 +02:00
|
|
|
else ifeq ($(platform), xenon)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_xenon360.a
|
2012-08-18 16:58:45 +02:00
|
|
|
CC = xenon-gcc$(EXE_EXT)
|
|
|
|
AR = xenon-ar$(EXE_EXT)
|
2012-07-09 23:14:35 +02:00
|
|
|
PLATFORM_DEFINES := -D__LIBXENON__ -DALT_RENDER
|
2014-07-18 17:35:40 +02:00
|
|
|
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
|
2013-05-18 17:49:57 +02:00
|
|
|
STATIC_LINKING = 1
|
2012-09-01 03:12:03 +02:00
|
|
|
else ifeq ($(platform), ngc)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ngc.a
|
2012-09-01 03:12:03 +02:00
|
|
|
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
|
|
|
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
|
2014-07-18 17:35:40 +02:00
|
|
|
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
|
2012-09-01 03:12:03 +02:00
|
|
|
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER
|
2013-05-18 17:49:57 +02:00
|
|
|
STATIC_LINKING = 1
|
2012-07-09 23:14:35 +02:00
|
|
|
else ifeq ($(platform), wii)
|
2013-04-17 18:34:21 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_wii.a
|
2012-08-18 16:58:45 +02:00
|
|
|
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
|
|
|
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
|
2012-09-01 03:12:03 +02:00
|
|
|
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER
|
2014-07-18 17:35:40 +02:00
|
|
|
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
|
2013-05-18 17:49:57 +02:00
|
|
|
STATIC_LINKING = 1
|
2013-07-14 02:31:53 +02:00
|
|
|
else ifneq (,$(findstring armv,$(platform)))
|
|
|
|
TARGET := $(TARGET_NAME)_libretro.so
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz
|
2014-04-29 23:49:47 +02:00
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2013-07-14 02:31:53 +02:00
|
|
|
PLATFORM_DEFINES := -DHAVE_ZLIB
|
|
|
|
CC = gcc
|
|
|
|
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 23:10:42 +02:00
|
|
|
else ifeq ($(platform), emscripten)
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
2014-04-29 23:49:47 +02:00
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2012-07-09 23:14:35 +02:00
|
|
|
else
|
2013-05-18 17:49:57 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
2012-07-09 23:14:35 +02:00
|
|
|
CC = gcc
|
|
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz
|
|
|
|
|
2014-04-29 23:49:47 +02:00
|
|
|
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
|
2012-07-09 23:14:35 +02:00
|
|
|
PLATFORM_DEFINES := -DHAVE_ZLIB
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
2013-09-15 23:10:42 +02:00
|
|
|
else ifeq ($(platform),qnx)
|
2014-11-29 19:15:09 +01:00
|
|
|
CFLAGS += -Os -DNDEBUG
|
2013-09-15 23:10:42 +02:00
|
|
|
else ifeq ($(platform), emscripten)
|
2014-11-29 19:15:09 +01:00
|
|
|
CFLAGS += -O2 -DNDEBUG
|
2013-04-20 18:38:41 +02:00
|
|
|
else
|
2014-11-29 19:15:09 +01:00
|
|
|
CFLAGS += -O3 -DNDEBUG
|
2013-04-20 18:38:41 +02:00
|
|
|
endif
|
2014-11-02 04:36:00 +01:00
|
|
|
|
2014-11-29 19:15:09 +01:00
|
|
|
CORE_DIR := .
|
2014-11-28 12:09:43 +01:00
|
|
|
|
2014-11-29 19:15:09 +01:00
|
|
|
TREMOR_SRC_DIR := $(CORE_DIR)/core/tremor
|
|
|
|
LIBRETRO_DIR := $(CORE_DIR)/libretro
|
2014-11-28 12:09:43 +01:00
|
|
|
|
2014-11-29 19:15:09 +01:00
|
|
|
include $(LIBRETRO_DIR)/Makefile.common
|
2012-07-09 23:14:35 +02:00
|
|
|
|
2014-11-02 04:36:00 +01:00
|
|
|
OBJECTS := $(SOURCES_C:.c=.o)
|
2012-07-09 23:14:35 +02:00
|
|
|
|
2012-07-10 19:15:26 +02:00
|
|
|
ifeq ($(LOGSOUND), 1)
|
|
|
|
LIBRETRO_CFLAGS := -DLOGSOUND
|
|
|
|
endif
|
|
|
|
|
2014-04-29 23:49:47 +02:00
|
|
|
DEFINES := -DUSE_LIBTREMOR
|
2012-07-09 23:14:35 +02:00
|
|
|
CFLAGS += $(fpic) $(DEFINES) $(CODE_DEFINES)
|
|
|
|
|
2012-10-22 06:47:16 +02:00
|
|
|
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
|
|
|
|
# if you have a new frontend that supports RGB565
|
2012-10-22 07:09:35 +02:00
|
|
|
BPP_DEFINES = -DUSE_16BPP_RENDERING -DFRONTEND_SUPPORTS_RGB565
|
2012-10-22 06:47:16 +02:00
|
|
|
else
|
|
|
|
BPP_DEFINES = -DUSE_15BPP_RENDERING
|
|
|
|
endif
|
|
|
|
|
2014-11-02 04:36:00 +01:00
|
|
|
|
|
|
|
LIBRETRO_CFLAGS += $(INCFLAGS)
|
|
|
|
LIBRETRO_CFLAGS += $(BPP_DEFINES) \
|
2012-07-09 23:14:35 +02:00
|
|
|
$(ENDIANNESS_DEFINES) \
|
|
|
|
$(PLATFORM_DEFINES) \
|
|
|
|
-D__LIBRETRO__
|
|
|
|
|
2013-04-04 01:59:52 +02:00
|
|
|
ifeq ($(platform), qnx)
|
2013-04-20 18:38:41 +02:00
|
|
|
LIBRETRO_CFLAGS += -D__inline__=inline
|
2013-04-04 01:59:52 +02:00
|
|
|
else
|
|
|
|
LIBRETRO_CFLAGS += -DINLINE="static inline"
|
|
|
|
endif
|
|
|
|
|
2012-07-09 23:14:35 +02:00
|
|
|
LIBRETRO_LIBS := -lm
|
|
|
|
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -o $@ -c $< $(CFLAGS) $(LIBRETRO_CFLAGS)
|
|
|
|
|
2014-11-02 04:36:00 +01:00
|
|
|
$(TARGET): $(OBJECTS)
|
2013-05-18 17:49:57 +02:00
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
2014-11-02 04:36:00 +01:00
|
|
|
$(AR) rcs $@ $(OBJECTS)
|
2012-07-09 23:14:35 +02:00
|
|
|
else
|
2014-11-02 04:36:00 +01:00
|
|
|
$(CC) -o $(TARGET) $(fpic) $(OBJECTS) $(LIBRETRO_LIBS) $(SHARED)
|
2012-07-09 23:14:35 +02:00
|
|
|
endif
|
|
|
|
|
2012-08-23 01:37:24 +02:00
|
|
|
clean-objs:
|
2014-11-02 04:36:00 +01:00
|
|
|
rm -f $(OBJECTS)
|
2012-08-23 01:37:24 +02:00
|
|
|
|
2012-07-09 23:14:35 +02:00
|
|
|
clean:
|
2014-11-02 04:36:00 +01:00
|
|
|
rm -f $(OBJECTS)
|
2012-07-09 23:14:35 +02:00
|
|
|
rm -f $(TARGET)
|
|
|
|
|
2012-08-23 01:37:24 +02:00
|
|
|
.PHONY: clean clean-objs
|
2012-07-09 23:14:35 +02:00
|
|
|
|