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