#
#************************************************************************
#                              AMBER                                   **
#                                                                      **
#               Copyright (c) 1986, 1991, 1995, 1997, 1999, 2004       **
#                Regents of the University of California               **
#                       All Rights Reserved.                           ** 
#                                                                      **
#  This software provided pursuant to a license agreement containing   **
#  restrictions on its disclosure, duplication, and use. This software **
#  contains confidential and proprietary information, and may not be   **
#  extracted or distributed, in whole or in part, for any purpose      **
#  whatsoever, without the express written permission of the authors.  **
#  This notice, and the associated author list, must be attached to    **
#  all copies, or extracts, of this software. Any additional           **
#  restrictions set forth in the license agreement also apply to this  **
#  software.                                                           **
#************************************************************************

# Makefile for UCSF Amber 9   PMEMD 

SHELL=/bin/sh
VPATH=

# Platform-specific info should be found in ../config.h

include ../config.h

OBJS=   gbl_constants.o gbl_datatypes.o state_info.o file_io_dat.o \
        parallel_dat.o mdin_ctrl_dat.o mdin_ewald_dat.o prmtop_dat.o \
        inpcrd_dat.o dynamics_dat.o img.o parallel.o pme_direct.o pme_recip.o \
        pme_fft.o fft1d.o bspline.o pme_force.o pbc.o nb_pairlist.o \
        nb_exclusions.o cit.o dynamics.o bonds.o angles.o dihedrals.o \
        extra_pnts_nb14.o runmd.o loadbal.o shake.o \
        runmin.o constraints.o axis_optimize.o gb_ene.o veclib.o gb_force.o \
        timers.o pmemd_lib.o runfiles.o file_io.o bintraj.o pmemd_clib.o \
        pmemd.o random.o degcnt.o erfcfun.o nmr_calls.o nmr_lib.o \
        get_cmdline.o master_setup.o alltasks_setup.o pme_setup.o \
        ene_frc_splines.o nextprmtop_section.o nextinpcrd_section.o \
        mdin_amoeba_dat.o amoeba_force.o amoeba_interface.o \
        amoeba_adjust.o amoeba_direct.o amoeba_induced.o amoeba_multipoles.o \
        amoeba_recip.o amoeba_self.o amoeba_valence.o amoeba_vdw.o \
        amoeba_runmd.o amoeba_flags.o amoeba_bonds.o amoeba_opbend_angles.o \
        amoeba_pitorsions.o amoeba_reg_angles.o amoeba_stretch_bend.o \
        amoeba_stretch_torsions.o amoeba_torsions.o amoeba_torsion_torsion.o \
        amoeba_trig_angles.o amoeba_ureyb.o

all: pmemd

install: all 
	mv pmemd ../../../exe

pmemd: $(NETCDF_MOD) $(OBJS)
	$(LOAD) $(LOADFLAGS) -o $@ $(OBJS) $(FFT_LIBS) $(NETCDF_LIBS) $(MATH_LIBS) $(MPI_LIBS) $(LOADLIBS)

# Some implementations of netcdf seem to have more than just netcdf.mod...

netcdf.mod:
	cp $(NETCDF_HOME)/include/*.mod .

clean:
	rm -f *.f90 *.o *.$(MODULE_SUFFIX) pmemd *.d work.pc*

# The following statement keeps the .f90 files from getting clobbered; this
# would happen because they are intermediates.
	 
.PRECIOUS: .f90

# Control the suffixes available; this essentially eliminates built-in
# inference rules, done here to improve portability.

.SUFFIXES:

.SUFFIXES: .fpp .c .o

.fpp.o:
	$(CPP) $(CPPFLAGS) $(FFT_INCLUDE) $(MPI_INCLUDE) $(FFT_DEFINES) $(NETCDF_DEFINES) $(MPI_DEFINES) $(DIRFRC_DEFINES) $(MATH_DEFINES) $(F90_DEFINES) $*.fpp $*.f90
	$(F90) $(F90FLAGS) $(F90_OPT_DFLT) $*.f90

.c.o:
	$(CC) $(CFLAGS) -c $*.c

# All f90 source compiles at F90_OPT_DFLT unless overridden here:

# F90_OPT_LO:

# F90_OPT_MED:

# F90_OPT_HI (the usual F90_OPT_DFLT):

## Dependencies for f90 modules and include files generated by makef90depends:

include f90depends
