;#
;# Copyright 1998, The University of Texas at Austin ("U. T. Austin").
;# All rights reserved.
;#
;# By using this software the USER indicates that he or she has read,
;# understood and will comply with the following:
;#
;# U. T. Austin hereby grants USER permission to use, copy, modify, and
;# distribute this software and its documentation for any purpose and
;# without fee, provided that:
;#
;# 1. the above copyright notice appears in all copies of the software
;#    and its documentation, or portions thereof, and 
;# 2. a full copy of this notice is included with the software and its
;#    documentation, or portions thereof, and 
;# 3. neither the software nor its documentation, nor portions thereof,
;#    is sold for profit. Any commercial sale or license of this software,
;#    copies of the software, its associated documentation and/or
;#    modifications of either is strictly prohibited without the prior
;#    consent of U. T. Austin. 
;# 
;# Title to copyright to this software and its associated documentation
;# shall at all times remain with U. T. Austin. No right is granted to
;# use in advertising, publicity or otherwise any trademark, service
;# mark, or the name of U. T. Austin.
;# 
;# This software and any associated documentation are provided "as is,"
;# and U. T. AUSTIN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESSED OR
;# IMPLIED, INCLUDING THOSE OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
;# PURPOSE, OR THAT USE OF THE SOFTWARE, MODIFICATIONS, OR ASSOCIATED
;# DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR
;# OTHER INTELLECTUAL PROPERTY RIGHTS OF A THIRD PARTY. U. T. Austin, The
;# University of Texas System, its Regents, officers, and employees shall
;# not be liable under any circumstances for any direct, indirect, special,
;# incidental, or consequential damages with respect to any claim by USER
;# or any third party on account of or arising from the use, or inability
;# to use, this software or its associated documentation, even if U. T.
;# Austin has been advised of the possibility of those damages.
;# 
;# Submit commercialization requests to: Office of the Executive Vice
;# President and Provost, U. T. Austin, 201 Main Bldg., Austin, Texas,
;# 78712, ATTN: Technology Licensing Specialist.
;#
;# @(#)Jmakefile	1.26 08/17/98 (cc.utexas.edu)
;#
/*
 * Jmakefile for npasswd/src
 *  @(#)Jmakefile	1.26 08/17/98 (cc.utexas.edu) /usr/share/src/private/ut/share/bin/passwd/V2.0/src/SCCS/s.Jmakefile
 */
#include "../Jmake.local"
>INSTALL

Initialize(INCLUDE_PATH, -I.. -ICommon -IPasswordCheck -IMethods)
Initialize(SYSTEM_PROGS, $p_sysprogs)	/* System programs to save */
Initialize(NPASSWD_HOME, $p_installdir)	/* Where to put npasswd */
Initialize(REPLACE_SYSTEM_PROGS, $p_replace)	/* Override sys progs */

/*
 * There are two types of subdirectories:
 * 	Standard - "make all", "depend", "clean" ... will traverse
 *	Special - traversal only when explicitly desired
 */
SetSubdirs(Scripts)				/* Standard subdirectories */
X_SUBDIRS = Common PasswordCheck Methods	/* Special subdirectories */
ALL_SUBDIRS = $(SUBDIRS) $(X_SUBDIRS)		/* All subdirectories */

;#
;# Sub directories & sub libraries
;#
LIB_METHOD = Methods/libmethod.a
LIB_PWCK = PasswordCheck/libpwcheck.a
LIB_COMOBJ = Common/libcomobj.a

;# Mode and ownership for npasswd binary
NPASSWD_MODE =	04111
NPASSWD_OWNER =	root

;# The main source components of npasswd
NPASSWD_SRC = \
	version.c \
	main.c \
	configure.c \
	passwd.c \
	chfn.c \
	chsh.c

;# The main object components of npasswd
NPASSWD_OBJ = \
|expand f!$(NPASSWD_SRC)!
	!f:\.c=\.o \
-expand \\

Describe(all, Build everything here and in subdirectories)

;#
;# Link the master config file into this directory for convenience
;#
Describe(config.h, Link ../config.h to here)
AllTarget(config.h)
LinkSourceFile(config.h,..)


Describe(npasswd, Build npasswd)
NormalProgramTarget(npasswd, $(NPASSWD_SRC), $(NPASSWD_OBJ) $(LIB_METHOD) $(LIB_PWCK) $(LIB_COMOBJ))

Describe(install,	Install npasswd and installs in subdirectories)
Describe(deinstall,	Remove npasswd and deinstall in subdirectories)

XdirMake(install,install,PasswordCheck)	/* Does recursive "make install" */
XdirMake(deinstall,deinstall,PasswordCheck)	/* Does recursive "make deinstall" */

;#
;# Put the binary into the npasswd install directory,
;#
install:: install-npasswd install-links

Describe(install-npasswd, Install npasswd binary only)
install-npasswd:	npasswd
	$(INSTALL) -c -o $(NPASSWD_OWNER) -m $(NPASSWD_MODE) \
		npasswd $(NPASSWD_HOME)

Describe(install-links, Make npasswd links if replacing system programs)
;#
;#	Link/symlink/copy to the other places it needes to live.
;#	The original versions of the system passwd/chfn/chsh
;#	programs are saved if the "replace" option is set in config.sh.
;#
install-links:	npasswd
	@if [ "$(REPLACE_SYSTEM_PROGS)" = define ]; then \
		echo Replacing system programs;\
		Scripts/savefiles $(SYSTEM_PROGS); \
		Scripts/installmany $(NPASSWD_HOME)/npasswd $(SYSTEM_PROGS); \
	 fi


Describe(deinstall, Restore system passwd programs and remove npasswd)
deinstall:: backdown
	$(RM) $(NPASSWD_HOME)/npasswd

Describe(backdown, Restore system passwd programs if saved by install)
backdown::
	@if [ "$(REPLACE_SYSTEM_PROGS)" = define ]; then \
		echo Restoring system programs;\
		Scripts/restorefiles; \
	fi;\
	exit 0

ThingFromSH(version.c)
ThingFromSH(options.h)

;#
;# Dependancies on things in subdirectories
;#
XdirMake($(LIB_PWCK),all,PasswordCheck)	/* Make password check lib */
XdirLibMake(method,Methods)		/* Make method lib */
XdirLibMake(comobj,Common)		/* Make comobj lib */

DebugTarget()				/* Enable debugging */
DebugCustomSubdir($(ALL_SUBDIRS))	/* Recursive debugging */

Describe(lint, Check C sources with lint)
LintTarget()

/*
 * Make up for not having all the subdirectories included in SUBDIRS
 */
SpecialSubdirsRule(xsubdirs,$(X_SUBDIRS))	/* Make xsubdir target */

DependTarget()					/* Depend here ... */
DependDirs($(ALL_SUBDIRS))			/* ... and in children */
TagsTarget()

|expand d!clean realclean clobber!
SpecialNamedTargetSubdirs(sub_!d,xsubdirs,!d,!d,$(FLAGS))
-expand


/* End Jmakefile */
