## Makefile ## ## copyright (c) 2010 SeaD ## ## $Id: Makefile,v 1.1.1.1 2012/02/21 21:59:41 misho Exp $ NAME=ipguard PREFIX?=/usr/local ETHERS?=/etc/ethers ## FreeBSD LOCALBASE=/usr/local LIBNET_CONFIG=libnet11-config ## OpenBSD (tested by irix) # LOCALBASE=/usr/local # LIBNET_CONFIG=libnet-config-1.1 ## Linux # LOCALBASE=/usr # LIBNET_CONFIG=libnet-config INCLUDES=`${LIBNET_CONFIG} --cflags` LIBS=`${LIBNET_CONFIG} --libs` -lpcap -L${LOCALBASE}/lib DEFINES=`${LIBNET_CONFIG} --defines` STATIC= CC=gcc CFLAGS+=-g -Wall -DETHERS='"$(ETHERS)"' OBJS=ethers.o ipguard.o packet.o system.o .c.o: @echo Compiling $*.c @$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< all: start $(NAME) start: @echo "Making $(NAME)" @echo "INCLUDES=$(INCLUDES)" @echo "LIBS=$(LIBS)" @echo "DEFINES=$(DEFINES)" @echo "CFLAGS=$(CFLAGS)" $(NAME): $(OBJS) @echo Linking $@ @$(CC) -o $@ $(OBJS) $(LIBS) $(STATIC) clean: @echo Cleaning OBJS @rm -f $(OBJS) cleanall: clean @echo Removing $(NAME) @rm -f $(NAME) install: all mkdir -p -m 755 $(PREFIX)/sbin install -s -m 755 $(NAME) $(PREFIX)/sbin/$(NAME) mkdir -p -m 755 $(PREFIX)/man/man8 install -m 644 doc/$(NAME).8 $(PREFIX)/man/man8/$(NAME).8 uninstall: deinstall deinstall: rm -f $(PREFIX)/man/man8/$(NAME).8 rm -f $(PREFIX)/sbin/$(NAME) ethers.o: ipguard.h ipguard.o: ipguard.h packet.o: ipguard.h system.o: ipguard.h