forked from shaunstanislaus/Soundpipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
124 lines (98 loc) · 3.23 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
.PHONY: all clean install docs bootstrap
default: all
VERSION = 1.6.0
INTERMEDIATES_PREFIX ?= .
PREFIX ?= /usr/local
LIBSOUNDPIPE = $(INTERMEDIATES_PREFIX)/libsoundpipe.a
SOUNDPIPEO = $(INTERMEDIATES_PREFIX)/soundpipe.o
MODDIR = $(INTERMEDIATES_PREFIX)/modules
HDIR = $(INTERMEDIATES_PREFIX)/h
UTILDIR = $(INTERMEDIATES_PREFIX)/util
LIBDIR = $(INTERMEDIATES_PREFIX)/lib
ifndef CONFIG
CONFIG = $(INTERMEDIATES_PREFIX)/config.mk
endif
HPATHS += $(addprefix h/, $(addsuffix .h, $(MODULES)))
CPATHS += $(addprefix modules/, $(addsuffix .c, $(MODULES)))
MPATHS += $(addprefix $(MODDIR)/, $(addsuffix .o, $(MODULES)))
include $(CONFIG)
ifeq ($(USE_DOUBLE), 1)
CFLAGS+=-DUSE_DOUBLE
SPFLOAT=double
else
SPFLOAT=float
endif
CFLAGS += -DSP_VERSION=$(VERSION) -O3 -DSPFLOAT=${SPFLOAT} -std=c99
CFLAGS += -I$(INTERMEDIATES_PREFIX)/h -Ih -I/usr/local/include -fPIC
CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
UTIL += $(INTERMEDIATES_PREFIX)/util/wav2smp
$(INTERMEDIATES_PREFIX) \
$(INTERMEDIATES_PREFIX)/h \
$(INTERMEDIATES_PREFIX)/modules \
$(INTERMEDIATES_PREFIX)/util \
$(PREFIX)/include \
$(PREFIX)/lib \
$(PREFIX)/share/doc/soundpipe:
mkdir -p $@
$(LIBSOUNDPIPE): $(MPATHS) $(LPATHS) | $(INTERMEDIATES_PREFIX)
$(AR) rcs $@ $(MPATHS) $(LPATHS)
$(HDIR)/soundpipe.h: $(HPATHS) | $(INTERMEDIATES_PREFIX)/h
echo "#ifndef SOUNDPIPE_H" >> $@
ifdef USE_DOUBLE
echo "#define USE_DOUBLE" >> $@
endif
echo "#define SOUNDPIPE_H" >> $@
cat $(HPATHS) >> $@
echo "#endif" >> $@
$(HDIR)/sp_base.h: h/base.h
>$@
echo "#ifndef SOUNDPIPE_H" >> $@
ifdef USE_DOUBLE
echo "#define USE_DOUBLE" >> $@
endif
echo "#define SOUNDPIPE_H" >> $@
cat $< >> $@
echo "#endif" >> $@
$(MODDIR)/%.o: modules/%.c h/%.h $(HDIR)/soundpipe.h | $(MODDIR)
$(CC) -Wall $(CFLAGS) -c -static $< -o $@
$(SOUNDPIPEO): $(MPATHS) $(LPATHS) | $(INTERMEDIATES_PREFIX)
$(CC) $(CFLAGS) -c -combine $(CPATHS) -o $@
$(INTERMEDIATES_PREFIX)/config.mk: config.def.mk | $(INTERMEDIATES_PREFIX)
cp $< $@
$(UTILDIR)/wav2smp: util/wav2smp.c | $(UTILDIR)
$(CC) $(CFLAGS) -L/usr/local/lib $< -lsndfile -o $@
stretcher: $(UTILDIR)/stretcher
$(UTILDIR)/stretcher: util/stretcher.c | $(UTILDIR)
$(CC) $(CFLAGS) -L/usr/local/lib $< -L. -lsoundpipe -lsndfile -lm -o $@
$(INTERMEDIATES_PREFIX)/sp_dict.lua: | $(INTERMEDIATES_PREFIX)
cat modules/data/*.lua > $@
bootstrap:
util/module_bootstrap.sh $(MODULE_NAME)
docs:
export INTERMEDIATES_PREFIX=$(INTERMEDIATES_PREFIX) && util/gendocs.sh
all: $(INTERMEDIATES_PREFIX)/config.mk \
$(INTERMEDIATES_PREFIX)/libsoundpipe.a \
$(INTERMEDIATES_PREFIX)/sp_dict.lua \
$(UTIL) \
$(HDIR)/sp_base.h
install: \
$(INTERMEDIATES_PREFIX)/h/soundpipe.h \
$(INTERMEDIATES_PREFIX)/libsoundpipe.a | \
$(PREFIX)/include \
$(PREFIX)/lib
install $(HDIR)/soundpipe.h $(PREFIX)/include/
install $(HDIR)/sp_base.h $(PREFIX)/include/
install $(LIBSOUNDPIPE) $(PREFIX)/lib/
clean:
rm -rf $(HDIR)/soundpipe.h
rm -rf $(INTERMEDIATES_PREFIX)/docs
rm -rf $(INTERMEDIATES_PREFIX)/gen_noise
rm -rf $(INTERMEDIATES_PREFIX)/libsoundpipe.a
rm -rf $(INTERMEDIATES_PREFIX)/soundpipe.c
rm -rf $(INTERMEDIATES_PREFIX)/sp_dict.lua
rm -rf $(LPATHS)
rm -rf $(MPATHS)
rm -rf $(UTIL)
rm -rf $(UTILDIR)/wav2smp.dSYM
rm -rf $(HDIR)/sp_base.h