diff --git a/Makefile.libretro b/Makefile.libretro index 583fc92..8daa284 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -40,20 +40,29 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),) endif TARGET_NAME := genesis_plus_gx +LIBM := -lm # Unix ifeq ($(platform), unix) TARGET := $(TARGET_NAME)_libretro.so fpic := -fPIC - SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz + SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined 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 + ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN + PLATFORM_DEFINES := -DHAVE_ZLIB + LIBM := # OS X else ifeq ($(platform), osx) TARGET := $(TARGET_NAME)_libretro.dylib fpic := -fPIC - SHARED := -dynamiclib -lz + SHARED := -dynamiclib ifeq ($(arch),ppc) ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN else @@ -75,7 +84,7 @@ else ifeq ($(platform), osx) else ifeq ($(platform), ios) TARGET := $(TARGET_NAME)_libretro_ios.dylib fpic := -fPIC - SHARED := -dynamiclib -lz + SHARED := -dynamiclib ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB @@ -109,7 +118,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 -lz + 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 @@ -181,7 +190,7 @@ else ifeq ($(platform), wii) else ifneq (,$(findstring armv,$(platform))) TARGET := $(TARGET_NAME)_libretro.so fpic := -fPIC - SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz + SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB ifneq (,$(findstring cortexa5,$(platform))) @@ -211,13 +220,15 @@ else ifeq ($(platform), emscripten) else TARGET := $(TARGET_NAME)_libretro.dll CC = gcc - SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--version-script=libretro/link.T -Wl,--no-undefined -lz + SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--version-script=libretro/link.T -Wl,--no-undefined ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB endif +LDFLAGS += $(LIBM) + ifeq ($(DEBUG), 1) CFLAGS += -O0 -g else ifeq ($(platform),qnx) @@ -264,8 +275,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 +291,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: diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 5d77f44..728487a 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -12,8 +12,6 @@ SOURCES_C = $(foreach dir,$(GENPLUS_SRC_DIR),$(wildcard $(dir)/*.c)) \ $(foreach dir,$(TREMOR_SRC_DIR),$(wildcard $(dir)/*.c)) \ $(LIBRETRO_DIR)/libretro.c -ifeq ($(WANT_CRC32), 1) - SOURCES_C += $(LIBRETRO_DIR)/scrc32.c -endif +SOURCES_C += $(LIBRETRO_DIR)/scrc32.c INCFLAGS += $(foreach dir,$(GENPLUS_SRC_DIR),-I$(dir)) -I$(LIBRETRO_DIR)