;#
;# 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.12 07/20/98 (cc.utexas.edu)
;#
;# Main Makefile for npasswd
;#
#include "Jmake.local"

Initialize(INSTALL_DIR, $p_installdir)
Initialize(KEEP_DIR, $p_keepdir)
Initialize(DICT_DIR, $p_dictionaries)
Initialize(UTIL_DIR, $p_utildir)
Initialize(ECHO_C, $c)
Initialize(ECHO_N, $n)

DIRS_NEEDED = $(INSTALL_DIR) $(DICT_DIR) $(KEEP_DIR) $(UTIL_DIR)

SetSubdirs(files src dict doc)

Describe(all, Build everything everywhere)
;# Force "all" to be the first target
all::
	/* Leave this blank line here */

HelpTarget()

Describe(install, Install npasswd. This must be done as root)
;#
;# Install section - lots of things to do
;#
install::
	@foo=`(id || whoami) 2>/dev/null`;\
	  case "$$foo" in \
	  *root*) exit 0;;\  
	  *) echo "make install should be done as root"; exit 1;;\
          esac

;#
;# Make and set modes for the installation directories
;#
install::
	MakeDirs($(DIRS_NEEDED))
	chmod 0755 $(INSTALL_DIR) $(DICT_DIR) $(UTIL_DIR)
	chmod 0751 $(KEEP_DIR)

Describe(deinstall, Remove npasswd and revert to vendor programs)
deinstall:: backdown

Describe(backdown, Revert to vendor programs )
backdown::
	cd src; make $(MFLAGS) backdown

Describe(nuke, Delete the entire install directory and contents) 
nuke:
	@echo $(ECHO_N) Delete everything under $(INSTALL_DIR) '(y/n)? $(ECHO_C)'; \
	 read ans;\
	 case "$$ans" in\
	 y*|Y*) (set -x; $(RM) -r $(INSTALL_DIR)) ;;\
	esac

Describe(depend, Update makefile dependancies)
DependSubdirs()	/* Depend ins SUBDIRS */
DebugSubdirs()	/* Debugging in SUBDIRS */

/* End Jmakefile */
