#CC=gcc

# Directory into which socks_clients's man page file will be installed:
MAN_DEST_DIR=/usr/local/man/man1

# If you want to install the SOCKS library into /usr/locallib,
# uncomment the next line:
#LIB_DEST_DIR=/usr/locallib
# Installing the library in /usr/locallib makes it possible to
# use '-lsocks' with cc or ld command to search the library.
# /usr/lib and /lib may also be used instead of /usr/local/lib.

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

#IRIX should uncomment next line:
# CCKR=-cckr

CFLAGS = -I../include -O ${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

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

OBJS = Rconnect.o SendGetDst.o saddrtoname.o porttoserv.o
SRCS= Rconnect.c SendGetDst.c saddrtoname.c porttoserv.c
INC =../include/socks.h
LIB = libsocks.a

all: echocwd $(LIB)

$(LIB): $(SRCS) $(INC)
	$(CC) -c $(CFLAGS) $(SRCS)
	rm -f $(LIB)
	ar rc $(LIB) $(OBJS)
	$(RANLIB) $(LIB)

install: echocwd $(LIB)
	-if [ -d $(LIB_DEST_DIR) ]; then \
	  ($(INSTALL) -m 644 $(LIB) $(LIB_DEST_DIR); \
	   $(RANLIB) -t $(LIB_DEST_DIR)/$(LIB)); fi

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

clean: echocwd
	rm -f $(OBJS) $(LIB) core

echocwd:
	@pwd
