# @(#) $Revision: 72.6 $
#
# makefile for diff 
#

DIFF=	/usr/bin/diff
DIFFH=  /usr/lbin/diffh
PR=	/usr/bin/pr
FLAGS=  -DDIFF='"${DIFF}"' -DDIFFH='"${DIFFH}"' -DPR='"${PR}"' -Aa \
		-D_HPUX_SOURCE

SRCS=	diff.c diffdir.c diffreg.c hpux_rel.c
HDRS=	diff.h
OBJS=	diff.o diffdir.o diffreg.o hpux_rel.o
LIBS=	-lBUILD

FINDMSG = /usr/bin/findmsg
GENCAT = /usr/bin/gencat
SORT   = /usr/bin/sort

default: all

all: diff diff.cat 

metrics: diff.M

diff: ${OBJS} ${HDRS}
	$(CC) $(CFLAGS) $(FLAGS) $(LDFLAGS) -o diff $(OBJS) $(LIBS)

diff.M: ${SRCS} ${HDRS}
	$(METRICS) $(CFLAGS) $(FLAGS) -o diff.M $(SRCS) 

clean:
	rm -f *.o diff.msg 

clobber: clean
	rm -f diff diff.cat 

diff.cat: diff.msg

diff.msg:
	$(FINDMSG) *.c | $(SORT) -u -n +0 -1 > $@

#
# Redefine the .c.o rule so that it uses $(FLAGS) too
#
.c.o:
	$(CC) -c $(CFLAGS) $(FLAGS) $<

#
# We define two rules, for creating .msg and .cat files.  This is so we
# can let make's internal rules do some work for us.  With these rules,
# we only need to specify that the .cat depends on the .msg(s), and
# make will know to make the .msg from the .c if it needs to.
#
.msg.cat:
	${GENCAT} $*.cat $*.msg

.SUFFIXES: .cat .msg
