#************************************************************************
#*   IRC - Internet Relay Chat, Makefile
#*   Copyright (C) 1990, Jarkko Oikarinen
#*
#*   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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#*   $Id: Makefile.in,v 1.7 2004/04/01 11:14:22 gvs Exp $
#*
#*/

# -------------------------------------------------------------------------
# Start of system configuration section.
#
prefix = @prefix@
exec_prefix = @exec_prefix@

# compiler program
CC = @CC@
# compiler flags used for the server
S_CFLAGS = @CFLAGS@ -I. -I../ircd -I../common -I../rusnet @IRC_ZLIB_INCLUDE@
# compiler flags used for the authentication slave
A_CFLAGS = @CFLAGS@ -I. -I../iauth -I../common -I../rusnet @IRC_ZLIB_INCLUDE@
# compiler flags used for chkconfig
CC_CFLAGS = @CFLAGS@ -I. -I../ircd -I../common -I../rusnet
# compiler flags used for the client
C_CFLAGS = @CFLAGS@ -I. -I../irc -I../common -I../rusnet
# compiler flags used for other things (in contrib/)
O_CFLAGS = @CFLAGS@ -I. -I../common -I../rusnet -DCONTRIB_COMPILE
# linker flags
LDFLAGS = @LDFLAGS@
# required libraries, except zlib and curses/termcap
LIBS = @LIBS@
MATHLIBS = @MATHLIBS@
# zlib, eventually
ZLIBS = @IRC_ZLIB_LIBRARY@
# for DSM support (dlopen(), dlsym(), dlclose())
DLIBS = @IRC_DLIB@
# curses library
CURSESLIBS = @IRC_CURSES_TERMCAP_LIBRARY@
# install and related programs
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
MKDIRHIER = ../support/mkdirhier

#
# Binary names
#
CLIENT = irc
SERVER = ircd
IAUTH = iauth
IRCDWATCH = ircdwatch

#
# Directories definitions
#
# Directory in which to install irc.
client_bin_dir = @bindir@
# Directory in which to install ircd, iauth, ircdwatch, mkpasswd and chkconf.
server_bin_dir = @sbindir@
# Directory in which to install the client manual page.
client_man_dir = @mandir@/man1
# Directory in which to install the configuration manual page.
conf_man_dir = @mandir@/man5
# Directory in which to install the server manual page.
server_man_dir = @mandir@/man8
# Directory where config files (ircd.conf, ircd.motd and iauth.conf) live.
ircd_conf_dir = @sysconfdir@
# Directory where state files (ircd.pid, ircd.tune) live.
ircd_var_dir = @localstatedir@
# Directory where log files (users, opers, rejects and auth) live.
ircd_log_dir = @logdir@
# Directory where codepage files live.
ircd_codepage_dir = @codepagedir@

#
# Most of these PATHs are hardcoded in the binaries.
# They should all be absolute.
#
# Path to server binary
IRCD_PATH = $(server_bin_dir)/$(SERVER)
# Path to authentification slave binary
IAUTH_PATH = $(server_bin_dir)/$(IAUTH)
# Path to the m4 configuration file
IRCDM4_PATH = $(ircd_conf_dir)/ircd.m4

# server configuration file
IRCDCONF_PATH = $(ircd_conf_dir)/ircd.conf
# tkserv/dynamic K:lines configuration file
KILLSCONF_PATH = $(ircd_conf_dir)/kills.conf
# RusNet configuration file
RUSNETCONF_PATH = $(ircd_conf_dir)/rusnet.conf
# server Message Of The Day
IRCDMOTD_PATH = $(ircd_conf_dir)/ircd.motd
# authentication slave configuration file
IAUTHCONF_PATH = $(ircd_conf_dir)/iauth.conf
# server PID file
IRCDPID_PATH = $(ircd_var_dir)/ircd.pid
# server state file
IRCDTUNE_PATH = $(ircd_var_dir)/ircd.tune
# ircdwatch PID file
IRCDWATCHPID_PATH = $(ircd_var_dir)/ircdwatch.pid

# files used for debugging purposes
IRCDDBG_PATH = $(ircd_log_dir)/ircd.log
IAUTHDBG_PATH = $(ircd_log_dir)/iauth.log

# Access mode for irc.
irc_mode = 755

# Access mode for ircd.
ircd_mode = 711

