#
# 5799-WZQ (C) COPYRIGHT = NONE
# LICENSED MATERIALS - PROPERTY OF IBM
#
# $Header:Makefile 12.0$ 
# $ACIS:Makefile 12.0$ 
# $Source: /ibm/acis/usr/src/ibm/rvd/client/RCS/Makefile,v $ 

#
# 	$Source: /ibm/acis/usr/src/ibm/rvd/client/RCS/Makefile,v $
#	$Author: root $
#	$Locker:  $
#	$Header:Makefile 12.0$
#	$ACIS:Makefile 12.0$
#

DESTDIR=
INSTDIR=	/usr/ibm
BININSTDIR=	${INSTDIR}

# To make without Kerberos authenticator support: "make KERBEROS="
#
# KERBEROS=	-DKERBEROS
CFLAGS=		-c -O ${KERBEROS} -I../h # -DDEBUG
LFLAGS=		-I../h
DEBUG_FLAG=		  # This is used to add "-g" on the make command line.

LIBS  = ../lib/libtctl.a ../lib/libls.a
# KLIBS = -lkrb -ldes

LINKS =	spinup spindown vdstats up down newvd vdabort rvdhosts

SRCS =	main.c rvdupdown.c newvd.c rvdtab.c common.c mtab.c \
	util.c servername.c rvdhosts.c

OBJS =	main.o rvdupdown.o newvd.o rvdtab.o common.o mtab.o \
	util.o servername.o rvdhosts.o

all: rvdclient

rvdclient:	${OBJS}
	${CC} ${LFLAGS} -o rvdclient ${OBJS} ${LIBS} ${KLIBS}

xs.o: strings
	xstr
	${CC} -R -c xs.c

.c.o:
	${CC} ${DEBUG_FLAG} ${CFLAGS} $<
	

${DESTDIR}${BININSTDIR}:
	mkdir ${DESTDIR}${BININSTDIR} ; chmod 755 ${DESTDIR}${BININSTDIR}

install: rvdclient ${DESTDIR}${BININSTDIR}
	install -m 4755 -c -s rvdclient ${DESTDIR}${BININSTDIR}/rvdclient
	for i in ${LINKS}; do rm  -f ${DESTDIR}${BININSTDIR}/$$i;\
	    ln ${DESTDIR}${BININSTDIR}/rvdclient ${DESTDIR}${BININSTDIR}/$$i;\
		done
	rm ${DESTDIR}${BININSTDIR}/rvdclient

lint:;		lint -u -I../h $(SRCS)

clean:
	rm -f rvdclient *.o xs.c strings *~ core a.out
	
depend: ${SRCS}
	cat </dev/null >x.c
	rm -f makedep
	for i in ${SRCS}; do \
		(echo `basename $$i .c`.o: $$i >>makedep; \
		/bin/grep '^#[  ]*include' x.c $$i | sed \
			-e '/\.\.\/h/d' \
			-e 's,<\(.*\)>,"../h/\1",' \
			-e 's/:[^"]*"\([^"]*\)".*/: \1/' \
			-e 's/\.c/.o/' >>makedep); \
	done
	rm -f eddep x.c
	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	chmod +w Makefile
	ed - Makefile < eddep
	rm -f eddep makedep x.c
	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	echo '# see make depend above' >> Makefile

# DO NOT DELETE THIS LINE --- make depend uses it
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
