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

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

CC=@CC@
CPPFLAGS=@CPPFLAGS@
CFLAGS=@CFLAGS@
DEFS=@DEFS@
LDFLAGS=@LDFLAGS@
LIBS=@LIBS@
REGEX_LIBS=@REGEX_LIBS@
ZEPHYR_LIBS=-lzephyr
ATHDIR_CFLAGS=@ATHDIR_CFLAGS@
ATHDIR_LIBS=@ATHDIR_LIBS@
AFS_LIBS=-lprot -lauth -lrxkad -lubik -laudit -lsys -lrx -llwp -lsys -lafsutil
ALL_CFLAGS=${CPPFLAGS} ${CFLAGS} ${DEFS}
ALL_LIBS=-llocker ${AFS_LIBS} ${ZEPHYR_LIBS} ${REGEX_LIBS} ${LIBS}

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

all: ${PROGRAMS}

attach: ${ATTACH_OBJS}
${ATTACH_OBJS}: CFLAGS += ${ATHDIR_CFLAGS}
attach: LIBS += ${ATHDIR_LIBS}

atconvert: atconvert.o

${PROGRAMS}:
	${CC} ${LDFLAGS} -o $@ $^ ${ALL_LIBS}

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

check:

install:
	${MKDIR_P} ${DESTDIR}${sbindir}
	${MKDIR_P} ${DESTDIR}${lbindir}
	${MKDIR_P} ${DESTDIR}${lsbindir}
	${MKDIR_P} ${DESTDIR}${mandir}/man1
	${MKDIR_P} ${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_PROGRAM} atconvert ${DESTDIR}${sbindir}
	${INSTALL_DATA} ${srcdir}/add.1 ${DESTDIR}${mandir}/man1
	${INSTALL_DATA} ${srcdir}/attach.1 ${DESTDIR}${mandir}/man1
	${INSTALL_DATA} ${srcdir}/detach.1 ${DESTDIR}${mandir}/man1
	${INSTALL_DATA} ${srcdir}/fsid.1 ${DESTDIR}${mandir}/man1
	${INSTALL_DATA} ${srcdir}/nfsid.1 ${DESTDIR}${mandir}/man1
	${INSTALL_DATA} ${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
