# $Id: Makefile.in,v 1.14 2006-07-12 19:54:39 ghudson Exp $

SHELL=/bin/sh
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
VPATH=@srcdir@
srcdir=@srcdir@
top_srcdir=@top_srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
lbindir=@lbindir@
lsbindir=@lsbindir@
mandir=@mandir@

CC=@CC@
CPPFLAGS=@CPPFLAGS@
CFLAGS=@CFLAGS@ ${WARN_CFLAGS} ${ERROR_CFLAGS}
DEFS=@DEFS@
LDFLAGS=@LDFLAGS@
LIBS=@LIBS@
KRB4_LIBS=@KRB4_LIBS@
REGEX_LIBS=@REGEX_LIBS@
ZEPHYR_LIBS=-lzephyr
AFS_LIBS=-lprot -lauth -lrxkad -lubik -laudit -lsys -lrx -llwp -lsys -lafsutil
ALL_CFLAGS=${WARN_CFLAGS} ${ERROR_CFLAGS} -I. ${CPPFLAGS} ${CFLAGS} ${DEFS}
ALL_LIBS=-llocker ${AFS_LIBS} ${ZEPHYR_LIBS} ${KRB4_LIBS} ${REGEX_LIBS} \
	 -lhesiod -lcom_err ${LIBS}

ATTACH_OBJS=suite.o agetopt.o add.o attach.o detach.o fsid.o zinit.o

all: attach atconvert

attach: ${ATTACH_OBJS}
	${CC} ${LDFLAGS} -o attach ${ATTACH_OBJS} -lathdir ${ALL_LIBS}

atconvert: atconvert.o
	${CC} ${LDFLAGS} -o atconvert atconvert.o ${ALL_LIBS}

.c.o:
	${CC} -c ${ALL_CFLAGS} $<

check:

install:
	${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
	${top_srcdir}/mkinstalldirs ${DESTDIR}${lbindir}
	${top_srcdir}/mkinstalldirs ${DESTDIR}${lsbindir}
	${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1
	${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
	${INSTALL} -m 4755 -o root attach ${DESTDIR}${lbindir}
	rm -f ${DESTDIR}${lbindir}/detach
	ln -s attach ${DESTDIR}${lbindir}/detach
	rm -f ${DESTDIR}${lbindir}/fsid
	ln -s attach ${DESTDIR}${lbindir}/fsid
	rm -f ${DESTDIR}${lbindir}/nfsid
	ln -s attach ${DESTDIR}${lbindir}/nfsid
	rm -f ${DESTDIR}${lbindir}/zinit
	ln -s attach ${DESTDIR}${lbindir}/zinit
	rm -f ${DESTDIR}${lsbindir}/zinit
	ln -s ${lbindir}/attach ${DESTDIR}${lsbindir}/zinit
	${INSTALL} -m 755 atconvert ${DESTDIR}${sbindir}
	${INSTALL} -m 644 ${srcdir}/add.1 ${DESTDIR}${mandir}/man1
	${INSTALL} -m 644 ${srcdir}/attach.1 ${DESTDIR}${mandir}/man1
	${INSTALL} -m 644 ${srcdir}/detach.1 ${DESTDIR}${mandir}/man1
	${INSTALL} -m 644 ${srcdir}/fsid.1 ${DESTDIR}${mandir}/man1
	${INSTALL} -m 644 ${srcdir}/nfsid.1 ${DESTDIR}${mandir}/man1
	${INSTALL} -m 644 ${srcdir}/zinit.8 ${DESTDIR}${mandir}/man8

clean:
	rm -f ${ATTACH_OBJS} attach
	rm -f atconvert.o atconvert

distclean: clean
	rm -f config.cache config.log config.status Makefile
