##############################################################################
# Zoltan Library for Parallel Applications                                   #
# Copyright (c) 2000,2001,2002, Sandia National Laboratories.                #
# For more info, see the README file in the top-level Zoltan directory.      # 
##############################################################################
##############################################################################
# CVS File Information
#    $RCSfile$
#    $Author$
#    $Date$
#    $Revision$
##############################################################################

#
# Utilities Makefile for machine dependent directories
#

include $(ZOLTAN_CONFIG)

ifndef DCC
DCC=$(CC)
endif

ifndef DEPS
DEPS=-M
endif

include $(OBJ_FILES:.o=.d)

%.o:	%.cpp
	@echo "Compiling $<..."
	@$(CC) $(DEFS) -c $<

%.o:	%.c
	@echo "Compiling $<..."
	@$(CC) $(DEFS) -c $<

%.d:	%.cpp
	@echo "(Re)Building dependency for $<..."
	@$(SHELL) -ec '$(DCC) $(DEPS) $(DEFS) $< | sed '\''s/$*\.o/& $@/g'\'' > $@'

%.d:	%.c
	@echo "(Re)Building dependency for $<..."
	@$(SHELL) -ec '$(DCC) $(DEPS) $(DEFS) $< | sed '\''s/$*\.o/& $@/g'\'' > $@'

$(LIB_NAME):	$(OBJ_FILES:.o=.d) $(OBJ_FILES) 
		@echo "creating library "$(LIB_NAME)
		@$(AR) $(BUILD_DIR)/$(LIB_NAME) $(OBJ_FILES) 
		@$(RANLIB) $(BUILD_DIR)/$(LIB_NAME)

$(DRIVER_NAME):	$(DEP_LIBS) $(OBJ_FILES:.o=.d) $(OBJ_FILES)
		@echo "linking driver "$(DRIVER_NAME)
		@$(PURE_CC) $(CC) $(OBJ_FILES) -o $(DRIVER_NAME) $(LNK_LIBS)

