# Make file for tftp 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/INETSVCS/indnetwk)

ROOT=

PRODUCTS=/usr/bin/tftp

ARCV_PRODUCTS=/usr/conf/ramroot/usr/sbin/tftp

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

include ${BUILDRULES}

INCLUDES=-I../include -I/usr/include
CCFLAGS=$(INCLUDES) $(CFLAGS)

OBJS= main.o tftp.o tftpsubs.o

SRCS= main.c tftp.c tftpsubs.c

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

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

#Commands used by this makefile
MV=/usr/bin/mv

default: all

all: clean build install

clean:
	$(RM) -f $(OBJS)
	$(RM) -f tftp tftp_a

install:
	for file in $(PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done 
	$(MV) tftp tftp_sav ; \
	cp tftp_a tftp ; \
	for file in $(ARCV_PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done
	$(MV) tftp_sav tftp

build: tftp

tftp:  $(SRCS)
	$(ECHO) "Building tftp..."
	$(CC) -c $(CCFLAGS) $(SRCS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS)
	$(CC) $(ARCV_LDFLAGS) -o tftp_a $(OBJS)
