#!/bin/sh
# Makefile to build/install doc files
#
MKDIR = sh ../mkinstalldirs 
INSTALL = sh ../install-sh -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SCRIPT =  ${INSTALL} -m 755
prefix = /usr

datadir = ${prefix}/share
mandir = ${prefix}/share/man
sbindir = ${prefix}/sbin
etcdir = /etc
datato = ${DESTDIR}${datadir}/ipmiutil
cronto = ${DESTDIR}${etcdir}/cron.daily
initdir = $(shell rpmbuild --showrc |grep _initrddir | cut -d'}' -f2)
init0 = $(shell if [ "a${initdir}" == "a" ]; then  echo "/init.d"; else echo "${initdir}"; fi )
initto = ${DESTDIR}${etcdir}${init0}
sbinto = ${DESTDIR}${sbindir}
sbinfls = alarms bmchealth fruconfig getevent hwreset icmd isolconsole pefconfig sensor showsel tmconfig wdt bmcconfig

all:	

clean:

clobber:
	
distclean:
	
install:
	$(MKDIR) ${DESTDIR}${mandir}/man8
	$(MKDIR) ${datato}
	$(MKDIR) ${sbinto}
	$(MKDIR) ${initto}
	$(MKDIR) ${cronto}
	${INSTALL_DATA} showsel.8   ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} sensor.8    ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} hwreset.8   ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} alarms.8    ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} wdt.8       ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} fruconfig.8 ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} pefconfig.8 ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} tmconfig.8  ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} icmd.8      ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} getevent.8  ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} bmchealth.8 ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} ipmiutil.8  ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} isolconsole.8 ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} idiscover.8   ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} ievents.8     ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} bmcconfig.8 ${DESTDIR}${mandir}/man8
	${INSTALL_DATA} bmclanaol.mib ${datato}
	${INSTALL_DATA} bmclanpet.mib ${datato}
	${INSTALL_DATA} UserGuide     ${datato}
	${INSTALL_DATA} ../README     ${datato}
	${INSTALL_DATA} ../COPYING    ${datato}
	for f in ${sbinfls}; do \
	   ${INSTALL_SCRIPT} $$f ${sbinto}; done
	${INSTALL_SCRIPT} ipmi_if.sh   ${datato}
	${INSTALL_SCRIPT} evt.sh       ${datato}
	${INSTALL_SCRIPT} checksel     ${cronto}
	${INSTALL_SCRIPT} ipmiutil_wdt ${initto}/ipmiutil_wdt
	${INSTALL_SCRIPT} ipmiutil_asy ${initto}/ipmiutil_asy
	${INSTALL_SCRIPT} ipmi_port.sh ${initto}/ipmi_port
	cd ${DESTDIR}${mandir}/man8; gzip -f *.8
	
