#Template Makefile Version: 1.0.2
#Time-stamp: <94/08/30 15:24:42 dev>
MAKE = make
CC = g++
AR = ar

#DEBG = -ggdb -D_DEBUG
#OPT = -m486 -O2
#STD_DEFINES = -D_POSIX_SOURCE -D_GNU_SOURCE
CFLAGS = -Wall -Wstrict-prototypes -pipe $(OPT) $(DEBG) $(STD_DEFINES)
LFLAGS =

TOPDIR = $$HOME/PVM++-0.3
LIBS = -L$$PVM_ROOT/lib -lgpvm -lpvm
INC = -I$$PVM_ROOT/include -I$(TOPDIR)/c++.classes/include

#target destination
DEST_1 = $(TOPDIR)/c++.classes/lib
TARGET_1 = $(DEST_1)/libpvm++.a
OBJS_1 = instantiation.o pdu.o pvm++.o

TARGETS = $(TARGET_1)
OBJS = $(OBJS_1)

#extension of files to be parsed for dependences
FEXT = cxx
#all the makefiles to be made before $(TARGET) 
SUBDIRS =

ifeq (.depend, $(wildcard .depend))
include .depend
endif

all: before $(TARGETS)

before:
	@set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i all; echo; done;

instantiation.o: instantiation.$(FEXT) 
	$(CC) -c $< $(CFLAGS) -o $@ $(INC)	

$(TARGET_1): $(OBJS_1)
	@rm -f $(TARGET_1)
	$(AR) -cr $(TARGET_1) $(OBJS_1)
	ranlib $(TARGET_1)
	@echo 'LIBPVM++.a: successfully compiled!'

# =====================================================================
.depend depend dep :
	rm -f .depend
	$(CC) -M *.$(FEXT) $(INC) >.depend;
	@set -e; for i in $(SUBDIRS); do echo; $(MAKE) -C $$i depend; done	

clean:
	@echo -n 'Cleaning directory: '
	rm -f $(OBJS) $(TARGETS) core *~ .*~ .depend

veryclean:
	@echo -n 'Cleaning directory: '
	rm -f $(OBJS) $(TARGETS) core *~ .*~ .depend
	@set -e; for i in $(SUBDIRS); do echo; $(MAKE) -C $$i veryclean; done

%.o: %.$(FEXT) 
	$(CC) -c $< $(CFLAGS) -o $@ $(INC)
