# Generated automatically from Makefile.in by configure.
# Makefile.in
#
# BitchX - by panasync
#
# targets recognised by this makefile:
#   all, everything	- compiles BitchX [wserv, scr-bx]
#   wserv		- compiles wserv
#   scr-bx		- compiles scr-bx
#   install		- installs BitchX [wserv, scr-bx] [plugins] scripts
#			  man pages help and translation
#   installirc		- installs BitchX [wserv, scr-bx]
#   installwserv	- installs wserv
#   installscr-bx	- installs scr-bx
#   installscript	- installs the scripts
#   installtranslation	- installs the translation tables
#   installhelp		- installs the help files
#   installman		- installs the manual pages
#   installeverything	- all of the above
#   clean		- remove all .o files, core, and binaries
#   distclean		- remove all files geneated by compilation/installation

.SUFFIXES: .c .o .so .in

prefix = /usr/local
exec_prefix = ${prefix}
topdir = /home/source/BitchX
objdir = /home/source/BitchX/source
srcdir = .
bindir = ${exec_prefix}/bin
datadir = ${prefix}/share
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
mandir = ${prefix}/man
local_dir = $(HOME)

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

# Where the BitchX 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 = ${libdir}/bx

CC = gcc
DEFS = -I$$(srcdir)/../include -I$(topdir)/include
LIBS = -lncurses  -lresolv -lcrypt -lm
INCLUDES = 

# These are for Tcl support
TCL_OBJS = 
# You don't have the following, so don't enable it.
# TCL_SRCS = tcl.c


# 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 = -g -O2 -Wall

# Set this to -s if you want the binary to be stripped.
LDFLAGS = 

# These are for the cd device player
CD_SRCS = 
CD_OBJS = 

# This is needed for modules.c
SHLIB_SUFFIX = .so

EXTRA_FILES = BitchX.help BitchX.ircnames BitchX.quit BitchX.reasons

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

# Full path of the directory for BitchX help files.
HELPDIR = $(IRCLIB)/help

# Full path of the directory for the BitchX scripts.
INSTALL_SCRIPT = $(IRCLIB)/script

# Default setting for IRCPATH where BitchX 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.
IRCPATH = ~/.BitchX:~/.BitchX/plugins:.::$(INSTALL_SCRIPT):$(IRCLIB)

# Path for TRANSLATION variable.
TRANSLATION_PATH=$(IRCLIB)/translation

# This command will be used to install the BitchX 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 = cp -pr $(srcdir)/bitchx-docs/* $(HELPDIR)

# This program allows you to use screen/xterm's to put new BitchX windows
# on new screen/xterm windows.
INSTALL_WSERV = $(IRCLIB)/wserv

# This program allows you to screen BitchX and reattach to it later.
INSTALL_SCRBX = ${bindir}/scr-bx

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

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

VERSION = BitchX-1.0c16
_VERSION_ = BitchX

SHELL = /bin/sh
MAKE = gmake $(MFLAGS)
MFLAGS ='CC=$(CC)'					\
	'CFLAGS=$(CFLAGS)'				\
	'DEFS=$(DEFS)'					\
	'HELPDIR=$(HELPDIR)'				\
	'INSTALL_IRC=$(INSTALL_IRC)'			\
        'INSTALL_WSERV=$(INSTALL_WSERV)'                \
	'IRCLIB=$(IRCLIB)'				\
	'IRCPATH=$(IRCPATH)'				\
	'TRANSLATION_PATH=$(TRANSLATION_PATH)'		\
	'LDFLAGS=$(LDFLAGS)'				\
	'LIBS=$(LIBS)'					\
	'LN=$(LN)'					\
	'RM=$(RM)'					\
	'TCL_SRCS=$(TCL_SRCS)'				\
	'TCL_OBJS=$(TCL_OBJS)'				\
	'CD_PLAY=$(CD_PLAY)'				\
	'CD_SRCS=$(CD_SRCS)'				\
	'CD_OBJS=$(CD_OBJS)'				\
	'TCLINC=$(TCLINC)'				\
	'SHLIB_SUFFIX=$(SHLIB_SUFFIX)'			\
	'_VERSION_=$(_VERSION_)'			\
	'VERSION=$(VERSION)'				\
	'INSTALL_DATA=$(INSTALL_DATA)'			\
	'INSTALL_SCRIPT=$(INSTALL_SCRIPT)'		\
	'INCLUDES=$(INCLUDES)'				\
	'local_dir=$(local_dir)'

default: all

all: Makefile $(objdir)/Makefile BitchX wserv scr-bx dll 

BitchX: Makefile $(objdir)/Makefile
	@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
	@cd $(objdir); $(MAKE) all

install: all installbin installdll installscript installman installhelp \
	installtranslation

installeverything: install

everything: all

dll/dummy:

dll: Makefile dll/Makefile dll/dummy
	@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
	@cd dll; $(MAKE) all

installdll: Makefile dll/Makefile dll
	@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
	@cd dll; $(MAKE) install

installdll_local: Makefile dll/Makefile
	@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
	@cd dll; $(MAKE) install_local

installhelp: installdirs
	$(INSTALL_HELP_CMD)

installbin: installirc installwserv installscr-bx

