# Generated automatically from Makefile.in by configure.
# IRC II was originally written by Michael Sandrof
# Copyright 1991 Michael Sandrof
# Copyright 1993 Matthew Green
# Copyright 1998 EPIC Software Labs
#
# This software uses your normal, default targets.  It should not be any
# more difficult than anything else to install.
#
# Most useful targets:
#	make		- Compiles ircII and wserv4
#	make install	- Installs ircII and wserv4 and the standard script
#			  library to the normal places
#	make clean	- Remove everything created by compiling
#	make distclean	- make clean + remove autoconf generated stuff
#
# Other interesting targets:
#	make wserv		- Compile just wserv
#	make installwserv 	- Installs just wserv
#	make installepic	- Installs just the epic binary
#	make installscript 	- Installs just the standard script library
#

CC = gcc
DEFS = -DHAVE_CONFIG_H
LIBS = -ltermcap  -lnsl -lresolv -lcrypt -lm

# Compiler/Linker flags -- These flags are passed to both the compiler
#			   and the linker.  Common flags include:
# -g 		Include debugging info in the binary.  
# -O		Compiler should do some basic optimizations.  
# -Wall 	For GCC compilers, the -Wall flag turns on lots of additional
#		warning checks.  You can safely ignore any warnings about 
#		"NULL format", as those uses are intentional.
CFLAGS = -g -O

# Compiler flags -- These flags are passed only to the compiler.
#		    Common flags include:
# -ansi		These two flags turn on "ansi" or "standard" mode on some
# -std1		vendor compilers.  This flag is required for the Digital
#		Alpha 'cc' compiler, and may be required for other compilers
#		that don't allow ansi C extensions without it.  GCC does
#		not require this flag, though EPIC will compile with it.
ANSIFLAGS =

# Linker flags -- These flags are passed only to the linker.
#		  Common flags include:
# -s		Strip all debugging information from the resulting binary. 
# -static	Generate a binary that does not use shared libraries
LDFLAGS = 


#
# These are automatically generated by 'configure'.  You really ought to 
# get in the habit of specifying these to 'configure' rather than changing 
# them here. ;-)
#
# Note that some things have changed!  This summarizes the changes:
#
# Script library	old:	/usr/local/lib/irc/script	
#			new:    /usr/local/share/epic/script
# Help files		old:	/usr/local/lib/irc/help
#			new:    /usr/local/share/epic/help
# Wserv location	old:	/usr/local/bin/wserv
#			new:	/usr/local/libexec/wserv
#
IP	    = 
prefix      = /usr/local
exec_prefix = ${prefix}
bindir      = ${exec_prefix}/bin
libexecdir  = ${exec_prefix}/libexec
sharedir    = ${prefix}/share
mandir	    = ${prefix}/man

epic        = epic
epic_exe    = $(bindir)/$(epic)
wserv_exe   = $(libexecdir)/wserv4
epicdir     = $(sharedir)/$(epic)

############ You ought not change anything below this line ###################

RM = rm -f
CP = cp
MV = mv
INSTALL_PROGRAM = ./bsdinstall -c -m 755
INSTALL_DATA = ./bsdinstall -c -m 644

VERSION  = EPIC4-2.0

SHELL = /bin/sh
MAKE2 = $(MAKE) $(MFLAGS)
MFLAGS ='CC=$(CC)'					\
	'ANSIFLAGS=$(ANSIFLAGS)'			\
	'CFLAGS=$(CFLAGS)'				\
	'DEFS=$(DEFS)'					\
	'INSTALL_WSERV=$(wserv_exe)'			\
	'IRCLIB=$(epicdir)'				\
	'LDFLAGS=$(LDFLAGS)'				\
	'LIBS=$(LIBS)'					\
	'RM=$(RM)'

all everything: epic wserv4
install installeverything: all installbin installscript installman
installbin: installepic installwserv



#
# Main irc binary
#
epic: source/Makefile Makefile
	@cd source; $(MAKE2) all

EPIC 	  = $(epic_exe)-$(VERSION)
EPIC_OLD  = $(epic_exe).old
EPIC_LINK = $(epic_exe)
installepic installirc: epic installdirs test
	if ./my_test \( ! -f $(IP)$(EPIC) \) \
			-o source/epic -nt $(IP)$(EPIC); then \
		$(INSTALL_PROGRAM) source/epic $(IP)$(EPIC);	\
		if ./my_test -f $(IP)$(EPIC_OLD); then \
			$(RM) $(IP)$(EPIC_OLD); \
		fi; \
		if ./my_test -f $(IP)$(EPIC_LINK); then \
			$(MV) $(IP)$(EPIC_LINK) $(IP)$(EPIC_OLD); \
		fi; \
		$(RM) $(IP)$(EPIC_LINK); \
		ln -s $(IP)$(EPIC) $(IP)$(EPIC_LINK); \
	fi

#
# wserv
#
wserv4: source/wserv.c source/gailib.c source/Makefile
	@cd source; $(MAKE2) wserv4

WSERV	 = $(wserv_exe)
installwserv: wserv4 installdirs test
	if ./my_test \( \! -f $(IP)$(WSERV) \) -o \
			source/wserv4 -nt $(IP)$(WSERV); then	\
		$(INSTALL_PROGRAM) source/wserv4 $(IP)$(WSERV);	\
	fi


#
# Script library
#
scriptdir = $(epicdir)/script
installscript: installdirs test
	-@(								\
		if ./my_test -f $(IP)$(scriptdir)/local; then		\
			if ./my_test -f script/local; then 		\
				$(MV) ./script/local 		\
					./script/local.orig;	\
			fi;						\
		fi;							\
	)
	for i in ./script/*; \
	do \
		if ./my_test -f $$i; then \
			if ./my_test -x $$i; then \
				chmod a-x $$i; \
			fi; \
			target=$(IP)$(scriptdir)/`basename $$i`; \
			if ./my_test -f $$target; then \
				if ./my_test $$i -nt $$target; then \
					$(INSTALL_DATA) $$i $$target; \
				fi; \
			elif ./my_test -f $$target.gz; then \
				if ./my_test $$i -nt $$target.gz; then \
					$(INSTALL_DATA) $$i $$target; \
					gzip -f $$target; \
				fi; \
			else \
				$(INSTALL_DATA) $$i $$target; \
				if ./my_test -f $(IP)$(scriptdir)/gzip-scripts; then \
					gzip -f $$target; \
				fi; \
			fi; \
		fi; \
	done

helpdir   = $(epicdir)/help
installhelp: installdirs
	if ./my_test -d help ; then \
		(cd ./help; tar cf - .) | (cd $(IP)$(helpdir); tar xf -)  ; \
	else \
		echo No help files to install. ; \
	fi

installman: installdirs
	$(INSTALL_DATA) ./doc/epic.1 $(IP)/$(mandir)/man1/$(epic).1

installdirs:
	umask 022; \
	./mkinstalldirs $(IP)$(epicdir) $(IP)$(scriptdir) \
		$(IP)$(helpdir) $(IP)$(bindir) $(IP)$(libexecdir) \
		$(IP)$(mandir)/man1

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; $(MAKE2) clean; fi
	$(RM) test.o my_test

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

depend:
	(cd source;make depend)

# This is the end of the file.
