## Makefile (G. Samsonidze Oct 2009)
##

PREFIX=../..
include $(PREFIX)/Common/common-rules.mk

SRC     = SIESTA_main.f90 name.f90 real.f90
OBJ     = $(SRC:.f90=.o)

# object files from Common directory
COMOBJ = norm.o write_program_header.o fftw.o fft_parallel.o \
         read_cube.o svninfo.o wfn_rho_vxc_io.o sort.o \
         check_inversion.o blas.o lapack.o symmetries.o misc.o
COMMONOBJS = $(addprefix $(COMMON)/,$(COMOBJ)) $(GLOBALOBJS)

LIBS = $(LAPACKLIB) $(FFTWLIB)

default: siesta2bgw

siesta2bgw: siesta2bgw$(FLAVOR).x

siesta2bgw$(FLAVOR).x: $(COMMONOBJS) $(OBJ) $(SPGLIB)/libsymspg.a
	$(LINK) $(FOPTS) -o $@ $^ $(LIBS)
	$(INSTALL_CMD)

$(OBJ) : $(GLOBALMODS)
SIESTA_main.o : $(COMMON)/fftw_m.mod $(COMMON)/wfn_rho_vxc_io_m.mod \
                $(COMMON)/fft_parallel_m.mod $(COMMON)/check_inversion_m.mod \
                $(COMMON)/symmetries_m.mod $(COMMON)/read_cube_m.mod \
                name_m.mod real_m.mod
name.o name_m.mod : $(COMMON)/global_m.mod
real.o real_m.mod : $(COMMON)/global_m.mod
