# Makefile.aimk for myLauncher.c, ringGatherer.c, treeGatherer.c in prog1.
#
# Changes you must make:
# 1.  Modify PVMDIR to point to your pvm3 directory
#
# Other notes:
# PVM_ARCH and ARCHLIB, among other things, are set for you if you
# use "$PVM_ROOT/lib/aimk" instead of "make".
#
# aimk also creates a $PVM_ARCH directory below this one and will cd
# to it before invoking make - this allows building in parallel on
# different arches.
#
# Compilation notes:
# To compile myLauncher.c, ringGatherer.c, and treeGatherer.c, cd to your
# prog1 directory and type 'aimk'. 

# To remove the resulting executables, type 'aimk clean' 


# directory in which pvm lies.
# please modify this.
# Note that PVMDIR needs to be the absolute path to your pvm3 directory.
# E.g.  /home/solaris/ieng9/oce.../pvm3  
# or 
# /home/solaris/ieng9/cs160s/yourusename/pvm3

PVMDIR		=	/home/solaris/ieng9/cs160s/yourusename/pvm3

# directory in which your source code lies.
SDIR		=	$(PVMDIR)/prog1

# directory which contains the directories (e.g. LINUX, SUN4SOL2) for
# binaries of different architectures 
BDIR = $(PVMDIR)/bin

# directory in which executables will be placed
XDIR = $(BDIR)/$(PVM_ARCH)

CFLOPTS		=	-g
CFLAGS		=	$(CFLOPTS) -I$(PVMDIR)/include $(ARCHCFLAGS)

# Here we set architecture-specific libraries to link tasks
# Current setup is for workstations

PVMLIB		=	-lpvm3

# Here we select the PVMHLIB depending on architecture
# Current setup is for workstations

PVMHLIB		=	-lpvm3

########################################################################
LIBS		=	$(PVMLIB) $(ARCHLIB)

GLIBS		=	-lgpvm3

LDFLAGS		=	$(LOPT) -L$(PVMDIR)/lib/$(PVM_ARCH)

CPROGS		=	myLauncher$(EXESFX) ringGatherer$(EXESFX) \
    treeGatherer$(EXESFX)

c-all:	$(CPROGS)

clean:
	rm -f *.o $(XDIR)/myLauncher $(XDIR)/ringGatherer $(XDIR)/treeGatherer

myLauncher$(EXESFX):  $(SDIR)/myLauncher.c $(XDIR)
	$(CC) $(CFLAGS) -o $@ $(SDIR)/myLauncher.c $(LDFLAGS) $(LIBS)
	mv $@ $(XDIR)

ringGatherer$(EXESFX):  $(SDIR)/ringGatherer.c $(XDIR)
	$(CC) $(CFLAGS) -o $@ $(SDIR)/ringGatherer.c $(LDFLAGS) $(GLIBS) $(LIBS)
	mv $@ $(XDIR)

treeGatherer$(EXESFX):  $(SDIR)/treeGatherer.c $(XDIR)
	$(CC) $(CFLAGS) -o $@ $(SDIR)/treeGatherer.c $(LDFLAGS) $(GLIBS) $(LIBS)
	mv $@ $(XDIR)
