-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
162 lines (129 loc) · 4.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
###################################
# Where to install
INSTALL_PREFIX = $(DESTDIR)/usr/local
###################################
# Where to find libraries, and their header files.
LIBPATHS = -L/usr/local/lib
INCLUDE = -I/usr/local/include
ifdef FFTW_PATH
LIBPATHS += -L$(FFTW_PATH)/lib
INCLUDE += -I$(FFTW_PATH)/include
endif
###################################
# FFTW3 libraries for single and double precision
FFTW_LIB = -lfftw3 -lfftw3f
###################################
# Binaries
FLEX = flex
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
AS = $(CROSS_COMPILE)as
###################################
# Flags
CC_WARN = -Wall -Wpointer-arith -Wshadow \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs
CC_FLAGS = $(DEFINE) -O2
CC_FPIC = -fPIC
LD_SHARED = -shared
###################################
# Objects and libs for targets
BRUTEFIR_LIBS = $(FFTW_LIB) -lm
BRUTEFIR_OBJS = brutefir.o fftw_convolver.o bfconf.o bfrun.o firwindow.o \
emalloc.o shmalloc.o dai.o bfconf_lexical.o inout.o dither.o delay.o
BRUTEFIR_SSE_OBJS = convolver_xmm.o
BFIO_FILE_OBJS = bfio_file.fpic.o
BFIO_ALSA_LIBS = -lasound
BFIO_ALSA_OBJS = bfio_alsa.fpic.o emalloc.fpic.o inout.fpic.o
BFIO_OSS_OBJS = bfio_oss.fpic.o emalloc.fpic.o
BFIO_JACK_LIBS = -ljack
BFIO_JACK_OBJS = bfio_jack.fpic.o emalloc.fpic.o inout.fpic.o
BFLOGIC_CLI_OBJS = bflogic_cli.fpic.o inout.fpic.o
BFLOGIC_EQ_OBJS = bflogic_eq.fpic.o emalloc.fpic.o shmalloc.fpic.o
BIN_TARGETS = brutefir
LIB_TARGETS = cli.bflogic eq.bflogic file.bfio
###################################
# System-specific settings
UNAME = $(shell uname)
UNAME_P = $(shell uname -p)
UNAME_M = $(shell uname -m)
# Linux
ifeq ($(UNAME),Linux)
ifeq ($(ARCH),arm)
BRUTEFIR_OBJS += $(BRUTEFIR_SSE_OBJS)
CC_FLAGS += -mfloat-abi=softfp -mfpu=neon -std=gnu99 -D__NEON__ -D__ARCH_ARM__
endif
ifeq ($(UNAME_M),i586)
BRUTEFIR_OBJS += $(BRUTEFIR_SSE_OBJS)
CC_FLAGS += -msse
endif
ifeq ($(UNAME_M),i686)
BRUTEFIR_OBJS += $(BRUTEFIR_SSE_OBJS)
CC_FLAGS += -msse
endif
ifeq ($(UNAME_M),x86_64)
BRUTEFIR_OBJS += $(BRUTEFIR_SSE_OBJS)
CC_FLAGS += -msse
endif
BRUTEFIR_LIBS += -ldl
LDMULTIPLEDEFS = -Xlinker --allow-multiple-definition
# assume that we have alsa, osss and jack
LIB_TARGETS += alsa.bfio
LIB_TARGETS += oss.bfio
LIB_TARGETS += jack.bfio
endif
# Solaris
ifeq ($(UNAME),SunOS)
CC_WARN = -Wall -Wlong-long -Wpointer-arith -Wshadow \
-Wcast-qual -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations \
-Wnested-externs
ifeq ($(UNAME_P),sparc)
CC_FLAGS += -Wa,-xarch=v8plus
endif
BRUTEFIR_LIBS += -lrt -ldl
endif
# FreeBSD
ifeq ($(UNAME),FreeBSD)
ifeq ($(UNAME_M),i386)
BRUTEFIR_OBJS += $(BRUTEFIR_IA32_OBJS)
endif
# assume that we have oss
LIB_TARGETS += oss.bfio
endif
TARGETS = $(BIN_TARGETS) $(LIB_TARGETS)
###################################
# Targets
all: $(TARGETS)
%.o: %.s
$(AS) -o $@ $<
%.fpic.o: %.c
$(CC) -o $@ -c $(INCLUDE) $(CC_FPIC) $(CC_WARN) $(CC_FLAGS) $<
%.o: %.c
$(CC) -o $@ -c $(INCLUDE) $(CC_WARN) $(CC_FLAGS) $<
# special rule to avoid to get warnings from code generated by flex
bfconf_lexical.o: bfconf_lexical.c
$(CC) -o $@ -c $(INCLUDE) $(CC_FLAGS) $<
%.c: %.lex
$(FLEX) -o$@ $<
brutefir: $(BRUTEFIR_OBJS)
$(CC) $(LIBPATHS) $(LDMULTIPLEDEFS) -o $@ $(BRUTEFIR_OBJS) $(BRUTEFIR_LIBS)
alsa.bfio: $(BFIO_ALSA_OBJS)
$(LD) $(LD_SHARED) $(CC_FPIC) $(LIBPATHS) -o $@ $(BFIO_ALSA_OBJS) $(BFIO_ALSA_LIBS) -lc
oss.bfio: $(BFIO_OSS_OBJS)
$(LD) $(LD_SHARED) $(CC_FPIC) $(LIBPATHS) -o $@ $(BFIO_OSS_OBJS) -lc
jack.bfio: $(BFIO_JACK_OBJS)
$(LD) $(LD_SHARED) $(CC_FPIC) $(LIBPATHS) -o $@ $(BFIO_JACK_OBJS) $(BFIO_JACK_LIBS) -lc
file.bfio: $(BFIO_FILE_OBJS)
$(LD) $(LD_SHARED) $(CC_FPIC) $(LIBPATHS) -o $@ $(BFIO_FILE_OBJS) -lc
cli.bflogic: $(BFLOGIC_CLI_OBJS)
$(LD) $(LD_SHARED) $(CC_FPIC) $(LIBPATHS) -o $@ $(BFLOGIC_CLI_OBJS) -lc
eq.bflogic: $(BFLOGIC_EQ_OBJS)
$(LD) $(LD_SHARED) $(CC_FPIC) $(LIBPATHS) -o $@ $(BFLOGIC_EQ_OBJS) -lc
install: $(BIN_TARGETS) $(LIB_TARGETS)
install -d $(INSTALL_PREFIX)/bin $(INSTALL_PREFIX)/lib/brutefir
install $(BIN_TARGETS) $(INSTALL_PREFIX)/bin
install $(LIB_TARGETS) $(INSTALL_PREFIX)/lib/brutefir
clean:
rm -f *.core core bfconf_lexical.c $(BRUTEFIR_OBJS) $(BFIO_FILE_OBJS) \
$(BFLOGIC_CLI_OBJS) $(BFLOGIC_EQ_OBJS) $(BFIO_ALSA_OBJS) $(BFIO_OSS_OBJS) \
$(BFIO_JACK_OBJS) $(TARGETS)