diff --git a/Makefile b/Makefile index 05a4f358..0d2582c0 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,9 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),) system_platform = win endif +CORE_DIR += . TARGET_NAME := melonds -LIBM = -lm +LIBM = -lm ifeq ($(ARCHFLAGS),) ifeq ($(archs),ppc) @@ -55,11 +56,11 @@ ifeq ($(platform), unix) EXT ?= so TARGET := $(TARGET_NAME)_libretro.$(EXT) fpic := -fPIC - SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined else ifeq ($(platform), linux-portable) TARGET := $(TARGET_NAME)_libretro.$(EXT) fpic := -fPIC -nostdlib - SHARED := -shared -Wl,--version-script=link.T + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T LIBM := else ifneq (,$(findstring osx,$(platform))) TARGET := $(TARGET_NAME)_libretro.dylib @@ -86,11 +87,11 @@ endif else ifneq (,$(findstring qnx,$(platform))) TARGET := $(TARGET_NAME)_libretro_qnx.so fpic := -fPIC - SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined else ifeq ($(platform), emscripten) TARGET := $(TARGET_NAME)_libretro_emscripten.bc fpic := -fPIC - SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined + SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined else ifeq ($(platform), vita) TARGET := $(TARGET_NAME)_vita.a CC = arm-vita-eabi-gcc @@ -100,7 +101,7 @@ else ifeq ($(platform), vita) else CC = gcc TARGET := $(TARGET_NAME)_libretro.dll - SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined + SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined endif LDFLAGS += $(LIBM) @@ -111,11 +112,12 @@ else CXXFLAGS += -O3 endif -OBJECTS := NDS.o ARM.o ARMInterpreter.o ARMInterpreter_ALU.o ARMInterpreter_Branch.o ARMInterpreter_LoadStore.o CP15.o DMA.o GPU.o GPU2D.o GPU3D.o NDSCart.o RTC.o SPI.o Wifi.o libretro.o +include Makefile.common -CXXFLAGS += -I../../libretro-common/include -Wall -pedantic $(fpic) +OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o) -CXXFLAGS += -I../../libretro-common/include +CFLAGS += -Wall -pedantic -D__LIBRETRO__ $(fpic) +CXXFLAGS += -Wall -pedantic -D__LIBRETRO__ $(fpic) all: $(TARGET) diff --git a/Makefile.common b/Makefile.common new file mode 100644 index 00000000..d9ad9676 --- /dev/null +++ b/Makefile.common @@ -0,0 +1,17 @@ +SOURCES_C := +SOURCES_CXX := $(CORE_DIR)/NDS.cpp \ + $(CORE_DIR)/ARM.cpp \ + $(CORE_DIR)/ARMInterpreter.cpp \ + $(CORE_DIR)/ARMInterpreter_ALU.cpp \ + $(CORE_DIR)/ARMInterpreter_Branch.cpp \ + $(CORE_DIR)/ARMInterpreter_LoadStore.cpp \ + $(CORE_DIR)/CP15.cpp \ + $(CORE_DIR)/DMA.cpp \ + $(CORE_DIR)/GPU.cpp \ + $(CORE_DIR)/GPU2D.cpp \ + $(CORE_DIR)/GPU3D.cpp \ + $(CORE_DIR)/NDSCart.cpp \ + $(CORE_DIR)/RTC.cpp \ + $(CORE_DIR)/SPI.cpp \ + $(CORE_DIR)/Wifi.cpp \ + $(CORE_DIR)/libretro.cpp