This commit is contained in:
twinaphex 2017-05-04 03:22:28 +02:00 committed by radius
parent fedea2cad7
commit 63b17e14af
4 changed files with 62 additions and 25 deletions

View File

@ -1,14 +1,19 @@
SOURCES_C := $(CORE_DIR)/gb.c \ INCFLAGS := -I$(CORE_DIR) \
$(CORE_DIR)/apu.c \ -I$(CORE_DIR)/Core
$(CORE_DIR)/memory.c \
$(CORE_DIR)/mbc.c \ SOURCES_C := $(CORE_DIR)/Core/gb.c \
$(CORE_DIR)/timing.c \ $(CORE_DIR)/Core/apu.c \
$(CORE_DIR)/display.c \ $(CORE_DIR)/Core/memory.c \
$(CORE_DIR)/symbol_hash.c \ $(CORE_DIR)/Core/mbc.c \
$(CORE_DIR)/debugger.c \ $(CORE_DIR)/Core/timing.c \
$(CORE_DIR)/camera.c \ $(CORE_DIR)/Core/display.c \
$(CORE_DIR)/z80_cpu.c \ $(CORE_DIR)/Core/symbol_hash.c \
$(CORE_DIR)/z80_disassembler.c \ $(CORE_DIR)/Core/debugger.c \
$(CORE_DIR)/joypad.c \ $(CORE_DIR)/Core/camera.c \
$(LIBRETRO_DIR)/libretro.c $(CORE_DIR)/Core/z80_cpu.c \
$(CORE_DIR)/Core/z80_disassembler.c \
$(CORE_DIR)/Core/joypad.c \
$(CORE_DIR)/libretro/libretro.c
SOURCES_CXX :=

View File

@ -30,14 +30,13 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
endif endif
ifeq ($(platform), win) ifeq ($(platform), win)
INCLUDES += -I Windows INCFLAGS += -I Windows
endif endif
CORE_DIR += ./Core CORE_DIR += .
LIBRETRO_DIR += ./libretro
TARGET_NAME = sameboy TARGET_NAME = sameboy
LIBM = -lm LIBM = -lm
INCLUDES += -I $(CORE_DIR)
ifeq ($(ARCHFLAGS),) ifeq ($(ARCHFLAGS),)
ifeq ($(archs),ppc) ifeq ($(archs),ppc)
@ -62,11 +61,11 @@ ifeq ($(platform), unix)
EXT ?= so EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT) TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
else ifeq ($(platform), linux-portable) else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.$(EXT) TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC -nostdlib fpic := -fPIC -nostdlib
SHARED := -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T
LIBM := LIBM :=
else ifneq (,$(findstring osx,$(platform))) else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib TARGET := $(TARGET_NAME)_libretro.dylib
@ -93,11 +92,11 @@ endif
else ifneq (,$(findstring qnx,$(platform))) else ifneq (,$(findstring qnx,$(platform)))
TARGET := $(TARGET_NAME)_libretro_qnx.so TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
else ifeq ($(platform), emscripten) else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.bc TARGET := $(TARGET_NAME)_libretro_emscripten.bc
fpic := -fPIC fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
else ifeq ($(platform), vita) else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_vita.a TARGET := $(TARGET_NAME)_vita.a
CC = arm-vita-eabi-gcc CC = arm-vita-eabi-gcc
@ -107,7 +106,7 @@ else ifeq ($(platform), vita)
else else
CC = gcc CC = gcc
TARGET := $(TARGET_NAME)_libretro.dll TARGET := $(TARGET_NAME)_libretro.dll
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined
endif endif
LDFLAGS += $(LIBM) LDFLAGS += $(LIBM)
@ -122,7 +121,7 @@ include Makefile.common
OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o) OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o)
CFLAGS += -Wall -D__LIBRETRO__ $(fpic) $(INCLUDES) -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DNDEBUG CFLAGS += -Wall -D__LIBRETRO__ $(fpic) $(INCFLAGS) -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES -DNDEBUG
CXXFLAGS += -Wall -D__LIBRETRO__ $(fpic) CXXFLAGS += -Wall -D__LIBRETRO__ $(fpic)
all: $(TARGET) all: $(TARGET)
@ -131,7 +130,7 @@ $(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1) ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS) $(AR) rcs $@ $(OBJECTS)
else else
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS) $(CC) $(fpic) $(SHARED) $(INCFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
endif endif
Core/%.o: Core/%.c Core/%.o: Core/%.c

31
libretro/jni/Android.mk Normal file
View File

@ -0,0 +1,31 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
HAVE_NETWORK = 1
LOCAL_MODULE := libretro
ifeq ($(TARGET_ARCH),arm)
LOCAL_CXXFLAGS += -DANDROID_ARM
LOCAL_ARM_MODE := arm
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_CXXFLAGS += -DANDROID_X86
endif
ifeq ($(TARGET_ARCH),mips)
LOCAL_CXXFLAGS += -DANDROID_MIPS
endif
CORE_DIR := ../..
include ../../Makefile.common
LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C)
LOCAL_CXXFLAGS += -DINLINE=inline -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DNDEBUG -D_USE_MATH_DEFINES
LOCAL_C_INCLUDES = $(INCFLAGS)
include $(BUILD_SHARED_LIBRARY)

View File

@ -0,0 +1,2 @@
APP_STL := gnustl_static
APP_ABI := all