#CC=gcc

# Directory into which rfinger and rwhois programs will be installed:
BIN_DEST_DIR=/usr/local/bin

# Directory into which man page files will be installed:
MAN_DEST_DIR=/usr/local/man/man1

SOCKS_LIB =../lib/libsocks.a

# Define RESOLV_LIB if your system (e.g., SunOS before 4.1.1)
# doesn't search resolver library automatically.
# Leave it undefined otherwise.
# If your compiler or loader complains about _res_init being
# an undefined symbol, then you must define RESOLV_LIB.
#RESOLV_LIB= -lresolv
#
# IRIX should use the next two lines:
#RESOLV_LIB=-lsun
#CCKR=-cckr

# The Internet Whois server; used to be nic.ddn.mil.
WHOIS_SERVER= -DWHOIS_SERVER'="rs.internic.net"'

CFLAGS = -I../include -g $(CCKR)

# The 'install' command is assumed to be the BSD variety (using -m to
# set the file mode). If the default 'install' on your system doesn't
# do that, you have to either specify an alternative one in the line below
# (e.g., /usr/ucb/install) or modify the install instructions.
INSTALL= install

#==============================================================================

OBJ = finger.o
SRC = finger.c

all: echocwd rfinger rwhois

rfinger: $(SRC) $(SOCKS_LIB)
	$(CC) $(CFLAGS) -o $@ $(SRC) $(SOCKS_LIB) $(RESOLV_LIB)

rwhois: $(SRC) $(SOCKS_LIB)
	$(CC) $(WHOIS_SERVER) $(CFLAGS) -o $@ $(SRC) $(SOCKS_LIB) $(RESOLV_LIB)

install: echocwd rfinger rwhois
	$(INSTALL) -m 111 rfinger $(BIN_DEST_DIR)
	$(INSTALL) -m 111 rwhois $(BIN_DEST_DIR)

install.man: echocwd rfinger.1 rwhois.1
	$(INSTALL) -m 444 rfinger.1 $(MAN_DEST_DIR)
	$(INSTALL) -m 444 rwhois.1 $(MAN_DEST_DIR)

clean: echocwd
	rm -f $(OBJ) rwhois rfinger core

echocwd:
	@pwd