#
# TK line service configuration
#
# TK line service binary
TKSERV = tkserv
# TK line service logfile
TKSERV_LOGFILE = $(ircd_log_dir)/tkserv.log
# TK line service access file 
TKSERV_ACCESSFILE = $(ircd_conf_dir)/tkserv.access
# IRCD config file without path (from CPATH)
TKSERV_IRCD_CONF = ircd.conf

# End of system configuration section.
# ------------------------------------------------------------------------
# Please don't change anything below this point - no need really - I hope.

RM = rm -f

CLIENT_COMMON_OBJS = clbsd.o cldbuf.o clpacket.o clsend.o clmatch.o \
                     clparse.o clsupport.o
CLIENT_OBJS = c_bsd.o c_msg.o c_numeric.o c_version.o edit.o help.o \
              ignore.o irc.o screen.o str.o swear.o c_debug.o ctcp.o

SERVER_COMMON_OBJS = bsd.o dbuf.o packet.o send.o match.o parse.o \
                     support.o
SERVER_OBJS = channel.o class.o hash.o ircd.o ircd_signal.o list.o res.o s_auth.o \
              s_bsd.o s_conf.o s_debug.o s_err.o s_id.o s_misc.o s_numeric.o \
              s_serv.o s_service.o s_user.o s_zip.o whowas.o \
              res_init.o res_comp.o res_mkquery.o \
              rusnet_codepages.o rusnet_init.o rusnet_misc.o \
              rusnet_cmds.o rusnet_virtual.o

IAUTH_COMMON_OBJS = clsupport.o clmatch.o # This is a little evil
IAUTH_OBJS = iauth.o a_conf.o a_io.o a_log.o mod_webproxy.o \
             mod_lhex.o mod_pipe.o mod_rfc931.o mod_socks.o mod_dnsbl.o
IAUTH = iauth

CHKCONF_COMMON_OBJS = match.o
CHKCONF_OBJS = chkconf.o
CHKCONF = chkconf

COMMON_DEPS = config.h setup.h
CLIENT_DEPS = $(COMMON_DEPS) ../irc/c_defines.h ../irc/c_externs.h
SERVER_DEPS = $(COMMON_DEPS) ../ircd/s_defines.h ../ircd/s_externs.h
IAUTH_DEPS = $(COMMON_DEPS) ../iauth/a_defines.h ../iauth/a_externs.h

help:
	@echo "Choose one of the following:"
	@echo "        all            : build everything"
	@echo "        server         : build server programs"
	@echo "                ircd          : build the irc daemon"
	@echo "                iauth         : build the authentication slave"
	@echo "                chkconf       : build the configuration file checker"
	@echo "                ircd-mkpasswd : build ircd-mkpasswd"
	@echo "                ircdwatch     : build ircdwatch"
	@echo "        client        	: build the client"
	@echo "        $(TKSERV)	: build tkserv"
	@echo
	@echo "        install        : build and install server and client programs"
	@echo "        install-server : build and install server programs"
	@echo "        install-client : build and install client program"
	@echo "        install-tkserv : build and install tkserv"

all: server client

server: $(SERVER) $(IAUTH) $(CHKCONF) ircd-mkpasswd $(IRCDWATCH)

client: $(CLIENT)

$(SERVER): $(SERVER_COMMON_OBJS) $(SERVER_OBJS)
	$(RM) $@
	./version.c.SH
	$(CC) $(S_CFLAGS) -c -o version.o version.c
	$(CC) $(LDFLAGS) -o $@ $(SERVER_COMMON_OBJS) version.o $(SERVER_OBJS) $(ZLIBS) $(MATHLIBS) $(LIBS)

$(IAUTH): $(IAUTH_COMMON_OBJS) $(IAUTH_OBJS)
	$(RM) $@
	$(CC) $(LDFLAGS) -o $@ $(IAUTH_COMMON_OBJS) $(IAUTH_OBJS) $(LIBS) $(DLIBS)

$(CLIENT): $(CLIENT_COMMON_OBJS) $(CLIENT_OBJS)
	$(RM) $@
	$(CC) $(LDFLAGS) -o $@ $(CLIENT_COMMON_OBJS) $(CLIENT_OBJS) $(CURSESLIBS) $(LIBS)

$(CHKCONF): $(CHKCONF_COMMON_OBJS) $(CHKCONF_OBJS)
	$(RM) $@
	$(CC) $(LDFLAGS) -o $@ $(CHKCONF_COMMON_OBJS) $(CHKCONF_OBJS) $(LIBS)

