#-------------------------------------------------------------------------
# This file was automatically generated by Automake, and manually modified 
# to make it simpler and cleaner. There are three sections in the file:
# 1) Macros
# 2) Recursive Rules and Suffixes (implicit rules)
# 3) Explicit Rules
#-------------------------------------------------------------------------

#-------------------------------------------------------------------------
#   Section 1) Macros
#-------------------------------------------------------------------------
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@

CONDOR_DIR = @CONDOR_DIR@
CXX = @CXX@
MEASURE_DEFN = @MEASURE_DEFN@
MISC_DEFN = @MISC_DEFN@
MISC_LIB = @MISC_LIB@
MW_LIBDIR = @MW_LIBDIR@
MW_LIBDIR_DEBUG = @MW_LIBDIR_DEBUG@
ENABLE_MWINDEPENDENT = @ENABLE_MWINDEPENDENT@
PVM_ROOT = @PVM_ROOT@
RANLIB = @RANLIB@
INSTALL = @INSTALL@
SOCKET_LIB = @SOCKET_LIB@
PACKAGE = @PACKAGE@
VERSION = @VERSION@

mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
AR = ar

DEFS = @DEFS@ -I.
LIBS = @LIBS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
CXXFLAGS = @CXXFLAGS@ -Wall

# Subdirectories
SUBDIRS = RMComm MWControlTasks BlackBox

###  Libraries to be built, and dependent source files
# If ENDABLE_INDEPENDENT is yes (you can do that by configure --with-independent). 
# It seems we must build two sets of object file/lib for the normal configuration and --with-independent (otherwise 
# the class definition included in different obj files are different (some are larget with independent - realized
# this after PAINFUL debugging. Thanks for Peter's intuition!)
# Here the safest way is to build libMW_indp.a and libMWutil_indp.a (although it currently doesn't include MWDriver.h 
#  or MWWorker.h), also the libNWS_indp.a, libMWRMComm_lib.a and the libMWRC_indp.a (the actual RMC implementation).
ifeq ($(ENABLE_MWINDEPENDENT), yes)
LIBRARIES = libMW.a libMWutil.a libMW_indp.a libMWutil_indp.a
else 
LIBRARIES = libMW.a libMWutil.a
endif

libMW_a_SOURCES = MW.C MWDriver.C MWTask.C MWTaskContainer.C MWWorkerID.C MWWorker.C MWStats.C MWprintf.C MWGroup.C MWUnixSystem.C
libMW_a_OBJECTS =  MW.o MWDriver.o MWTask.o MWTaskContainer.o MWWorkerID.o MWWorker.o MWStats.o MWprintf.o MWGroup.o MWUnixSystem.o
libMWutil_a_SOURCES = MWList.C
libMWutil_a_OBJECTS =  MWList.o

libMW_indp_a_OBJECTS = MWInd.o MWDriverInd.o MWWorkerInd.o MWWorkerIDInd.o MWTaskInd.o MWTaskContainerInd.o MWStatsInd.o MWprintfInd.o MWGroupInd.o MWUnixSystem.o
libMWutil_indp_a_OBJECTS = MWListInd.o 

# To work with Insure, need to "setenv DEBUG_BUILD='insure'" and write/copy a good .psrc file
ifdef DEBUG_BUILD
DEBUG_CHECKER = $(DEBUG_BUILD)
MW_LIBDIR = $(MW_LIBDIR_DEBUG)
endif
INCLUDES = -I. -IRMComm -IMW-File -IMW-CondorPVM -IMW-Socket -IMWControlTasks $(MISC_DEFN) $(MEASURE_DEFN)
CXXCOMPILE = $(DEBUG_CHECKER) $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
INDP_CXXCOMPILE = $(CXXCOMPILE) -DINDEPENDENT

INCLUDEFILES = MW.h MWDriver.h\
	MWGroup.h MWList.h MWStats.h MWSystem.h MWTask.h  MWTaskContainer.h MWWorker.h MWWorkerID.h MWprintf.h

#-------------------------------------------------------------------------
#   Section 2) Explicit and Implicit Rules
#-------------------------------------------------------------------------

all: $(LIBRARIES)
	[ "__$(SUBDIRS)" = "__" ] || for subdir in `echo "$(SUBDIRS)"`; do (cd $$subdir && $(MAKE) $@) ; done

