-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (43 loc) · 1.47 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
LIBS ?= -lpcap -lstdc++
RELEASEFLAGS ?= -O0 -Wall -g
#CXXFLAGS ?= --std=c++0x
# auto-detect if bsd/strings.h is available
ifeq ($(shell $(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFS) -E -o /dev/null \
make-checks/libbsd.cpp 2>/dev/null; echo $$?),0)
BSDSTR_DEFS := -DUSE_BSD_STRING_H
BSDSTR_LIBS := -lbsd
endif
# auto-detect rhel/fedora and debian/ubuntu
ifneq ($(wildcard /etc/redhat-release),)
EXTRA_INSTALL := install-redhat
endif
ifneq ($(wildcard /etc/debian_version),)
EXTRA_INSTALL := install-debian
endif
all: make-checks/all pcapsipdump
include make-checks/*.mk
pcapsipdump: make-checks *.cpp *.h
$(CXX) $(RELEASEFLAGS) $(CXXFLAGS) $(LDFLAGS) $(DEFS) $(BSDSTR_DEFS) \
*.cpp \
$(LIBS) $(BSDSTR_LIBS) \
-o pcapsipdump
pcapsipdump-debug: make-checks *.cpp *.h
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFS) $(BSDSTR_DEFS) -ggdb \
*.cpp \
$(LIBS) $(BSDSTR_LIBS) -pg \
-o pcapsipdump-debug
clean: make-checks/clean
rm -f pcapsipdump pcapsipdump-debug gmon.out
install: pcapsipdump $(EXTRA_INSTALL)
install pcapsipdump ${DESTDIR}/usr/sbin/pcapsipdump
mkdir -p ${DESTDIR}/var/spool/pcapsipdump
chmod 0700 ${DESTDIR}/var/spool/pcapsipdump
install-redhat:
install redhat/pcapsipdump.init ${DESTDIR}/etc/rc.d/init.d/pcapsipdump
install redhat/pcapsipdump.sysconfig ${DESTDIR}/etc/sysconfig/pcapsipdump
install-debian:
install debian/pcapsipdump.init ${DESTDIR}/etc/init.d/pcapsipdump
install debian/pcapsipdump.default ${DESTDIR}/etc/default/pcapsipdump
.PHONY: tests
tests:
make -C tests