# @(#) $Revision: 72.1 $
#
# makefile -- makefile for the heartbeat utilities
#

PROGS = switchheartb heartbeat
PROGS_M = switchheartb.M heartbeat.M
LIB=../lib
INC=-I$(LIB)

HEARTBEAT_OBJS = heartbeat.o $(LIB)/switchnet.o $(LIB)/switchdsub.o
SWITCHHEARTB_OBJS = switchheartb.o $(LIB)/getinfo.o $(LIB)/detach.o $(LIB)/signal.o
HEARTBEAT_C = heartbeat.c $(LIB)/switchnet.c $(LIB)/switchdsub.c
SWITCHHEARTB_C = switchheartb.c $(LIB)/getinfo.c $(LIB)/detach.c $(LIB)/signal.c

default: all

metrics: $(PROGS_M)

all: $(PROGS)

heartbeat: $(HEARTBEAT_OBJS)
	$(CC) $(LDFLAGS) -o heartbeat $(HEARTBEAT_OBJS)

heartbeat.M: $(HEARTBEAT_C)
	$(METRICS) $(CFLAGS) $(INC) -o $@ $(HEARTBEAT_C)

heartbeat.o: $(LIB)/switchgen.h
	$(CC) $(CFLAGS) -c $(INC) heartbeat.c

switchheartb: $(SWITCHHEARTB_OBJS)
	$(CC) $(LDFLAGS) -o switchheartb $(SWITCHHEARTB_OBJS)

switchheartb.M: $(SWITCHHEARTB_C)
	$(METRICS) $(CFLAGS) $(INC) -o $@ $(SWITCHHEARTB_C)

switchheartb.o: $(LIB)/getinfo.h
	$(CC) $(CFLAGS) -c $(INC) switchheartb.c

clean:
	rm -f *.o *.lint

clobber: clean
	rm -f $(PROGS) $(PROGS_M)

lint:
	lint $(INC) $(HEARTBEAT_C) >heartbeat.lint
	lint $(INC) $(SWITCHHEARTB_C) >switchheartb.lint
