/*
   Imakefile to use Tape with an SPMD (only one task model) PVM program.

   Change 'MYPVMPROGRAM' to the name of your non instrumented exexutable 
   program.

   If your program needs system libraries, like '-lm', list them in the
   variable 'MYSYSLIBRARIES'.

   Specify the name of the tapepp source file database in 'MYDBASE' (has to
   be "-f <filename>"). Leave blank for default database name.

   List the libraries to be linked with the non instrumented program in
   'PVM_LIBRARIES'. List the libraries to be linked with the instrumented
   program in 'TAPE_LIBRARIES'.

   You will get a non instrumented executable 'MYPVMPROGRAM' as well as
   an instrumented executable of the same name but suffixed by '_t.c'.
 
*/


  MYPVMPROGRAM = srtsR
MYSYSLIBRARIES = -lm
       MYDBASE = 

        BINDIR = $(TAPEBINDIR)

INCLUDES = -I$(TAPE_ROOT)/include -I$(PVM_ROOT)/include

#ifdef SP1
  /* PVMe libraries using switch on SP1 machines */
PVM_SYS       = /usr/lpp/pvm3/lib/libpvm3.a
SYSLIBS       = $(MYSYSLIBRARIES) -bI:/usr/lpp/pvm3/lib/pvm3e.exp
#else
  /* public domain PVM using TCP/IP */
PVM_SYS       = $(PVM_ROOT)/lib/$(PVM_ARCH)/libpvm3.a \
                $(PVM_ROOT)/lib/$(PVM_ARCH)/libgpvm3.a
SYSLIBS       = $(MYSYSLIBRARIES)
#endif

PVM_LIBRARIES = $(PVM_SYS) \
                $(TAPELIBDIR)/libtape.a

TAPE_LIBRARIES = $(TAPELIBDIR)/libtape.a \ 
                 $(PVM_SYS)

PROGRAMS = $(MYPVMPROGRAM) $(MYPVMPROGRAM)_t

   SRCS1 = $(MYPVMPROGRAM).c
   OBJS1 = $(MYPVMPROGRAM).o
DEPLIBS1 = $(PVM_LIBRARIES)

   SRCS2 = $(MYPVMPROGRAM)_t.c
   OBJS2 = $(MYPVMPROGRAM)_t.o
DEPLIBS2 = $(TAPE_LIBRARIES)


/* rule to build the instrumented '_t' sources */

TAPEPP = tapepp

#define MakeProbes(src)					@@\
probes:							@@\
	@for s in src; do			\	@@\
	(set -x; $(TAPEPP) $(MYDBASE) $$s);	\	@@\
	done

/* produce the probes target */

AllTarget(probes)
MakeProbes($(SRCS1))

/* build the non instrumented program */
ComplexProgramTarget_1($(MYPVMPROGRAM),$(PVM_LIBRARIES),$(SYSLIBS))

/* build the instrumented program */
ComplexProgramTarget_2($(MYPVMPROGRAM)_t,$(TAPE_LIBRARIES),$(SYSLIBS))

