# $Source: /hpux/shared/supp//usr/src/cmd/frecover/./makefile,v $
# $Revision: 78.3 $

# Common makefile for frecover

# CFLAGS= -DDEBUG -DDEBUG_T -DDEBUG_D
FLAGS= -D_LARGE_UIDS -D_FILE_OFFSET_BITS=64 -D__STDC_EXT__ -Dhpux -Ae
#LDFLAGS = -Wl,-E
LIBS=-lmalloc -lIO

GENCAT= /usr/bin/gencat
FINDMSG= /usr/bin/findmsg -a

FILES=	    main.c utilities.c files.c io.c volheaders.c hpux_rel.c rmt.c vdi.c
OBJS=	    main.o utilities.o files.o io.o volheaders.o hpux_rel.o rmt.o vdi.o
MSGS= main.msg utilities.msg files.msg io.msg volheaders.msg

default: frecover frecover.cat

metrics: frecover.M

frecover: $(OBJS)
	$(CC) $(LDFLAGS) $(FLAGS) $(CFLAGS) -o frecover $(OBJS) $(LIBS)

frecover.M: $(FILES)
	$(METRICS) $(FLAGS) $(CFLAGS) -o frecover.M $(FILES) $(LIBS)

clean:
	rm -f *.o $(MSGS)

clobber: clean
	rm -f frecover frecover.cat

frecover.cat: $(MSGS)
	$(GENCAT) $@ $(MSGS)

#
# We define two new rules, for creaing .msg and .cat files.  With these rules,
# make knows how to automatically create .msg files from .c files, and .cat
# files from .msg files.  This allows us to merely specify that the .cat
# depends on the .msg; make will create the .msg file for us if necessary.
#

.c.msg:
	$(FINDMSG) $*.c > $*.msg

.msg.cat:
	$(GENCAT) $*.cat $*.msg

.SUFFIXES: .cat .msg

$(OBJS): frecover.h 

.c.o:
	$(CC) $(CLFAGS) $(FLAGS) -c $<
