#	Makefile for trafshow program.

DEFS	= 
DEBUG   = 

ARCH    = #-bi486-linuxaout  

CC	= gcc
# LD	= ld # Not used
CFLAGS  = -O6  -Wall -I/usr/include/ncurses
LDFLAGS = # -s
LIBS	= -lncurses

ifdef PROF
CFLAGS  = -O6 -pg -Wall
LDFLAGS = -pg
LIBS	= -lncurses_p#  -lgcc -lc -lgmon -lgcc
endif

ifdef DEBUG
CFLAGS  = -O6 -fomit-frame-pointer -Wall -g
LDFLAGS = -g
DEFS	= #-DDEBUG
endif

PROGS	= trafshow
INCS	= trafshow.h
SRCS 	= trafshow.c csum.c host.c table.c screen.c frag.c
OBJS    = trafshow.o csum.o host.o table.o screen.o frag.o
DOCS    = COPYING TODO trafshow.lsm trafshow.1
DIST    = Makefile $(SRCS) $(INCS) $(DOCS)

all:	.depend $(PROGS)

.c.o:   
	$(CC) $(ARCH) $(CFLAGS) $(DEFS) -c $<

trafshow: $(OBJS)
	$(CC) $(ARCH) $(LDFLAGS) -o $@ $^ $(LIBS)

tar:	$(DIST)
	tar -cvf - $^ | gzip -9c > trafshow-1.3.tgz

co:
	co -l $(DIST)

ci:
	ci $(DIST)

install: all
	install -o root -g root -s -m 4711 trafshow /usr/local/bin
	install -o root -g root trafshow.1 /usr/local/man/man1

dep depend .depend: $(SRCS) $(INCS) 
	gcc -M $(SRCS) > .depend

clean:
	rm -f $(PROGS) *.o *~ gmon.out

realclean:
	rm -f $(PROGS) *.o *~ gmon.out .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif
