#       @(#)Makefile    0.0 (Julian H. Stacey) First ver was 1994 01 06

# See also http://www.berklix.com/~jhs/src/bsd/fixes/freebsd/src/gen/rescue/suid/
# for a spare copy of old su with no pam.

PROG=   xs
SRCS=   xs.c
BINOWN= root
BINMODE=6555

.include <berklix_no_man.mk>

.if exists( ${HOME}/.xs_uid )	# {
# If you are compiling this as root ${HOME} is root where there is no .xs_uid
# so compile it as jhs & only then change to root to install.
ROOT_UID != cat ~/.xs_uid
# JJLATER Id be better doing a get uid at compile time.
# CFLAGS +=-DROOT_UID=${ROOT_UID} -static
# CFLAGS+= -static breaks on 13.2-RELEASE but not on 12.4-RELEASE
CFLAGS +=-DROOT_UID=${ROOT_UID}
tst:
	echo "ROOT_UID=${ROOT_UID} CFLAGS=${CFLAGS}"
.endif				# }

.if exists(Makefile.inc)
# To allow a BINDIR of /usr/bin rather than /usr/local/bin,
# 'cos Im sick of it going in /usr/local on build hosts that nfs to king,
# that hangs on boot if no kbd.
# BINDIR doesnt get asserted though - why not ? JJLATER
.include "Makefile.inc"

install:
	@# Replacement of normal default install as seen without this rule
	@# install -s -o root -g wheel -m 6555   xs /usr/local/bin/xs
	@#	Just 12.0-CURRENT
	@# install -o root -g wheel -m 444 \
	@#	 xs.debug /usr/local/bin/.debug/xs.debug
	@# Normal using some macros, more could be converted to macros
	install -s -o root -g wheel -m 6555 ${PROG} ${BINDIR}/${PROG}
	@# add rescue tool
	@echo JJLATER A cludge follows from ${.CURDIR}/Makefile
	@# a temporary solution until I solve
	@# http://berklix.com/~jhs/src/bsd/fixes/freebsd/src/gen/rescue/
	@# It bloats /rescue by another 1M on top of the 11M there.
	install  -s -o root -g wheel -m 6555   ${PROG} /rescue/${PROG}
.endif

.include <bsd.prog.mk>
.include <berklix.mk>   # Needed to support recursive make html from above.
