# Makefile template
#
# Copyright (C) 1999-2002 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
# Copyright (C) 1999 Carl Erhorn <cerhorn@hyperion.com>
#
# This file is used as a template to create the
# Makfile for the Solaris 2.x specific installation.
# This includes Solaris 2.4, 2.5, 2.5.1, 2.6, 
# 2.7 (Solaris 7), 2.8 (Solaris 8), and 2.9ea (Solaris 9 Early Access)
#
#	December 9th, 1999 -- CPE
#	October 7th, 2001 -- CPE
#

# Default variables
@VARIABLES@
# TOP source directory.
topdir = @topdir@
top_builddir = $(topdir)

# Include the default make targets: to be put before the all-targets: rule.
@TARGETS@

all-targets: Makefile

install: install-exec install-@USB_DRIVER@

install-:

install-exec:
	@rm -f /etc/rc0.d/K21apcupsd
	@rm -f /etc/rc1.d/S89apcupsd
	@rm -f /etc/rc2.d/S89apcupsd
	@rm -f /etc/init.d/apcupsd
	@$(INSTALL_PROGRAM) -m 744 apcupsd /etc/init.d/apcupsd ;
	@ln -f -s /etc/init.d/apcupsd /etc/rc0.d/K21apcupsd
	@ln -f -s /etc/init.d/apcupsd /etc/rc1.d/S89apcupsd
	@ln -f -s /etc/init.d/apcupsd /etc/rc2.d/S89apcupsd

	@echo "================================================="
	@echo 
	@echo "apcupsd script installation for Solaris $(DISTVER) complete."
	@echo "You should now edit $(sysconfdir)/apcupsd.conf  to correspond"
	@echo "to your setup then start the apcupsd daemon with:"
	@echo 
	@echo "/etc/init.d/apcupsd start"
	@echo 
	@echo "Thereafter when you reboot, it will be stopped and started"
	@echo "automatically."
	@echo 
	@echo "================================================="

install-usb:
	@echo
	@echo "Configuring ugen driver to match APC UPSes..."
	@echo
	-add_drv -f -i '"usbif51d,class3"' ugen || \
	  update_drv -a -i '"usbif51d,class3"' ugen
	@echo
	@echo "NOTE:"
	@echo "   \"(usbif51d,class3) already in use\" and"
	@echo "   \"Driver (ugen) is already installed\""
	@echo "   errors may be safely ignored."
	@echo
	@echo "================================================="
	@echo "Driver configured. You must PERFORM A RECONFIGURE"
	@echo "BOOT \"reboot -- -r\" before running Apcupsd."
	@echo "================================================="

uninstall:
	@echo "Removing symlinks..."
	@rm -f /etc/rc0.d/K21apcupsd
	@rm -f /etc/rc1.d/S89apcupsd
	@rm -f /etc/rc2.d/S89apcupsd
	@echo "Removing boot script..."
	@rm -f /etc/init.d/apcupsd
	@echo "Removing ugen binding (errors are safe to ignore)..."
	-update_drv -d -i '"usbif51d,class3"' ugen > /dev/null
	@echo 
	@echo "apcupsd has been disabled."

clean:

distclean:
	@rm -f apccontrol.sh apcupsd Makefile rc0.solaris
	@rm -rf CVS


syntax highlighted by Code2HTML, v. 0.9.1