#!/bin/sh
####
# NAME
#	make-install : execute "make install" command
# VERSION
#	$Id$
# USAGE
#	make-install [-p|-g]
# DESCRIPTION
#  make-install is used by sudo command. if you set this command to
#  "sudoers" file (the configulation file for sudo command),
#  you can install the packages as a user.
# COPYRIGHT
#  Copyright (C) 2000,2001 Steel Wheels Project.
#  This file is a apart of the papaya utilities. 
#  If you need the information of copyright of this file, see COPYING
#  file distributed with file or see http://www.asahi-net.or.jp/~em7t-hmd
#  web page.

make_command="make"

arg=$1 ;

error(){
	echo "ERROR: $1" >&2 ;
	exit 1 ;
}

if test "x$arg" = "x-p" ; then
	if search-exec -n pmake ; then
		make_command="pmake" 
	fi
elif test "x$arg" = "x-g" ; then
	if search-exec -n gmake ; then
		make_command=/usr/pkg/bin/gmake
	fi
elif test ! "x$arg" = "x" ; then
	error "unknown option \"$arg\"" ;
fi

echo "$make_command install" 
if $make_command install ; then
	if search-exec -n ldconfig ; then
		echo "ldconfig"
		ldconfig
		exit 0 ;
	fi
fi

exit 1 ;

