Genesis-Plus-GX/Makefile.libretro

299 lines
8.0 KiB
Makefile
Raw Normal View History

2012-07-09 21:14:35 +00:00
DEBUG = 0
2012-07-10 17:15:26 +00:00
LOGSOUND = 0
FRONTEND_SUPPORTS_RGB565 = 1
2012-07-09 21:14:35 +00:00
ifeq ($(platform),)
2014-11-15 22:08:58 +00:00
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
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
2012-07-09 21:14:35 +00:00
endif
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
2014-11-15 22:08:58 +00:00
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
2014-11-15 22:08:58 +00:00
system_platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
2014-11-15 22:08:58 +00:00
system_platform = win
endif
2013-04-17 16:34:21 +00:00
TARGET_NAME := genesis_plus_gx
2015-03-02 16:37:39 +00:00
LIBM := -lm
2013-04-17 16:34:21 +00:00
2014-11-15 22:08:58 +00:00
# Unix
2012-07-09 21:14:35 +00:00
ifeq ($(platform), unix)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
2015-02-07 17:19:53 +00:00
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
2014-11-15 22:08:58 +00:00
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
2015-03-02 16:37:39 +00:00
# Portable Linux
else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC -nostdlib
2015-03-05 22:55:29 +00:00
SHARED := -shared -Wl,--version-script=libretro/link.T
2015-03-02 16:37:39 +00:00
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
LIBM :=
2014-11-15 22:08:58 +00:00
# OS X
2012-07-09 21:14:35 +00:00
else ifeq ($(platform), osx)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
2015-02-07 17:19:53 +00:00
SHARED := -dynamiclib
2014-11-15 22:08:58 +00:00
ifeq ($(arch),ppc)
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
else
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
endif
PLATFORM_DEFINES := -DHAVE_ZLIB
2014-11-15 22:08:58 +00:00
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
2015-08-01 22:13:37 +00:00
fpic += -mmacosx-version-min=10.1
ifndef ($(NOUNIVERSAL))
CFLAGS += $(ARCHFLAGS)
LDFLAGS += $(ARCHFLAGS)
endif
2015-02-01 05:21:22 +00:00
2014-11-15 22:08:58 +00:00
# iOS
2013-03-17 22:51:57 +00:00
else ifeq ($(platform), ios)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
2015-02-07 17:19:53 +00:00
SHARED := -dynamiclib
2014-11-15 22:08:58 +00:00
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
2014-10-23 07:56:59 +00:00
2014-11-15 22:08:58 +00:00
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcrun -sdk iphoneos -show-sdk-path)
endif
CC = clang -arch armv7 -isysroot $(IOSSDK)
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
ifeq ($(OSX_LT_MAVERICKS),"YES")
CC += -miphoneos-version-min=5.0
PLATFORM_DEFINES += -miphoneos-version-min=5.0
endif
2015-01-07 22:38:26 +00:00
# Theos
2014-12-23 07:39:51 +00:00
else ifeq ($(platform), theos_ios)
2015-01-07 22:38:26 +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
2014-11-15 22:08:58 +00:00
2015-01-07 22:38:26 +00:00
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
2014-12-23 07:39:51 +00:00
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
2015-01-07 22:38:26 +00:00
# QNX
else ifeq ($(platform), qnx)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
2015-03-02 16:37:39 +00:00
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
2014-11-15 22:08:58 +00:00
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
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
2014-11-15 22:08:58 +00:00
# PS3
2012-07-09 21:14:35 +00:00
else ifeq ($(platform), ps3)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER -DBYTE_ORDER=BIG_ENDIAN
2013-05-18 15:49:57 +00:00
STATIC_LINKING = 1
2014-11-15 22:08:58 +00:00
# sncps3
2013-05-18 15:49:57 +00:00
else ifeq ($(platform), sncps3)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER -DBYTE_ORDER=BIG_ENDIAN
2013-05-18 15:49:57 +00:00
STATIC_LINKING = 1
2014-11-15 22:08:58 +00:00
# Lightweight PS3 Homebrew SDK
2012-07-09 21:14:35 +00:00
else ifeq ($(platform), psl1ght)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_psl1ght.a$(EXE_EXT)
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER
2013-05-18 15:49:57 +00:00
STATIC_LINKING = 1
2014-11-15 22:08:58 +00:00
# PSP
2012-11-23 19:51:59 +00:00
else ifeq ($(platform), psp1)
2013-04-17 16:34:21 +00:00
TARGET := $(TARGET_NAME)_libretro_psp1.a$(EXE_EXT)
2012-11-23 19:51:59 +00:00
CC = psp-gcc$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
2012-11-23 19:51:59 +00:00
PLATFORM_DEFINES := -DPSP
2012-11-24 03:34:19 +00:00
CFLAGS += -G0
2013-05-18 15:49:57 +00:00
STATIC_LINKING = 1
2014-11-15 22:08:58 +00:00
# Xbox 360
2012-07-09 21:14:35 +00:00
else ifeq ($(platform), xenon)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)
AR = xenon-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__LIBXENON__ -DALT_RENDER
2014-07-18 15:35:40 +00:00
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
2013-05-18 15:49:57 +00:00
STATIC_LINKING = 1
2014-11-15 22:08:58 +00:00
# Nintendo Game Cube
2012-09-01 01:12:03 +00:00
else ifeq ($(platform), ngc)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_ngc.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
2014-07-18 15:35:40 +00:00
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
2014-11-15 22:08:58 +00:00
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER
2013-05-18 15:49:57 +00:00
STATIC_LINKING = 1
2014-11-15 22:08:58 +00:00
# Nintendo Wii
2012-07-09 21:14:35 +00:00
else ifeq ($(platform), wii)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER
2014-07-18 15:35:40 +00:00
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
2013-05-18 15:49:57 +00:00
STATIC_LINKING = 1
2014-11-15 22:08:58 +00:00
# ARM
2013-07-14 00:31:53 +00:00
else ifneq (,$(findstring armv,$(platform)))
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
2015-02-07 17:19:53 +00:00
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
2014-11-15 22:08:58 +00:00
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
ifneq (,$(findstring cortexa5,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a5
else ifneq (,$(findstring cortexa8,$(platform)))
2014-11-15 22:08:58 +00:00
PLATFORM_DEFINES += -marm -mcpu=cortex-a8
else ifneq (,$(findstring cortexa9,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a9
else ifneq (,$(findstring cortexa15a7,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a15.cortex-a7
else
PLATFORM_DEFINES += -marm
2014-11-15 22:08:58 +00:00
endif
ifneq (,$(findstring softfloat,$(platform)))
PLATFORM_DEFINES += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
PLATFORM_DEFINES += -mfloat-abi=hard
endif
PLATFORM_DEFINES += -DARM
# emscripten
2013-09-15 21:10:42 +00:00
else ifeq ($(platform), emscripten)
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
# Windows
2012-07-09 21:14:35 +00:00
else
2014-11-15 22:08:58 +00:00
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
2015-02-07 17:19:53 +00:00
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--version-script=libretro/link.T -Wl,--no-undefined
2014-11-15 22:08:58 +00:00
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
2012-07-09 21:14:35 +00:00
endif
2015-03-02 16:37:39 +00:00
LDFLAGS += $(LIBM)
2012-07-09 21:14:35 +00:00
ifeq ($(DEBUG), 1)
2014-11-15 22:08:58 +00:00
CFLAGS += -O0 -g
2013-09-15 21:10:42 +00:00
else ifeq ($(platform),qnx)
2014-11-29 18:15:09 +00:00
CFLAGS += -Os -DNDEBUG
2013-09-15 21:10:42 +00:00
else ifeq ($(platform), emscripten)
2014-11-29 18:15:09 +00:00
CFLAGS += -O2 -DNDEBUG
else
2014-11-29 18:15:09 +00:00
CFLAGS += -O3 -DNDEBUG
endif
CORE_DIR := .
2014-11-28 11:09:43 +00:00
2014-11-29 18:15:09 +00:00
TREMOR_SRC_DIR := $(CORE_DIR)/core/tremor
LIBRETRO_DIR := $(CORE_DIR)/libretro
2014-11-28 11:09:43 +00:00
2014-11-29 18:15:09 +00:00
include $(LIBRETRO_DIR)/Makefile.common
2012-07-09 21:14:35 +00:00
OBJECTS := $(SOURCES_C:.c=.o)
2012-07-09 21:14:35 +00:00
2012-07-10 17:15:26 +00:00
ifeq ($(LOGSOUND), 1)
2014-11-15 22:08:58 +00:00
LIBRETRO_CFLAGS := -DLOGSOUND
2012-07-10 17:15:26 +00:00
endif
DEFINES := -DUSE_LIBTREMOR
2012-07-09 21:14:35 +00:00
CFLAGS += $(fpic) $(DEFINES) $(CODE_DEFINES)
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
2014-11-15 22:08:58 +00:00
# if you have a new frontend that supports RGB565
BPP_DEFINES = -DUSE_16BPP_RENDERING -DFRONTEND_SUPPORTS_RGB565
else
2014-11-15 22:08:58 +00:00
BPP_DEFINES = -DUSE_15BPP_RENDERING
endif
LIBRETRO_CFLAGS += $(INCFLAGS)
LIBRETRO_CFLAGS += $(BPP_DEFINES) \
2014-11-15 22:08:58 +00:00
$(ENDIANNESS_DEFINES) \
$(PLATFORM_DEFINES) \
-D__LIBRETRO__
2012-07-09 21:14:35 +00:00
2013-04-03 23:59:52 +00:00
ifeq ($(platform), qnx)
LIBRETRO_CFLAGS += -D__inline__=inline
2013-04-03 23:59:52 +00:00
else
LIBRETRO_CFLAGS += -DINLINE="static inline"
endif
2014-12-23 07:39:51 +00:00
ifeq ($(platform), theos_ios)
COMMON_FLAGS := $(COMMON_DEFINES) $(INCFLAGS) -I$(THEOS_INCLUDE_PATH) -Wno-error
$(LIBRARY_NAME)_CFLAGS += $(CFLAGS) $(LIBRETRO_CFLAGS) $(COMMON_FLAGS)
${LIBRARY_NAME}_FILES = $(SOURCES_C)
${LIBRARY_NAME}_LIBRARIES = m z
include $(THEOS_MAKE_PATH)/library.mk
else
2012-07-09 21:14:35 +00:00
all: $(TARGET)
%.o: %.c
$(CC) -o $@ -c $< $(CFLAGS) $(LIBRETRO_CFLAGS)
$(TARGET): $(OBJECTS)
2013-05-18 15:49:57 +00:00
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
2012-07-09 21:14:35 +00:00
else
2015-03-02 16:37:39 +00:00
$(CC) -o $(TARGET) $(fpic) $(OBJECTS) $(LDFLAGS) $(SHARED)
2012-07-09 21:14:35 +00:00
endif
2012-08-22 23:37:24 +00:00
clean-objs:
rm -f $(OBJECTS)
2012-08-22 23:37:24 +00:00
2012-07-09 21:14:35 +00:00
clean:
rm -f $(OBJECTS)
2012-07-09 21:14:35 +00:00
rm -f $(TARGET)
2012-08-22 23:37:24 +00:00
.PHONY: clean clean-objs
2014-12-23 07:39:51 +00:00
endif