# Makefile for "plain" export version of DDSCAT.6.1

#******************************************************************************
#
# 1. Compiler Definition
#    ===================
#    FC specifies the fortran compiler
#    FFLAGS is used to compile the modules in "OBJS"
#    FFLAGSslamc1 is used to compile the module lapackslamc1.f
#    FFLAGSundecl is used to compile the modules with variables that have not
#              been explicitly declared.
#    LDFLAGS are flags for linking
#
# 2. TIMEIT Definition
#    =================
#    TIMEIT defines the timeing routine, which depends on system calls
#    provided by the operating system.
#    use one of the following:
#	timeit_null (no timing results provided)
#	timeit_linux (if using Linux)
#	timeit_sun (if using Solaris)
#	timeit_hp
#	timeit_sgi
#	timeit_convex
#	timeit_ibm6000
#	timeit_osf
#	timeit_vms
#	timeit_cray
#	timeit_titan
#    
#----------------------Linux with g77 -------- --------------------------------

FC		= g77 
FFLAGS		= -c -u -O
FFLAGSundecl  	= -c -O
FFLAGSslamc1	= -c
TIMEIT		= timeit_linux
LDFLAGS 	=

#----------------------- Linux pgf77 ------------------------------------------
# pgf77 = Portland Group compiler (http://www.pgroup.com)

#FC		= pgf77
#FFLAGS  	= -c -fast 
#FFLAGSundecl 	= -c -fast 
#FFLAGSslamc1	= -c
#LDFLAGS 	= -Bstatic 
#TIMEIT  	= timeit_linux

#----------------------- Linux ifc --------------------------------------------
# ifc = intel fortran compiler

#FC              = ifc
#FFLAGS          = -c -O3
#FFLAGSundecl    = -c -O3
#FFLAGSslamc1    = -c
#LDFLAGS         = -Vaxlib
#TIMEIT          = timeit_linux

#---------------------- OSF on Compaq alpha -----------------------------------

#FC		= f77
#FFLAGS		= -c -fast
#FFLAGSundecl	= -c -fast
#FFLAGSslamc1	= -c
#LDFLAGS	=
#TIMEIT		= timeit_osf

#------------------------- Sun fortran ----------------------------------------

#FC		= f77
#FFLAGS		= -fast -u 
#FFLAGSundecl 	= -fast -O3 -c
#FFLAGSslamc1	= -c
#LDFLAGS	= -fast -O3
#TIMEIT		= timeit_sun

#---------------------- AIX fortran on RS6000 ---------------------------------

#FC		= xlf
#FFLAGS		= -O
#FFLAGSundecl 	= -O -c
#FFLAGSslamc1	= -c
#LDFLAGS 	= -O
#TIMEIT		= timeit_ibm6000

#------------------------ SGI IRIX on R4000 -----------------------------------
# -mips2 option generates code using the MIPS 2 instruction set [R4000 cpu]

#FC		= f77
#FFLAGS		= -u -mips2 -O2
#FFLAGSundecl	= -mips2 -O2 -c
#FFLAGSslamc1	= -c
#LDFLAGS	= -mips2 -O2
#TIMEIT		= timeit_sgi

#--------- SGI IRIX on R5000, R8000, or R10000 systems ------------------------
# -mips4 option generates code using the MIPS IV instruction set [supported on
# R5000, R8000, and R10000 cpus]

#FC		= f77
#FFLAGS		= -u -mips4 -O2
#FFLAGSundecl	= -mips4 -O2 -c
#FFLAGSslamc1	= -c
#LDFLAGS	= -mips4 -O2
#TIMEIT		= timeit_sgi

#----------------------- HP AUX -----------------------------------------------

#FC		= f77
#FFLAGS		= -O3 -c
#FFLAGSundecl	= -O3
#FFLAGSslamc1	= -c
#LDFLAGS	=
#TIMEIT		= timeit_hp

#******************************************************************************
#
#                  End of option specifications.
#      User should not need to edit the Makefile below this point
#
#******************************************************************************