libMW.a: $(libMW_a_OBJECTS) $(libMW_a_DEPENDENCIES)
	-rm -f libMW.a
	$(AR) cru libMW.a $(libMW_a_OBJECTS) $(libMW_a_LIBADD)
	$(RANLIB) libMW.a
	cp libMW.a $(MW_LIBDIR)

libMWutil.a: $(libMWutil_a_OBJECTS) $(libMWutil_a_DEPENDENCIES)
	-rm -f libMWutil.a
	$(AR) cru libMWutil.a $(libMWutil_a_OBJECTS) $(libMWutil_a_LIBADD)
	$(RANLIB) libMWutil.a
	cp libMWutil.a $(MW_LIBDIR)

ifeq ($(ENABLE_MWINDEPENDENT), yes)
libMW_indp.a: $(libMW_indp_a_OBJECTS)
	-rm -f libMW_indp.a
	$(AR) cru libMW_indp.a $(libMW_indp_a_OBJECTS)
	$(RANLIB) libMW_indp.a
	cp libMW_indp.a $(MW_LIBDIR)
libMWutil_indp.a: $(libMWutil_indp_a_OBJECTS)
	-rm -f libMWutil_indp.a
	$(AR) cru libMWutil_indp.a $(libMWutil_indp_a_OBJECTS)
	$(RANLIB) libMWutil_indp.a
	cp libMWutil_indp.a $(MW_LIBDIR)
MWInd.o:MW.C
	$(INDP_CXXCOMPILE) -o MWInd.o -c MW.C
MWDriverInd.o:MWDriver.C
	$(INDP_CXXCOMPILE) -o MWDriverInd.o -c MWDriver.C
MWWorkerInd.o:MWWorker.C
	$(INDP_CXXCOMPILE) -o MWWorkerInd.o -c MWWorker.C
MWTaskInd.o:MWTask.C
	$(INDP_CXXCOMPILE) -o MWTaskInd.o -c MWTask.C
MWTaskContainerInd.o:MWTaskContainer.C
	$(INDP_CXXCOMPILE) -o MWTaskContainerInd.o -c MWTaskContainer.C
MWWorkerIDInd.o:MWWorkerID.C
	$(INDP_CXXCOMPILE) -o MWWorkerIDInd.o -c MWWorkerID.C
MWStatsInd.o:MWStats.C
	$(INDP_CXXCOMPILE) -o MWStatsInd.o -c MWStats.C
MWprintfInd.o:MWprintf.C
	$(INDP_CXXCOMPILE) -o MWprintfInd.o -c MWprintf.C
MWGroupInd.o:MWGroup.C
	$(INDP_CXXCOMPILE) -o MWGroupInd.o -c MWGroup.C
MWListInd.o:MWList.C
	$(INDP_CXXCOMPILE) -o MWListInd.o -c MWList.C
endif

.SUFFIXES: .C .o

.C.o:
	$(CXXCOMPILE) -c $<

#-------------------------------------------------------------------------
#   Section 3) Recursive Rules: Common
#-------------------------------------------------------------------------

install: $(LIBRARIES) $(INCLUDEFILES)
	$(mkinstalldirs) $(libdir)
	@list='$(LIBRARIES)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo "  ${INSTALL} -m 644 $$p $(libdir)/$$p"; \
	    $(INSTALL) -m 644 $$p $(libdir)/$$p; \
	    echo " $(RANLIB) $(libdir)/$$p"; \
	    $(RANLIB) $(libdir)/$$p; \
	  fi; \
	done
	$(mkinstalldirs) $(includedir)
	@list='$(INCLUDEFILES)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo "  ${INSTALL} -m 644 $$p $(includedir)/$$p"; \
	    $(INSTALL) -m 644 $$p $(includedir)/$$p; \
	  fi; \
	done	
	[ "__$(SUBDIRS)" = "__" ] || for subdir in `echo "$(SUBDIRS)"`; do (cd $$subdir && $(MAKE) $@) ; done

check: 

clean: 
	-rm -f *.o *.a *core
	[ "__$(SUBDIRS)" = "__" ] || for subdir in `echo "$(SUBDIRS)"`; do (cd $$subdir && $(MAKE) $@) ; done

distclean: 
	-rm -f Makefile *.tar *.gz
	-rm -rf .deps
	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
	-rm -f *.o *.a core
	[ "__$(SUBDIRS)" = "__" ] || for subdir in `echo "$(SUBDIRS)"`; do (cd $$subdir && $(MAKE) $@) ; done

.PHONY: all check clean distclean install
