# Make file for pathalias 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/pathalias

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

include ${BUILDRULES}

INCLUDES=-I/usr/include

CCFLAGS=$(INCLUDES) $(CFLAGS)

YFLAGS=-d

OBJS=	addlink.o addnode.o local.o main.o mapit.o mapaux.o mem.o parse.o \
	printit.o   
SRCS=   addlink.c addnode.c local.c main.c mapit.c mapaux.c mem.c printit.c \
	parse.c
HDRS=	def.h config.h

#
#Commands used by this Makefile
#
YACC=/opt/langtools/bin/yacc
MV=/usr/bin/mv

#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 y.tab.?
	$(RM) -f parse.c
	$(RM) -f pathalias
	
build: pathalias

parse.o: parse.y $(HDRS)
	$(YACC) $(YFLAGS) parse.y
	$(MV) y.tab.c parse.c

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

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