#
# Makefile for irchat
#
# $Id: Makefile,v 1.8 1994/07/29 09:13:37 tmo Exp tmo $
#

#
# If you don't have jwz's optimizing byte-compiler, uncomment the following
# lines.  A better idea would be to get it from archive.cis.ohio-state.edu
# in the file pub/gnu/emacs/elisp-archive/packages/bytecomp.tar.Z. It also
# comes with emacs19
#
# DEFSUBST_SRC=  defsubst.el
# DEFSUBST_BIN=  defsubst.elc
# DEFSUBST_LOAD= -l ./$(DEFSUBST_BIN)

EMACS	= emacs -batch -q -l ./setpath.el
TAR	= gtar
CC 	= gcc
LD	= $(CC)

# LDFLAGS for DCC 
# Sparc-Solaris2.3 & other SVR4?
#LDFLAGS	= -lgen -lnsl -lsocket
#CFLAGS		=
# BSD 4.3, Solaris 1.1, Ultrix &c
LDFLAGS	=
CFLAGS = -DUSE_BCOPY
#
# You shouldn't need to change anything after this point.

OBJS 	= \
	irchat-filter.elc	\
	gnus-caesar.elc		\
	irchat-000.elc		\
	irchat-200.elc		\
	irchat-300.elc		\
	irchat-400.elc		\
	irchat-500.elc		\
	irchat-commands.elc	\
	irchat-copyright.elc	\
	irchat-cta.elc		\
	irchat-dcc.elc		\
	irchat-globals.elc	\
	irchat-handle.elc	\
	irchat-misc.elc		\
	irchat-timer.elc	\
	irchat-vars.elc		\
	irchat-main.elc

SRCS	= $(OBJS:.elc=.el)

all: irchat.elc irchat.info dcc 

dcc:	dcc.o
	$(LD) -o $@ dcc.o $(LDFLAGS)
	rm -f dcc.o

%.elc: %.el
	$(EMACS) -f batch-byte-compile $(DEFSUBST_SRC) $<

irchat.elc:	$(OBJS)
	rm -f $@
	cat $(OBJS) > $@
	rm -f $(OBJS)

irchat.texinfo:
	cat i-irchat.texi i-etiq.texi i-overview.texi 	\
	    i-setup.texi i-command.texi i-custom.texi 	\
	    i-authors.texi 				> irchat.texinfo

irchat.info:	irchat.texinfo
	-$(EMACS) -batch -q irchat.texinfo \
		 -f texinfo-format-buffer -f save-buffer

clean: 
	-rm -f $(OBJS) irchat dcc.o dcc

tidy:
	$(MAKE) clean 
	rm -f irchat.elc

EXTRAS = 	Makefile irchat-hooks.el			\
		dcc.c 		 				\
		defsubst.el setpath.el 				\
		irchat-inlines.el 				\
		irchat.elc					\
		irchat.texinfo irchat.info

dist:	$(SRCS) $(EXTRAS)
	-@mkdir irchat-dist
	-@cp $(SRCS) $(EXTRAS) irchat-dist
	$(TAR) cf dist-`date +%d.%b.%Y`.tar irchat-dist
	gzip -9 dist-`date +%d.%b.%Y`.tar
	-@rm -rf irchat-dist
