-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
75 lines (57 loc) · 1.81 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
# vim:ts=8:noet
#
# Makefile for rtpsniff.
# By Walter Doekes, 2009,2014.
ifeq ($(CFLAGS),)
CFLAGS = -Wall
endif
ifeq ($(LDFLAGS),)
# -lslowpoll goes first
LDFLAGS = -Wall -L./bin
endif
ifeq ($(LDLIBS),)
LDLIBS = -lslowpoll -lpthread -lpcap
endif
ifeq ($(PREFIX),)
PREFIX = /usr/local
endif
MOD_OUT := out_rtpsniff # hardcoded for now..
.PHONY: all clean distclean variables \
rtpsniff rtpsniff-debug rtpsniff-verbose
all: rtpsniff rtpsniff-debug
clean:
$(RM) -r bin
distclean: clean
variables:
@if test -z "$(MOD_OUT)"; then \
echo 'Please select output module through MOD_OUT:' >&2; \
echo ' make MOD_OUT=out_rtpsniff # for stream output' >&2; \
false; fi
rtpsniff: variables
APPNAME="$@" CPPFLAGS="$(CPPFLAGS) -DNDEBUG" \
CFLAGS="$(CFLAGS) -g -O3" LDFLAGS="$(LDFLAGS) -g -O3" \
MODULES="rtpsniff sniff_rtp $(MOD_OUT) timer_interval util" \
$(MAKE) bin/$@
@#strip bin/$@
rtpsniff-debug: variables
APPNAME="$@" CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(CFLAGS) -g -O0" LDFLAGS="$(LDFLAGS) -g" \
MODULES="rtpsniff sniff_rtp $(MOD_OUT) timer_interval util" \
$(MAKE) bin/$@
.PHONY: install uninstall
install: bin/rtpsniff bin/libslowpoll.so
install -DT -m 644 bin/libslowpoll.so $(PREFIX)/lib/libslowpoll.so
install -DT -m 755 bin/rtpsniff $(PREFIX)/sbin/rtpsniff
-ldconfig
uninstall:
$(RM) $(PREFIX)/lib/libslowpoll.so $(PREFIX)/sbin/rtpsniff
-ldconfig
$(addprefix bin/.$(APPNAME)/, $(addsuffix .o, $(MODULES))): Makefile endian.h rtpsniff.h
bin/libslowpoll.so: slowpoll.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -D_GNU_SOURCE -fPIC -shared -o $@ $< -ldl
bin/.$(APPNAME)/%.o: %.c
@mkdir -p $(dir $@)
$(COMPILE.c) $< -o $@
bin/$(APPNAME): bin/libslowpoll.so $(addprefix bin/.$(APPNAME)/, $(addsuffix .o, $(MODULES)))
$(LINK.o) -L./bin $(filter-out bin/libslowpoll.so, $^) $(LDLIBS) -o $@