# Makefile for MPI-Spin model of Example 2.6 from
# "MPI: The Complete Reference, vol. 1", 2nd ed.

# Because the sender and receiver are specifying communication 
# of untyped values, we are checking that the portion of the 
# sent message was equal to the portion of the received message. 

# Author: Pujan Kafle <kafle@cis.udel.edu>
# Created: 19-jul-2007
# Last modified: 19-jul-2007

PREP        = rm -f pan* *trail mpi-spin-init.c
MS          = $(PREP); ms -notest -nocancel -noprobe -dl

PARAMS0 = -np=2 -block -chansize=0 
PARAMS1 = -np=2 -block -chansize=2 
PARAMS2 = -np=2 -req=2 -buf=3

all: sendrecv_untyped_0 sendrecv_untyped_1 sendrecv_untyped_2 \
     mpi_sendrecv_untyped 

sendrecv_untyped_0: sendrecv_untyped.prom
	$(MS) $(PARAMS0) sendrecv_untyped.prom
	mscc
	./pan -n

sendrecv_untyped_1: sendrecv_untyped.prom
	$(MS) $(PARAMS1) sendrecv_untyped.prom
	mscc
	./pan -n

sendrecv_untyped_2: sendrecv_untyped.prom
	$(MS) $(PARAMS2) sendrecv_untyped.prom
	mscc
	./pan -n
	
mpi_sendrecv_untyped: sendrecv_untyped.c
	mpicc -o sendrecv_untyped sendrecv_untyped.c
	mpiexec -n 2 ./sendrecv_untyped

clean:
	-rm -f sendrecv_untyped pan* *.trail *.out mpi-spin-init.c *.err *~
