#
#  This is the Makefile for EGGDROP (the irc bot)
#  Edit the top of this file before attempting to compile!
#
# successfully compiled on the following systems:
#   SunOS, NeXT, Linux, Ultrix, IRIX, BSD/386 (maybe), HP-UX (allegedly),
#   AIX, SVR4 (hopefully)
#

# Binaries
CC = gcc
RM = rm
AWK = awk
MAKE = make
CFLG = -O
# for memory debugging:  -DMEMORY_DEBUGGING
# (only robey will find this useful, usually)
# beware: memory debugging swallows 300+k of memory


# SunOS or NeXT or Ultrix: (they work fine)
# but NOT SunOS 5 (Solaris) -- you guys are below
#OS = BSD

# Linux or IRIX:
OS = LINUX
CFLG = -c -O2

# BSD/386 (seems to be buggy lately):
#OS = BSD386

# HP-UX (may have to twiddle code):
#OS = HPUX

# AIX:  you must use gcc!
#OS = AIX
#CC = gcc

# SVR4 (thanks to knight@calon.com)
#OS = SVR4

# SunOS 5 (Solaris) -- use gcc (thanks to John Fulton <eldorin@alaska.net>)
# (you may not need the LIBS line; experiment)
#OS = SVR4
#CC = gcc
#LIBS = -lnsl -lsocket -L/usr/ucblib -lucb


#### TCL ####

# If you want to compile WITHOUT Tcl, put a '#' in front of these lines:
#XOBJS = tcl.o tclhash.o
#TCLDEF = -DTCL
#XLIBS = -L. -ltcle -lm
#XREQ = ./libtcle.a

# If your TCL include file is in a weird place, specify it here
# (compiling without Tcl?  comment this out)
#TCLINC = -I/usr/local/include
#TCLINC = -I/usr/include/tcl

# give the directory the original tcl library is stored
# (eggdrop needs to copy and modify it a bit to be usable)
# (compiling without Tcl?  comment this out)
#TCLLIB = /usr/local/lib
#TCLLIB = /usr/lib


# STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP #
# - - - - - - - - do not edit anything below this line. - - - - - - - - #
# STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP #

CFLAGS = ${CFLG} -c -D${OS} ${TCLDEF} ${TCLINC}

all: eggdrop

help:
	@echo Makefile for Eggdrop.
	@echo "To make eggdrop (the bot):"
	@echo "   % make eggdrop"

clean:
	@${RM} -f eggdrop egg core *.o
	@cd src ; ${RM} -f eggdrop egg core *.o

eggdrop: always
	@cd src ; ${GMAKE} eggdrop
	@mv src/eggdrop .

egg: always
	@cd src ; ${GMAKE} egg
	@mv src/egg .

always:

# Justin Slootsky says some systems need this (?)
src/libtcle.a: ${TCLLIB}/libtcl.a
	@cp ${TCLLIB}/libtcl.a src/libtcle.a
	@ar d src/libtcle.a tclMain.o
	@ranlib src/libtcle.a

GMAKE = ${MAKE} 'CC=${CC}' 'RM=${RM}' 'AWK=${AWK}' 'OS=${OS}' \
	'LINT=${LINT}' 'OBJS=${OBJS}' 'CFLAGS=${CFLAGS}' 'XREQ=${XREQ}' \
	'XLIBS=${XLIBS} ${LIBS}' 'TCLLIB=${TCLLIB}'

eggdrop.h:
	@echo You do not have the eggdrop source!
	@exit 1
	
OBJS = net.o io.o chan.o mode.o chanprog.o mem.o reg.o msgnotice.o dcc.o\
	gotdcc.o edit.o misc.o hash.o cmds.o msgcmds.o files.o userrec.o\
	users.o tandem.o tandcmd.o proc.o ${XOBJS}
