# --------------------------------------------------------------
#
# Usage:
#	[g]make            [to create the executable diff_pat]
#	[g]make install	 [to install  it in the correct directory]
#	[g]make clean	 [to clean the source directory]
#
#
# --------------------------------------------------------------
#
# System definition (architecture)
#
ARCH := $(shell ../../xop_uname)
CPP = cpp

#*********** PLATFORM DEPENDENT VARIABLES ******************
#
#-------------------------- libraries for sun5 (expgh) 
#
ifeq ($(ARCH),sun5)
FC = g95
FFLAGS =   -O -Wall
CPP = /usr/ccs/lib/cpp
endif
#
#-------------------------- libraries for linux (expglio)
#
ifeq ($(ARCH),linux)
FC = g95
FFLAGS =  -O -Wall
endif
#
#-------------------------- libraries for darwin
#
ifeq ($(ARCH),darwin)
FC = g95
FFLAGS =  -O -Wall
endif
#*********** END OF PLATFORM DEPENDENT VARIABLES ******************

all: diff_pat

# mac: 
# 	$(CPP) -P diff_pat.F diff_pat.fmac
# 	cat io_shadow.f >>  diff_pat.fmac
# 	cat vector.f >>  diff_pat.fmac

# lahey: 
# 	$(CPP) -P -Dlahey diff_pat.F diff_pat.flahey
# 	cat io_shadow.f >>  diff_pat.flahey
# 	cat vector.f >>  diff_pat.flahey

# wing77: 
# 	$(CPP) -P diff_pat.F diff_pat.wing77

diff_pat: diff_pat.o vector.o io_shadow.o
	$(FC) $(FFLAGS) -o diff_pat diff_pat.F vector.f io_shadow.f

.f.o: 
	$(FC) -c $<

.F.o: 
	$(FC) -c $<

clean: 
	/bin/rm -f *.trace *.o diff_pat *.flahey *.fmac

install:
	cp diff_pat ./../../bin.$(ARCH)/diff_pat
