LIBS	= $(LOG_TCP)/libwrap.a ../lib/libutil.a
SRCS	= rshd.c
CFLAGS	= -O -I$(LOG_TCP) -DFACILITY=LOG_DAEMON $(XFLAGS)
SHELL	= /bin/sh
MAKE	= make
SYSLIBS	=

what:
	@echo Usage: make system-type. System types are:
	@echo sunos4 sunos5 ultrix4 hpux 
	@exit 1;

sunos5:
	@$(MAKE) all SYS=$@ XFLAGS=-DSYSV4 SYSLIBS="-lsocket -lnsl"

sunos4 ultrix4: 
	@$(MAKE) all SYS=$@

bsd44 freebsd bsdi:
	@$(MAKE) all SYS=bsd44 XFLAGS=-DBSD44

hpux:
	@$(MAKE) all SYS=$@ XFLAGS=-DHPUX

newsos4:
	@echo newsos4 has not been tested.

all: config-check lib rshd

config-check:
	@set +e; test -n "$(LOG_TCP)" || { \
	    echo "Do a 'setenv LOG_TCP /dir/with/libwrap.a' first." 1>&2; \
	    exit 1; \
	}

rshd: rshd.c ${LIBS}
	${CC} -s -o $@ ${CFLAGS} $@.c ${LIBS} ${SYSLIBS}

lib:
	cd ../lib; $(MAKE) $(SYS)

clean:
	rm -f ${OBJS} core rshd
	cd ../lib; $(MAKE) $@

rshd.o:	sys_defs.h
