# $Id: Makefile.in,v 1.9 2004/02/21 00:32:00 jeremy Exp $

CC		= @CC@
INSTALL		= @INSTALL@
INSTALL_BIN	= @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
INSTALL_SUID	= @INSTALL_PROGRAM@ -o root -m 4755
RM		= @RM@
LEX		= @LEX@
LEXLIB		= @LEXLIB@
CFLAGS		= @IRC_CFLAGS@ -DIRCD_PREFIX=\"@prefix@\"
LDFLAGS   	= @LDFLAGS@
MKDEP		= @MKDEP@ -DIRCD_PREFIX=\"@prefix@\"
MV		= @MV@
RM		= @RM@
LN              = @LN@

SSL_LIBS	= @SSL_LIBS@
SSL_INCLUDES	= @SSL_INCLUDES@

IRCDLIBS	= @LIBS@ $(SSL_LIBS)
INCLUDES	= -I../include $(SSL_INCLUDES)
CPPFLAGS	= ${INCLUDES} @CPPFLAGS@

prefix		= @prefix@
exec_prefix	= @exec_prefix@
bindir		= @bindir@
libexecdir	= @libexecdir@
sysconfdir	= @sysconfdir@
localstatedir	= @localstatedir@
# Change this later! -- adrian
moduledir	= @prefix@/modules
automoduledir	= @prefix@/modules/autoload

PROGS		= viconf mkpasswd convertconf convertilines convertklines encspeed

mkpasswd_SOURCES = mkpasswd.c
mkpasswd_OBJECTS = mkpasswd.o
viconf_SOURCES = viconf.c
viconf_OBJECTS = viconf.o
convertconf_SOURCES = convertconf.c
convertconf_OBJECTS = convertconf.o
convertklines_SOURCES = convertklines.c
convertklines_OBJECTS = convertklines.o
convertilines_SOURCES = convertilines.c
convertilines_OBJECTS = convertilines.o
encspeed_SOURCES = encspeed.c
encspeed_OBJECTS = encspeed.o

all_OBJECTS = $(viconf_OBJECTS) $(mkpasswd_OBJECTS) $(convertconf_OBJECTS)\
        $(convertklines_OBJECTS) $(encspeed_OBJECTS) $(convertilines_OBJECTS)

all: $(PROGS)

build: all

encspeed: $(encspeed_OBJECTS)
	@$(CC) $(CFLAGS) $(LDFLAGS) -o encspeed $(encspeed_OBJECTS) $(IRCDLIBS)
mkpasswd: $(mkpasswd_OBJECTS)
	@$(CC) $(CFLAGS) $(LDFLAGS) -o mkpasswd $(mkpasswd_OBJECTS) $(IRCDLIBS)

viconf: $(viconf_OBJECTS)
	@$(CC) $(CFLAGS) $(LDFLAGS) -o viconf $(viconf_OBJECTS) $(IRCDLIBS)

convertilines: convertilines.o
	@$(CC) $(CFLAGS) $(LDFLAGS) -o convertilines $(convertilines_OBJECTS) $(IRCDLIBS)

convertklines: convertklines.o
	@$(CC) $(CFLAGS) $(LDFLAGS) -o convertklines $(convertklines_OBJECTS) $(IRCDLIBS)

convertconf: convertconf.o
	@$(CC) $(CFLAGS) $(LDFLAGS) -o convertconf $(convertconf_OBJECTS) $(IRCDLIBS)

clean:
	@$(RM) -f $(all_OBJECTS) convertconf encspeed viconf chkconf mkpasswd *~ core *.exe convertklines convertilines

distclean: clean
	@$(RM) -f Makefile services/Makefile services/services.pl

lint:
	lint -aacgprxhH $(CPPFLAGS) -DIRCD_PREFIX=\"@prefix@\" $(convertconf_SOURCES) $(convertklines_SOURCES) $(mkpasswd_SOURCES) $(viconf_SOURCES) $(encspeed_SOURCES) >>../lint.out

depend:

.c.o:
	@$(CC) $(CFLAGS) $(INCLUDES) $(CPPFLAGS) -c $<
	@echo "Compiling $<"

# DO NOT DELETE

viconf.o: ../include/config.h ../include/setup.h
viconf.o:


prefix		= @prefix@
exec_prefix	= @exec_prefix@
exec_suffix	= @exec_suffix@
bindir		= @bindir@
libexecdir	= @libexecdir@
sysconfdir	= @sysconfdir@
localstatedir	= @localstatedir@
# Change this later! -- adrian
moduledir	= @prefix@/modules
automoduledir	= @prefix@/modules/autoload


 
install-mkdirs:
	-@if test ! -d $(prefix); then \
		mkdir $(prefix); \
	fi
	-@if test ! -d $(exec_prefix); then \
		mkdir $(exec_prefix); \
	fi
	-@if test ! -d $(bindir); then \
		mkdir $(bindir); \
	fi
	-@if test ! -d $(moduledir); then \
		mkdir $(moduledir); \
	fi
	-@if test ! -d $(automoduledir); then \
		mkdir $(automoduledir); \
	fi
	-@if test ! -d $(sysconfdir); then \
		mkdir $(sysconfdir); \
	fi
	-@if test ! -d $(localstatedir)/logs; then \
		mkdir $(localstatedir)/logs; \
	fi

install: install-mkdirs build
	@for i in $(PROGS); do \
		if test -f $(bindir)/$$i; then \
			$(MV) $(bindir)/$$i $(bindir)/$$i.old; \
		fi; \
		$(INSTALL_BIN) $$i $(bindir); \
	done; \
        $(RM) -f $(bindir)/vimotd $(bindir)/viklines; \
        $(LN) $(bindir)/viconf $(bindir)/vimotd; \
        $(LN) $(bindir)/viconf $(bindir)/viklines

