# Configure CFLAGS/LDFLAGS for your machine/OS
# for HP-UX and other Sys V systems:
CFLAGS= -O -DSYSV
# for VAX 4.[23] BSD, SunOS and other BSD based systems:
# CFLAGS= -O -DBSD

# Need getopt for pwget, include library that has it.
# System V based system (like HP-UX), 4.3BSD and SunOS have null LDFLAGS.
LDFLAGS=
# 4.2BSD requires getopt from someplace.
# LDFLAGS= -lgetopt

MODE=755
OWNER=bin
GROUP=bin
DEST=dest
MANMODE=444
MANOWNER=bin
MANGROUP=bin
MANDEST=man

all: grget pwget pwget.cat

install: installcmd installman

installcmd: pwget
	strip pwget
# use install for BSD and cpset for SYSV
#	install -c -o $(OWNER) -g $(GROUP) -m $(MODE) pwget $(DEST)
	cpset pwget $(DEST) $(MODE) $(OWNER) $(GROUP)
	ln $(DEST)/pwget $(DEST)/grget

installman: pwget.1
# use install for BSD and cpset for SYSV
#	install -c -o $(MANOWNER) -g $(MANGROUP) -m $(MANMODE) pwget.1 $(MANDEST)
	cpset pwget.1 $(MANDEST) $(MANMODE) $(MANOWNER) $(MANGROUP)

grget: pwget
	ln pwget grget

pwget: pwget.o
	cc $(LDFLAGS) -o pwget pwget.o

pwget.o: pwget.c
	cc $(CFLAGS) -c pwget.c

pwget.cat: pwget.1
	tbl pwget.1 | nroff -man -T > pwget.cat

clean:
	/bin/rm -f pwget.o pwget grget

clobber: clean
