-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (62 loc) · 1.95 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
CFLAGS = -Wall -Wextra -pedantic -fPIC
PREFIX = /usr/local
LIBDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/man/man3
HDRS = audio.h
LIBS = libaudio.a libaudio.so
OBJS = audio.o pcm.o wav.o
MAN3 = libaudio.3
TEST = test-file test-rw
all: $(LIBS)
libaudio.a: $(OBJS)
ar -r libaudio.a $(OBJS)
libaudio.so: $(OBJS)
$(CC) -shared -o libaudio.so $(OBJS)
audio.o: $(HDRS) audio.c pcm.h
$(CC) $(CFLAGS) -c audio.c
pcm.o: $(HDRS) pcm.c pcm.h
$(CC) $(CFLAGS) -c pcm.c
wav.o: $(HDRS) wav.c wav.h
$(CC) $(CFLAGS) -c wav.c
lint: $(MAN3)
mandoc -Tlint -Wstyle $(MAN3)
install: $(LIBS) $(HDRS) $(MAN3) lint
install -d $(LIBDIR)
install -d $(INCDIR)
install -d $(MANDIR)
install $(LIBS) $(LIBDIR)
install $(HDRS) $(INCDIR)
install $(MAN3) $(MANDIR)
test: $(TEST)
./test-file 2> /dev/null
./test-rw 2> /dev/null
play: $(TEST)
./test-rw -l 2
play -c 1 -r 48000 -e float -b 32 -L pcm-f32le.raw
play -c 1 -r 48000 -e float -b 32 -B pcm-f32be.raw
play -c 1 -r 48000 -e signed -b 32 -L pcm-s32le.raw
play -c 1 -r 48000 -e signed -b 32 -B pcm-s32be.raw
play -c 1 -r 48000 -e signed -b 16 -L pcm-s16le.raw
play -c 1 -r 48000 -e signed -b 16 -B pcm-s16be.raw
play -c 1 -r 48000 -e signed -b 8 pcm-s08.raw
play -c 1 -r 48000 -e unsigned -b 32 -L pcm-u32le.raw
play -c 1 -r 48000 -e unsigned -b 32 -B pcm-u32be.raw
play -c 1 -r 48000 -e unsigned -b 16 -L pcm-u16le.raw
play -c 1 -r 48000 -e unsigned -b 16 -B pcm-u16be.raw
play -c 1 -r 48000 -e unsigned -b 8 pcm-u08.raw
diff: $(TEST)
./test-rw -l 2
play `printf -- "-c 1 -r 48000 -e float -b 32 %s " diff*.raw`
test-file: test-file.c $(LIBS) $(HDRS)
$(CC) $(CFLAGS) -o test-file test-file.c libaudio.a
test-rw: test-rw.c $(LIBS) $(HDRS)
$(CC) $(CFLAGS) -lm -o test-rw test-rw.c libaudio.a
uninstall:
cd $(LIBDIR) && rm -f $(LIBS)
cd $(INCDIR) && rm -f $(HDRS)
cd $(MANDIR) && rm -f $(MAN3)
clean:
rm -f $(LIBS) $(OBJS) $(TEST)
rm -f *.raw *.core *~