-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (80 loc) · 2.03 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
.PHONY: all clean install docs bootstrap util
default: all
VERSION = 2.0.0-ydm-2.1.0
PREFIX ?= /usr/local
LIBSOUNDPIPE = libsoundpipe.a
ifndef CONFIG
CONFIG = config.mk
endif
HPATHS += $(addprefix h/, $(addsuffix .h, $(MODULES)))
MPATHS += $(addprefix modules/, $(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}
CFLAGS += -Ih -I/usr/local/include -fPIC
CFLAGS += -I.
CFLAGS += -Wall -pedantic
UTIL += util/wav2smp
C89=$(CC) -std=c89
C99=$(CC) -std=c99
libsoundpipe.a: $(MPATHS) $(LPATHS) $(TANGLED)
@echo "Creating $@"
@$(AR) rcs $@ $(MPATHS) $(LPATHS) $(TANGLED)
libsoundpipe.so: $(MPATHS) $(LPATHS) $(TANGLED)
@echo "Creating $@"
@$(CC) -shared -o libsoundpipe.so $(MPATHS) $(LPATHS) $(TANGLED)
libsoundpipe.dll: $(MPATHS) $(LPATHS) $(TANGLED)
@echo "Creating $@"
@$(CC) -shared -o libsoundpipe.dll $(MPATHS) $(LPATHS) $(TANGLED)
h/soundpipe.h: $(HPATHS)
echo "#ifndef SOUNDPIPE_H" > $@
ifdef USE_DOUBLE
echo "#define USE_DOUBLE" >> $@
endif
echo "#define SOUNDPIPE_H" >> $@
cat $(HPATHS) >> $@
echo "#endif" >> $@
h/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" >> $@
modules/%.o: modules/%.c h/soundpipe.h
$(C89) $(CFLAGS) -c -static $< -o $@
tangled/%.o: %.c h/soundpipe.h
$(C89) $(CFLAGS) -c -static $< -o $@
config.mk: config.def.mk
cp $< $@
sp_dict.lua:
cat modules/data/*.lua > $@
docs:
util/gendocs.sh
all: config.mk libsoundpipe.a sp_dict.lua h/sp_base.h
install: \
h/soundpipe.h \
h/sp_base.h \
libsoundpipe.a
install h/soundpipe.h /usr/local/include/
install h/sp_base.h /usr/local/include/
install libsoundpipe.a /usr/local/lib/
clean:
$(RM) h/soundpipe.h
$(RM) -r docs
$(RM) libsoundpipe.a
$(RM) libsoundpipe.so
$(RM) libsoundpipe.dll
$(RM) soundpipe.c
$(RM) sp_dict.lua
$(RM) $(LPATHS)
$(RM) $(MPATHS)
$(RM) $(TANGLED)
$(RM) h/sp_base.h