# IRC II - written by Michael Sandrof
#
# Copyright (c) 1991 Michael Sandrof.
# Copyright (c) 1991, 1992 Troy Rollo.
# Copyright (c) 1992-2003 Matthew R. Green.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
#    derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)$Id: Makefile.in,v 1.22 2006/04/30 14:15:42 f Exp $

# targets recognised by this makefile:
#   all, everything	- compiles ircii, ircio, ircflush and wserv
#   ircio		- compiles ircio
#   ircflush		- compiles ircflush
#   wserv		- compiles wserv
#   install		- installs ircii, ircio, ircflush and wserv
#   installirc		- installs ircii
#   installio		- installs ircio
#   installwserv	- installs wserv
#   installflush	- installs ircflush
#   installscript 	- installs the scripts
#   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.

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sharedir = @prefix@/share
mandir = @prefix@/man/man1

DESTDIR =

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

# Where the ircII library will be.  Generally this is the place that
# you put the scripts and help pages.  It is
# very important that you set this correctly.
IRCSHARE = ${sharedir}/scrollz

# The documentation directory
IRCDOC = ${IRCSHARE}/doc

# Set this to the lex you want to use, and if they lex uses a library.

LEX = @LEX@
LEXLIB = @LEXLIB@

CC = @CC@
DEFS = @DEFS@
LIBS = @LIBS@

# 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 = @CFLAGS@

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

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

# Full path of the directory for ircII help files.  
HELP_DIR = $(IRCSHARE)/help

# Full path of the directory for the ircII scripts.
INSTALL_SCRIPT = $(IRCSHARE)/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 = ~/.ScrollZ:$(INSTALL_SCRIPT):.

# Set the next line to the full path for installation of the ircio program
# if you wish to use it. 
INSTALL_IRCIO = $(bindir)/ircio

# This little program is necessary to have an interactive shell
# in a window of ircII. The 'shell' script uses it, so also update
# the path in there, if you want to enable this.
INSTALL_IRCFLUSH = $(bindir)/ircflush

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

# 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@

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

srcdir = .

RM = @RM@
LN = @LN@
CP = cp
MV = mv
INSTALL = ./bsdinstall -c -m 755
INSTALL_DATA = ../bsdinstall -c -m 644

VERSION = @VERSION@

SHELL = /bin/sh
MAKE = make $(MFLAGS)
MFLAGS ='CC=$(CC)'					\
	'CFLAGS=$(CFLAGS)'				\
	'DEFS=$(DEFS)'					\
	'HELP_DIR=$(HELP_DIR)'				\
	'INSTALL_IRC=$(INSTALL_IRC)'			\
	'INSTALL_IRCIO=$(INSTALL_IRCIO)'		\
	'INSTALL_WSERV=$(INSTALL_WSERV)'		\
	'IRCSHARE=$(IRCSHARE)'				\
	'IRCPATH=$(IRC_PATH)'				\
	'LDFLAGS=$(LDFLAGS)'				\
	'LEX=$(LEX)'					\
	'LEXLIB=$(LEXLIB)'				\
	'LIBS=$(LIBS)'					\
	'LN=$(LN)'					\
	'RM=$(RM)'

all: scrollz scrollz.1

install: all installbin installdirs installman installhelp

scrollz: source/Makefile Makefile
	@cd include; $(MAKE)
	@cd source; $(MAKE) all

scrollz.1: scrollz.1.in
	sed -e "s,SHAREDIR,$(IRCSHARE)," < scrollz.1.in > scrollz.1

installeverything:  install installman installflush installio \
		    installwserv installhelp

everything: all ircflush ircio wserv

ircserv: ircio

ircio: source/Makefile
	@cd source; $(MAKE) ircio

ircflush: source/ircflush.c source/Makefile
	@cd source; $(MAKE) ircflush

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

installbin: installirc

installirc: scrollz installdirs
	@if test -f $(DESTDIR)/$(INSTALL_IRC).old; then $(RM) $(DESTDIR)/$(INSTALL_IRC).old; fi
	@if test -f $(DESTDIR)/$(INSTALL_IRC); then $(MV) $(DESTDIR)/$(INSTALL_IRC) $(INSTALL_IRC).old; fi
	$(RM) $(DESTDIR)/$(INSTALL_IRC)
	$(INSTALL) source/scrollz $(DESTDIR)/$(INSTALL_IRC)-$(VERSION)
	@(cd $(DESTDIR)/$(bindir) ; $(LN) scrollz-$(VERSION) scrollz)
	@cp doc/ScrollZ.doc $(DESTDIR)/$(IRCDOC)

installman: scrollz.1
	$(INSTALL) scrollz.1 $(DESTDIR)/$(mandir)

installserv: installio
installio: ircio installdirs
	$(INSTALL) source/ircio $(DESTDIR)/$(INSTALL_IRCIO)

installflush: ircflush installdirs
	$(INSTALL) source/ircflush $(DESTDIR)/$(INSTALL_IRCFLUSH)

installwserv: wserv installdirs
	$(INSTALL) source/wserv $(DESTDIR)/$(INSTALL_WSERV)

installdirs:
	umask 022; ./mkinstalldirs $(DESTDIR)/$(IRCSHARE) $(DESTDIR)/$(bindir) \
		$(DESTDIR)/$(INSTALL_SCRIPT) \
		$(DESTDIR)/$(HELP_DIR) $(DESTDIR)/$(IRCDOC) $(DESTDIR)/$(mandir)

installhelp:
	$(INSTALL_HELP_CMD)
	find $(DESTDIR)/$(HELP_DIR) -type d -print | xargs chmod a+rx
	find $(DESTDIR)/$(HELP_DIR) -type f -print | xargs chmod a+r

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

distclean cleandir realclean: clean
	$(RM) Makefile include/Makefile source/Makefile source/sig.inc config.status config.cache config.log include/defs.h include/hook.h include/keys.h include/vars.h ircbug scrollz.1

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

autoconf: configure

configure: configure.in acconfig.h aclocal.m4
	autoconf

autoheader: include/defs.h.in

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

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

autofiles: headers autoconf autoheader

config_h:
	$(RM) include/config.h
	cp include/config.h.dist include/config.h

export: headers distclean autoconf autoheader


syntax highlighted by Code2HTML, v. 0.9.1