From 365077772d3d8d5d479febd0388d7e74ef08d508 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Mon, 8 Dec 2014 22:56:33 +0100 Subject: start implementing the libretro interface. (not working yet) --- Makefile | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3be6a1e --- /dev/null +++ b/Makefile @@ -0,0 +1,66 @@ +TARGET := gpsp_libretro.so + +CC = gcc +AR = psp-ar +STATIC_LINKING = 0 + +CFLAGS += -fPIC +CFLAGS += -DPC_BUILD -Wall -m32 +CFLAGS += -D__LIBRETRO__ + + +ifeq ($(DEBUG), 1) +OPTIMIZE := -O0 -g +OPTIMIZE_SAFE := -O0 -g +else +OPTIMIZE := -O3 +OPTIMIZE_SAFE := -O2 +endif + + +OBJS := main.o +OBJS += cpu.o +OBJS += memory.o +OBJS += video.o +OBJS += input.o +OBJS += sound.o +OBJS += cpu_threaded.o + +OBJS += x86_stub.o +OBJS += cheats.o +OBJS += zip.o + +OBJS += libretro.o + + + +ASFLAGS = $(CFLAGS) +INCDIRS := -I. +LDFLAGS += -shared -m32 +LDLIBS += -lz + + +all: $(TARGET) + +$(TARGET): $(OBJS) +ifeq ($(STATIC_LINKING), 1) + $(AR) rcs $@ $(OBJS) +else + $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) +endif + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) $(OPTIMIZE) $(INCDIRS) + +cpu.o: cpu.c + $(CC) -c -o $@ $< $(CFLAGS) -Wno-unused-variable -Wno-unused-label $(OPTIMIZE_SAFE) $(INCDIRS) + +%.o: %.S + $(CC) -c -o $@ $< $(ASFLAGS) $(OPTIMIZE) + +clean: +# rm -f main.o cpu.o memory.o video.o input.o sound.o cpu_threaded.o x86_stub.o cheats.o zip.o libretro.o + rm -f $(OBJS) + rm -f $(TARGET) + +.PHONY: $(TARGET) clean -- cgit v1.2.3 From 8f9b841f721bbfbc74590267e57e0bb4744ae63f Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 00:17:28 +0100 Subject: can compile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3be6a1e..a9aab37 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CC = gcc AR = psp-ar STATIC_LINKING = 0 -CFLAGS += -fPIC +CFLAGS += -fPIC -Werror-implicit-function-declaration CFLAGS += -DPC_BUILD -Wall -m32 CFLAGS += -D__LIBRETRO__ @@ -26,7 +26,7 @@ OBJS += input.o OBJS += sound.o OBJS += cpu_threaded.o -OBJS += x86_stub.o +OBJS += x86/x86_stub.o OBJS += cheats.o OBJS += zip.o -- cgit v1.2.3 From 38158f67e2d8a9c8c43b3b3598a56f3d86a727f8 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 01:00:31 +0100 Subject: show undefined referances. add link.T --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a9aab37..3152bf3 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ OBJS += libretro.o ASFLAGS = $(CFLAGS) INCDIRS := -I. -LDFLAGS += -shared -m32 +LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T LDLIBS += -lz -- cgit v1.2.3 From 50df6df600745247af98d0f6ed52f80043c9922b Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 01:59:02 +0100 Subject: fix undefined referances. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3152bf3..4ddb89f 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ OBJS += cheats.o OBJS += zip.o OBJS += libretro.o +OBJS += libco/libco.o -- cgit v1.2.3 From 3510bfb5281f8c98fc8ddd97eb9e7aed35f879ab Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 02:11:22 +0100 Subject: hide some warnings --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4ddb89f..4228d97 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,9 @@ endif cpu.o: cpu.c $(CC) -c -o $@ $< $(CFLAGS) -Wno-unused-variable -Wno-unused-label $(OPTIMIZE_SAFE) $(INCDIRS) +cpu_threaded.o: cpu_threaded.c + $(CC) -c -o $@ $< $(CFLAGS) -Wno-unused-variable -Wno-unused-label $(OPTIMIZE_SAFE) $(INCDIRS) + %.o: %.S $(CC) -c -o $@ $< $(ASFLAGS) $(OPTIMIZE) -- cgit v1.2.3 From b69fee8b3139eb26405c20aa3adde166f9034b59 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 05:16:09 +0100 Subject: video output now works in statically linked builds. core can't be used as a shared library yet due to the dynarec not working when compiled with -fPIC --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4228d97..0297ace 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -TARGET := gpsp_libretro.so +TARGET := gpsp_libretro CC = gcc AR = psp-ar STATIC_LINKING = 0 -CFLAGS += -fPIC -Werror-implicit-function-declaration +CFLAGS += -Werror-implicit-function-declaration CFLAGS += -DPC_BUILD -Wall -m32 CFLAGS += -D__LIBRETRO__ @@ -33,14 +33,18 @@ OBJS += zip.o OBJS += libretro.o OBJS += libco/libco.o - +ifeq ($(STATIC_LINKING), 1) +TARGET := $(TARGET).a +else +TARGET := $(TARGET).so +CFLAGS += -fPIC +endif ASFLAGS = $(CFLAGS) INCDIRS := -I. LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T LDLIBS += -lz - all: $(TARGET) $(TARGET): $(OBJS) -- cgit v1.2.3 From a859afadfdbdc1449d039f66b957487342ef8e1a Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 05:47:45 +0100 Subject: fix sound --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0297ace..6d5b019 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ cpu_threaded.o: cpu_threaded.c $(CC) -c -o $@ $< $(ASFLAGS) $(OPTIMIZE) clean: -# rm -f main.o cpu.o memory.o video.o input.o sound.o cpu_threaded.o x86_stub.o cheats.o zip.o libretro.o +# rm -f main.o memory.o input.o sound.o cpu_threaded.o x86_stub.o cheats.o zip.o libretro.o rm -f $(OBJS) rm -f $(TARGET) -- cgit v1.2.3 From 1a6a13680119d40bb20f1bd8a7e62a76c6b16d58 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 09:54:33 +0100 Subject: dynamic recompiler now works when the core is compiled as a shared library. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6d5b019..0d428ba 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ endif ASFLAGS = $(CFLAGS) INCDIRS := -I. -LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T +LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T -fPIC LDLIBS += -lz all: $(TARGET) -- cgit v1.2.3 From d8a9fca756bf96a8fdf626d8bf0cb48bafaae6c2 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 10:13:44 +0100 Subject: -fPIC wasn't necessary afterall, and compiling without it increases fps by about 10%. --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0d428ba..c70231c 100644 --- a/Makefile +++ b/Makefile @@ -37,12 +37,11 @@ ifeq ($(STATIC_LINKING), 1) TARGET := $(TARGET).a else TARGET := $(TARGET).so -CFLAGS += -fPIC endif ASFLAGS = $(CFLAGS) INCDIRS := -I. -LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T -fPIC +LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T LDLIBS += -lz all: $(TARGET) @@ -67,7 +66,7 @@ cpu_threaded.o: cpu_threaded.c $(CC) -c -o $@ $< $(ASFLAGS) $(OPTIMIZE) clean: -# rm -f main.o memory.o input.o sound.o cpu_threaded.o x86_stub.o cheats.o zip.o libretro.o +# rm -f main.o memory.o input.o sound.o x86_stub.o cheats.o zip.o libretro.o rm -f $(OBJS) rm -f $(TARGET) -- cgit v1.2.3