diff --git a/Makefile.libretro b/Makefile.libretro index f43642f..a9b75e2 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -40,6 +40,7 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),) endif TARGET_NAME := genesis_plus_gx +LIBM := -lm # Unix ifeq ($(platform), unix) @@ -49,6 +50,16 @@ ifeq ($(platform), unix) ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB +# Portable Linux +else ifeq ($(platform), linux-portable) + TARGET := $(TARGET_NAME)_libretro.so + fpic := -fPIC -nostdlib + SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined + ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN + PLATFORM_DEFINES := -DHAVE_ZLIB + LIBM := + LDFLAGS += -L. -lmusl + # OS X else ifeq ($(platform), osx) TARGET := $(TARGET_NAME)_libretro.dylib @@ -109,7 +120,7 @@ else ifeq ($(platform), theos_ios) else ifeq ($(platform), qnx) TARGET := $(TARGET_NAME)_libretro_qnx.so fpic := -fPIC - SHARED := -lm -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined + SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB CC = qcc -Vgcc_ntoarmv7le @@ -218,6 +229,8 @@ else endif +LDFLAGS += $(LIBM) + ifeq ($(DEBUG), 1) CFLAGS += -O0 -g else ifeq ($(platform),qnx) @@ -264,8 +277,6 @@ else LIBRETRO_CFLAGS += -DINLINE="static inline" endif -LIBRETRO_LIBS := -lm - ifeq ($(platform), theos_ios) COMMON_FLAGS := $(COMMON_DEFINES) $(INCFLAGS) -I$(THEOS_INCLUDE_PATH) -Wno-error $(LIBRARY_NAME)_CFLAGS += $(CFLAGS) $(LIBRETRO_CFLAGS) $(COMMON_FLAGS) @@ -282,7 +293,7 @@ $(TARGET): $(OBJECTS) ifeq ($(STATIC_LINKING), 1) $(AR) rcs $@ $(OBJECTS) else - $(CC) -o $(TARGET) $(fpic) $(OBJECTS) $(LDFLAGS) $(LIBRETRO_LIBS) $(SHARED) + $(CC) -o $(TARGET) $(fpic) $(OBJECTS) $(LDFLAGS) $(SHARED) endif clean-objs: