#
#  This is the Makefile for IRC Bounce (an irc proxy)
#

VERSION=v2.0a

CC=gcc
TAR=tar
SRC=bnc.c help.c conf.c net.c fifo.c serv.c
OBJS=$(SRC:%.c=%.o)
INSTALL_DIR=/usr/local/bin
CFLAGS=-DVERSION='"${VERSION}"' -O6 -g3

all:	build

bnc.o: common.h bnc.c Makefile
	${CC} ${CFLAGS} -c bnc.c
help.o: common.h help.c Makefile
	${CC} ${CFLAGS} -c help.c
conf.o: common.h conf.c Makefile
	${CC} ${CFLAGS} -c conf.c
net.o: common.h net.c Makefile
	${CC} ${CFLAGS} -c net.c
fifo.o: common.h fifo.c Makefile
	${CC} ${CFLAGS} -c fifo.c
serv.o: common.h serv.c Makefile
	${CC} ${CFLAGS} -c serv.c

build: ${OBJS} Makefile
	${CC} -O3 -o bnc ${OBJS}
	@strip bnc
	@bnc -i

clean:
	@bnc -f
	@rm -rf core bnc bnc.log bnc.pid *.o *~

dist:   clean
	@rm -f bnc.conf
	@(PACKNAME=`basename \`pwd\`` ; cd .. ; touch --file $$PACKNAME/bnc.c $$PACKNAME $$PACKNAME/* ; $(TAR) cf - $$PACKNAME | gzip -9 >$$PACKNAME.tar.gz)

install: all
	@install -s -m 755 bnc $(INSTALL_DIR)