# stuff in contrib/

$(IRCDWATCH): ircdwatch.o clsupport.o clmatch.o
	$(RM) $(IRCDWATCH)
	$(CC) $(LDFLAGS) -o $(IRCDWATCH) clsupport.o clmatch.o ircdwatch.o $(LIBS)

ircd-mkpasswd: mkpasswd.o
	$(RM) ircd-mkpasswd
	$(CC) $(LDFLAGS) -o ircd-mkpasswd mkpasswd.o $(LIBS)

$(TKSERV): tkserv.o
	$(RM) $(TKSERV)
	$(CC) $(LDFLAGS) -o $(TKSERV) tkserv.o $(LIBS)

install: install-server install-client

install-client: client
	-@if [ ! -d $(client_bin_dir) ]; then \
		$(MKDIRHIER) $(client_bin_dir); \
	fi
	-@if [ ! -d $(client_man_dir) ]; then \
		$(MKDIRHIER) $(client_man_dir); \
	fi
	$(INSTALL_PROGRAM) -m $(irc_mode) $(CLIENT) $(client_bin_dir)
	(cd ../doc; $(INSTALL_DATA) irc.1 $(client_man_dir))
	@echo "installation of client done."

install-server: server
	-@if [ ! -d $(server_bin_dir) ]; then \
		$(MKDIRHIER) $(server_bin_dir); \
	fi
	-@if [ ! -d $(server_man_dir) ]; then \
		$(MKDIRHIER) $(server_man_dir); \
	fi
	-@if [ ! -d $(conf_man_dir) ]; then \
		$(MKDIRHIER) $(conf_man_dir); \
	fi
	-@if [ ! -d $(ircd_conf_dir) ]; then \
		$(MKDIRHIER) $(ircd_conf_dir); \
	fi
	-@if [ ! -d $(ircd_var_dir) ]; then \
		$(MKDIRHIER) $(ircd_var_dir); \
	fi
	-@if [ ! -d $(ircd_log_dir) ]; then \
		$(MKDIRHIER) $(ircd_log_dir); \
	fi
	-@if [ ! -d $(ircd_codepage_dir) ]; then \
                $(MKDIRHIER) $(ircd_codepage_dir); \
        fi
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(SERVER) $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(IAUTH) $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(CHKCONF) $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) ircd-mkpasswd $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(IRCDWATCH) $(server_bin_dir)
	$(RM) $(IRCDM4_PATH)
	../ircd/buildm4 $(IRCDM4_PATH)
	$(INSTALL_DATA) ../doc/ircd.8 $(server_man_dir)
	$(INSTALL_DATA) ../doc/iauth.8 $(server_man_dir)
	$(INSTALL_DATA) ../doc/iauth.conf.5 $(conf_man_dir)
	$(INSTALL_DATA) ../contrib/ircdwatch/ircdwatch.8 $(server_man_dir)
	$(INSTALL_DATA) ../doc/example.conf $(ircd_conf_dir)
	$(INSTALL_DATA) ../doc/example.rusnet.conf $(ircd_conf_dir)
	$(INSTALL_DATA) ../doc/example.tkserv.access $(ircd_conf_dir)
	$(INSTALL_DATA) ../codepages.universal/*UNI* $(ircd_codepage_dir)
	-@if [ ! -f $(IAUTHCONF_PATH) ]; then \
		$(INSTALL_DATA) ../support/iauth.conf $(IAUTHCONF_PATH); \
	fi
	@echo "installation of server done."

install-tkserv: $(TKSERV)
	-@if [ ! -d $(server_bin_dir) ]; then \
	$(MKDIRHIER) $(server_bin_dir); \
	fi
	-@if [ ! -d $(ircd_conf_dir) ]; then \
	$(MKDIRHIER) $(ircd_conf_dir); \
	fi
	-@if [ ! -s $(KILLSCONF_PATH) ]; then \
	touch $(KILLSCONF_PATH); \
	fi
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(TKSERV) $(server_bin_dir)
	@echo "installation of client done."

clbsd.o: ../common/bsd.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../common/bsd.c

cldbuf.o: ../common/dbuf.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../common/dbuf.c

clpacket.o: ../common/packet.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../common/packet.c

clsend.o: ../common/send.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../common/send.c

clmatch.o: ../common/match.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../common/match.c

clparse.o: ../common/parse.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../common/parse.c

clsupport.o: ../common/support.c $(CLIENT_DEPS) ../common/patchlevel.h
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../common/support.c

c_bsd.o: ../irc/c_bsd.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/c_bsd.c

c_msg.o: ../irc/c_msg.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/c_msg.c

c_numeric.o: ../irc/c_numeric.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/c_numeric.c

c_version.o: ../irc/c_version.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/c_version.c

edit.o: ../irc/edit.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/edit.c

help.o: ../irc/help.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/help.c

ignore.o: ../irc/ignore.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/ignore.c

irc.o: ../irc/irc.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/irc.c

screen.o: ../irc/screen.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/screen.c

str.o: ../irc/str.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/str.c

swear.o: ../irc/swear.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/swear.c

c_debug.o: ../irc/c_debug.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/c_debug.c

ctcp.o: ../irc/ctcp.c $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -DCLIENT_COMPILE -c -o $@ ../irc/ctcp.c

# server stuff
bsd.o: ../common/bsd.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/bsd.c

dbuf.o: ../common/dbuf.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/dbuf.c

packet.o: ../common/packet.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/packet.c

send.o: ../common/send.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DLOG_DIR="\"$(ircd_log_dir)\"" -c -o $@ ../common/send.c

match.o: ../common/match.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/match.c

parse.o: ../common/parse.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/parse.c

support.o: ../common/support.c $(SERVER_DEPS) ../common/patchlevel.h
	$(CC) $(S_CFLAGS) -c -o $@ ../common/support.c

channel.o: ../ircd/channel.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/channel.c

class.o: ../ircd/class.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/class.c

hash.o: ../common/struct_def.h ../common/os.h ../ircd/hash_def.h \
	../ircd/hash_ext.h ../common/common_def.h ../ircd/s_bsd.c \
	../ircd/s_serv.c ../ircd/s_user.c ../ircd/channel.c ../ircd/s_misc.c \
	../ircd/hash.c ../ircd/ircd.c Makefile $(SERVER_DEPS)
	@cp ../ircd/hash.c .
	@/bin/sh ./sums
	$(CC) $(S_CFLAGS) -c -o $@ hash.c
	@$(RM) hash.c hash.c.old
	@touch hash.o

ircd.o: ../ircd/ircd.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DIRCDCONF_PATH="\"$(IRCDCONF_PATH)\"" \
	-DRUSNETCONF_PATH="\"$(RUSNETCONF_PATH)\"" \
	-DIRCDTUNE_PATH="\"$(IRCDTUNE_PATH)\"" \
	-DIRCDMOTD_PATH="\"$(IRCDMOTD_PATH)\""  \
	-DIRCD_PATH="\"$(IRCD_PATH)\"" -DIAUTH_PATH="\"$(IAUTH_PATH)\"" \
	-DIAUTH="\"$(IAUTH)\"" -DIRCDDBG_PATH="\"$(IRCDDBG_PATH)\"" \
	-c -o $@ ../ircd/ircd.c

ircd_signal.o: ../ircd/ircd_signal.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/ircd_signal.c

list.o: ../ircd/list.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/list.c

res.o: ../ircd/res.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res.c

s_auth.o: ../ircd/s_auth.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_auth.c

s_bsd.o: ../ircd/s_bsd.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DIRCDPID_PATH="\"$(IRCDPID_PATH)\"" -DIAUTH_PATH="\"$(IAUTH_PATH)\"" -DIAUTH="\"$(IAUTH)\"" -c -o $@ ../ircd/s_bsd.c

s_conf.o: ../ircd/s_conf.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DIRCDMOTD_PATH="\"$(IRCDMOTD_PATH)\"" \
	-DIRCDCONF_DIR="\"$(ircd_conf_dir)\"" \
	-DIRCDM4_PATH="\"$(IRCDM4_PATH)\"" -c -o $@ ../ircd/s_conf.c

s_debug.o: ../ircd/s_debug.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_debug.c

s_err.o: ../ircd/s_err.c $(SERVER_DEPS) ../common/patchlevel.h
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_err.c

s_id.o: ../ircd/s_id.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_id.c

s_misc.o: ../ircd/s_misc.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_misc.c

s_numeric.o: ../ircd/s_numeric.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_numeric.c

s_serv.o: ../ircd/s_serv.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DIRCDMOTD_PATH="\"$(IRCDMOTD_PATH)\"" -c -o $@ ../ircd/s_serv.c

s_service.o: ../ircd/s_service.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_service.c

s_user.o: ../ircd/s_user.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DLOG_DIR="\"$(ircd_log_dir)\"" -c -o $@ ../ircd/s_user.c

s_zip.o: ../ircd/s_zip.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_zip.c

rusnet_codepages.o: ../rusnet/rusnet_codepages.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_codepages.c

rusnet_init.o: ../rusnet/rusnet_init.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_init.c

rusnet_misc.o: ../rusnet/rusnet_misc.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_misc.c

rusnet_cmds.o: ../rusnet/rusnet_cmds.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_cmds.c

rusnet_virtual.o: ../rusnet/rusnet_virtual.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_virtual.c

whowas.o: ../ircd/whowas.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/whowas.c

res_init.o: ../ircd/res_init.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res_init.c

res_comp.o: ../ircd/res_comp.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res_comp.c

res_mkquery.o: ../ircd/res_mkquery.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res_mkquery.c

# iauth stuff
iauth.o: ../iauth/iauth.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/iauth.c

a_conf.o: ../iauth/a_conf.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -DIAUTHCONF_PATH="\"$(IAUTHCONF_PATH)\"" -c -o $@ ../iauth/a_conf.c

a_dyn.o: ../iauth/a_dyn.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/a_dyn.c

a_io.o: ../iauth/a_io.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/a_io.c

a_log.o: ../iauth/a_log.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -DIAUTHDBG_PATH="\"$(IAUTHDBG_PATH)\"" -DLOG_DIR="\"$(ircd_log_dir)\"" -c -o $@ ../iauth/a_log.c

mod_lhex.o: ../iauth/mod_lhex.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_lhex.c

mod_pipe.o: ../iauth/mod_pipe.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_pipe.c

mod_rfc931.o: ../iauth/mod_rfc931.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_rfc931.c

mod_socks.o: ../iauth/mod_socks.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_socks.c

mod_webproxy.o: ../iauth/mod_webproxy.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_webproxy.c

mod_dnsbl.o: ../iauth/mod_dnsbl.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_dnsbl.c

chkconf.o: ../ircd/chkconf.c $(SERVER_DEPS)
	$(CC) $(CC_CFLAGS) -DCHKCONF_COMPILE \
	-DIRCDCONF_PATH="\"$(IRCDCONF_PATH)\"" \
	-DIRCDCONF_DIR="\"$(ircd_conf_dir)\"" \
	-DIRCDM4_PATH="\"$(IRCDM4_PATH)\"" -c -o $@ ../ircd/chkconf.c

# stuff in contrib/

ircdwatch.o: ../contrib/ircdwatch/ircdwatch.c
	$(CC) $(O_CFLAGS) -DIRCDWATCH_PID_FILENAME="\"$(IRCDWATCHPID_PATH)\"" -DIRCD_PATH="\"$(IRCD_PATH)\"" -DIRCDCONF_PATH="\"$(IRCDCONF_PATH)\"" -DIRCDPID_PATH="\"$(IRCDPID_PATH)\"" -c -o $@ ../contrib/ircdwatch/ircdwatch.c

mkpasswd.o: ../contrib/mkpasswd/mkpasswd.c
	$(CC) $(O_CFLAGS) -c -o $@ ../contrib/mkpasswd/mkpasswd.c

tkserv.o: ../contrib/tkserv/tkserv.c tkconf.h
	$(CC) $(O_CFLAGS) -DTKSERV_LOGFILE="\"$(TKSERV_LOGFILE)\"" -DTKSERV_ACCESSFILE="\"$(TKSERV_ACCESSFILE)\"" -DTKSERV_IRCD_CONF="\"$(TKSERV_IRCD_CONF)\"" -DCPATH="\"$(KILLSCONF_PATH)\"" -DPPATH="\"$(IRCDPID_PATH)\"" -c -o $@ ../contrib/tkserv/tkserv.c

clean:
	$(RM) $(CLIENT) $(SERVER) $(IAUTH) $(CHKCONF) ircd-mkpasswd $(IRCDWATCH) $(TKSERV) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* version.c

distclean:
	@echo "To make distclean, just delete the current directory."

rcs:
	(cd ..; cii -H -R configure common doc include irc ircd support)


syntax highlighted by Code2HTML, v. 0.9.1