#!/bin/bash
LD_RUN_PATH=${HOME}/usr/lib
PRJ=$(shell echo `basename ${PWD}`)

#executable name is the same as the project name, same with main source
${PRJ}: ${PRJ}.cpp
	~/usr/bin/mpicxx -O3 -I${HOME}/usr/include $<  -L${HOME}/usr/lib -o $@ 

run: ${PRJ}
	~/usr/bin/mpirun -np 2 ./${PRJ}

clean:
	rm -f *~

clean_all: clean
	rm -f ${PRJ}

emacs:
	emacs -nw Makefile ${PRJ}.cpp

tar: clean_all
	tar -cvf ../${PRJ}.tar ../${PRJ}
