# Makefile template
#
# Copyright (C) 1999-2002 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
#

# 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:
	@echo "Slackware distribution installation"
	$(INSTALL_PROGRAM) -m 744 apcupsd /etc/rc.d/rc.apcupsd
	$(INSTALL_PROGRAM) -d -m 755 @LOCKDIR@/subsys
	@-rcfile=/etc/rc.d/rc.6; \
	grep -q @sysconfdir@/apccontrol $$rcfile; \
	if [ $$? -ne 0 ]; then \
	    echo "Patching $$rcfile"; \
	    cp -p $$rcfile $$rcfile.`date +%Y%m%d%M%S`; \
	    patch -s $$rcfile rc6.patch; \
	    if [ $$? -ne 0 ]; then \
		echo; \
		echo "Patches could not be properly applied.  Please check"; \
		echo "$$rcfile and edit it manually."; \
		echo; \
		exit 1; \
	    fi; \
	else \
	    echo "$$rcfile appears to already have been patched."; \
	    echo "leaving it unchanged"; \
	fi
	@( echo ''; \
	echo "The apcupsd boot script has been installed to"; \
	echo "/etc/rc.d/rc.apcupsd and the halt script /etc/rc.d/rc.6 has"; \
	echo "been patched.  You must still call /etc/rc.d/rc.apcupsd"; \
	echo "during the boot process after you have tested your"; \
	echo "installation.  One way to do this is from the"; \
	echo "/etc/rc.d/rc.local file."; \
	echo "See the distributions/slackware/README file."; \
	echo ) | /usr/bin/fmt

uninstall:
	@echo "Slackware distribution uninstall"
	rm -f /etc/rc.d/rc.apcupsd
	@-rcfile=/etc/rc.d/rc.6; \
	grep -q @sysconfdir@/apccontrol $$rcfile; \
	if [ $$? -eq 0 ]; then \
	    echo "Unpatching $$rcfile"; \
	    cp -p $$rcfile $$rcfile.`date +%Y%m%d%M%S`; \
	    patch -s -R $$rcfile rc6.patch; \
	    if [ $$? -ne 0 ]; then \
		echo; \
		echo "Patches could not be properly removed.  Please check"; \
		echo "$$rcfile and edit it manually."; \
		echo; \
		exit 1; \
	    fi; \
	fi; \
	echo "References to rc.apcupsd (rc.local?) have not been removed."

clean:

distclean:
	@rm -f apccontrol.sh apcupsd Makefile rc6.patch
	@rm -rf CVS


syntax highlighted by Code2HTML, v. 0.9.1