# Generated automatically from Makefile.in by configure.
# BitchX Makefile

# targets recognised by this makefile:
#   all, everything	- compiles ircii
#   install		- installs ircii and the scripts
#   installirc		- installs ircii
#   installscript	- installs the scripts
#   installhelp 	- installs the help files
#   installeverything	- all of the above
#   clean		- remove all .o files, core, and binaries
#   distclean		- remove all files geneated by compilation/installation.

prefix = .
exec_prefix = ${prefix}/
bindir = ${exec_prefix}

# Where the ircII binary will be installed.
# 'make install' will compile and install the program
INSTALL_IRC = $(bindir)/

# Where the ircII library will be.  Generally this is the place that
# you put the scripts, help pages and translation tables.  It is
# very important that you set this correctly.
IRCLIB = ${prefix}/

# Alternate paths home directory installs
#prefix = $(HOME)/irc/client
#exec_prefix = $(prefix)
#bindir = $(prefix)
#IRCLIB = $(bindir)/irclib

CC = gcc
DEFS =
LIBS = -ltcl8.1 -lsocket -lresolv -ltermcap -lrx -lcrypt -lmmpm2

# if AIX system then -ldl will need to be changed to -lld
XREQ =

# Remove the # from the following if you want a tcl BitchX
# If you don't have tcl.c then don't remove the # from TCL_SRCS
# TCLINC = -I
# TCLLIB =
# TCL = -DWANT_TCL
# TCL_SRCS = tcl.c
# TCL_OBJS = tcl.o



# Set this to -g if you want to be able to debug the client, otherwise
# use -O to have the compiler do some optimization instead.
CFLAGS = -O2 -Zmt -D__ST_MT_ERRNO__ -D__EMXPM__ -DMMPM
CFLAGS = -O -g -Zmt -D__ST_MT_ERRNO__ -D__EMXPM__ -DMMPM

# Set this to -s if you want the binary to be stripped.
# Also on SunOS and linux system -rdynamic might be wanted if you plan on
# using the modules and have compiled with include/config.h WANT_DLL
# defined.
LDFLAGS =


# set this to whatever flag your compiler takes to turn on ansi mode.
# gcc is ansi by default, but you can specify -ansi anyhow.  Digital's
# 'cc' requires this, as may other non-gcc compilers.
# Typically, its "-ansi" or "-std1" or some such thing.
ANSIFLAGS = # -ansi

#uncomment the following if you want the cd device player
# CD_PLAY = -DWANT_CD
# CD_SRCS = cdrom.c
# CD_OBJS = cdrom.o

# Use one of the following for mips systems:
# Choice 1, if your system has the wait3() call
# DEFS = -systype bsd43
# Choice 2, if your system has the wait2() call
# DEFS = -systype bsd43 -Duse_wait2
#
# Or, if you only have sysv installed, use one of the following:
# DEFS = -DMIPS_SYSV
# DEFS = -DMIPS_SYSV -Duse_wait2

## You probably don't need to change anything below this line

# Full path of the directory for ircII help files.
# The help files are not within the source distribution, if you don't have
# them and want them, check out your nearest ircII archive.
# You may comment HELP_DIR, then the ircIIhelp service will be used.
# If you don't comment it out and want to use the IRCIIHelp service anyway,
# you must make sure that the directory doesn't exist.
HELP_DIR = $(IRCLIB)help

# Full path of the directory in which to copy the
# IRCII scripts supplied with the code.  These scripts
# may be loaded by using the LOAD command in IRCII.
INSTALL_SCRIPT = $(IRCLIB)script

# Default setting for IRC_PATH where irc will look for
# its script files if the environment variable is undefined.
# Usually, this should contain the same path as used for INSTALL_SCRIPT in
# the Makefile, but it can contain multiple path elements
# separated by colons. The path MUST lead to an existing directory,
# because the 'global' script is expected to be found there.
IRC_PATH = ~/irc:$(INSTALL_SCRIPT):~/BitchX:.:script/:

# This command will be used to install the irc help files.  If you don't
# want to install them, replace with the following:
# INSTALL_HELP_CMD = @echo The help files have not been installed.
INSTALL_HELP_CMD = @INSTALL_HELP_CMD@

INSTALL_WSERV = $(bindir)/wserv

## You shouldn't have to change anything below here

srcdir = .
LN = ln -s
RM = rm -f
CP = cp
MV = mv
INSTALL = ./bsdinstall -c -m 755
INSTALL_DATA = ../bsdinstall -c -m 644

