Create Makefile.common

This commit is contained in:
twinaphex 2015-07-26 18:05:51 +02:00
parent 392235c1f9
commit 9aff5f726a
4 changed files with 125 additions and 176 deletions

View File

@ -1,10 +1,7 @@
DEBUG = 0
FRONTEND_SUPPORTS_RGB565 = 1
MEDNAFEN_DIR := mednafen
MEDNAFEN_LIBRETRO_DIR := mednafen-libretro
NEED_TREMOR = 0
LIBRETRO_SOURCES :=
CORE_DIR := .
ifneq ($(EMSCRIPTEN),)
platform = emscripten
@ -49,28 +46,9 @@ NEED_BLIP = 1
NEED_STEREO_SOUND = 1
WANT_NEW_API = 1
CORE_DEFINE := -DWANT_WSWAN_EMU
CORE_DIR := $(MEDNAFEN_DIR)/wswan
CORE_SOURCES := $(CORE_DIR)/gfx.cpp \
$(CORE_DIR)/wswan-memory.cpp \
$(CORE_DIR)/v30mz.cpp \
$(CORE_DIR)/sound.cpp \
$(CORE_DIR)/tcache.cpp \
$(CORE_DIR)/interrupt.cpp \
$(CORE_DIR)/eeprom.cpp \
$(CORE_DIR)/rtc.cpp
TARGET_NAME := mednafen_wswan_libretro
ifeq ($(NEED_BLIP), 1)
RESAMPLER_SOURCES += $(MEDNAFEN_DIR)/sound/Blip_Buffer.cpp
endif
ifeq ($(NEED_STEREO_SOUND), 1)
SOUND_DEFINE := -DWANT_STEREO_SOUND
endif
CORE_INCDIR := -I$(CORE_DIR)
ifeq ($(platform), unix)
TARGET := $(TARGET_NAME).so
fpic := -fPIC
@ -235,35 +213,7 @@ else
FLAGS += -DHAVE__MKDIR
endif
ifeq ($(NEED_CRC32), 1)
FLAGS += -DWANT_CRC32
LIBRETRO_SOURCES += scrc32.cpp
endif
ifeq ($(NEED_DEINTERLACER), 1)
FLAGS += -DNEED_DEINTERLACER
endif
MEDNAFEN_SOURCES := $(MEDNAFEN_DIR)/mednafen.cpp \
$(MEDNAFEN_DIR)/settings.cpp \
$(MEDNAFEN_DIR)/general.cpp \
$(MEDNAFEN_DIR)/state.cpp \
$(MEDNAFEN_DIR)/endian.cpp \
$(CDROM_SOURCES) \
$(MEDNAFEN_DIR)/mempatcher.cpp \
$(RESAMPLER_SOURCES) \
$(MEDNAFEN_DIR)/file.cpp \
$(OKIADPCM_SOURCES) \
$(MEDNAFEN_DIR)/md5.cpp
LIBRETRO_SOURCES += libretro.cpp
TRIO_SOURCES += $(MEDNAFEN_DIR)/trio/trio.c $(MEDNAFEN_DIR)/trio/triostr.c
SOURCES_C := $(TREMOR_SRC) $(LIBRETRO_SOURCES_C) $(TRIO_SOURCES) $(THREAD_SOURCES)
SOURCES := $(LIBRETRO_SOURCES) $(CORE_SOURCES) $(MEDNAFEN_SOURCES) $(HW_CPU_SOURCES) $(HW_MISC_SOURCES) $(HW_SOUND_SOURCES) $(HW_VIDEO_SOURCES)
include Makefile.common
WARNINGS := -Wall \
-Wno-sign-compare \
@ -282,8 +232,7 @@ else
EXTRA_GCC_FLAGS := -g
endif
OBJECTS := $(SOURCES:.cpp=.o) $(SOURCES_C:.c=.o)
OBJECTS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o)
all: $(TARGET)
@ -295,34 +244,10 @@ endif
LDFLAGS += $(fpic) $(SHARED)
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
FLAGS += -I. -Imednafen -Imednafen/include -Imednafen/intl -Imednafen/hw_misc -Imednafen/hw_sound -Imednafen/hw_cpu $(CORE_INCDIR) $(EXTRA_CORE_INCDIR)
FLAGS += $(INCFLAGS)
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.31\" -DPACKAGE=\"mednafen\" -DMEDNAFEN_VERSION_NUMERIC=931 -DPSS_STYLE=1 -DMPC_FIXED_POINT $(CORE_DEFINE) -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -D_LOW_ACCURACY_ $(EXTRA_INCLUDES) $(SOUND_DEFINE)
ifeq ($(IS_X86), 1)
FLAGS += -DARCH_X86
endif
ifeq ($(CACHE_CD), 1)
FLAGS += -D__LIBRETRO_CACHE_CD__
endif
ifeq ($(NEED_BPP), 8)
FLAGS += -DWANT_8BPP
endif
ifeq ($(NEED_BPP), 16)
FLAGS += -DWANT_16BPP
endif
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
FLAGS += -DFRONTEND_SUPPORTS_RGB565
endif
ifeq ($(WANT_NEW_API), 1)
FLAGS += -DWANT_NEW_API
endif
CXXFLAGS += $(FLAGS)
CFLAGS += $(FLAGS)

