-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathGNUmakefile
More file actions
55 lines (41 loc) · 1.18 KB
/
GNUmakefile
File metadata and controls
55 lines (41 loc) · 1.18 KB
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
.SUFFIXES: .So
VPATH = .
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)
OS_NAME:= $(shell uname -s)
ifeq ($(OS_NAME),Darwin)
SONAME= -install_name
PREFIX?= $(HOME)/Library/libg722
else
SONAME= -soname
PREFIX?= /usr/local
endif
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}