diff --git a/Makefile b/Makefile index c185cf97..d2802970 100755 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ quicklook: $(BIN)/SameBoy.qlgenerator sdl: $(SDL_TARGET) $(BIN)/SDL/dmg_boot.bin $(BIN)/SDL/cgb_boot.bin $(BIN)/SDL/LICENSE $(BIN)/SDL/registers.sym $(BIN)/SDL/drop.bmp bootroms: $(BIN)/BootROMs/cgb_boot.bin $(BIN)/BootROMs/dmg_boot.bin tester: $(TESTER_TARGET) $(BIN)/tester/dmg_boot.bin $(BIN)/tester/cgb_boot.bin -all: cocoa sdl tester +all: cocoa sdl tester libretro # Get a list of our source files and their respective object file targets @@ -279,7 +279,12 @@ $(BIN)/BootROMs/%.bin: BootROMs/%.asm head -c $(if $(findstring dmg,$@), 256, 2304) $@.tmp2 > $@ @rm $@.tmp $@.tmp2 +# Libretro Core (uses its own build system) +libretro: + make -C libretro + # Clean - clean: - rm -rf build \ No newline at end of file + rm -rf build + +.PHONY: libretro \ No newline at end of file diff --git a/Makefile.libretro b/libretro/Makefile similarity index 94% rename from Makefile.libretro rename to libretro/Makefile index 40077a28..eb8132bc 100644 --- a/Makefile.libretro +++ b/libretro/Makefile @@ -33,7 +33,7 @@ ifeq ($(platform), win) INCFLAGS += -I Windows endif -CORE_DIR += . +CORE_DIR += .. TARGET_NAME = sameboy LIBM = -lm @@ -113,7 +113,7 @@ else SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(CORE_DIR)/libretro/link.T -Wl,--no-undefined endif -TARGET := build/bin/libretro/$(TARGET) +TARGET := $(CORE_DIR)/build/bin/$(TARGET) # To force use of the Unix version instead of the Windows version MKDIR := $(shell which mkdir) @@ -128,7 +128,7 @@ endif include Makefile.common -OBJECTS := $(patsubst %.c,build/obj/%_libretro.c.o,$(SOURCES_C)) +OBJECTS := $(patsubst %.c,$(CORE_DIR)/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) @@ -143,7 +143,7 @@ $(CORE_DIR)/libretro/%_boot.c: $(CORE_DIR)/build/bin/BootROMs/%_boot.bin echo "const unsigned $(notdir $(@:%.c=%))_length = sizeof($(notdir $(@:%.c=%)));" >> $@ $(CORE_DIR)/build/bin/BootROMs/%_boot.bin: - make -C $(CORE_DIR) $@ + make -C $(CORE_DIR) $(patsubst $(CORE_DIR)/%,%,$@) $(TARGET): $(OBJECTS) -@$(MKDIR) -p $(dir $@) @@ -153,7 +153,7 @@ else $(CC) $(fpic) $(SHARED) $(INCFLAGS) -o $@ $(OBJECTS) $(LDFLAGS) endif -build/obj/%_libretro.c.o: %.c +$(CORE_DIR)/build/obj/%_libretro.c.o: %.c -@$(MKDIR) -p $(dir $@) $(CC) -c -o $@ $< $(CFLAGS) $(fpic) -DGB_INTERNAL diff --git a/Makefile.common b/libretro/Makefile.common similarity index 100% rename from Makefile.common rename to libretro/Makefile.common