-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGNUmakefile
47 lines (34 loc) · 1.03 KB
/
GNUmakefile
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
.SUFFIXES: .So
VPATH = .
PREFIX?= /usr/local
LIBDIR= ${PREFIX}/lib
INCLUDEDIR= ${PREFIX}/include
SRCS_C= g722_decode.c g722_encode.c
SRCS_H= g722.h g722_private.h g722_encoder.h g722_decoder.h
CFLAGS?= -O2 -pipe -Wno-attributes
OBJS = $(SRCS_C:.c=.o)
OBJS_PIC = $(SRCS_C:.c=.So)
all: libg722.a libg722.so.0 libg722.so
libg722.a: $(OBJS) $(SRCS_H)
$(AR) cq $@ $(OBJS)
ranlib $@
libg722.so.0: $(OBJS_PIC) $(SRCS_H)
$(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS_PIC)
libg722.so: libg722.so.0
ln -sf libg722.so.0 $@
.c.o:
$(CC) -c $(CFLAGS) $< -o $@
.c.So:
$(CC) -fpic -DPIC -c $(CFLAGS) $< -o $@
clean:
rm -f libg722.a libg722.so.0 $(OBJS) $(OBJS_PIC) test *.out
test: test.c libg722.a libg722.so.0
${CC} ${CFLAGS} -o $@ test.c -lm -L. -lg722
LD_LIBRARY_PATH=. ./scripts/do-test.sh ./$@
install:
install -d ${DESTDIR}${LIBDIR}
install libg722.a ${DESTDIR}${LIBDIR}
install libg722.so.0 ${DESTDIR}${LIBDIR}
ln -sf libg722.so.0 ${DESTDIR}${LIBDIR}/libg722.so
install -d ${DESTDIR}${INCLUDEDIR}
install ${SRCS_H} ${DESTDIR}${INCLUDEDIR}