# 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_pH: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 /DPHCALC

# 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
# FFLAGS =  /fltconsistency /fast /keep /optimize:5 /check:underflow \
#           /check:overflow /inline:speed /compile_only /debug:full /arch:p6 \
#          /fpe:3 -IInclude  -IC:\PROGRA~1\MPIPro\include
  FFLAGS =  /fltconsistency /fast /keep /optimize:5 /traceback \
   /check:none /inline:speed /compile_only /debug:none /arch:p6 \
   /tune:p6 /fpe:3 /nof77rtl /fpscomp:general -IInclude  -IC:\PROGRA~1\MPIPro\include
#
# Dont use the following options. The program wont work
# /check:underflow /check:overflow \
 
# Linker/loader variables
# change for MPI-Pro on NT, 7-26-99
LDFLAGS = /traceback  /link /stack:1500000 /out:eceppakpH-${ECEPP_ARCH}.exe  /NODEFAULTLIB:libcd.lib 
#
# 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_pH/
.for.obj:
	${FC} -c ${FFLAGS} $<
	mv $*.obj Object_MPI_pH

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

objects = accept.obj \
	  bd11p.obj \
	  calcfpo.obj \
	  charged_conf.obj \
	  cluster.obj \
	  conf_calc.obj \
	  connect_ha.obj \
	  connect_la97.obj \
	  connect_lh.obj \
	  core.obj \
	  degionzpH.obj \
	  dihedral_const.obj \
	  distconf.obj \
	  distconst.obj \
	  eceppize.obj \
	  edmc.obj \
	  edmc_rtns.obj \
	  en_ggg000.obj \
	  en_ggg001.obj \
	  ene_eval.obj \
	  generate.obj \
	  gradients.obj \
	  grant2.obj \
	  init_int_table.obj \
	  inptest.obj \
	  linbcg.obj \
	  main_driver.obj \
	  map.obj \
	  minimiz.obj \
	  MP.obj \
	  mseed_new.obj \
	  nrgsetup.obj \
	  openunits.obj \
	  optim_ionstate.obj \
	  orient1.obj \
	  param.obj \
	  pepprob.obj \
	  place.obj \
	  potential_eql_DR.obj \
	  potential_xyz.obj \
	  precal01.obj \
	  prng.obj \
	  probres.obj \
	  protonation.obj \
	  randgens.obj \
	  readinfo.obj \
	  readrtns.obj \
	  restart.obj \
	  rmdcon.obj \
	  rms_rtns.obj \
	  rmscalcs.obj \
	  rmsconst.obj \
	  set_defaults.obj \
	  sigma0_loc.obj \
	  sigma_ibem.obj \
	  sigma_loc.obj \
	  sims_01_pbl.obj \
	  sims_02_pbl.obj \
	  solv_frengSIMS.obj \
	  solv_ibems_DR.obj \
	  solv_transSIMS.obj \
	  solvation.obj \
	  sp_KKK.obj \
	  ssint_en.obj \
	  ssolv_en.obj \
	  sumsl1.obj \
	  surf_loc01.obj \
	  surf_loc02.obj \
	  thermo.obj \
	  thetartns.obj \
	  timing.obj \
	  timit.obj \
	  utils.obj \
	  vtf_rtns.obj \
	  write.obj

# All rules go below here

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

