#
#  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, HP-UX, AIX, SVR4 (kinda)
#

# 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 or OSF/1:
# but NOT SunOS 5 (Solaris) -- you guys are below
OS = BSD
# hey! OSF/1 people! uncomment the following line too:
#CFLG = -DSTOP_UAC
# hey! Ultrix people! uncomment the following line too:
#CFLG = -DULTRIX
# hey! SunOS people! uncomment this if you don't use yp:
LIBS = -ldl

# Linux:
# (apparently this is now identical to BSD)
#OS = LINUX
#CFLG = -O2

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

# BSD/386 (does anyone still use this?):
# (like BSD, but had weird wait() function)
#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 -R/usr/ucblib -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 *.a
	@cd src ; ${RM} -f eggdrop egg core *.o *.a

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
	@echo "[ Fixing libtcl.a -> libtcle.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 = chan.o chanprog.o cmds.o dcc.o dccutil.o edit.o fileq.o files.o\
	gotdcc.o hash.o	main.o match.o mem.o misc.o mode.c msgcmds.o\
	msgnotice.o net.o proc.o tandcmd.o tandem.o ${XOBJS} userrec.o\
	users.o
