#
# $Id: makefile.dos,v 1.17 2000/03/26 03:06:28 balay Exp $
#
# This is the makefile for installing PETSc on Windows NT.
# See the file docs/installation.html for directions on installing PETSc.
# See also bmake\common\nt\base for additional commands.
#

ALL : all_libs

DIRS	 = src include docs 

!include $(PETSC_DIR)\bmake\$(PETSC_ARCH)\base

!IF "$(BOPT)" == "g_complex" || "$(BOPT)" == "O_complex"
all_libs: info chkpetsc_dir deletelibs build_petsc build_petscblas_fortran
!ELSE
!IF "$(BOPT)" == "g" || "$(BOPT)" == "O" ||"$(BOPT)" == "g_c++" || "$(BOPT)" == "O_c++"
all_libs: info chkpetsc_dir deletelibs build_petsc build_petscblas_c
!ELSE
all_libs: chkopts
!ENDIF
!ENDIF

info:
	-@echo "========================================="
	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
	-@echo "-----------------------------------------"
	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
	-@echo "-----------------------------------------"
	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
	-@echo "-----------------------------------------"
	-@echo "Using configuration flags: $(CONF)"
	-@echo "-----------------------------------------"
	-@echo "Using include paths: $(PETSC_INCLUDE)"
	-@echo "-----------------------------------------"
	-@echo "Using PETSc directory: $(PETSC_DIR)"
	-@echo "Using PETSc arch: $(PETSC_ARCH)"
	-@echo "========================================="

deletelibs:
	-$(RM) $(PDIR)\*

deletepetscblaslib:
	-@if exist "$(PDIR)\libpetscblas.lib" \
	$(RM) "$(PDIR)\libpetscblas.lib"

# Builds PETSc libraries for a given BOPT and architecture
# including the fortran interface files
build_petsc: 
	-@echo "Beginning to compile libraries in all directories"
	-@echo "========================================="
	-@$(OMAKE) /f makefile BOPT=$(BOPT)  \
	   ACTION=libfast  tree 
	-@echo "Completed building libraries"
	-@echo "========================================="

build_petscblas_c: build_petscblaslib_c
	-@echo "Completed compiling CBLAS and CLAPACK"
	-@echo "========================================="

build_petscblas_fortran: build_petscblaslib_fortran
	-@echo "Completed compiling BLAS and LAPACK"
	-@echo "========================================="

build_petscblaslib_c: deletepetscblaslib
	-@echo "Begining to compile CBLAS and CLAPACK"
	-@echo "========================================="
	-@cd src\blaslapack\c
	-@$(OMAKE) /f makefile BOPT=$(BOPT) ACTION=libfast tree
	-@cd ..\..\..

build_petscblaslib_fortran: deletepetscblaslib
	-@echo "Begining to compile BLAS and LAPACK"
	-@echo "========================================="
	-@cd src\blaslapack\fortran
	-@$(OMAKE) /f makefile BOPT=$(BOPT) ACTION=libfast tree BLAS_FC=TRUE
	-@cd ..\..\..

testexamples_does_not_work: chkopts
	-@echo "Beginning to compile and run test examples"
	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
	-@echo "-----------------------------------------"
	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
	-@echo "-----------------------------------------"
	-@echo "Using include paths: $(PETSC_INCLUDE)"
	-@echo "-----------------------------------------"
	-@echo "Using PETSc directory: $(PETSC_DIR)"
	-@echo "Using PETSc arch: $(PETSC_ARCH)"
	-@echo "------------------------------------------"
	-@echo "Using linker: $(CLINKER)"
	-@echo "Using libraries: $(PETSC_LIB)"
	-@echo "------------------------------------------"
	-@echo "Due to different numerical round-off on certain"
	-@echo "machines some of the numbers may not match exactly."
	-@echo "========================================="
	-@$(OMAKE) /f makefile BOPT=$(BOPT)  \
	   ACTION=testexamples_4  tree 
	-@echo "Completed compiling and running test examples"
	-@echo "========================================="

testfortran_does_not_work: chkopts
	-@echo "Beginning to compile and run Fortran test examples"
	-@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
	-@echo "Using linker: $(FLINKER)"
	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
	-@echo "------------------------------------------"
	-@echo "Using PETSc directory: $(PETSC_DIR)"
	-@echo "Using PETSc arch: $(PETSC_ARCH)"
	-@echo "------------------------------------------"
	-@echo "Using linker: $(FLINKER)"
	-@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)"
	-@echo "========================================="
	-@echo "Due to different numerical round-off on certain"
	-@echo "machines or the way Fortran formats numbers"
	-@echo "some of the results may not match exactly."
	-@echo "========================================="
	-@$(OMAKE) /f makefile BOPT=$(BOPT)  \
	   ACTION=testexamples_9 tree 
	-@echo "Completed compiling and running Fortran test examples"
	-@echo "========================================="

