#
#  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 (sorta)
#

# Binaries
CC = gcc
RM = rm
AWK = awk
MAKE = make
RANLIB = ranlib
CFLGS = -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:
# but NOT SunOS 5 (Solaris) -- you guys are below
#OS = BSD

# Linux:
OS = LINUX
CFLG = -O2

# Irix:
#OS = IRIX
#CFLG = -O2

# BSD/386 (does anyone still use this?):
#OS = BSD386

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

# AIX:  (you must use gcc!  default AIX cc is broken)
#OS = AIX
#CC = gcc

# SVR4/Solaris/SunOS 5:  (thanks to knight@calon.com, eldorin@alaska.net)
#OS = SVR4
#CC = gcc
#RANLIB = touch
#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 = ${CFLGS} ${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}' 'RANLIB=${RANLIB}'

eggdrop.h:
	@echo You do not have the eggdrop source!
	@exit 1
	
OBJS = net.o main.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}
