# Makefile for p4 programs

P4 = /Net/encore/efs3/kotz/p4
IFLAGS = -I$(P4)
LDFLAGS = -L$(P4)
LIBS = -lp4dfk -lp4 -lpp -lm
REQD = -I. $(IFLAGS) -DMULTIMAX -DP4BSD

# You might add to this line. Remove -g -DDPRINTFL for timing.
CFLAGS = $(REQD) -g -DDPRINTFL

all: matrix smmatrix mpmatrix

smmatrix: smmatrix.o alloc2d.o
	cc $(LDFLAGS) -o smmatrix smmatrix.o alloc2d.o $(LIBS)

smmatrix.o: $(P4)/dfk.h $(P4)/p4.h $(P4)/timing.h $(P4)/divide.h

# the MP program, called mpmatrix
mpmatrix: mpmatrix_master.o mpmatrix_slave.o 
	cc $(LDFLAGS) -o mpmatrix mpmatrix_master.o mpmatrix_slave.o $(LIBS)

mpmatrix_master.o mpmatrix_slave.o: mpmatrix.h

# needs -lpp for timer
matrix: matrix.o alloc2d.o
	cc -o matrix matrix.o alloc2d.o -lpp

matrix.o: $(P4)/dfk.h $(P4)/timing.h

clean:
	rm -f *.o *~ *.cdb

spotless: clean
	rm -f matrix smmatrix mpmatrix
