# ----------------------------------------------------------------------
# Adapt the installation directories to your local standards.
# ----------------------------------------------------------------------

BINDIR = /local/etc
MANDIR = /local/man/man8
 
# ----------------------------------------------------------------------
# Special compilation options are needed only on a few platforms.
# ----------------------------------------------------------------------

#if defined(_AIX)
#	SYSDEFS = -D_BSD -D_BSD_INCLUDES -U__STR__
#endif

#if defined(hpux)
#	SYSDEFS = -DSYSV_SETVBUF -DSYSV_UDPPROTO
#endif

#if defined(__sparc) && defined(__svr4__)
	SYSDEFS = -DSYSV_SETVBUF
#endif

# SYSDEFS =

# ----------------------------------------------------------------------
# Compilation definitions.
# ----------------------------------------------------------------------

DEFS =

CFLAGS = -O $(DEFS) $(SYSDEFS)

CC = cc

# ----------------------------------------------------------------------
# Files.
# ----------------------------------------------------------------------

HDRS =
SRCS = traceroute.c
OBJS = traceroute.o
PROG = traceroute
MANS = traceroute.8

FILES = Makefile $(SRCS) $(MANS)

# ----------------------------------------------------------------------
# libresolv.a should contain the resolver library of BIND 4.8.2 or later.
# Link it in only if your default library is different.
# libnet.a contains the getnet...() getserv...() getproto...() calls.
# It is safe to leave it out and use your default library.
# ----------------------------------------------------------------------

#LIBS = ../resolver/libresolv.a
#LIBS = -lresolv
#LIBS = -lresolv -lnet
LIBS = -lresolv -lsocket -lnsl

# ----------------------------------------------------------------------
# Rules for installation.
# ----------------------------------------------------------------------

all: $(PROG)

$(PROG): $(OBJS)
	$(CC) -o $(PROG) $(OBJS) $(LIBS)

install: $(PROG)
	install -c -o root -g network -m 4755 -s $(PROG) $(BINDIR)

man:
	install -c -m 444 $(MANS) $(MANDIR)

clean:
	rm -f $(PROG) *.o a.out core traceroute.tar traceroute.tar.Z

# ----------------------------------------------------------------------
# Rules for maintenance.
# ----------------------------------------------------------------------

lint:
	lint $(DEFS) $(SYSDEFS) $(SRCS)

dist:
	tar cf traceroute.tar $(FILES)
	compress traceroute.tar
