# Make file for cmds/usr.etc/rexd directory
#
# Things you might want to change.  Pass them in on the command line:
# ROOT - should point to the root where the commands will be installed
#        (e.g. /deliver/NFS/indnetwk)

ROOT=

PRODUCTS= /usr/sbin/rpc.rexd \
	/usr/bin/on

BSDOBJS= getwd.o killpg.o

REXD_OBJS= rexd.o mount_nfs.o unix_login.o logging.o bsdtermio.o 
ON_OBJS= on.o where.o bsdtermio.o

INCLUDES= -I/source/NFS/$(LOGNAME)/include -I/usr/include
CCFLAGS= $(INCLUDES) $(CFLAGS)

#Commands used by this Makefile
AR=/usr/ccs/bin/ar

#Install database name
INSTALLDB=/source/NFS/$(LOGNAME)/config/installdb

#Script called to parse the install deliverable
INSTALLSCPT=/source/NFS/$(LOGNAME)/config/install_script

# Defaults file containing the shell, compiler options, etc
BUILDRULES=/source/NFS/$(LOGNAME)/config/defaults

include ${BUILDRULES}

default: all

all: clean build install

clean:
	$(RM) -f *.o rpc.rexd on

build: rpc.rexd on

.c.o:
	$(CC) $(CCFLAGS) -DHFS -c $*.c

rpc.rexd: $(REXD_OBJS) 
	$(ECHO) "Building rpc.rexd..."
	$(AR) x $(LBSD) $(BSDOBJS)
	$(CC) $(CCFLAGS) -DHFS $(LDFLAGS) -o rpc.rexd $(REXD_OBJS) $(RPCSVC_LIB) $(BSDOBJS) -lV3

on: $(ON_OBJS) 
	$(ECHO) "Building on..."
	$(AR) x $(LBSD) $(BSDOBJS)
	$(CC) $(CCFLAGS) -DHFS $(LDFLAGS) -o on $(ON_OBJS) $(RPCSVC_LIB) $(LCURSES) $(BSDOBJS)

logging.o: 
	$(CC) $(CCFLAGS) -c ../logging.c $(RPCSVC_LIB)

under: under.o mount_nfs.o bsdtermio.o logging.o
	$(ECHO) "Building under..."
	$(AR) x $(LBSD) $(BSDOBJS)
	$(CC) $(CCFLAGS) -DHFS $(LDFLAGS) -o under under.o mount_nfs.o bsdtermio.o $(RPCSVC_LIB) logging.o $(BSDOBJS)

where: where_main.o where.o bsdtermio.o
	$(ECHO) "Building where..."
	$(AR) x $(LBSD) $(BSDOBJS)
	$(CC) $(CCFLAGS) -DHFS $(LDFLAGS) -o where where_main.o where.o bsdtermio.o $(RPCSVC_LIB) $(BSDOBJS)

install:
	for file in $(PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done

