# Copyright (c) 1996 and 1997  WIDE Project. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifications, are permitted provided that the above copyright notice
# and this paragraph are duplicated in all such forms and that any
# documentation, advertising materials, and other materials related to
# such distribution and use acknowledge that the software was developed
# by the WIDE Project, Japan. The name of the Project may not be used to
# endorse or promote products derived from this software without
# specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS''
# AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
# LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE.

.if exists(${.CURDIR}/../Makefile.opsys)
.include "${.CURDIR}/../Makefile.opsys"
.endif

PROGS   = route6d rip6query ifmcstat udp6stat udp6send udp6recv

CFLAGS+=	-DADVAPI=1 -Dss_family=__ss_family -Dss_len=__ss_len
#CFLAGS+=	-Wall -Werror -Dlint
LIBS	= -lkvm
DESTDIR	= sbin
DESTDIR1= bin

.include <../Makefile.old.inc>


all	:	${PROGS}

route6d	:	route6d.o route6d.h
	${CCLD} -o $@ route6d.o ${LIBS}

rip6query :	rip6query.o route6d.h
	${CCLD} -o $@ rip6query.o ${LIBS}

udp6stat :	udp6stat.o
	${CCLD} -o $@ udp6stat.o ${LIBS}

ifmcstat :	ifmcstat.o
	${CCLD} -o $@ ifmcstat.o ${LIBS}

udp6send	:	udp6send.o
	${CCLD} -o $@ udp6send.o ${LIBS}

udp6recv :	udp6recv.o
	${CCLD} -o $@ udp6recv.o ${LIBS}

install	:	${PROGS}
	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	${INSTALLFLAGS} route6d ${PREFIX}${DESTDIR}
	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	${INSTALLFLAGS} rip6query ${PREFIX}${DESTDIR1}
	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	${INSTALLFLAGS} udp6stat ${PREFIX}${DESTDIR1}
	${INSTALL} ${COPY} ${STRIP} -o bin -g kmem -m 2555 \
	${INSTALLFLAGS} ifmcstat ${PREFIX}${DESTDIR1}
	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	${INSTALLFLAGS} udp6send ${PREFIX}${DESTDIR1}
	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	${INSTALLFLAGS} udp6recv ${PREFIX}${DESTDIR1}
	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
	${INSTALLFLAGS} chkrt ${PREFIX}${DESTDIR1}
	${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
		route6d.8 ifmcstat.8 ${MANDIR}8

clean   ::
	${RM} ${PROGS} a.out core *~ *.o

.c.o    :
	${CC} ${CDEBUG} ${CFLAGS} ${INCL} -c $*.c

shar	:
	shar *.c *.h route6d.8 Makefile > route6d.shar
