# Makefile

# You can edit this file or override these variables on
# the commandline.  For example, "make install MANDIR=/tmp/man"
# would use defaults for all variables except ${MANDIR}.


# You can set this to something like /opt/aoetools-x
# if you want to install everything in one place.
#
# Note that even with ${PREFIX} set, the devices in
# /dev/etherd will be used unless you override ${DEVDIR}.
PREFIX = 

# Your aoe-driver device files should be in ${DEVDIR}.
DEVDIR = /dev/etherd

# The programs will be installe in ${SBINDIR}.
SBINDIR = ${PREFIX}/usr/sbin
MANDIR = ${PREFIX}/usr/share/man

# end of user-configurable variables


CONF_SCRIPTS = aoe-discover aoe-interfaces
COMMANDS := ${CONF_SCRIPTS} aoe-mkdevs aoe-mkshelf aoe-stat

configure :
	@for f in ${CONF_SCRIPTS}; do \
	  sh -xc "sed 's!@devdir@!${DEVDIR}!g' $$f.in > $$f" || break; \
	done

install : configure
	mkdir -p ${SBINDIR}
	mkdir -p ${MANDIR}/man8
	@for f in ${COMMANDS}; do \
	  sh -xc "install -m 700 $$f ${SBINDIR}/$$f" || break; \
	  sh -xc "install -m 664 $$f.8 ${MANDIR}/man8/$$f.8" || break; \
	done

clean :
	rm -f ${CONF_SCRIPTS}