installirc: installdirs BitchX
	$(INSTALL) $(objdir)/$(_VERSION_) $(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) $(VERSION) $(INSTALL_IRC)
	-@(								\
		cd $(srcdir);						\
		for i in $(EXTRA_FILES); do				\
			$(INSTALL_DATA) $$i $(IRCLIB);			\
		done							\
	)

install_local: local_installdirs installdll_local BitchX wserv scr-bx
	$(INSTALL) $(objdir)/BitchX $(local_dir)/bin/$(VERSION)
	@if test -f $(local_dir)/bin/$(_VERSION_).old; then $(RM) $(local_dir)/bin/$(_VERSION_).old; fi
	@if test -f $(local_dir)/bin/$(_VERSION_); then $(MV) $(local_dir)/bin/$(_VERSION_) $(local_dir)/bin/$(_VERSION_).old; fi
	$(LN) $(VERSION) $(local_dir)/bin/$(_VERSION_)
	@cp $(objdir)/scr-bx $(local_dir)/bin/scr-bx
	-@(								\
		cd $(srcdir);						\
		for i in $(EXTRA_FILES); do				\
			$(INSTALL_DATA) $$i $(local_dir)/.BitchX/$$i;	\
		done							\
	)

wserv: $(srcdir)/source/wserv.c $(srcdir)/source/term.c $(objdir)/Makefile
	@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
	@cd $(objdir); $(MAKE) wserv

scr-bx: $(srcdir)/source/scr-bx.c $(srcdir)/source/term.c $(objdir)/Makefile
	@if test ! -f $(topdir)/.config.h ; then touch $(topdir)/.config.h; fi
	@cd $(objdir); $(MAKE) scr-bx

installwserv: installdirs wserv
	$(INSTALL) $(objdir)/wserv $(INSTALL_WSERV) 

installscr-bx: installdirs scr-bx
	$(INSTALL) $(objdir)/scr-bx $(INSTALL_SCRBX) 

installscript: installdirs
	-@(								\
	if test -d $(srcdir)/script; then				\
	cd $(srcdir)/script;						\
	for i in *; do							\
		if test "$$i" = "bxglobal" -a -f $(INSTALL_SCRIPT)/bxglobal; then \
			if test -f bxglobal; then				\
				$(CP) $(INSTALL_SCRIPT)/bxglobal $(INSTALL_SCRIPT)/bxglobal.old; \
				$(INSTALL_DATA) bxglobal $(INSTALL_SCRIPT); \
			fi;						\
		else							\
			if test "$$i" != "CVS"; then			\
				$(INSTALL_DATA) $$i $(INSTALL_SCRIPT);	\
			fi;						\
		fi;							\
	done;								\
	chmod -x $(INSTALL_SCRIPT)/*;					\
	fi;								\
	)

installtranslation: installdirs
	-@(								\
	if test -d $(srcdir)/translation; then				\
	cd $(srcdir)/translation;					\
	for i in *; do							\
		if test "$$i" != "CVS"; then				\
			$(INSTALL_DATA) $$i $(TRANSLATION_PATH);	\
		fi;							\
	done;								\
	chmod -x $(TRANSLATION_PATH)/*;					\
	fi;								\
	)

installman:
	-@(								\
	if test -d $(topdir)/doc; then					\
	cd $(topdir)/doc;						\
	for i in BitchX.1; do						\
	if test -f $$i; then 						\
		$(INSTALL_DATA) $$i $(mandir)/man1;			\
	fi;								\
	done;								\
	fi;								\
	)

installdirs:
	umask 022; $(srcdir)/mkinstalldirs $(bindir) $(IRCLIB) $(mandir)/man1 \
		$(TRANSLATION_PATH) $(INSTALL_SCRIPT) $(HELPDIR)

local_installdirs:
	umask 022; $(srcdir)/mkinstalldirs $(local_dir)/bin $(local_dir)/.BitchX $(local_dir)/.BitchX/plugins

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

distclean cleandir realclean: clean
	$(RM) Makefile $(objdir)/Makefile dll/Makefile $(objdir)/sig.inc config.status config.cache config.log easyinst.status include/defs.h
	$(RM) doc/*~ stamp-h *.spec
	$(CP) doc/Makefile $(topdir)/Makefile

export: distclean
	$(topdir)/autogen.sh

package: export
	(cd ..;tar zcvvf $(VERSION).src.tar.gz BitchX; )

distrib: BitchX
	cp $(srcdir)/dll/hints/BitchX.hints dll/hint/BitchX.hints
	(cp $(objdir)/BitchX BitchX; strip --strip-all BitchX; gzip BitchX; tar zcvvf $(VERSION).tar.gz dll/*.so dll/hint/BitchX.hints BitchX.*; )

depend:
	@cd $(objdir); $(MAKE) depend

# FIXME This was taken straight from the autoconf docs, but it doesn't ever run
# autolocal or autoheader... Does it?
configure: configure.in aclocal.m4
	cd $(topdir) && autoconf

# autoheader might not change $(topdir)/include/defs.h.in, so touch a stamp file.
include/defs.h.in: stamp-h.in
stamp-h.in: configure.in aclocal.m4
	cd $(topdir) && autoheader
	echo timestamp > $(topdir)/stamp-h.in

include/defs.h: stamp-h
stamp-h: $(topdir)/include/defs.h.in config.status
	$(topdir)/config.status

Makefile: $(srcdir)/Makefile.in config.status 
	$(topdir)/config.status 

config.status: $(srcdir)/configure
	$(topdir)/config.status --recheck
