libretro: Allow overriding -flto.

With some users it could be handy to set -flto manually, for example with gcc
its possible to get a speed up for linking with -flto=jobserver.
This commit is contained in:
orbea 2018-12-01 14:45:22 -08:00
parent 1b61affbb5
commit 21d6275a85
1 changed files with 23 additions and 22 deletions

View File

@ -2,6 +2,7 @@ DEBUG = 0
HAVE_EXCEPTIONS = 0
HAVE_STRINGS_H = 1
LTO ?= -flto
SPACE :=
SPACE := $(SPACE) $(SPACE)
BACKSLASH :=
@ -45,9 +46,9 @@ endif
# Unix
ifneq (,$(findstring unix,$(platform)))
CFLAGS += -flto
CXXFLAGS += -flto
LDFLAGS += -flto
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
ifneq ($(findstring SunOS,$(shell uname -a)),)
@ -70,9 +71,9 @@ ifneq (,$(findstring unix,$(platform)))
# OS X
else ifeq ($(platform), osx)
CFLAGS += -flto
CXXFLAGS += -flto
LDFLAGS += -flto
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
@ -102,9 +103,9 @@ else ifeq ($(platform), libnx)
# iOS
else ifneq (,$(findstring ios,$(platform)))
CFLAGS += -flto
CXXFLAGS += -flto
LDFLAGS += -flto
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
@ -134,9 +135,9 @@ else ifneq (,$(findstring ios,$(platform)))
# Theos
else ifeq ($(platform), theos_ios)
CFLAGS += -flto
CXXFLAGS += -flto
LDFLAGS += -flto
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
DEPLOYMENT_IOSVERSION = 5.0
TARGET = iphone:latest:$(DEPLOYMENT_IOSVERSION)
ARCHS = armv7 armv7s
@ -159,9 +160,9 @@ else ifeq ($(platform), qnx)
# Vita
else ifeq ($(platform), vita)
CFLAGS += -flto
CXXFLAGS += -flto
LDFLAGS += -flto
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro_$(platform).so
fpic := -fPIC
CC = arm-vita-eabi-gcc$(EXE_EXT)
@ -199,9 +200,9 @@ else ifneq (,$(filter $(platform), ps3 sncps3 psl1ght))
# Xbox 360
else ifeq ($(platform), xenon)
CFLAGS += -flto
CXXFLAGS += -flto
LDFLAGS += -flto
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)
CXX = xenon-g++$(EXE_EXT)
@ -465,9 +466,9 @@ CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
CXXFLAGS += -D_CRT_SECURE_NO_DEPRECATE
# Windows
else
CFLAGS += -flto
CXXFLAGS += -flto
LDFLAGS += -flto
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
CXX = g++
@ -569,7 +570,7 @@ $(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
$(LD) $(fpic) $(SHARED) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(LIBS)
+$(LD) $(fpic) $(SHARED) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(LIBS)
endif
%.o: %.cpp