prosystem-libretro/Makefile

246 lines
5.7 KiB
Makefile
Raw Normal View History

2014-08-08 09:01:40 +00:00
DEBUG = 0
ifeq ($(platform),)
platform = unix
ifeq ($(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 MINGW,$(shell uname -a)),)
platform = win
endif
2014-08-08 09:01:40 +00:00
endif
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
2014-08-08 09:01:40 +00:00
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
2014-08-08 09:01:40 +00:00
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
2014-08-08 09:01:40 +00:00
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
2014-08-08 09:01:40 +00:00
endif
TARGET_NAME := prosystem
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
2014-08-08 09:01:40 +00:00
# Unix
2014-08-08 09:01:40 +00:00
ifeq ($(platform), unix)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
CFLAGS+=-fsigned-char
# OS X
2014-08-08 09:01:40 +00:00
else ifeq ($(platform), osx)
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(arch),ppc)
FLAGS += -DMSB_FIRST
OLD_GCC = 1
endif
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
fpic += -mmacosx-version-min=10.1
2014-08-08 09:01:40 +00:00
# iOS
2015-10-15 14:26:19 +00:00
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
2015-10-15 14:26:19 +00:00
CC = cc -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
CC += -miphoneos-version-min=8.0
SHARED += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
SHARED += -miphoneos-version-min=5.0
endif
2014-10-23 07:32:12 +00:00
# Theos
2014-12-23 18:18:17 +00:00
else ifeq ($(platform), theos_ios)
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-12-23 18:18:17 +00:00
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
2014-12-23 18:18:17 +00:00
# QNX
2014-08-08 09:01:40 +00:00
else ifeq ($(platform), qnx)
2016-09-07 06:20:06 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
2014-08-08 09:01:40 +00:00
CC = qcc -Vgcc_ntoarmv7le
# PS3
2014-08-08 09:01:40 +00:00
else ifeq ($(platform), ps3)
2016-09-07 06:20:06 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
STATIC_LINKING = 1
2014-08-08 09:01:40 +00:00
FLAGS += -DMSB_FIRST
OLD_GCC = 1
2016-05-29 07:23:41 +00:00
# Lightweight PS3 Homebrew SDK
else ifeq ($(platform), psl1ght)
2016-09-07 06:20:06 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
2016-05-29 07:23:41 +00:00
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
STATIC_LINKING = 1
FLAGS += -DMSB_FIRST
OLD_GCC = 1
# sncps3
2014-08-08 09:01:40 +00:00
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
STATIC_LINKING = 1
2014-08-08 09:01:40 +00:00
FLAGS += -DMSB_FIRST
NO_GCC = 1
# PSP
2014-08-08 09:01:40 +00:00
else ifeq ($(platform), psp1)
2016-09-07 06:20:06 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
2014-08-08 09:01:40 +00:00
CC = psp-gcc$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
STATIC_LINKING = 1
2015-07-23 20:06:10 +00:00
FLAGS += -G0
2015-08-31 20:16:34 +00:00
# Vita
else ifeq ($(platform), vita)
2016-09-07 06:20:06 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
2015-08-31 20:16:34 +00:00
CC = arm-vita-eabi-gcc$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
STATIC_LINKING = 1
FLAGS += -DVITA
2015-09-10 04:19:20 +00:00
# CTR (3DS)
else ifeq ($(platform), ctr)
2016-09-07 06:20:06 +00:00
TARGET := $(TARGET_NAME)_libretro_$(platform).a
2015-09-10 04:19:20 +00:00
CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
FLAGS += -DARM11 -D_3DS
STATIC_LINKING = 1
2016-02-27 11:02:31 +00:00
# Raspberry Pi 1
else ifeq ($(platform), rpi1)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
CFLAGS+=-fsigned-char
FLAGS += -DARM11
FLAGS += -marm -march=armv6j -mfpu=vfp -mfloat-abi=hard
2016-02-27 11:02:31 +00:00
FLAGS += -fomit-frame-pointer -ffast-math
2016-02-25 14:40:07 +00:00
# Raspberry Pi 2
else ifeq ($(platform), rpi2)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
CFLAGS+=-fsigned-char
FLAGS += -DARM
FLAGS += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
FLAGS += -fomit-frame-pointer -ffast-math
# Raspberry Pi 3
else ifeq ($(platform), rpi3)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
CFLAGS+=-fsigned-char
FLAGS += -DARM
FLAGS += -marm -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
2016-02-25 14:40:07 +00:00
FLAGS += -fomit-frame-pointer -ffast-math
2016-09-07 06:20:06 +00:00
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
STATIC_LINKING = 1
# Windows
2014-08-08 09:01:40 +00:00
else
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += -static-libgcc -static-libstdc++ -lwinmm
2014-08-08 09:01:40 +00:00
endif
2015-08-07 02:03:01 +00:00
CORE_DIR := core
include Makefile.common
2015-08-31 20:16:34 +00:00
OBJECTS := $(SOURCES_C:.c=.o)
2014-08-08 09:01:40 +00:00
ifeq ($(DEBUG),1)
FLAGS += -O0 -g
else
FLAGS += -O2 -DNDEBUG
2014-08-08 09:01:40 +00:00
endif
2014-12-19 07:48:49 +00:00
LDFLAGS += $(fpic) $(SHARED)
2014-08-08 09:01:40 +00:00
FLAGS += $(fpic)
FLAGS += $(INCFLAGS)
2014-08-08 09:01:40 +00:00
ifeq ($(OLD_GCC), 1)
WARNINGS := -Wall
else ifeq ($(NO_GCC), 1)
WARNINGS :=
else
WARNINGS := -Wall \
-Wno-sign-compare \
-Wno-unused-variable \
-Wno-unused-function \
-Wno-uninitialized \
-Wno-strict-aliasing \
-Wno-overflow \
-fno-strict-overflow
endif
FLAGS += -D__LIBRETRO__ $(WARNINGS)
2014-08-08 17:57:18 +00:00
CFLAGS += $(FLAGS)
2014-08-08 09:01:40 +00:00
2014-12-23 18:18:17 +00:00
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
ifeq ($(platform), theos_ios)
COMMON_FLAGS := -DIOS $(COMMON_DEFINES) $(INCFLAGS) -I$(THEOS_INCLUDE_PATH) -Wno-error
$(LIBRARY_NAME)_CFLAGS += $(CFLAGS) $(COMMON_FLAGS)
2015-08-31 20:16:34 +00:00
${LIBRARY_NAME}_FILES = $(SOURCES_C)
2014-12-23 18:18:17 +00:00
include $(THEOS_MAKE_PATH)/library.mk
else
all: $(TARGET)
2014-08-08 09:01:40 +00:00
$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
2015-08-31 20:16:34 +00:00
$(CC) -o $@ $^ $(LDFLAGS)
2014-08-08 09:01:40 +00:00
endif
clean:
rm -f $(TARGET) $(OBJECTS)
.PHONY: clean
2014-12-23 18:18:17 +00:00
endif