############################################################
# Use first  command if you have the LAPACK library
# Use second command to compily necessary LAPACK routines 
############################################################
LIBS	= -L$(ANILIB) -lm -lani2D-1.3 -laft2D-1.3 -llapack     -lblas
#LIBS	= -L$(ANILIB) -lm -lani2D-1.3 -laft2D-1.3 -llapack-3.0 -lblas


############################################################
# YOU DO NOT NEED TO CHANGE THE LINES BELOW
############################################################
SYSHOME := $(shell cd ../..; /bin/pwd)
include $(SYSHOME)/src/Rules.make


############################################################
EXE         = $(ANIBIN)/TestAPP.exe

OBJ         = $(OBJUSER)  main.o graph.o forlibani.o esterr.o

OBJLIBAFT   = $(OBJCORE) 

############################################################
all: 	    help

exe: 	    $(EXE) info

run:
	    cd $(ANIBIN) &&  $(EXE)

clean: 
	    @/bin/rm -f *.o  *~ $(ANIBIN)/*.ps \
            $(ANIBIN)/*.exe $(ANIBIN)/gmon.out 

help:
	    @echo "make {exe|run|clean|help|gs}"
	    @echo " "
	    @echo " Compile options:"
	    @echo "     exe - compile the code and link with libaft2D.a"
	    @echo " "
	    @echo " Execute options:"
	    @echo "     run - run code with given boundary"
	    @echo " "
	    @echo " Misceleneous options:"
	    @echo "     gs     - draw the mesh (bin/aft.ps) and solution (bin/iso.ps)"
	    @echo "     clean  - clean the package"
	    @echo "     help   - print this message"
	    @echo " "

info:
	    @echo " "
	    @echo "Executable files are located in   ani2D/bin"
	    @echo "Library files are located in      ani2D/lib"
	    @echo "Postscript figures are located in ani2D/bin"
	    @echo " "

gs:
	    @echo " "
	    @echo " "
	    @echo "Postscript figures:"
	    @echo "   1. initial mesh"
	    @echo "   2. isolines of the corresponing solution"
	    @echo "   3. final (adapted) mesh"
	    @echo "   4. isolines of the corresponing solution"
	    cd $(ANIBIN); gv aft.ps; gv iso.ps; gv hba.ps; gv his.ps




############################################################
$(EXE): $(OBJ) 
	@echo ''
	@echo 'Creating executable bin/Test.exe' 
	@$(FLINKER) $(LDFLAGS) -o $(EXE) $(OBJ) $(LIBS)
	@echo ''


############################################################
main.o      : main.f  
forlibani.o : forlibani.f
graph.o     : graph.f   
esterr.o    : esterr.f  



############################################################
.f.o:
	@echo $(F77)' -c ' $*.f 
	@$(F77) $(FFLAGS) -c $*.f -o $*.o 
.c.o:
	@echo $(CC)'  -c ' $*.c 
	@$(CC)  $(CFLAGS) -c $*.c -o $*.o 

