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

# Make configuration variables
SHELL = /bin/sh
VPATH = Object:Include:../bin


# Preprocessor variables
CPP = /usr/lib/cpp

# Wilson's VRND is used for the serial version until we test PRNG.
# PRNG (Parallel Random Number Generator ) algorithm is the default
# for the pre-processor. The -DWVRND flag should be used in this case.
# When using PRNG, LIBS should include the correct library.
CPPFLAGS = -P -DAIX -DWVRND

# Fortran compiler variables
FC = xlf 
  FFLAGS = -O2 -IInclude 
# FFLAGS = -g -IInclude 
# FFLAGS = -g -C -IInclude 

# Linker/loader variables
LDFLAGS = -o eceppak-${ECEPP_ARCH}
LIBS = -L/usr/local/lib -limsl

# 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. 
.SUFFIXES: .o .f .F


.F.f:
	${CPP} ${CPPFLAGS} $*.F >  $*.f
	cp $*.f f_FILES/
.f.o:
	${FC} -c ${FFLAGS} $<
	mv $*.o Object

.F.o:
	${CPP} ${CPPFLAGS} $*.F >  $*.f
	cp $*.f f_FILES/
	${FC} -c ${FFLAGS} $*.f
	mv $*.o Object
	rm $*.f

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

# All rules go below here

eceppak-${ECEPP_ARCH}: ${objects}
	cd Object; ${FC} ${LDFLAGS} ${objects} ${LIBS}; \
	mv $(@F) ${ECEPP_ROOT}/bin
clean:
	rm -f Object/*.o *.o
