# Make file for vacation 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/vacation \
	/usr/lib/nls/msg/C/vacation.cat \
	/usr/share/lib/vacation.def

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

include ${BUILDRULES}

#Commands used by this makefile
FINDMSG=/usr/bin/findmsg
GENCAT=/usr/bin/gencat

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

OBJS= vacation.o

SRCS= vacation.c

#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 *.msg
	$(RM) -f a.out 
	$(RM) -f vacation vacation.cat vacation.o vacation.msg
	
install:
	for file in $(PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done

build:  vacation vacation.cat

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

vacation.cat: ./*.c
	$(ECHO) "Building vacation.cat..."
	for i in ./*.c; \
	do \
		$(FINDMSG) $$i > ./vacation.msg; \
		$(GENCAT) $@ ./vacation.msg; \
	done
