#####################################################
# Simple Makefile to instrument 'gexample.c' from the 
# PVM3 distribution (C version) 
# ---------------------------------------------------
#                     TAPE/PVM
# E.Maillet, LMC-IMAG, University of Grenoble, France
#####################################################

# include and library directories

PVMLIBDIR = -L$(PVM_ROOT)/lib/$(PVM_ARCH)
PVMINCDIR = -I$(PVM_ROOT)/include
PVMBINDIR = $(PVM_ROOT)/bin/$(PVM_ARCH)

TAPELIBDIR = -L$(TAPE_ROOT)/$(PVM_ARCH)
TAPEINCDIR = -I$(TAPE_ROOT)/include

# libraries

PVMLIB = -lpvm3 -lgpvm3
TAPELIB = -ltape

all: gexample gexample_t

clean:
	rm -f gexample gexample_t *.o gexample_t.c

install: gexample gexample_t
	cp -f gexample gexample_t $(PVMBINDIR)

####################################################
# build non instrumented version (as usual)
####################################################

# link

gexample: gexample.o
	$(CC) $(PVMLIBDIR) $(PVMLIB) gexample.o -o gexample

# compile 

gexample.o: gexample.c
	$(CC) $(PVMINCDIR) -c gexample.c

####################################################      
# build instrumented version 
####################################################

# link

gexample_t: gexample_t.o
	$(CC) $(TAPELIBDIR) $(PVMLIBDIR) gexample_t.o -o gexample_t \
              $(TAPELIB) $(PVMLIB)

# compile instrumented source

gexample_t.o: gexample_t.c
	$(CC) $(PVMINCDIR) $(TAPEINCDIR) -c gexample_t.c

# build instrumented source from normal source

gexample_t.c: gexample.c
	tapepp -fDB gexample.c
