1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-11-23 17:32:59 +01:00

Migrate to makefile

This commit is contained in:
Pavel Odintsov 2013-11-14 12:21:18 +04:00
parent aef1d35a73
commit c7ef9f9001
2 changed files with 29 additions and 25 deletions

29
Makefile Normal file

@ -0,0 +1,29 @@
all: fastnetmon
ENGINE = ULOG2
#ENGINE = PCAP
REDIS_SUPPORT = yes
# we use C++ 11 threads. We must include pthread library due gcc bug
LIBS += -lpthread
DEFINES += -D$(ENGINE)
ifeq ($(REDIS_SUPPORT), yes)
LIBS += -lhiredis
DEFINES += -DREDIS
endif
ifeq ($(ENGINE), PCAP)
LIBS = -lpcap
endif
fastnetmon: libipulog.o fastnetmon.o
g++ libipulog.o fastnetmon.o -o fastnetmon $(LIBS)
libipulog.o: libipulog.c
g++ -c libipulog.c -o libipulog.o -Wno-write-strings
fastnetmon.o: fastnetmon.cpp
g++ $(DEFINES) -c fastnetmon.cpp -o fastnetmon.o -std=c++11
clean:
rm -f libipulog.o fastnetmon.o fastnetmon

@ -1,25 +0,0 @@
#!/bin/bash
ENGINE=ULOG2
#ENGINE=PCAP
# we use C++ 11 threads. We must include pthread library due gcc bug
LIBS="-l pthread"
if [ "PCAP" == $ENGINE ]; then
LIBS="$LIBS -lpcap"
fi
# enabled by default
REDIS_SUPPORT="yes"
if [ "yes" == $REDIS_SUPPORT ]; then
LIBS="$LIBS -lhiredis"
fi
# TODO вынести в опции подключаемые либы
g++ libipulog.c -c -o libipulog.o -Wno-write-strings
# -std=c++11
g++ -DREDIS -D$ENGINE fastnetmon.cpp libipulog.o $LIBS -o fastnetmon -std=c++11 -g