Commit 3294714f authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Add static linking support

parent d69235ab
STATIC_LINKING=0
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
......@@ -38,23 +40,30 @@ else
endif
endif
ifeq ($(STATIC_LINKING),1)
EXT=a
endif
ifeq ($(platform), unix)
TARGET := $(TARGET_NAME)_libretro.so
EXT?=so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined
else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.so
EXT?=so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC -nostdlib
SHARED := -shared -Wl,--no-undefined
LIBM :=
else ifeq ($(platform), osx)
TARGET := $(TARGET_NAME)_libretro.dylib
EXT?=dylib
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC
SHARED := -dynamiclib
# iOS
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
EXT?=dylib
TARGET := $(TARGET_NAME)_libretro_ios.$(EXT)
fpic := -fPIC
SHARED := -dynamiclib
DEFINES := -DIOS
......@@ -81,16 +90,19 @@ include $(THEOS)/makefiles/common.mk
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
else ifeq ($(platform), qnx)
TARGET := $(TARGET_NAME)_libretro_qnx.so
EXT?=so
TARGET := $(TARGET_NAME)_libretro_qnx.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.so
EXT?=bc
TARGET := $(TARGET_NAME)_libretro_emscripten.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined
# PS3
else ifeq ($(platform), ps3)
TARGET := $(TARGET_NAME)_libretro_ps3.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_ps3.$(EXT)
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CC_AS = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
......@@ -99,7 +111,8 @@ else ifeq ($(platform), ps3)
# sncps3
else ifeq ($(platform), sncps3)
TARGET := $(TARGET_NAME)_libretro_ps3.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_ps3.$(EXT)
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
CC_AS = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
......@@ -108,7 +121,8 @@ else ifeq ($(platform), sncps3)
# Lightweight PS3 Homebrew SDK
else ifeq ($(platform), psl1ght)
TARGET := $(TARGET_NAME)_libretro_psl1ght.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_psl1ght.$(EXT)
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CC_AS = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
......@@ -117,7 +131,8 @@ else ifeq ($(platform), psl1ght)
# PSP
else ifeq ($(platform), psp1)
TARGET := $(TARGET_NAME)_libretro_psp1.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_psp1.$(EXT)
CC = psp-gcc$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
PLATFORM_DEFINES := -DPSP -G0
......@@ -125,7 +140,8 @@ else ifeq ($(platform), psp1)
# Vita
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_libretro_vita.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_vita.$(EXT)
CC = arm-vita-eabi-gcc$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DVITA
......@@ -133,7 +149,8 @@ else ifeq ($(platform), vita)
# CTR (3DS)
else ifeq ($(platform), ctr)
TARGET := $(TARGET_NAME)_libretro_ctr.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_ctr.$(EXT)
CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
CFLAGS += -DARM11 -D_3DS
......@@ -145,7 +162,8 @@ else ifeq ($(platform), ctr)
# Nintendo Game Cube
else ifeq ($(platform), ngc)
TARGET := $(TARGET_NAME)_libretro_ngc.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_ngc.$(EXT)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CC_AS = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
......@@ -154,17 +172,24 @@ else ifeq ($(platform), ngc)
# Nintendo Wii
else ifeq ($(platform), wii)
TARGET := $(TARGET_NAME)_libretro_wii.a
EXT=a
TARGET := $(TARGET_NAME)_libretro_wii.$(EXT)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CC_AS = $(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
STATIC_LINKING = 1
else
TARGET := $(TARGET_NAME)_libretro.dll
EXT?=dll
TARGET := $(TARGET_NAME)_libretro.$(EXT)
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--no-undefined -s
endif
ifeq ($(STATIC_LINKING),1)
fpic=
SHARED=
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment