# Makefile for the pingtunnel utility
# (c) 2004-2005 Daniel Stdle, daniels@stud.cs.uit.no

CC	 		= gcc
CFLAGS		= -Wall -g
LDOPTS		= -lpthread -lpcap
PT_OBJS		= ptunnel.o
prefix		= /usr
bindir		= $(prefix)/bin

all: ptunnel

dist:
	rm -rf PingTunnel/
	mkdir PingTunnel
	cp ptunnel.c ptunnel.h Makefile.dist PingTunnel/
	mv PingTunnel/Makefile.dist PingTunnel/Makefile
	

install: ptunnel
	install -D ./ptunnel $(bindir)/ptunnel

ptunnel: $(PT_OBJS)
	$(CC) $(LDOPTS) -o $@ $^

clean:
	rm -f *.o ptunnel
	rm -f .depend

depend: .depend
.depend:
	$(CC) $(CFLAGS) -MM *.c > $@

%.o:%.c
	$(CC) $(CFLAGS) -c -o $@ $<

-include .depend
