From 4cd1094151f628d75b7dbcc576ca8bf3ce0a1bce Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 16 Apr 2014 01:49:02 +0200 Subject: [PATCH] Add Makefile for filters (needs to be made crossplatform later) --- gfx/filters/2xbr.c | 4 +++ gfx/filters/Makefile | 60 +++++++++++++++++++++++++++++++++++++++++++ gfx/filters/darken.c | 4 +++ gfx/filters/link.T | 4 +++ gfx/filters/scale2x.c | 4 +++ 5 files changed, 76 insertions(+) create mode 100644 gfx/filters/Makefile create mode 100644 gfx/filters/link.T diff --git a/gfx/filters/2xbr.c b/gfx/filters/2xbr.c index 687d1e69cf..842b053815 100644 --- a/gfx/filters/2xbr.c +++ b/gfx/filters/2xbr.c @@ -18,6 +18,10 @@ #include "softfilter.h" #include +#ifdef RARCH_INTERNAL +#define softfilter_get_implementation twoxbr_get_implementation +#endif + #define TWOXBR_SCALE 2 static uint8_t initialized = 0; diff --git a/gfx/filters/Makefile b/gfx/filters/Makefile new file mode 100644 index 0000000000..5115c9aac5 --- /dev/null +++ b/gfx/filters/Makefile @@ -0,0 +1,60 @@ +compiler := gcc +extra_flags := +use_neon := 0 + +ifndef platform +platform := $(shell $(compiler) -dumpmachine) +endif + +ifneq (,$(findstring armv7,$(platform))) +extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon +use_neon := 1 +endif + +ifneq (,$(findstring hardfloat,$(platform))) +extra_flags += -mfloat-abi=hard +endif + +ifeq (release,$(build)) +extra_flags += -O2 +endif + +ifeq (debug,$(build)) +extra_flags += -O0 -g +endif + +cc := $(compiler) +cpp := $(subst cc,++,$(compiler)) -std=gnu++0x +flags := -fPIC $(extra_flags) +asflags := -fPIC $(extra_flags) +ldflags := -shared -Wl,--version-script=link.T +objects := +flags += -std=c99 + + +ifeq (1,$(use_neon)) +ASMFLAGS := -INEON/asm +asflags += -mfpu=neon +endif + +objects += 2xbr.so darken.so scale2x.so + +all: build; + +%.o: %.S + $(cc) -c -o $@ $(asflags) $(ASMFLAGS) $< + +%.o: %.c + $(cc) -c -o $@ $(flags) $< + +%.so: %.o + $(cc) -o $@ $(ldflags) $(flags) $^ + +build: $(objects) + +clean: + rm -f *.o + rm -f *.so + +strip: + strip -s *.so diff --git a/gfx/filters/darken.c b/gfx/filters/darken.c index 5960648c13..854a82018a 100644 --- a/gfx/filters/darken.c +++ b/gfx/filters/darken.c @@ -20,6 +20,10 @@ #include "softfilter.h" #include +#ifdef RARCH_INTERNAL +#define softfilter_get_implementation darken_get_implementation +#endif + static unsigned darken_input_fmts(void) { return SOFTFILTER_FMT_XRGB8888 | SOFTFILTER_FMT_RGB565; diff --git a/gfx/filters/link.T b/gfx/filters/link.T new file mode 100644 index 0000000000..478b8b5053 --- /dev/null +++ b/gfx/filters/link.T @@ -0,0 +1,4 @@ +{ + global: softfilter_*; + local: *; +}; diff --git a/gfx/filters/scale2x.c b/gfx/filters/scale2x.c index 2ef099571a..043934646c 100644 --- a/gfx/filters/scale2x.c +++ b/gfx/filters/scale2x.c @@ -18,6 +18,10 @@ #include "softfilter.h" #include +#ifdef RARCH_INTERNAL +#define softfilter_get_implementation scale2x_get_implementation +#endif + #define SCALE2X_SCALE 2 #define SCALE2X_GENERIC(width, height, first, last, src, src_stride, dst, dst_stride) \