#
# Copyright (c) 1992 Regents of the University of Michigan.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that this notice is preserved and that due credit is given
# to the University of Michigan at Ann Arbor. The name of the University
# may not be used to endorse or promote products derived from this
# software without specific prior written permission. This software
# is provided ``as is'' without express or implied warranty.
#
# Make Definitions file for the Internet Rover ping daemon
#
SRCS=	fpapi.c pingd.c
HDRS=	
OBJS=	fpapi.o pingd.o

DEFINES= 	-D_BSD
INCLUDES= 	-I../../include 
CFLAGS=	 	${INCLUDES} ${DEFINES} ${ACFLAGS}

MYLIBS=		-lctools -lProblemManager -lHostfileManager
LDFLAGS= 	-L${LIBDIR} ${MYLIBS} ${ALDFLAGS}

default:
	(cd ../.. ; make pingd)

all: pingd

pingd: ${OBJS} version.c
	${CC} -o $@ version.c ${OBJS} ${LDFLAGS}

version.c: Version.c
	(u=$${USER-root} h=`hostname` t=`date` v=`cat ../../VERSION`; \
	sed -e "s|%WHEN%|$${t}|" \
	    -e "s|%VERSION%|$${v}|" \
	    -e "s|%WHOANDWHERE%|$${u}@$${h}|" \
	    < Version.c > version.c)

clean:
	rm -f *.o core pingd version.c version.o

install:
	( cd ../.. ; make ping-install )

ping-install:
	@echo "To complete the install of pingd you must perform"
	@echo "these following three steps as root:"
	@echo "     1.  cp pingd ${BINDIR}"
	@echo "     2.  chown root ${BINDIR}/pingd"
	@echo "     3.  chmod 4755 ${BINDIR}/pingd"
	@echo " "
	@echo "or use make root-install"

root-install:
	( cd ../.. ; make root-install )

root-ping:
	rm -f ${BINDIR}/pingd
	cp pingd ${BINDIR}
	chown root ${BINDIR}/pingd
	chmod 4755 ${BINDIR}/pingd

depend: ${SRCS}
	mkdep ${CFLAGS} ${SRCS}

lint: ${SRCS} ${HDRS}
	lint -Dlint ${DEFINES} ${INCLUDES} ${SRCS}

tags:
	ctags -t ${SRCS} ${HDRS}

# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

fpapi.c:
pingd.c:

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
