# Make file for ocd 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/sbin/ocd \
	/usr/sbin/ocdebug \
	/usr/examples/ddfa/pcf

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

include ${BUILDRULES}

INCLUDES=-I. -I../include -I/usr/include

SRCS=   ocd.c dfa_account.c
OBJS=   ocd.o dfa_account.o

CCFLAGS=$(INCLUDES) $(CFLAGS)

LDLIBRARIES=    ../util/libutil.a

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

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

default: all

all: clean build install

clean:
	$(RM) -f *.o
	$(RM) -f core
	$(RM) -f ocd ocdebug
	
build:  ocd ocdebug

ocd:    $(SRCS)
	$(ECHO) "Building ocd..."
	$(CC) -c $(CCFLAGS) $(SRCS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBRARIES)

ocdebug: $(SRCS)
	$(ECHO) "Building ocdebug..."
	$(CC) -c $(CCFLAGS) -DDEBUG $(SRCS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBRARIES)
	
install:
	for file in $(PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done
