RM = rm
INCLUDES = -I. -I/afs/cs/project/nectar-prashant/sys.vpc/sys -I/afs/cs/project/nectar-prashant/sys.vpc/arch -I/afs/cs/project/nectar-prashant/sys.vpc -I../include
CFLAGS = -Wall -Wimplicit-prototypes -O2 

SRC = jmlu.c jminit.c jmread.c jmwrite.c loopback.c hang.c skip.c jmreload.c

TARGETS = $(SRC:.c=)

all: $(TARGETS)

jmlu: jmlu.c jetmsg.h
	$(CC) $(CFLAGS) $(INCLUDES) -L. jmlu.c -o jmlu

jminit: jminit.c jetmsg.h libjetmsg.a
	$(CC) $(CFLAGS) $(INCLUDES) -L. jminit.c -o jminit -ljetmsg

jmread: jmread.c jetmsg.h libjetmsg.a
	$(CC) $(CFLAGS) $(INCLUDES) -L. jmread.c -o jmread -ljetmsg

jmwrite: jmwrite.c jetmsg.h libjetmsg.a
	$(CC) $(CFLAGS) $(INCLUDES) -L. jmwrite.c -o jmwrite -ljetmsg

hang: hang.c jetmsg.h libjetmsg.a
	$(CC) $(CFLAGS) $(INCLUDES) -L. hang.c -o hang -ljetmsg

loopback: loopback.c jetmsg.h libjetmsg.a
	$(CC) $(CFLAGS) $(INCLUDES) -L. loopback.c -o loopback -ljetmsg

skip: skip.c jetmsg.h libjetmsg.a
	$(CC) $(CFLAGS) $(INCLUDES) -L. skip.c -o skip -ljetmsg 

jmreload: jmreload.c jetmsg.h
	$(CC) $(CFLAGS) $(INCLUDES) -L. jmreload.c -o jmreload

libjetmsg.a: libjetmsg.c jetmsg.h
	$(CC) -c $(CFLAGS) $(INCLUDES) libjetmsg.c
	ar rv libjetmsg.a libjetmsg.o
	${RM} -f libjetmsg.o

clean:
	${RM} -f $(TARGETS)
