From 83fb91d437593f60596f94dac513d6019f973587 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 5 Sep 2017 21:30:24 +0200 Subject: [PATCH] Update Makefiles --- Makefile.libretro | 22 +++++-------- libretro/Makefile.common | 71 +++++++++++++++++++++++++++++++++++----- 2 files changed, 71 insertions(+), 22 deletions(-) diff --git a/Makefile.libretro b/Makefile.libretro index 86b024a..93c1323 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -3,6 +3,8 @@ LOGSOUND = 0 FRONTEND_SUPPORTS_RGB565 = 1 HAVE_CHD = 1 +CORE_DIR := . + # system platform ifeq ($(platform),) platform = unix @@ -39,7 +41,7 @@ endif ifneq (,$(findstring unix,$(platform))) TARGET := $(TARGET_NAME)_libretro.so fpic := -fPIC - SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB @@ -60,7 +62,7 @@ ifneq (,$(findstring unix,$(platform))) else ifeq ($(platform), linux-portable) TARGET := $(TARGET_NAME)_libretro.so fpic := -fPIC -nostdlib - SHARED := -shared -Wl,--version-script=libretro/link.T + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB LIBS = @@ -124,7 +126,7 @@ else ifeq ($(platform), theos_ios) else ifeq ($(platform), qnx) TARGET := $(TARGET_NAME)_libretro_qnx.so fpic := -fPIC - SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB CC = qcc -Vgcc_ntoarmv7le @@ -230,7 +232,7 @@ else ifeq ($(platform), gcw0) TARGET := $(TARGET_NAME)_libretro.so CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar - SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined fpic := -fPIC LDFLAGS += $(PTHREAD_FLAGS) CFLAGS += $(PTHREAD_FLAGS) -DHAVE_MKDIR @@ -307,7 +309,7 @@ LIBS = else TARGET := $(TARGET_NAME)_libretro.dll CC = gcc - SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--version-script=libretro/link.T -Wl,--no-undefined + SHARED := -shared -static-libgcc -static-libstdc++ -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN PLATFORM_DEFINES := -DHAVE_ZLIB @@ -324,17 +326,11 @@ else CFLAGS += -O2 -DNDEBUG endif -CORE_DIR := . - ifeq ($(SHARED_LIBVORBIS),) TREMOR_SRC_DIR := $(CORE_DIR)/core/tremor endif -ifeq ($(HAVE_CHD), 1) - CHDLIBDIR = $(CORE_DIR)/core/cd_hw/libchdr -endif -LIBRETRO_DIR := $(CORE_DIR)/libretro -include $(LIBRETRO_DIR)/Makefile.common +include $(CORE_DIR)/libretro/Makefile.common OBJECTS := $(SOURCES_C:.c=.o) @@ -352,7 +348,7 @@ ifeq ($(HAVE_CHD), 1) DEFINES += -DUSE_LIBCHDR -DPACKAGE_VERSION=\"1.3.2\" -DFLAC_API_EXPORTS -DFLAC__HAS_OGG=0 -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_SYS_PARAM_H -D_7ZIP_ST endif -CFLAGS += $(fpic) $(DEFINES) $(CODE_DEFINES) +CFLAGS += $(fpic) $(DEFINES) $(CODE_DEFINES) $(FLAGS) ifeq ($(FRONTEND_SUPPORTS_RGB565), 1) # if you have a new frontend that supports RGB565 diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 1fee0dd..ba5463c 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -1,4 +1,7 @@ -GENPLUS_SRC_DIR := $(CORE_DIR)/core \ +LIBRETRO_COMM_DIR := $(CORE_DIR)/libretro/libretro-common +LIBRETRO_DIR := $(CORE_DIR)/libretro +CHDLIBDIR := $(CORE_DIR)/core/cd_hw/libchdr +GENPLUS_SRC_DIR := $(CORE_DIR)/core \ $(CORE_DIR)/core/z80 \ $(CORE_DIR)/core/m68k \ $(CORE_DIR)/core/ntsc \ @@ -9,18 +12,68 @@ GENPLUS_SRC_DIR := $(CORE_DIR)/core \ $(CORE_DIR)/core/cart_hw/svp ifeq ($(HAVE_CHD), 1) - INCFLAGS += -I$(CHDLIBDIR)/src -I$(CHDLIBDIR)/deps/libFLAC/include -I$(CHDLIBDIR)/deps/lzma -I$(CHDLIBDIR)/deps/zlib - GENPLUS_SRC_DIR += $(CHDLIBDIR)/src - GENPLUS_SRC_DIR += $(CHDLIBDIR)/deps/libFLAC - GENPLUS_SRC_DIR += $(CHDLIBDIR)/deps/lzma - GENPLUS_SRC_DIR += $(CHDLIBDIR)/deps/zlib + INCFLAGS += -I$(CHDLIBDIR)/src \ + -I$(CHDLIBDIR)/deps/libFLAC/include \ + -I$(CHDLIBDIR)/deps/lzma \ + -I$(CHDLIBDIR)/deps/zlib + SOURCES_C += \ + $(CHDLIBDIR)/src/bitstream.c \ + $(CHDLIBDIR)/src/cdrom.c \ + $(CHDLIBDIR)/src/chd.c \ + $(CHDLIBDIR)/src/flac.c \ + $(CHDLIBDIR)/src/huffman.c \ + $(CHDLIBDIR)/deps/libFLAC/bitmath.c \ + $(CHDLIBDIR)/deps/libFLAC/bitreader.c \ + $(CHDLIBDIR)/deps/libFLAC/bitwriter.c \ + $(CHDLIBDIR)/deps/libFLAC/cpu.c \ + $(CHDLIBDIR)/deps/libFLAC/crc.c \ + $(CHDLIBDIR)/deps/libFLAC/fixed.c \ + $(CHDLIBDIR)/deps/libFLAC/fixed_intrin_sse2.c \ + $(CHDLIBDIR)/deps/libFLAC/fixed_intrin_ssse3.c \ + $(CHDLIBDIR)/deps/libFLAC/float.c \ + $(CHDLIBDIR)/deps/libFLAC/format.c \ + $(CHDLIBDIR)/deps/libFLAC/lpc.c \ + $(CHDLIBDIR)/deps/libFLAC/lpc_intrin_avx2.c \ + $(CHDLIBDIR)/deps/libFLAC/lpc_intrin_sse.c \ + $(CHDLIBDIR)/deps/libFLAC/lpc_intrin_sse2.c \ + $(CHDLIBDIR)/deps/libFLAC/lpc_intrin_sse41.c \ + $(CHDLIBDIR)/deps/libFLAC/md5.c \ + $(CHDLIBDIR)/deps/libFLAC/memory.c \ + $(CHDLIBDIR)/deps/libFLAC/metadata_iterators.c \ + $(CHDLIBDIR)/deps/libFLAC/metadata_object.c \ + $(CHDLIBDIR)/deps/libFLAC/ogg_decoder_aspect.c \ + $(CHDLIBDIR)/deps/libFLAC/ogg_encoder_aspect.c \ + $(CHDLIBDIR)/deps/libFLAC/ogg_helper.c \ + $(CHDLIBDIR)/deps/libFLAC/ogg_mapping.c \ + $(CHDLIBDIR)/deps/libFLAC/stream_decoder.c \ + $(CHDLIBDIR)/deps/libFLAC/stream_encoder.c \ + $(CHDLIBDIR)/deps/libFLAC/stream_encoder_framing.c \ + $(CHDLIBDIR)/deps/libFLAC/stream_encoder_intrin_avx2.c \ + $(CHDLIBDIR)/deps/libFLAC/stream_encoder_intrin_sse2.c \ + $(CHDLIBDIR)/deps/libFLAC/stream_encoder_intrin_ssse3.c \ + $(CHDLIBDIR)/deps/libFLAC/window.c \ + $(CHDLIBDIR)/deps/libFLAC/windows_unicode_filenames.c \ + $(CHDLIBDIR)/deps/lzma/LzFind.c \ + $(CHDLIBDIR)/deps/lzma/LzmaDec.c \ + $(CHDLIBDIR)/deps/lzma/LzmaEnc.c + + ifeq ($(platform), win) + FLAGS += -DHAVE_FSEEKO + endif endif SOURCES_C = $(foreach dir,$(GENPLUS_SRC_DIR),$(wildcard $(dir)/*.c)) ifneq ($(STATIC_LINKING), 1) -SOURCES_C += $(CORE_DIR)/libretro/libretro-common/streams/file_stream.c \ - $(CORE_DIR)/libretro/libretro-common/streams/file_stream_transforms.c +SOURCES_C += \ + $(LIBRETRO_COMM_DIR)/streams/file_stream.c \ + $(LIBRETRO_COMM_DIR)/streams/file_stream_transforms.c + +SOURCES_C += $(CHDLIBDIR)/deps/zlib/adler32.c \ + $(CHDLIBDIR)/deps/zlib/inffast.c \ + $(CHDLIBDIR)/deps/zlib/inflate.c \ + $(CHDLIBDIR)/deps/zlib/inftrees.c \ + $(CHDLIBDIR)/deps/zlib/zutil.c endif ifeq ($(SHARED_LIBVORBIS),) @@ -31,4 +84,4 @@ SOURCES_C += $(LIBRETRO_DIR)/libretro.c SOURCES_C += $(LIBRETRO_DIR)/scrc32.c -INCFLAGS += $(foreach dir,$(GENPLUS_SRC_DIR),-I$(dir)) -I$(LIBRETRO_DIR) -I$(CORE_DIR)/libretro/libretro-common/include +INCFLAGS += $(foreach dir,$(GENPLUS_SRC_DIR),-I$(dir)) -I$(LIBRETRO_DIR) -I$(LIBRETRO_COMM_DIR)/include