add a thp-based huge page alloc fallback
[pcsx_rearmed.git] / deps / libretro-common / audio / dsp_filters / Makefile
CommitLineData
3719602c
PC
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
53 ARCHFLAGS=
54 MINVERFLAGS=
55 ifeq ($(shell uname -p),arm)
56 MINVERFLAGS = -mmacosx-version-min=10.15 -stdlib=libc++ # macOS (Metal, ARM 64bit)
57 else ifeq ($(HAVE_METAL),1)
58 MINVERFLAGS = -mmacosx-version-min=10.13 -stdlib=libc++ # macOS (Metal, x86 64bit)
59 else ifeq ($(shell uname -p),powerpc)
60 MINVERFLAGS = -mmacosx-version-min=10.5 # macOSX (PowerPC 32-bit)
61 else ifeq ($(shell uname -m),i386)
62 MINVERFLAGS = -mmacosx-version-min=10.6 # macOSX (OpenGL, x86 32bit)
63 else
64 MINVERFLAGS = -mmacosx-version-min=10.7 -stdlib=libc++ # macOSX (OpenGL, x86 64bit)
65 endif
66
67 # Build for a specific architecture when ARCH is defined as a switch
68 ifeq ($(ARCH),arm64)
69 MINVERFLAGS = -mmacosx-version-min=10.15 -stdlib=libc++ # macOS (Metal, ARM 64bit)
70 ARCHFLAGS = -arch arm64
71 else ifeq ($(ARCH),x86_64)
72 ifeq ($(HAVE_METAL),1)
73 MINVERFLAGS = -mmacosx-version-min=10.13 -stdlib=libc++
74 else
75 MINVERFLAGS = -mmacosx-version-min=10.7 -stdlib=libc++
76 endif
77 ARCHFLAGS = -arch x86_64
78 else ifeq ($(ARCH),x86)
79 MINVERFLAGS = -mmacosx-version-min=10.6
80 ARCHFLAGS = -arch x86
81 else ifeq ($(ARCH),ppc)
82 MINVERFLAGS = -mmacosx-version-min=10.5
83 ARCHFLAGS = -arch ppc
84 endif
85 ifeq ($(BUILDBOT),1)
86 ARCHFLAGS = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT)
87 endif
88 extraflags += $(MINVERFLAGS) $(ARCHFLAGS)
89 ldflags += $(MINVERFLAGS) $(ARCHFLAGS)
90else
91 extra_flags += -static-libgcc -static-libstdc++
92 DYLIB = dll
93endif
94
95CC := $(compiler) -Wall
96CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall
97flags := $(CPPFLAGS) $(CFLAGS) -fPIC $(extra_flags) -I../../include
98asflags := $(ASFLAGS) -fPIC $(extra_flags)
99objects :=
100
101ifeq (1,$(use_neon))
102 ASMFLAGS := -INEON/asm
103 asflags += -mfpu=neon
104endif
105
106plugs := $(wildcard *.c)
107objects := $(plugs:.c=.o)
108targets := $(objects:.o=.$(DYLIB))
109
110all: build;
111
112%.o: %.S
113 $(CC) -c -o $@ $(asflags) $(ASMFLAGS) $<
114
115%.o: %.c
116 $(CC) -c -o $@ $(flags) $<
117
118%.$(DYLIB): %.o
119 $(CC) -o $@ $(ldflags) $(flags) $^
120
121build: $(targets)
122
123clean:
124 rm -f *.o
125 rm -f *.$(DYLIB)
126
127strip:
128 strip -s *.$(DYLIB)
129
130install:
131 mkdir -p $(DESTDIR)$(INSTALLDIR)
132 cp -t $(DESTDIR)$(INSTALLDIR) $(targets) *.dsp
133
134test-install:
135 DESTDIR=/tmp/build $(MAKE) install