SRCS	      = DDSCAT.f\
		alpha.f\
		blas.f\
		ccgpack.f\
		cgcommon.f\
		copyit.f\
		cprod.f\
		cxc3dfft_fake.f\
		cxfft3n.f\
		cxfftw_fake.f\
		dielec.f\
		divide.f\
		errmsg.f\
		eself.f\
		evala.f\
		evale.f\
		evalq.f\
		extend.f\
		getfml.f\
		getmueller.f\
		gpfa.f\
		interp.f\
		lapackslamc1.f\
		lapacksubs.f\
		mpi_fake.f\
		namer.f\
		namid.f\
		nuller.f\
		orient.f\
		pim.f\
		prinaxis.f\
		reapar.f\
		reashp.f\
		reduce.f\
		refice.f\
		refwat.f\
		restore.f\
		rot2.f\
		rotate.f\
		scat.f\
		scavec.f\
		tar2el.f\
		tar2sp.f\
		tar3el.f\
		taranirec.f\
		tarblocks.f\
		tarcel.f\
		tarcyl.f\
		tarcylcap.f\
		tarell.f\
		target.f\
		targspher_fake.f\
		tarhex.f\
		tarnsp.f\
		tarprsm.f\
		tarrec.f\
		tarslb.f\
		tartet.f\
		timeit_null.f\
		version.f\
		wrimsg.f\
		writebin.f\
		writenet_fake.f\
		writesca.f

OBJS	      = DDSCAT.o\
		alpha.o\
		blas.o\
		ccgpack.o\
		cgcommon.o\
		copyit.o\
		cprod.o\
		cxc3dfft_fake.o\
		cxfft3n.o\
		cxfftw_fake.o\
		dielec.o\
		divide.o\
		errmsg.o\
		eself.o\
		evala.o\
		evale.o\
		evalq.o\
		extend.o\
		getfml.o\
		getmueller.o\
		gpfa.o\
		interp.o\
		lapackslamc1.o\
		lapacksubs.o\
		mpi_fake.o\
		namer.o\
		namid.o\
		nuller.o\
		orient.o\
		pim.o\
		prinaxis.o\
		reapar.o\
		reashp.o\
		reduce.o\
		refice.o\
		refwat.o\
		restore.o\
		rot2.o\
		rotate.o\
		scat.o\
		scavec.o\
		tar2el.o\
		tar2sp.o\
		tar3el.o\
		taranirec.o\
		tarblocks.o\
		tarcel.o\
		tarcyl.o\
		tarcylcap.o\
		tarell.o\
		target.o\
		targspher_fake.o\
		tarhex.o\
		tarnsp.o\
		tarprsm.o\
		tarrec.o\
		tarslb.o\
		tartet.o\
		timeit_null.o\
		version.o\
		wrimsg.o\
		writebin.o\
		writenet_fake.o\
		writesca.o

#-----------------------------------------------------------------------------
# Most of the $(OBJS) modules can be compiled with the -u option on Sun.
# (The -u option requires that every variable type be declared explicitly).
# Only exceptions are the following routines:

gpfa.o:		gpfa.f
		$(FC) -c $(FFLAGSundecl) -o gpfa.o gpfa.f 
lapackslamc1.o: lapackslamc1.f
		$(FC) -c $(FFLAGSslamc1) -o lapackslamc1.o lapackslamc1.f
refwat.o:	refwat.f
		$(FC) -c $(FFLAGSundecl) -o refwat.o refwat.f

#-----------------------------------------------------------------------------
# dependencies for calltarget:

SRCS2	      =	CALLTARGET.f \
		blas.f\
		errmsg.f\
		lapackslamc1.f\
		lapacksubs.f\
		prinaxis.f\
		reashp.f\
		sizer.f\
		tar2el.f\
		tar2sp.f\
		tar3el.f\
		taranirec.f\
		tarblocks.f\
		tarcel.f\
		tarcyl.f\
		tarcylcap.f\
		tarell.f\
		target.f\
		targspher_fake.f\
		tarhex.f\
		tarnsp.f\
		tarprsm.f\
		tarrec.f\
		tarslb.f\
		tartet.f\
		wrimsg.f

OBJS2	      =	CALLTARGET.o \
		blas.o\
		errmsg.o\
		lapackslamc1.o\
		lapacksubs.o\
		prinaxis.o\
		reashp.o\
		sizer.o\
		tar2el.o\
		tar2sp.o\
		tar3el.o\
		taranirec.o\
		tarblocks.o\
		tarcel.o\
		tarcyl.o\
		tarcylcap.o\
		tarell.o\
		target.o\
		targspher_fake.o\
		tarhex.o\
		tarnsp.o\
		tarprsm.o\
		tarrec.o\
		tarslb.o\
		tartet.o\
		wrimsg.o

all:		ddscat calltarget

clean::
		rm -f *.o

ddscat:		$(OBJS) Makefile
		$(FC) $(OBJS) $(LDFLAGS)  -o ddscat

calltarget:	$(OBJS2) Makefile
		$(FC) $(OBJS2) $(LDFLAGS) -o calltarget
