# *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* 
# ** Copyright UCAR (c) 1992 - 2010 
# ** University Corporation for Atmospheric Research(UCAR) 
# ** National Center for Atmospheric Research(NCAR) 
# ** Research Applications Laboratory(RAL) 
# ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA 
# ** 2010/10/7 16:53:3 
# *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* 
##########################################################################
#
# Makefile targets for C, C++ and FORTRAN program library modules
#
# Mike Dixon
#
# RAP,NCAR,Boulder,Colorado,80307,USA
# 
# Nov 1998
#
###########################################################################

#
# Include the recursive targets for C, C++ and FORTRAN
#

all: debug

include $(RAP_MAKE_INC_DIR)/rap_make_cf_recursive_targets

#
# compile target
#

target:
	echo Making library module ...
	$(MAKE) _CC="$(_CC)" _CPPC="$(_CPPC)" _F90C="$(_F90C)" DBUG_OPT_FLAGS="$(DBUG_OPT_FLAGS)" DEBUG_CFLAGS="$(DEBUG_CFLAGS)" DEBUG_LIBS="$(DEBUG_LIBS)" DEBUG_LDFLAGS="$(DEBUG_LDFLAGS)" SYS_LIBS="$(SYS_LIBS)" SYS_CFLAGS="$(SYS_CFLAGS)" lib
	if $(TEST) $(MODULE_TYPE) ;\
	then \
		if $(TEST) $(MODULE_TYPE) = library_so; \
		then \
		echo Making shared object library ... ; \
		$(MAKE) _CC="$(_CC)" _CPPC="$(_CPPC)" DBUG_OPT_FLAGS="$(DBUG_OPT_FLAGS)" DEBUG_CFLAGS="$(DEBUG_CFLAGS)" DEBUG_LIBS="$(DEBUG_LIBS)" DEBUG_LDFLAGS="$(DEBUG_LDFLAGS)" SYS_LIBS="$(SYS_LIBS)" SYS_CFLAGS="$(SYS_CFLAGS)" lib_so; \
		fi ;\
	fi

#
# archive target
#

lib:	$(OBJS)
	echo Archiving library ...
	$(AR) $(ARFLAGS) $(TARGET_FILE) $(OBJS)

lib_so: $(OBJS)
	echo Creating shared object...
	ld -shared $(OBJS) -o $(TARGET_FILE)

#
# miscellaneous targets
#

include $(RAP_MAKE_INC_DIR)/rap_make_misc_targets

clean_all: clean clean_insure

#
# Include the suffixes
#

include $(RAP_MAKE_INC_DIR)/rap_make_suffixes