#
# Makefile for tcp net
# Yes, it's gnu-make specific.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#


CC=gcc
CFLAGS=-I/usr/include -O2 -Wall -g
LDLIBS=

BASE=/usr
VERSION=0.6

CFLAGS+=-DVERSION=\"$(VERSION)\"
DISTDIR=tcpnet-$(VERSION)


all: tcpnet

tcpnet: libtcpnet.a

libtcpnet.a: tn_internal.o tn_setup.o tn_read.o tn_write.o
	rm -f libtcpnet.a
	ar cru libtcpnet.a tn_internal.o tn_setup.o tn_read.o tn_write.o

test: tn_test
	./tn_test

tn_test: libtcpnet.a tn_test.o tn_testlib.o
	gcc -o tn_test tn_test.o tn_testlib.o libtcpnet.a

depend:
	makedepend -- $(CFLAGS) -- *.c

clean:
	rm -rf *.o *.bak *~

distclean: clean
	rm -rf tcpnet-[0-9].[0-9]* libtcpnet.a tn_test

distlist: distclean
DISTLIST=$(shell find $(PWD) -mindepth 1)

distdir: distlist
	mkdir $(DISTDIR)
	cp -a $(DISTLIST) $(DISTDIR)

dist: distdir
	tar chozf $(DISTDIR).tar.gz $(DISTDIR)
	rm -rf $(DISTDIR)
