/*
 * Jmakefile for mailagent
 */

;# $Id: Jmakefile,v 3.0.1.4 1999/07/12 13:40:32 ram Exp ram $
;#
;#  Copyright (c) 1990-2006, Raphael Manfredi
;#  
;#  You may redistribute only under the terms of the Artistic License,
;#  as specified in the README file that comes with the distribution.
;#  You may reuse parts of this distribution only within the terms of
;#  that same Artistic License; a copy of which may be found at the root
;#  of the source tree for mailagent 3.0.
;#
;# $Log: Jmakefile,v $
;# Revision 3.0.1.4  1999/07/12  13:40:32  ram
;# patch66: will now install examples as well
;#
;# Revision 3.0.1.3  1994/10/31  11:12:59  ram
;# patch23: file magent.sh now replaces magent.SH to avoid auto-extraction
;#
;# Revision 3.0.1.2  1994/10/29  17:37:48  ram
;# patch20: directory pl added to subdirs and depend lists
;#
;# Revision 3.0.1.1  1994/09/22  13:39:09  ram
;# patch12: new edusers script to edit users file
;#
;# Revision 3.0  1993/11/29  13:47:37  ram
;# Baseline for mailagent 3.0 netwide release.
;#

BIN = mailpatch mailhelp maillist maildist package edusers

NoManPages()
ShellScriptTarget($(BIN))
SimpleShellScriptTargetExt(magent,.sh)

/* The mailagent itself is derived from 'magent' through perload, hence
 * making the program more efficient (the whole script need not be compiled
 * by perl).
 */

AllTarget(mailagent)
mailagent: magent
	perl $(TOP)/bin/perload -o magent > $@
	chmod +rx $@

/* The mailagent carries some machine-dependant parts (for file locking)
 * so it is a binary, not a script (viz it may not be shared accross
 * different architectures).
 */

InstallScript(mailagent,$(BINDIR))

SetSubdirs(pl filter files man test examples)
DependDirs(pl filter)
RemoteDependency(pl/utmp,utmp.pl)
RemoteDependency(pl/termios,termios.pl)

BINSH = \
|expand f!$(BIN)!
	!f.SH \
-expand
	magent.sh

depend::
	($(SED) '/^# DO NOT DELETE/q' Makefile && \
	grep '^\$$grep' $(BINSH) | \
	$(SED) -e "s/^.*' \([^ ]*\) >>\(.*\)/\2: \1/" \
	) > Makefile.new
	cp Makefile Makefile.bak
	cp Makefile.new Makefile
	$(RM) Makefile.new

