#	login  --  for Interactive Unix 3,2.2  & AT&T unix SysV / 3.2.2

#	NOTE: check 'install:' to determine if you want the makefile
#		to install netlogin and man pages.
#
#   tony@ajfcal.cuc.ab.ca 	November, 1991

# RCS revision
REV=2.0


# Set operating system.
#
#	OS=-DNEEDUTIME	for AT&T - /usr/include/utime.h is missing
#	OS=		blank for Interactive unix

OS=-DNEEDUTIME
# OS=

# If network rlogind and telnet access is required, then enable
# the network code.  If no network is installed, the leave blank.
# (note: this works with Interactive unix tcp/ip (rlogin and telnet)
#        For AT&T set NETWORK blank.  (still works for telnet, not rlogin))

# NETWORK=-DTCPIP
NETWORK=

# Set UA=-DUSRACCESS if user access time feature is used (see login.4)
#     UA=            if not desired.

UA=-DUSRACCESS
# UA=

# Set -DNOISY if you want unsuccessful login attempts to be
#	reported to the user. Otherwise, login is silent
#	about failures.  Standard login reports unsuccessful attempts.

QUIET=-DNOISY
# QUIET=

# Set PG=-DPOSIX_GROUPS if supplimentary groups are used (not for AT&T)
# Set LIBS to ensure that initgroups() and alloca() are available
# TCP/IP connection on Interactive need -linet
# Usually, initgroups() in -lcposix     (ATT unix does not have this)
#              alloca() in -lPW (if GCC is used, don't define -lPW)

# PG=-DPOSIX_GROUPS
PG=

# Set name of slip login binary.

# SLIP=sllogin
SLIP=slogin

# set libraries as needed.  
# AT&T SysV/386 3.2.2
#		LIBS=-lPW
# Interactive unix with tcp/ip:
#		LIBS=-lcposix -linet -lPW   (needs PW for alloca if not gcc)

# LIBS=-lcposix -linet
# LIBS=-lcposix -linet -lPW
# LIBS=-lcposix -lPW
# LIBS=-lPW
LIBS=

# Set compiler

# CC=gcc
CC=cc

# set version of tar

TAR=tar
# TAR=gtar

CFLAGS=	-O $(OS) $(QUIET) $(PG) $(UA) $(NETWORK)
SRC=	login.c getutmp.c cftime.c
OBJ=	login.o getutmp.o cftime.o

help:
	@echo "	make login      to make the login binary"
	@echo "	make install    to install login, netlogin and man pages"
	@echo "	                (change the install process to suit your site)"

all: login

login: $(OBJ)
	${CC} $(CFLAGS) -DSLIP="\"$(SLIP)\"" -o $@ $(OBJ) $(LIBS)

tar:
	$(TAR) cvf login.tar Readme login.1 login.4 Makefile $(SRC)

ci:
	ci -r$(REV) Readme login.1 login.4 Makefile $(SRC) usrtime

co:
	co -l Readme login.1 login.4 Makefile $(SRC) usrtime

shar:
	shar Readme login.1 login.4 Makefile $(SRC) usrtime > login.shar

kit:
	makekit Readme login.1 login.4 Makefile usrtime $(SRC)

clean:
	rm -f ${OBJ} core login udump *.B *~


# /etc/netlogin could be installed as a link to /bin/login
# or could be copied as a separate binary.

install:
	install -f /bin -u root -g bin -m 4755 login
	rm /etc/netlogin
	ln /bin/login /etc/netlogin

#	cp /bin/login /etc/netlogin

#	install -f /usr/man/man.1 -u bin -g bin -m 644 login.1
#	install -f /usr/man/man.4 -u bin -g bin -m 644 login.4
