| 1 |
# |
| 2 |
# ipband - IP bandwidth watchdog |
| 3 |
# Change this variables to match your installation |
| 4 |
# |
| 5 |
# Note: When the version changes, you also have to change |
| 6 |
# the RPM spec file |
| 7 |
|
| 8 |
V=0.8.1 |
| 9 |
|
| 10 |
MAKE=make |
| 11 |
|
| 12 |
CPPFLAGS=-I/usr/include/pcap |
| 13 |
LIBS=-lpcap |
| 14 |
CFLAGS := -Wall $(CFLAGS) |
| 15 |
CC=gcc |
| 16 |
|
| 17 |
ifndef PREFIX |
| 18 |
PREFIX=/usr |
| 19 |
endif |
| 20 |
|
| 21 |
ifndef BINDIR |
| 22 |
BINDIR=$(PREFIX)/sbin |
| 23 |
endif |
| 24 |
|
| 25 |
ifndef MANDIR |
| 26 |
MANDIR=$(PREFIX)/share/man |
| 27 |
endif |
| 28 |
|
| 29 |
ifndef MAN8DIR |
| 30 |
MAN8DIR=$(MANDIR)/man8 |
| 31 |
endif |
| 32 |
|
| 33 |
ifndef SYSCONFDIR |
| 34 |
#SYSCONFDIR=$(PREFIX)/etc |
| 35 |
SYSCONFDIR=/etc |
| 36 |
endif |
| 37 |
|
| 38 |
ifndef RCDIR |
| 39 |
RCDIR=$(SYSCONFDIR)/rc.d/init.d |
| 40 |
endif |
| 41 |
|
| 42 |
|
| 43 |
BIN = ipband |
| 44 |
SRC_C = main.c error.c init.c packets.c \ |
| 45 |
pcapfunc.c popen.c reports.c utils.c hash.c |
| 46 |
OBJ_C = $(SRC_C:.c=.o) |
| 47 |
|
| 48 |
|
| 49 |
all: $(BIN) |
| 50 |
|
| 51 |
$(BIN): $(OBJ_C) |
| 52 |
$(CC) -o $(BIN) $(OBJ_C) $(LIBS) $(CFLAGS) |
| 53 |
strip $(BIN) |
| 54 |
|
| 55 |
install-strip: install |
| 56 |
|
| 57 |
install: all |
| 58 |
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN8DIR) |
| 59 |
mkdir -p $(DESTDIR)$(SYSCONFDIR) |
| 60 |
mkdir -p $(DESTDIR)$(RCDIR) |
| 61 |
install -D ipband $(DESTDIR)$(BINDIR)/ipband |
| 62 |
install -D ipband.8 $(DESTDIR)$(MAN8DIR)/ipband.8 |
| 63 |
install -D ipband.sample.conf $(DESTDIR)$(SYSCONFDIR)/ipband.sample.conf |
| 64 |
install -D ipband.rc $(DESTDIR)$(RCDIR)/ipband |
| 65 |
|
| 66 |
|
| 67 |
clean: |
| 68 |
rm -f *.o |
| 69 |
rm -f ipband |
| 70 |
|
| 71 |
|
| 72 |
# |
| 73 |
# ------------------------------------------------------------------------- |
| 74 |
# |
| 75 |
# If we need rpm |
| 76 |
|
| 77 |
SRC_ROOT = Makefile CHANGELOG COPYING README INSTALL ipband.spec styles.css |
| 78 |
SRC_SRCS = Makefile *.c *.h ipband.8 |
| 79 |
SRC_CONF = ipband.sample.conf ipband.rc |
| 80 |
|
| 81 |
tgz: |
| 82 |
mkdir ipband-$(V) |
| 83 |
cp $(SRC_ROOT) ipband-$(V)/ |
| 84 |
cp $(SRC_SRCS) ipband-$(V)/ |
| 85 |
cp $(SRC_CONF) ipband-$(V)/ |
| 86 |
tar -czvf ipband-$(V).tgz ipband-$(V)/ |
| 87 |
rm -rf ipband-$(V) |
| 88 |
|
| 89 |
rpm: tgz |
| 90 |
mv ipband-$(V).tgz /usr/src/redhat/SOURCES |
| 91 |
cp ipband.spec /usr/src/redhat/SPECS |
| 92 |
rpmbuild -bb ipband.spec |