
EXTRA_AIX_CFLAGS = -qidirf -qlanglvl=ansi
EXTRA_HPUX_CFLAGS = -Aa -D _HPUX_SOURCE \
		-I../libbsd/include -I$(BACKING)/ptelnet/lib/libbsd/include
EXTRA_SUNOS_CFLAGS = -DSUNOS -DSOLARIS2 -DUSE_TERMIO \
		-I../libbsd/include -I$(BACKING)/ptelnet/lib/libbsd/include
EXTRA_LINUX_CFLAGS = -DUSE_TERMIO

LIB=	telnet
#OBJS=	auth.o encrypt.o genget.o getent.o gettytab.o misc.o \
#kerberos.o enc_des.o kerberos5.o sra.o

OBJS= auth.o \
		enc_des.o \
		encrypt.o \
		genget.o \
		getent.o \
		gettytab.o \
		kerberos.o \
		kerberos5.o \
		krb_des.o \
		misc.o \
		sra.o \
		ssl.o
SRCS= auth.c \
		enc_des.c \
		encrypt.c \
		genget.c \
		getent.c \
		gettytab.c \
		kerberos.c \
		kerberos5.c \
		krb_des.c \
		misc.c \
		sra.c \
		ssl.c

CFLAGS= -Dunix -D_BSD -DUSE_SHADOW -DTREX_ENC \
        -I$(SSLTOP)/include -I../libpk

CFLAGS+= $(CCOPTS)

all: lib${LIB}.a

#${OBJS}: Makefile
# Linux does not like this, use .c.o: instead
.c.o:	Makefile
	@if [ "`uname`" = "AIX" ]; then \
	echo "$(CC) -c $(CFLAGS) $(EXTRA_AIX_CFLAGS) $<"; \
	$(CC) -c $(CFLAGS) $(EXTRA_AIX_CFLAGS) $<; \
	elif [ "`uname`" = "HP-UX" ]; then \
	echo "$(CC) -c $(CFLAGS) $(EXTRA_HPUX_CFLAGS) $<"; \
	$(CC) -c $(CFLAGS) $(EXTRA_HPUX_CFLAGS) $<; \
	elif [ "`uname`" = "SunOS" ]; then \
	echo "$(CC) -c $(CFLAGS) $(EXTRA_SUNOS_CFLAGS) $<"; \
	$(CC) -c $(CFLAGS) $(EXTRA_SUNOS_CFLAGS) $<; \
	elif [ "`uname`" = "Linux" ]; then \
	echo "$(CC) -c $(CFLAGS) $(EXTRA_LINUX_CFLAGS) $<"; \
	$(CC) -c $(CFLAGS) $(EXTRA_LINUX_CFLAGS) $<; \
	else \
	echo "$(CC) -c $(CFLAGS) $<"; \
	$(CC) -c $(CFLAGS) $<; \
	fi

lib${LIB}.a: ${OBJS}
	echo building standard ${LIB} library 
	rm -f lib${LIB}.a 
	if [ -f /usr/bin/lorder ]; then \
		ar cq lib${LIB}.a `lorder ${OBJS} | tsort` ; \
	else \
		ar cq lib${LIB}.a ${OBJS}; \
	fi; 
	if [ -f /usr/bin/ranlib ]; then \
		ranlib lib${LIB}.a; \
	fi;

clean:
	rm -f *.o lib${LIB}.a

depend:
	mkmf -f Makefile
###
auth.o: encrypt.h enc-proto.h auth.h auth-proto.h misc-proto.h
enc_des.o: encrypt.h enc-proto.h key-proto.h misc-proto.h
encrypt.o: encrypt.h enc-proto.h misc.h misc-proto.h
gettytab.o: pathnames.h
kerberos.o: encrypt.h enc-proto.h auth.h auth-proto.h misc.h misc-proto.h
kerberos5.o: encrypt.h enc-proto.h auth.h auth-proto.h misc.h misc-proto.h
krb_des.o: encrypt.h enc-proto.h key-proto.h misc-proto.h
misc.o: misc.h misc-proto.h
sra.o: auth.h auth-proto.h misc.h misc-proto.h encrypt.h enc-proto.h
ssl.o: auth.h auth-proto.h misc.h misc-proto.h
