From 441781cbe95c3fee16625fd1f217a7b41238a551 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Thu, 12 Oct 2017 19:42:30 +0300 Subject: [PATCH] Libretro .o files are now in the build/obj folder and are suffixed with _libretro (since they have different compilation flags). This also lets us rename gbmemory.c/h back to its original name. --- Core/gb.h | 2 +- Core/{gbmemory.c => memory.c} | 0 Core/{gbmemory.h => memory.h} | 0 Makefile.common | 4 +++- Makefile.libretro | 10 +++++++--- 5 files changed, 11 insertions(+), 5 deletions(-) rename Core/{gbmemory.c => memory.c} (100%) rename Core/{gbmemory.h => memory.h} (100%) diff --git a/Core/gb.h b/Core/gb.h index ff3096c..1085f06 100644 --- a/Core/gb.h +++ b/Core/gb.h @@ -14,7 +14,7 @@ #include "display.h" #include "joypad.h" #include "mbc.h" -#include "gbmemory.h" +#include "memory.h" #include "printer.h" #include "timing.h" #include "z80_cpu.h" diff --git a/Core/gbmemory.c b/Core/memory.c similarity index 100% rename from Core/gbmemory.c rename to Core/memory.c diff --git a/Core/gbmemory.h b/Core/memory.h similarity index 100% rename from Core/gbmemory.h rename to Core/memory.h diff --git a/Makefile.common b/Makefile.common index 0643617..fbb4fbc 100644 --- a/Makefile.common +++ b/Makefile.common @@ -3,7 +3,7 @@ INCFLAGS := -I$(CORE_DIR) \ SOURCES_C := $(CORE_DIR)/Core/gb.c \ $(CORE_DIR)/Core/apu.c \ - $(CORE_DIR)/Core/gbmemory.c \ + $(CORE_DIR)/Core/memory.c \ $(CORE_DIR)/Core/mbc.c \ $(CORE_DIR)/Core/timing.c \ $(CORE_DIR)/Core/display.c \ @@ -20,5 +20,7 @@ SOURCES_C += $(CORE_DIR)/Core/debugger.c \ else CFLAGS += -DDISABLE_DEBUGGER endif +CFLAGS += -DDISABLE_TIMEKEEPING + SOURCES_CXX := diff --git a/Makefile.libretro b/Makefile.libretro index 589d2d9..3049a2b 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -58,7 +58,7 @@ EXT := a endif ifeq ($(platform), unix) - EXT ?= so + EXT ?= so TARGET := $(TARGET_NAME)_libretro.$(EXT) fpic := -fPIC SHARED := -shared -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined @@ -113,6 +113,9 @@ else SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined endif +# To force use of the Unix version instead of the Windows version +MKDIR := $(shell which mkdir) + LDFLAGS += $(LIBM) ifeq ($(DEBUG), 1) @@ -123,7 +126,7 @@ endif include Makefile.common -OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o) +OBJECTS := $(patsubst %.c,build/obj/%_libretro.c.o,$(SOURCES_C)) CFLAGS += -Wall -D__LIBRETRO__ $(fpic) $(INCFLAGS) -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES CXXFLAGS += -Wall -D__LIBRETRO__ $(fpic) @@ -137,7 +140,8 @@ else $(CC) $(fpic) $(SHARED) $(INCFLAGS) -o $@ $(OBJECTS) $(LDFLAGS) endif -Core/%.o: Core/%.c +build/obj/%_libretro.c.o: %.c + -@$(MKDIR) -p $(dir $@) $(CC) -c -o $@ $< $(CFLAGS) $(fpic) -DGB_INTERNAL %.o: %.c