
## tgat
## Mark Allman (mallman@icir.org)

## Copyright (c) 2004 International Computer Science Institute
## 
## Permission is hereby granted, free of charge, to any person
## obtaining a copy of this software and associated documentation files
## (the "Software"), to deal in the Software without restriction,
## including without limitation the rights to use, copy, modify, merge,
## publish, distribute, sublicense, and/or sell copies of the Software,
## and to permit persons to whom the Software is furnished to do so,
## subject to the following conditions:
## 
## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
## 
## The names and trademarks of copyright holders may not be used in
## advertising or publicity pertaining to the software without specific
## prior permission. Title to copyright in this software and any
## associated documentation will at all times remain with the copyright
## holders.
## 
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.

VERSION=2.0

CC=gcc
CFLAGS=-g -Wall -Werror -DVERSION=$(VERSION) -Icommon -Itraffic-src -Idiscardd-src $(OTHER)
LD=gcc
LDFLAGS=$(CFLAGS)
LIBS=-lpcap

DOBJS=alrm.o dargs.o discardd.o error.o iface.o dnetwork.o trace.o tv.o
TOBJS=alrm.o targs.o cnns.o error.o iface.o tnetwork.o trace.o traffic.o tv.o

all: traffic discardd

## traffic

traffic: $(TOBJS)
	$(LD) $(LDFLAGS) -o traffic $(TOBJS) $(LIBS)

targs.o: traffic-src/targs.c traffic-src/traffic.h
	$(CC) $(CFLAGS) -c traffic-src/targs.c

cnns.o: traffic-src/cnns.c traffic-src/traffic.h
	$(CC) $(CFLAGS) -c traffic-src/cnns.c

tnetwork.o: traffic-src/tnetwork.c 
	$(CC) $(CFLAGS) -c traffic-src/tnetwork.c

traffic.o: traffic-src/traffic.c traffic-src/traffic.h
	$(CC) $(CFLAGS) -c traffic-src/traffic.c

## discradd

discardd: $(DOBJS)
	$(LD) $(LDFLAGS) -o discardd $(DOBJS) $(LIBS)

dargs.o: discardd-src/dargs.c discardd-src/discardd.h
	$(CC) $(CFLAGS) -c discardd-src/dargs.c

discardd.o: discardd-src/discardd.c discardd-src/discardd.h
	$(CC) $(CFLAGS) -c discardd-src/discardd.c

dnetwork.o: discardd-src/dnetwork.c discardd-src/discardd.h
	$(CC) $(CFLAGS) -c discardd-src/dnetwork.c

## common

alrm.o: common/alrm.c common/tgat-common.h
	$(CC) $(CFLAGS) -c common/alrm.c

error.o: common/error.c
	$(CC) $(CFLAGS) -c common/error.c

iface.o: common/iface.c common/tgat-common.h
	$(CC) $(CFLAGS) -c common/iface.c

trace.o: common/trace.c common/tgat-common.h
	$(CC) $(CFLAGS) -c common/trace.c

tv.o: common/tv.c
	$(CC) $(CFLAGS) -c common/tv.c

## misc.

tar:
	tar czf tgat-$(VERSION).tar.gz * --exclude CVS --exclude Notes
	mkdir tgat-$(VERSION)
	cd tgat-$(VERSION); tar xzf ../tgat-$(VERSION).tar.gz; cd ..
	tar czf tgat-$(VERSION).tar.gz tgat-$(VERSION)/
	rm -rf tgat-$(VERSION)

clean:
	rm -f *.o *core core 

distclean: clean
	rm -f traffic discardd
	rm -f tgat-$(VERSION).tar.gz
