# @(#) Makefile 1.4 90/05/27 18:53:37

# Usage:
#	make NAME=name
#
#	Produces su-name.c, invokes an editor to edit the table of
#	authorized users in su-name.c, and compiles the program.
#	With BSD UNIX, the executable should be installed set-uid 
#	and set-gid to the desired uid and gid. If you are running 
#	SYSV the program must be installed set-uid root and NAME 
#	must be defined in the CFLAGS macro below.

# CFLAGS
#
# -DUSE_HER_SHELL	if you want the shell specified in the password data 
#			base. Otherwise, you will always get /bin/sh.
#
# -DNAME=\"$(NAME)\"	if you are running SYSV; this wires the desired user 
#			ID into the program, and requires that it be installed 
#			set-uid root.
#
# -Drindex=strrchr	if you don't have rindex().

NAME	= $(USER)
CFLAGS	= -DUSE_HER_SHELL -DNAME=\"$(NAME)\" -Drindex=strrchr

SHELL	= /bin/sh
FILES	= README su-someone.c Makefile
KIT	= $(FILES) su-someone.1

su-$(NAME): su-$(NAME).c
	cc $(CFLAGS) -o $@ $?

su-$(NAME).c: su-someone.c
	cp $? $@
	chmod u+w $@
	$${EDITOR-vi} +200 $@

clean:
	rm -f *.o core nohup.out su-$(NAME)

su-someone.1: su-someone.c
	srctoman $? >$@

shar:	$(KIT)
	shar $(KIT)

archive: $(FILES)
	sarch $(FILES)
	touch archive
