# LANL:license
#  ----------------------------------------------------------------------
# This SOFTWARE has been authored by an employee or employees of the
# University of California, operator of the Los Alamos National Laboratory
# under Contract No. W-7405-ENG-36 with the U.S. Department of Energy.
# The U.S. Government has rights to use, reproduce, and distribute this
# SOFTWARE.  The public may copy, distribute, prepare derivative works and
# publicly display this SOFTWARE without charge, provided that this Notice
# and any statement of authorship are reproduced on all copies.  Neither
# the Government nor the University makes any warranty, express or implied,
# or assumes any liability or responsibility for the use of this SOFTWARE.
# If SOFTWARE is modified to produce derivative works, such modified
# SOFTWARE should be clearly marked, so as not to confuse it with the
# version available from LANL.
# -------------------------------------------------------------------------
# LANL:license
#--------------------------------------------------------------------------
# $Id: Makefile.in,v 1.7 2005/08/31 19:56:42 crickett05 Exp $

#### Start of system configuration section. ####



top_srcdir = ../..
srcdir = .
projdir = $(top_srcdir)/@PROJECT@
incdir = $(top_srcdir)/include
VPATH = $(projdir)

CC  = cc
CXX = g++
F90 = i586-alt-linux-gfortran
F90FLAGS = 
F90_COMP_LIBS =  -L/usr/lib/gcc/i586-alt-linux/4.5.3 -L/usr/lib/gcc/i586-alt-linux/4.5.3/../../..  -lgfortran -lm -lgcc_s
COMPILER_INFO = $(CHASM_ROOT)/include/compilers/GNU.h
FORTRAN_COMPILER  = GNU

AR  = ar
ARFLAGS = cr
RANLIB = ranlib

DEFS =  
LIBS = /usr/lib -lpdb
CHASM_ARCH = linux

CXXFLAGS = -pipe -Wall -g -O2 -march=i586 -mtune=i686 -fPIC -DPIC -ggdb -fPIC  -I../../include -I/usr/include
CFLAGS = -pipe -Wall -g -O2 -march=i586 -mtune=i686 -fPIC -DPIC -ggdb -fPIC  -I../../include -I/usr/include
CPPFLAGS = -I/usr/include
LDFLAGS =  -L. -L/usr/lib

prefix = /usr
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
scriptdir = $(bindir)
datadir = $(prefix)/lib
libdir = $(prefix)/lib
infodir = $(prefix)/info

#### End of system configuration section. ####

SHELL = /bin/sh

CHASM    = /usr/share/chasm
XMLDIR   = $(CHASM)/xml/xsl/fortran/from-cxx
XMLGEN   = /usr/bin/xmlgen
PDBGEN   = /usr/bin/f90parse
INCDIR   = /usr/include
LIBS     = /usr/lib/libchasm.a
OBJS     = driver.o chasm_call.o chasm_call_init.o particle.o

XALAN = java -jar /usr/share/java/saxon8.jar

all: driver

driver: $(OBJS)
	$(CXX) -o driver $(CXXFLAGS) $(OBJS) $(LIBS) $(F90_COMP_LIBS)

driver.o: driver.cc chasm_call.h
	$(CXX) -c -g -I$(INCDIR) $(CXXFLAGS) driver.cc

chasm_call.o: chasm_call.cc chasm_call.h
	$(CXX) -c -g -I$(INCDIR) $(CXXFLAGS) chasm_call.cc

chasm_call_init.o: chasm_call_init.f90 particle.o
	$(F90) -c -g $(F90FLAGS) chasm_call_init.f90

particle.o: particle.f90
	$(F90) -c -g $(F90FLAGS) particle.f90

chasm_call.h: particle.xml
	$(XALAN) -o chasm_call.h particle.xml $(XMLDIR)/chasm_call.h.xsl

chasm_call.cc: particle.xml
	$(XALAN) -o chasm_call.cc particle.xml $(XMLDIR)/chasm_call.cc.xsl

chasm_call_init.f90: particle.xml
	$(XALAN) -o chasm_call_init.f90 particle.xml $(XMLDIR)/chasm_call_init.f90.xsl

particle.xml: particle.pdb
	$(XMLGEN) particle.xml particle.pdb

particle.pdb: particle.f90
	$(PDBGEN) particle.f90

clean:
	rm -rf driver *.o *~ *.pdb *.xml chasm_call* *.mod a.out
