#
# Copyright (c) 1988 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation, advertising
# materials, and other materials related to such redistribution and
# use acknowledge that the software was developed by the University
# of California, Berkeley.  The name of the University may not be
# used to endorse or promote products derived from this software
# without specific prior written permission.  THIS SOFTWARE IS PROVIDED
# ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
# WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
# FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#)Makefile	5.2 (Berkeley) 9/20/88
#

CFLAGS	= -O -DNOPLUS $(XFLAGS)
COMMOBJ	= open_limit.o rcmd.o
S5R3OBJ	= utmp_init.o utmp_login.o utmp_logout.o updwtmp.o $(COMMOBJ)
S5R4OBJ	= stream_pty.o utmpx_init.o utmpx_login.o utmpx_logout.o $(COMMOBJ)
BSD4OBJ	= login.o logout.o logwtmp.o $(COMMOBJ)
RANLIB	= ranlib
EXTRA	=
SHELL	= /bin/sh

what:
	@echo This Makefile is not to be invoked directly 1>&2; exit 1

386bsd freebsd bsdi:
	@make XFLAGS=-DINT_GROUPS OBJS="$(BSD4OBJ) $(EXTRA)" libutil.a

linux:
	@make XFLAGS=-D__const= OBJS="$(BSD4OBJ) $(EXTRA)" libutil.a

ultrix4 sunos4:
	@make XFLAGS="-DINT_GROUPS -DNIS" OBJS="$(BSD4OBJ) $(EXTRA)" \
	    libutil.a

sysv4 sunos5:
	@make XFLAGS=-DNIS OBJS="$(S5R4OBJ) $(EXTRA)" RANLIB=echo libutil.a

hpux:
	@make XFLAGS="-DNIS -DUSE_SETRESXID -DHAS_UT_ADDR" \
	    OBJS="$(S5R3OBJ) $(EXTRA)" RANLIB=echo libutil.a

libutil.a: ${OBJS}
	ar rv $@ $?
	$(RANLIB) $@

clean:
	rm -f *.o libutil.a

stream_pty: tiocpkt.h
