2014-08-08 09:01:40 +00:00
|
|
|
DEBUG = 0
|
|
|
|
|
|
|
|
ifeq ($(platform),)
|
2015-08-23 00:03:42 +00:00
|
|
|
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),)
|
2015-08-23 00:03:42 +00:00
|
|
|
EXE_EXT = .exe
|
|
|
|
system_platform = win
|
2014-08-08 09:01:40 +00:00
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
2015-08-23 00:03:42 +00:00
|
|
|
system_platform = osx
|
2014-08-08 09:01:40 +00:00
|
|
|
arch = intel
|
2015-08-23 00:03:42 +00:00
|
|
|
ifeq ($(shell uname -p),powerpc)
|
|
|
|
arch = ppc
|
|
|
|
endif
|
2014-08-08 09:01:40 +00:00
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
2015-08-23 00:03:42 +00:00
|
|
|
system_platform = win
|
2014-08-08 09:01:40 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
TARGET_NAME := prosystem
|
|
|
|
|
2015-08-23 00:03:42 +00:00
|
|
|
# Unix
|
2014-08-08 09:01:40 +00:00
|
|
|
ifeq ($(platform), unix)
|
2015-08-23 00:03:42 +00:00
|
|
|
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)
|
2015-08-23 00:03:42 +00:00
|
|
|
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
|
|
|
|
2015-08-23 00:03:42 +00:00
|
|
|
# iOS
|
2014-08-08 09:01:40 +00:00
|
|
|
else ifeq ($(platform), ios)
|
2015-08-23 00:03:42 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
|
|
|
ifeq ($(IOSSDK),)
|
|
|
|
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
|
|
|
endif
|
|
|
|
CC = clang -arch armv7 -isysroot $(IOSSDK)
|
|
|
|
CXX = 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")
|
|
|
|
SHARED += -miphoneos-version-min=5.0
|
|
|
|
CC += -miphoneos-version-min=5.0
|
|
|
|
CXX += -miphoneos-version-min=5.0
|
|
|
|
endif
|
2014-10-23 07:32:12 +00:00
|
|
|
|
2015-08-23 00:03:42 +00:00
|
|
|
# Theos
|
2014-12-23 18:18:17 +00:00
|
|
|
else ifeq ($(platform), theos_ios)
|
2015-08-23 00:03:42 +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-12-23 18:18:17 +00:00
|
|
|
|
2015-08-23 00:03:42 +00:00
|
|
|
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
|
2014-12-23 18:18:17 +00:00
|
|
|
|
2015-08-23 00:03:42 +00:00
|
|
|
# QNX
|
2014-08-08 09:01:40 +00:00
|
|
|
else ifeq ($(platform), qnx)
|
2015-08-23 00:03:42 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_qnx.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
|
|
|
|
CXX = QCC -Vgcc_ntoarmv7le_cpp
|
2015-08-23 00:03:42 +00:00
|
|
|
|
|
|
|
# PS3
|
2014-08-08 09:01:40 +00:00
|
|
|
else ifeq ($(platform), ps3)
|
2015-08-23 00:03:42 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
|
|
|
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
|
|
|
|
STATIC_LINKING = 1
|
2014-08-08 09:01:40 +00:00
|
|
|
FLAGS += -DMSB_FIRST
|
|
|
|
OLD_GCC = 1
|
2015-08-23 00:03:42 +00:00
|
|
|
|
|
|
|
# sncps3
|
2014-08-08 09:01:40 +00:00
|
|
|
else ifeq ($(platform), sncps3)
|
2015-08-23 00:03:42 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
|
|
|
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
|
|
|
|
STATIC_LINKING = 1
|
2014-08-08 09:01:40 +00:00
|
|
|
FLAGS += -DMSB_FIRST
|
|
|
|
NO_GCC = 1
|
2015-08-23 00:03:42 +00:00
|
|
|
|
|
|
|
# PSP
|
2014-08-08 09:01:40 +00:00
|
|
|
else ifeq ($(platform), psp1)
|
2015-08-23 00:03:42 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_psp1.a
|
2014-08-08 09:01:40 +00:00
|
|
|
CC = psp-gcc$(EXE_EXT)
|
|
|
|
CXX = psp-g++$(EXE_EXT)
|
|
|
|
AR = psp-ar$(EXE_EXT)
|
2015-08-23 00:03:42 +00:00
|
|
|
STATIC_LINKING = 1
|
2015-07-23 20:06:10 +00:00
|
|
|
FLAGS += -G0
|
2015-08-23 00:03:42 +00:00
|
|
|
|
|
|
|
# Windows
|
2014-08-08 09:01:40 +00:00
|
|
|
else
|
2015-08-23 00:03:42 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
|
|
|
CC = gcc
|
|
|
|
CXX = g++
|
|
|
|
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
|
2014-11-01 21:11:56 +00:00
|
|
|
|
2015-08-07 02:03:01 +00:00
|
|
|
CORE_DIR := core
|
2014-11-01 21:11:56 +00:00
|
|
|
|
|
|
|
include Makefile.common
|
|
|
|
|
|
|
|
OBJECTS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o)
|
2014-08-08 09:01:40 +00:00
|
|
|
|
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
FLAGS += -O0 -g
|
|
|
|
else
|
2014-08-08 17:23:36 +00:00
|
|
|
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)
|
2014-11-01 21:11:56 +00:00
|
|
|
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)
|
|
|
|
|
|
|
|
CXXFLAGS += $(FLAGS)
|
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: %.cpp
|
|
|
|
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
|
|
|
|
|
|
|
%.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)
|
|
|
|
$(LIBRARY_NAME)_CXXFLAGS += $(CXXFLAGS) $(COMMON_FLAGS)
|
|
|
|
${LIBRARY_NAME}_FILES = $(SOURCES_CXX) $(SOURCES_C)
|
|
|
|
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
|
|
|
|
$(CXX) -o $@ $^ $(LDFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(TARGET) $(OBJECTS)
|
|
|
|
|
|
|
|
.PHONY: clean
|
2014-12-23 18:18:17 +00:00
|
|
|
endif
|