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

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

# If your system doesn't have PWD defined, define it here:
#PWD=/projects/insg/socks.cstc
# It should be this current directory.

SOCKS_LIB=$(PWD)/lib/libsocks.a
IDENT_LIB=$(PWD)/libident/libident.a

RANLIB=ranlib
# Systems (e.g., IRIX) that do not need (and thus don't have) ranlib should use
#RANLIB=/bin/true

# 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 other Makefile.
INSTALL= install

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

all: LIB LIBIDENT server clients

server: LIB LIBIDENT
	(cd sockd; $(MAKE) SOCKS_LIB=$(SOCKS_LIB) IDENT_LIB=$(IDENT_LIB) CCKR=$(CCKR) RANLIB=$(RANLIB))

clients: LIB RFINGER RFTP RTELNET RXGOPHER RXMOSAIC

LIB:
	(cd lib; $(MAKE) CCKR=$(CCKR) RANLIB=$(RANLIB))

LIBIDENT:
	(cd libident; $(MAKE) CCKR=$(CCKR) RANLIB=$(RANLIB))

RFINGER: LIB
# This also build rwhois
	(cd rfinger; $(MAKE) RESOLV_LIB=$(RESOLV_LIB) $(WHOIS_SERVER) SOCKS_LIB=$(SOCKS_LIB) CCKR=$(CCKR) RANLIB=$(RANLIB))

RTELNET: LIB
	(cd rtelnet; $(MAKE) SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB=$(RESOLV_LIB) CCKR=$(CCKR) RANLIB=$(RANLIB))

RFTP: LIB
	(cd rftp; $(MAKE) SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB=$(RESOLV_LIB) CCKR=$(CCKR) RANLIB=$(RANLIB))

RXGOPHER: LIB
	(cd rxgopher; $(MAKE) SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB=$(RESOLV_LIB) CCKR=$(CCKR) RANLIB=$(RANLIB))
# If you have 'xmkmf' on your system, you may want to comment
# out the line above and use the line below.
#	(cd rxgopher; xmkmf; makedepend; $(MAKE) SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB=$(RESOLV_LIB) CCKR=$(CCKR) RANLIB=$(RANLIB))
# You will then have to edit the Makefile (cf. Makefile.YDL) if
# you also want to use it for install and install.man.

RXMOSAIC: LIB
	(cd rxmosaic; $(MAKE) SOCKS_LIB=$(SOCKS_LIB) RESOLV_LIB=$(RESOLV_LIB) CCKR=$(CCKR) RANLIB=$(RANLIB))


install.server:
	(cd sockd; $(MAKE) INSTALL=$(INSTALL) install install.man)

install.clients:
	for i in lib libident rfinger rftp rtelnet rxgopher rxmosaic; do ( cd $$i ; $(MAKE) INSTALL=$(INSTALL) install install.man) done

clean:
	for i in lib libident sockd rfinger rftp rtelnet rxgopher rxmosaic; do ( cd $$i ; $(MAKE) clean) done


