1compiler    := gcc
2extra_flags :=
3use_neon    := 0
4build       = release
5DYLIB	      := so
6PREFIX      := /usr
7INSTALLDIR  := $(PREFIX)/lib/retroarch/filters/audio
8
9ifeq ($(platform),)
10   platform = unix
11   ifeq ($(shell uname -s),)
12      platform = win
13   else ifneq ($(findstring Darwin,$(shell uname -s)),)
14      platform = osx
15      arch     = intel
16      ifeq ($(shell uname -p),powerpc)
17         arch = ppc
18      endif
19   else ifneq ($(findstring MINGW,$(shell uname -s)),)
20      platform = win
21   endif
22endif
23
24ifeq ($(platform),gcc)
25   extra_rules_gcc := $(shell $(compiler) -dumpmachine)
26endif
27
28ifneq (,$(findstring armv7,$(extra_rules_gcc)))
29   extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon
30   use_neon := 1
31endif
32
33ifneq (,$(findstring hardfloat,$(extra_rules_gcc)))
34   extra_flags += -mfloat-abi=hard
35endif
36
37ifeq (release,$(build))
38   extra_flags += -O2
39endif
40
41ifeq (debug,$(build))
42   extra_flags += -O0 -g
43endif
44
45ldflags := $(LDFLAGS) -shared -lm -Wl,--version-script=link.T
46
47ifeq ($(platform), unix)
48   DYLIB = so
49else ifeq ($(platform), osx)
50   compiler := $(CC)
51   DYLIB = dylib
52   ldflags := -dynamiclib
53else
54   extra_flags += -static-libgcc -static-libstdc++
55   DYLIB = dll
56endif
57
58CC      := $(compiler) -Wall
59CXX     := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall
60flags   := $(CPPFLAGS) $(CFLAGS) -fPIC $(extra_flags) -I../../include
61asflags := $(ASFLAGS) -fPIC  $(extra_flags)
62objects :=
63
64ifeq (1,$(use_neon))
65   ASMFLAGS := -INEON/asm
66   asflags += -mfpu=neon
67endif
68
69plugs := $(wildcard *.c)
70objects := $(plugs:.c=.o)
71targets := $(objects:.o=.$(DYLIB))
72
73all: build;
74
75%.o: %.S
76	$(CC) -c -o $@ $(asflags)  $(ASMFLAGS)  $<
77
78%.o: %.c
79	$(CC) -c -o $@ $(flags) $<
80
81%.$(DYLIB): %.o
82	$(CC) -o $@ $(ldflags) $(flags) $^
83
84build: $(targets)
85
86clean:
87	rm -f *.o
88	rm -f *.$(DYLIB)
89
90strip:
91	strip -s *.$(DYLIB)
92
93install:
94	mkdir -p $(DESTDIR)$(INSTALLDIR)
95	cp -t $(DESTDIR)$(INSTALLDIR) $(targets) *.dsp
96
97test-install:
98	DESTDIR=/tmp/build $(MAKE) install
99