diff --git a/Makefile.common b/Makefile.common index 4b783d9..240907d 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1,14 +1,19 @@ -SOURCES_C := $(CORE_DIR)/gb.c \ - $(CORE_DIR)/apu.c \ - $(CORE_DIR)/memory.c \ - $(CORE_DIR)/mbc.c \ - $(CORE_DIR)/timing.c \ - $(CORE_DIR)/display.c \ - $(CORE_DIR)/symbol_hash.c \ - $(CORE_DIR)/debugger.c \ - $(CORE_DIR)/camera.c \ - $(CORE_DIR)/z80_cpu.c \ - $(CORE_DIR)/z80_disassembler.c \ - $(CORE_DIR)/joypad.c \ - $(LIBRETRO_DIR)/libretro.c - \ No newline at end of file +INCFLAGS := -I$(CORE_DIR) \ + -I$(CORE_DIR)/Core + +SOURCES_C := $(CORE_DIR)/Core/gb.c \ + $(CORE_DIR)/Core/apu.c \ + $(CORE_DIR)/Core/memory.c \ + $(CORE_DIR)/Core/mbc.c \ + $(CORE_DIR)/Core/timing.c \ + $(CORE_DIR)/Core/display.c \ + $(CORE_DIR)/Core/symbol_hash.c \ + $(CORE_DIR)/Core/debugger.c \ + $(CORE_DIR)/Core/camera.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 := + diff --git a/Makefile.libretro b/Makefile.libretro index d76fd09..f5e1e5b 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -30,14 +30,13 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),) endif ifeq ($(platform), win) - INCLUDES += -I Windows + INCFLAGS += -I Windows endif -CORE_DIR += ./Core -LIBRETRO_DIR += ./libretro +CORE_DIR += . + TARGET_NAME = sameboy LIBM = -lm -INCLUDES += -I $(CORE_DIR) ifeq ($(ARCHFLAGS),) ifeq ($(archs),ppc) @@ -62,11 +61,11 @@ ifeq ($(platform), unix) EXT ?= so TARGET := $(TARGET_NAME)_libretro.$(EXT) 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) TARGET := $(TARGET_NAME)_libretro.$(EXT) fpic := -fPIC -nostdlib - SHARED := -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T LIBM := else ifneq (,$(findstring osx,$(platform))) TARGET := $(TARGET_NAME)_libretro.dylib @@ -93,11 +92,11 @@ endif else ifneq (,$(findstring qnx,$(platform))) TARGET := $(TARGET_NAME)_libretro_qnx.so 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) TARGET := $(TARGET_NAME)_libretro_emscripten.bc 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) TARGET := $(TARGET_NAME)_vita.a CC = arm-vita-eabi-gcc @@ -107,7 +106,7 @@ else ifeq ($(platform), vita) else CC = gcc 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 LDFLAGS += $(LIBM) @@ -122,7 +121,7 @@ include Makefile.common 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) all: $(TARGET) @@ -131,7 +130,7 @@ $(TARGET): $(OBJECTS) ifeq ($(STATIC_LINKING), 1) $(AR) rcs $@ $(OBJECTS) else - $(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS) + $(CC) $(fpic) $(SHARED) $(INCFLAGS) -o $@ $(OBJECTS) $(LDFLAGS) endif Core/%.o: Core/%.c diff --git a/libretro/jni/Android.mk b/libretro/jni/Android.mk new file mode 100644 index 0000000..c6bba11 --- /dev/null +++ b/libretro/jni/Android.mk @@ -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) diff --git a/libretro/jni/Application.mk b/libretro/jni/Application.mk new file mode 100644 index 0000000..219fdf2 --- /dev/null +++ b/libretro/jni/Application.mk @@ -0,0 +1,2 @@ +APP_STL := gnustl_static +APP_ABI := all