# $Id: Makefile.in,v 1.36 2005/06/01 16:55:55 leeh Exp $

CC=@CC@
RM=@RM@
MV=@MV@
INSTALL=@INSTALL@
LEX=@LEX@
LEXLIB=@LEXLIB@
YACC=@YACC@
BIN=ratbox-services@EXEEXT@
INCLUDES=-I ../include/ @SQLITE_INCLUDES@
LDFLAGS=@LDFLAGS@
LIBS=@LIBS@
SQLITE_LIB=@SQLITE_LIB@
MAKE = make

prefix=@prefix@
sysconfdir=@sysconfdir@
localstatedir=@localstatedir@
logdir=@logdir@
rundir=@rundir@
helpdir=@helpdir@

CFLAGS=@CPPFLAGS@ @CFLAGS@ -DPREFIX=\"$(prefix)\" -DSYSCONFDIR=\"$(sysconfdir)\" \
	-DLOGDIR=\"$(logdir)\" -DRUNDIR=\"$(rundir)\" -DHELPDIR=\"$(helpdir)\"

# Anything marked with the .PHONY attribute is always considered "out of date"
.PHONY: $(BIN)

BSRCS = 		\
        balloc.c        \
        c_error.c       \
	c_message.c	\
	c_mode.c	\
        cache.c         \
	channel.c	\
	client.c	\
	crypt.c		\
	conf.c		\
	event.c		\
	hook.c		\
	io.c		\
	log.c		\
	match.c		\
	modebuild.c	\
        newconf.c       \
	rserv.c		\
	scommand.c	\
	service.c	\
	tools.c		\
        u_stats.c       \
	ucommand.c

SRCS = ${BSRCS} @S_NICKSERV@ @S_USERSERV@ @S_CHANSERV@ @S_OPERSERV@ @S_ALIS@\
	@S_OPERBOT@ @S_JUPESERV@ @S_GLOBAL@ @S_BANSERV@

OBJS=$(SRCS:.c=.o)

all: $(BIN)

$(BIN): $(OBJS) y.tab.o lex.yy.o
	${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} y.tab.o lex.yy.o $(SQLITE_LIB) $(LIBS) $(LEXLIB)

.c.o:
	${CC} $(INCLUDES) ${CFLAGS} -c $<

y.tab.o:	y.tab.c parser.y
	$(CC) $(INCLUDES) -I. $(CFLAGS) -c y.tab.c

y.tab.c:	parser.y
	$(YACC) -d parser.y

lex.yy.o:	lex.yy.c lexer.l
	$(CC) $(INCLUDES) -I. $(CFLAGS) -c lex.yy.c

lex.yy.c:	lexer.l
	$(LEX) lexer.l

build: $(BIN)

clean:
	$(RM) -f $(BIN) *.o y.tab.* lex.yy.c

distclean: clean
	$(RM) Makefile

depend:
	$(CC) -MM $(INCLUDES) $(CFLAGS) $(SRCS) > .depend

install:

include .depend
