#
# Makefile for the duroc tutorial program
#
#
# Requires that the GLOBUS_DEVELOPMENT_PATH variables is set. This 
# environment variable must point to the Globus development directory
# containing the flavor or libraries, etc. that you wish to use when
# building this example.  This environment variable should be set in
# the shell prior to envoking make.  The utility program
# $GLOBUS_PATH/globus-development-path can be used to assist you in
# determining the correct setting. For usage information type
# $GLOBUS_PATH/globus-development-path -help 
#
# For example:
# 
# SH:
#
# Non-threaded: 
#
# GLOBUS_DEVELOPMENT_PATH = `$GLOBUS_PATH/globus-development-path -nothreads`
# export GLOBUS_DEVELOPMENT_PATH
#
# Threaded:
#
# GLOBUS_DEVELOPMENT_PATH = `$GLOBUS_PATH/globus-development-path -threads`
# export GLOBUS_DEVELOPMENT_PATH
#
# CSH:
#
# Non-threaded:
#
# setenv GLOBUS_DEVELOPMENT_PATH \
#	`$GLOBUS_PATH/globus-development-path -nothreads`
# 
# Threaded:
#
# setenv GLOBUS_DEVELOPMENT_PATH \
# 	`$GLOBUS_PATH/globus-development-path -threads`
#

#
# Read the makefile header containing build specific definitions
#

include $(GLOBUS_DEVELOPMENT_PATH)/etc/makefile_header

BUILD = $(GLOBUS_RELEASE_MAJOR).$(GLOBUS_RELEASE_MINOR)


DUROCTEST_CFLAGS   = 	-I$(includedir) $(CFLAGS) \
			$(GLOBUS_DUROC_RUNTIME_CFLAGS)
DUROCTEST_LDFLAGS  = 	-L$(libdir) $(LDFLAGS)  \
			$(GLOBUS_DUROC_RUNTIME_LDFLAGS)
DUROCTEST_LIBS     = 	$(GLOBUS_DUROC_RUNTIME_LIBS) \
			$(LIBS)

DUROCRUN_CFLAGS   = 	-I$(includedir) $(CFLAGS) \
			$(GLOBUS_DUROC_CONTROL_CFLAGS) \
			-DTHREADFLAVOR=$(THREADFLAVOR)
DUROCRUN_LDFLAGS  = 	-L$(libdir) $(LDFLAGS)  \
			$(GLOBUS_DUROC_CONTROL_LDFLAGS)
DUROCRUN_LIBS     = 	$(GLOBUS_DUROC_CONTROL_LIBS) \
			$(LIBS) 


EXECS = duroctestruntime durocrun

all:
	@if (echo $(GLOBUS_DEVELOPMENT_PATH)|$(GREP) nothreads); then \
	    echo "" ; \
	    echo "NOTE: You must compile threads.c threaded !!!" ; \
	    echo "      Change GLOBUS_DEVELOPMENT_PATH and try again." ; \
	    echo "" ; \
	    exit 1 ; \
	fi
	make $(EXECS)

duroctestruntime:	duroctestruntime.o 
	$(CC) $(DUROCTEST_CFLAGS) $(DUROCTEST_LDFLAGS) -o duroctestruntime \
	duroctestruntime.o $(DUROCTEST_LIBS)

duroctestruntime.o:	duroctestruntime.c
	$(CC) $(DUROCTEST_CFLAGS) -c duroctestruntime.c

durocrun:	durocrun.o
	$(CC) $(DUROCRUN_CFLAGS) $(DUROCRUN_LDFLAGS) -o durocrun \
	durocrun.o $(DUROCRUN_LIBS)

durocrun.o:	durocrun.c
	$(CC) $(DUROCRUN_CFLAGS) -c durocrun.c

clean:
	$(RM) -f $(EXECS) *.o rsl out.*