112
Makefile.common Normal file
View File

@ -0,0 +1,112 @@
SOURCES_CXX :=
SOURCES_C :=
MEDNAFEN_DIR := $(CORE_DIR)/mednafen
CORE_EMU_DIR := $(MEDNAFEN_DIR)/wswan
INCFLAGS := -I$(CORE_DIR) -I$(MEDNAFEN_DIR) -I$(MEDNAFEN_DIR)/include -I$(MEDNAFEN_DIR)/intl -I$(MEDNAFEN_DIR)/hw_sound -I$(MEDNAFEN_DIR)/hw_cpu -I$(MEDNAFEN_DIR)/hw_misc
ifneq ($(HAVE_GRIFFIN),1)
SOURCES_CXX += \
$(CORE_EMU_DIR)/gfx.cpp \
$(CORE_EMU_DIR)/wswan-memory.cpp \
$(CORE_EMU_DIR)/v30mz.cpp \
$(CORE_EMU_DIR)/sound.cpp \
$(CORE_EMU_DIR)/tcache.cpp \
$(CORE_EMU_DIR)/interrupt.cpp \
$(CORE_EMU_DIR)/eeprom.cpp \
$(CORE_EMU_DIR)/rtc.cpp
endif
ifeq ($(NEED_BLIP), 1)
SOURCES_CXX += $(MEDNAFEN_DIR)/sound/Blip_Buffer.cpp
endif
ifeq ($(NEED_THREADING), 1)
FLAGS += -DWANT_THREADING
SOURCES_C += $(CORE_DIR)/threads.c
endif
ifeq ($(NEED_CRC32), 1)
FLAGS += -DWANT_CRC32
SOURCES_C += $(CORE_DIR)/scrc32.c
endif
ifeq ($(NEED_DEINTERLACER), 1)
FLAGS += -DNEED_DEINTERLACER
endif
ifeq ($(IS_X86), 1)
FLAGS += -DARCH_X86
endif
ifeq ($(NEED_BPP), 8)
FLAGS += -DWANT_8BPP
endif
ifeq ($(NEED_BPP), 16)
FLAGS += -DWANT_16BPP
endif
ifeq ($(NEED_BPP), 32)
FLAGS += -DWANT_32BPP
endif
ifeq ($(WANT_NEW_API), 1)
FLAGS += -DWANT_NEW_API
endif
ifeq ($(NO_COMPUTED_GOTO), 1)
FLAGS += -DNO_COMPUTED_GOTO
endif
ifeq ($(NEED_STEREO_SOUND), 1)
FLAGS += -DWANT_STEREO_SOUND
endif
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
FLAGS += -DFRONTEND_SUPPORTS_RGB565
endif
ifeq ($(CACHE_CD), 1)
FLAGS += -D__LIBRETRO_CACHE_CD__
endif
ifeq ($(NEED_CD), 1)
ifneq ($(HAVE_GRIFFIN),1)
SOURCES_CXX += $(MEDNAFEN_DIR)/cdrom/CDAccess.cpp \
$(MEDNAFEN_DIR)/cdrom/CDAccess_Image.cpp \
$(MEDNAFEN_DIR)/cdrom/CDAccess_CCD.cpp \
$(MEDNAFEN_DIR)/cdrom/CDUtility.cpp \
$(MEDNAFEN_DIR)/cdrom/lec.cpp \
$(MEDNAFEN_DIR)/cdrom/SimpleFIFO.cpp \
$(MEDNAFEN_DIR)/cdrom/audioreader.cpp \
$(MEDNAFEN_DIR)/cdrom/galois.cpp \
$(MEDNAFEN_DIR)/cdrom/recover-raw.cpp \
$(MEDNAFEN_DIR)/cdrom/l-ec.cpp \
$(MEDNAFEN_DIR)/cdrom/crc32.cpp \
$(MEDNAFEN_DIR)/cdrom/cdromif.cpp
endif
FLAGS += -DNEED_CD
endif
ifeq ($(NEED_TREMOR), 1)
SOURCES_C += $(wildcard $(MEDNAFEN_DIR)/tremor/*.c)
FLAGS += -DNEED_TREMOR
endif
ifneq ($(HAVE_GRIFFIN), 1)
SOURCES_CXX += \
$(MEDNAFEN_DIR)/mednafen.cpp \
$(MEDNAFEN_DIR)/settings.cpp \
$(MEDNAFEN_DIR)/general.cpp \
$(MEDNAFEN_DIR)/state.cpp \
$(MEDNAFEN_DIR)/mempatcher.cpp \
$(MEDNAFEN_DIR)/md5.cpp \
$(MEDNAFEN_DIR)/file.cpp \
$(MEDNAFEN_DIR)/endian.cpp \
$(CORE_DIR)/libretro.cpp
endif
SOURCES_C += $(MEDNAFEN_DIR)/trio/trio.c \
$(MEDNAFEN_DIR)/trio/triostr.c

View File

@ -1,142 +1,54 @@
LOCAL_PATH := $(call my-dir)
DEBUG = 0
FRONTEND_SUPPORTS_RGB565 = 1
FAST = 1
include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH),arm)
LOCAL_CXXFLAGS += -DANDROID_ARM
LOCAL_CFLAGS +=-DANDROID_ARM
ANDROID_FLAGS := -DANDROID_ARM
LOCAL_ARM_MODE := arm
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_CXXFLAGS += -DANDROID_X86
LOCAL_CFLAGS += -DANDROID_X86
ANDROID_FLAGS := -DANDROID_X86
IS_X86 = 1
endif
ifeq ($(TARGET_ARCH),mips)
LOCAL_CXXFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__
LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__
ANDROID_FLAGS := -DANDROID_MIPS -D__mips__ -D__MIPSEL__
endif
MEDNAFEN_DIR := ../mednafen
MEDNAFEN_LIBRETRO_DIR := ..
LOCAL_CXXFLAGS += $(ANDROID_FLAGS)
LOCAL_CFLAGS += $(ANDROID_FLAGS)
CORE_DIR := ..
LOCAL_MODULE := libretro
# If you have a system with 1GB RAM or more - cache the whole
# CD for CD-based systems in order to prevent file access delays/hiccups
CACHE_CD = 0
core = wswan
NEED_BPP = 16
WANT_NEW_API = 1
NEED_BLIP = 1
NEED_STEREO_SOUND = 1
CORE_DEFINE := -DWANT_WSWAN_EMU
CORE_DIR := $(MEDNAFEN_DIR)/wswan
CORE_SOURCES := $(CORE_DIR)/gfx.cpp \
$(CORE_DIR)/wswan-memory.cpp \
$(CORE_DIR)/v30mz.cpp \
$(CORE_DIR)/sound.cpp \
$(CORE_DIR)/tcache.cpp \
$(CORE_DIR)/interrupt.cpp \
$(CORE_DIR)/eeprom.cpp \
$(CORE_DIR)/rtc.cpp
TARGET_NAME := mednafen_wswan_libretro
ifeq ($(NEED_STEREO_SOUND), 1)
SOUND_DEFINE := -DWANT_STEREO_SOUND
endif
CORE_INCDIR := $(CORE_DIR)
ifeq ($(NEED_CRC32), 1)
FLAGS += -DWANT_CRC32
CORE_SOURCES += $(MEDNAFEN_LIBRETRO_DIR)/scrc32.cpp
endif
MEDNAFEN_SOURCES := $(MEDNAFEN_DIR)/mednafen.cpp \
$(MEDNAFEN_DIR)/settings.cpp \
$(MEDNAFEN_DIR)/general.cpp \
$(MEDNAFEN_DIR)/state.cpp \
$(MEDNAFEN_DIR)/mempatcher.cpp \
$(MEDNAFEN_DIR)/sound/Blip_Buffer.cpp \
$(MEDNAFEN_DIR)/file.cpp \
$(MEDNAFEN_DIR)/endian.cpp \
$(OKIADPCM_SOURCES) \
$(MEDNAFEN_DIR)/md5.cpp
LIBRETRO_SOURCES := $(MEDNAFEN_LIBRETRO_DIR)/libretro.cpp
SOURCES_C := $(TREMOR_SRC) $(LIBRETRO_SOURCES_C) $(MEDNAFEN_DIR)/trio/trio.c $(MEDNAFEN_DIR)/trio/triostr.c
LOCAL_SRC_FILES += $(LIBRETRO_SOURCES) $(CORE_SOURCES) $(MEDNAFEN_SOURCES) $(HW_CPU_SOURCES) $(HW_MISC_SOURCES) $(HW_SOUND_SOURCES) $(HW_VIDEO_SOURCES) $(SOURCES_C) $(CORE_CD_SOURCES)
WARNINGS := -Wall \
-Wno-sign-compare \
-Wno-unused-variable \
-Wno-unused-function \
-Wno-uninitialized \
$(NEW_GCC_WARNING_FLAGS) \
-Wno-strict-aliasing
include ../Makefile.common
LOCAL_SRC_FILES += $(SOURCES_CXX) $(SOURCES_C)
EXTRA_GCC_FLAGS := -funroll-loops
ifeq ($(NO_GCC),1)
EXTRA_GCC_FLAGS :=
WARNINGS :=
endif
ifeq ($(DEBUG),0)
FLAGS += -O3 $(EXTRA_GCC_FLAGS)
else
FLAGS += -O0 -g
endif
ifneq ($(OLD_GCC),1)
NEW_GCC_WARNING_FLAGS += -Wno-narrowing \
-Wno-unused-but-set-variable \
-Wno-unused-result \
-Wno-overflow
NEW_GCC_FLAGS += -fno-strict-overflow
endif
LDFLAGS += $(fpic) $(SHARED)
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
LOCAL_C_INCLUDES += .. ../mednafen ../mednafen/include ../mednafen/intl ../mednafen/hw_cpu ../mednafen/hw_sound ../mednafen/hw_misc ../mednafen/hw_video $(CORE_INCDIR) $(EXTRA_CORE_INCDIR)
FLAGS += $(fpic) $(NEW_GCC_FLAGS) $(INCFLAGS)
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.26\" -DPACKAGE=\"mednafen\" -DMEDNAFEN_VERSION_NUMERIC=926 -DPSS_STYLE=1 -DMPC_FIXED_POINT $(CORE_DEFINE) -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -DNDEBUG -D_LOW_ACCURACY_ $(SOUND_DEFINE)
ifeq ($(IS_X86), 1)
FLAGS += -DARCH_X86
endif
ifeq ($(CACHE_CD), 1)
FLAGS += -D__LIBRETRO_CACHE_CD__
endif
ifeq ($(NEED_BPP), 16)
FLAGS += -DWANT_16BPP
endif
ifeq ($(WANT_NEW_API), 1)
FLAGS += -DWANT_NEW_API
endif
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
FLAGS += -DFRONTEND_SUPPORTS_RGB565
endif
ifeq ($(NEED_BPP), 32)
FLAGS += -DWANT_32BPP
endif
LOCAL_CFLAGS = $(FLAGS)
LOCAL_CXXFLAGS = $(FLAGS) -fexceptions