VERSION = BitchX-75a12
_VERSION_ = BitchX

SHELL = sh.exe
MAKE = make -f Makefile $(MFLAGS)
MFLAGS ='CC=$(CC)'                                      \
	'ANSIFLAGS=$(ANSIFLAGS)'                        \
	'CFLAGS=$(CFLAGS)'                              \
	'DEFS=$(DEFS)'                                  \
	'HELP_DIR=$(HELP_DIR)'                          \
	'INSTALL_IRC=$(INSTALL_IRC)'                    \
	'INSTALL_WSERV=$(INSTALL_WSERV)'                \
	'IRCLIB=$(IRCLIB)'                              \
	'IRCPATH=$(IRC_PATH)'                           \
	'LDFLAGS=$(LDFLAGS)'                            \
	'LIBS=$(LIBS)'                                  \
	'LN=$(LN)'                                      \
	'_VERSION_=$(_VERSION_)'                        \
	'RM=$(RM)'                                      \
	'TCL=$(TCL)'                                    \
	'TCL_SRCS=$(TCL_SRCS)'                          \
	'TCL_OBJS=$(TCL_OBJS)'                          \
	'CD_PLAY=$(CD_PLAY)'                            \
	'CD_SRCS=$(CD_SRCS)'                            \
	'CD_OBJS=$(CD_OBJS)'                            \
	'TCLLIBFN='					\
	'TCLINC=$(TCLINC)'                              \
	'XREQ=${XREQ}'                                  \
	'XLIBS=${TCLLIB}'

#all: BitchX wserv
all: BitchX
everything: all

install: all installbin

BitchX: source/Makefile Makefile
	@cd source; $(MAKE) -f Makefile all

dll: dll/Makefile Makefile
	@cd dll; $(MAKE) all

installeverything: install

installbin: installirc installwserv

installirc: BitchX installdirs
	$(INSTALL) source/BitchX $(bindir)/$(VERSION)
	@if test -f $(INSTALL_IRC).old; then $(RM) $(INSTALL_IRC).old; fi
	@if test -f $(INSTALL_IRC); then $(MV) $(INSTALL_IRC) $(INSTALL_IRC).old; fi
	$(RM) $(INSTALL_IRC)
	$(LN) $(bindir)/$(VERSION) $(INSTALL_IRC)

wserv: source/wserv.c source/term.c source/Makefile
	@cd source; $(MAKE) -f Makefile wserv

installwserv: wserv installdirs
	if test ! -f $(INSTALL_WSERV) -o source/wserv -nt $(INSTALL_WSERV); then \
		$(INSTALL) source/wserv $(INSTALL_WSERV); \
	fi

installscript: installdirs
	-chmod -x script/*
	-@(								\
		if test -f $(INSTALL_SCRIPT)/local; then		\
			if test -f script/local; then			\
				$(MV) script/local script/local.orig;	\
			fi;						\
		fi							\
	)
	cd script; for i in *; do $(INSTALL_DATA) $$i $(INSTALL_SCRIPT); done

installhelp: installdirs
	if test -f epic3.004-help.tar.gz; then
		tar zxvf epic3.004-help.tar.gz
		(cd help; tar cf - .) | (cd $(HELP_DIR); tar xf -)
	else
		echo ftp.neato.org and grab epic3.004-help.tar.gz for ircII help
	fi

installdirs:
	umask 022; ./mkinstalldirs $(IRCLIB) $(bindir) $(INSTALL_SCRIPT)

test.o: test.c
	$(CC) -c test.c
test: test.o
	$(CC) test.o -o my_test

clean:
	@-if test -f source/Makefile; then cd source; $(MAKE) clean; cd ../dll; $(MAKE) distclean; fi

distclean cleandir realclean: clean
	$(RM) Makefile source/Makefile dll/Makefile source/sig.inc config.status config.cache config.log easyinst.status include/defs.h

lint:
	@if test -f source/Makefile; then cd source; $(MAKE) lint; fi

autoconf: configure

configure: configure.in acconfig.h
	autoconf

autoheader: include/defs.h.in

include/defs.h.in: configure.in acconfig.h
	autoheader

export: distclean autoheader autoconf

package: export
	(cd ..;tar zcvf $(VERSION).src.tar.z BitchX; )

distrib: source/BitchX
	(cp source/BitchX BitchX; strip --strip-all BitchX; gzip BitchX; tar zcvf $(VERSION).tar.gz cavlink/cavlink.so hint/hint.so hint/BitchX.hints possum/possum.so CubicZ/BitchX.* BitchX.*; )
