# Makefile for the Eceppak Package (parallel version) on NTs
# using MPI.
#
# Note: This file is written for the gnu version of make, and it may not
#  be compatible with other versions.

# Make configuration variables
VPATH = Object_MPI:Include:../bin

# Preprocessor variables
# change for NT, dis 7-22-99
CPP = fpp

# There is no default random number generator.
# The Parallel Random Number Generator uses the PRNG algorithm from M. Kalos. 
# CPP directive -DWPRNG (/DWPRNG on NT).
# For the serial version two posibilities are available:
# Wilson's VRND can be requested with the CPP directive -DWPRNG (/DWPRNG on NT).
#   or alternatively,
# the generator from the NAG library can be invoked with the 
#  the CPP directive -DNAG (/DNAG for NT systems).
# When using PRNG and NAG, LIBS should include the correct libraries.
# Note (10/8/99) PRNG code for NT version (using integer*4) included with the 
# code. 
CPPFLAGS = /P /DWINNT /DMP /DMPI /DWPRNG

# Fortran compiler variables
# change for MPI-Pro on NT, 7-22-99
# FC = mpif77
FC = f77

# comment out for MPI-Pro on NT, 7-26-99
# add optimization after making MPI version, 7-26-99
# OPT = -O3 -g
# OPT = -g
# change for MPI-Pro on NT, 7-26-99
# FFLAGS = /debug:full /optimize:0 -IInclude
# FFLAGS = /define:MPI_VIA_proto /debug:full /optimize:0 -IInclude
  FFLAGS = /debug:full /optimize:0 -IInclude \
-IC:\PROGRA~1\MPIPro\include

# Linker/loader variables
# change for MPI-Pro on NT, 7-26-99
LDFLAGS = /link /out:eceppak-${ECEPP_ARCH}.exe 
#
# LIBS should include library for PRNG on the SP2
# change for MPI-Pro on NT, 7-26-99
#LIBS  = -L/usr/local/lib -lctc -limsl
# the IMSL libs listed are set to LINK_F90.  How to use that in make?
LIBS = "C:\PROGRA~1\MPIPro\LIB\MPIPro.lib C:\PROGRA~1\MPIPro\LIB\MPIPro_dvf.lib sstatd.lib sstats.lib smathd.lib smaths.lib sf90mp.lib" 

# Suffix rule definitions
# All three of these need to be here. ".F.f" is necessary for working
# with RCS and GNU make, and ".f.o" and ".F.o" are always necessary. 

# change for NT, .f-->.for, .o-->.obj
.SUFFIXES: .obj .for .F

.F.for:
	 ${CPP} ${CPPFLAGS} $*.F >  $*.for
	cp $*.for f_FILES_MPI/
.for.obj:
	${FC} -c ${FFLAGS} $<
	mv $*.obj Object_MPI

.F.obj:
	${CPP} ${CPPFLAGS} $*.F >  $*.for
	cp $*.for f_FILES_MPI/
	${FC} -c ${FFLAGS} $*.for
	mv $*.obj Object_MPI
	rm $*.for

objects = accept.obj \
          bd11p.obj \
          calcfpo.obj \
	  cluster.obj \
	  conf_calc.obj \
          core.obj \
          dihedral_const.obj \
	  distconf.obj \
          distconst.obj \
          eceppize.obj \
          edmc.obj \
          edmc_rtns.obj \
	  ene_eval.obj \
          generate.obj \
          gradients.obj \
	  init_int_table.obj \
	  main_driver.obj \
          map.obj \
          minimiz.obj \
	  MP.obj \
          nrgsetup.obj \
	  openunits.obj \
          orient1.obj \
	  param.obj \
	  pepprob.obj \
          place.obj \
	  prng.obj \
	  probres.obj \
          randgens.obj \
          readrtns.obj \
          restart.obj \
          rmdcon.obj \
	  rmscalcs.obj \
	  rmsconst.obj \
	  rms_rtns.obj \
	  set_defaults.obj \
          solvation.obj \
          sumsl1.obj \
          thetartns.obj \
          thermo.obj \
          timing.obj \
          utils.obj \
          vtf_rtns.obj \
	  write.obj

# All rules go below here

eceppak-${ECEPP_ARCH}.exe: ${objects} 
	cd Object_MPI; ${FC} ${LDFLAGS} ${objects} ${LIBS}; \
	mv $(@F) ${ECEPP_ROOT}/bin
clean:
	rm -f Object_MPI/*.obj *.obj f_FILES_MPI/*.for
