Do not ignore errors in Makefile

Barry Smith bsmith at mcs.anl.gov
Sun Jun 10 21:17:24 CDT 2007


  Shi,

   I have come up with a scheme that helps with this implemented 
in petsc-dev. The default behavior is the same, for example,

[anlext2wls147:snes/examples/tutorials] bsmith% make ex37f90 
gfortran -c -I/Users/bsmith/Src/petsc-dev/include/finclude -fPIC -Wall -Wno-unused-variable -g   -I/Users/bsmith/Src/petsc-dev -I/Users/bsmith/Src/petsc-dev/c-gfortran/include -I/Users/bsmith/Src/petsc-dev/include -I/usr/X11R6/include -I/Users/bsmith/Src/petsc-dev/c-gfortran/include        -o mex37f90.o mex37f90.F90
mex37f90.F90:4:

ffv
1
Error: Unclassifiable statement at (1)
mex37f90.F90:77.22:

          use mex37f90
                     1
Fatal Error: Can't open module file 'mex37f90.mod' for reading at (1): No such file or directory
make: [mex37f90.o] Error 1 (ignored)
gfortran -c -I/Users/bsmith/Src/petsc-dev/include/finclude -fPIC -Wall -Wno-unused-variable -g   -I/Users/bsmith/Src/petsc-dev -I/Users/bsmith/Src/petsc-dev/c-gfortran/include -I/Users/bsmith/Src/petsc-dev/include -I/usr/X11R6/include -I/Users/bsmith/Src/petsc-dev/c-gfortran/include        -o ex37f90.o ex37f90.F90
ex37f90.F90:14.18:

      use mex37f90
                 1
Fatal Error: Can't open module file 'mex37f90.mod' for reading at (1): No such file or directory
make: [ex37f90.o] Error 1 (ignored)
/Users/bsmith/Src/petsc-dev/c-gfortran/bin/mpif90 -fPIC -Wall -Wno-unused-variable -g   -o ex37f90 ex37f90.o -L/Users/bsmith/Src/petsc-dev/c-gfortran/lib -L/Users/bsmith/Src/petsc-dev/c-gfortran/lib -lpetscsnes -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc   -L/usr/X11R6/lib -lX11  -llapack -lblas -L/usr/lib/gcc/i686-apple-darwin8/4.0.1 -L/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../.. -ldl -lSystem -lgfortranbegin -lgfortran -L/usr/local/gfortran/lib/gcc/i386-apple-darwin8.8.1/4.3.0 -L/usr/local/gfortran/lib/gcc/i386-apple-darwin8.8.1/4.3.0/../../.. -lgcc_s.10.4  -ldl -L/usr/lib/gcc/i686-apple-darwin8/4.0.1 -L/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../.. -ldl -lSystem -ldl 
gfortran: ex37f90.o: No such file or directory
make: [ex37f90] Error 1 (ignored)
/bin/rm -f ex37f90.o mex37f90.mod mex37f90.o mex37finterfaces.mod

But 
[anlext2wls147:snes/examples/tutorials] bsmith% make ex37f90 PETSC_MAKE_STOP_ON_ERROR=""
gfortran -c -I/Users/bsmith/Src/petsc-dev/include/finclude -fPIC -Wall -Wno-unused-variable -g   -I/Users/bsmith/Src/petsc-dev -I/Users/bsmith/Src/petsc-dev/c-gfortran/include -I/Users/bsmith/Src/petsc-dev/include -I/usr/X11R6/include -I/Users/bsmith/Src/petsc-dev/c-gfortran/include        -o mex37f90.o mex37f90.F90
mex37f90.F90:4:

ffv
1
Error: Unclassifiable statement at (1)
mex37f90.F90:77.22:

          use mex37f90
                     1
Fatal Error: Can't open module file 'mex37f90.mod' for reading at (1): No such file or directory
make: *** [mex37f90.o] Error 1

Causes it to stop immediately. You can also put 
PETSC_MAKE_STOP_ON_ERROR = "" 
in the makefile UNDER all the includes in the makefile

  Hope this helps,

   Barry


On Fri, 8 Jun 2007, Shi Jin wrote:

> Hi,there,
> 
> I found that the default behavior of compiling a PETSc
> program composed of many source files is that errors
> are ignored and compilations continue to the next
> source file when an error is encountered during
> "make".
> I think it is caused by the "-" sign in the Makefile.
> There may be a good reason to have this feature but
> for my code, I really don't want it. I want to he
> process to stop so that I can immediately deal with
> the error. Is there a way to accomplish this feature?
> I guess something must be changed inside
> ${PETSC_DIR}/bmake/common/base etc but it seems quite
> complicated to figure it out. Could you please help me
> here? Thank you very much.
> 
> Shi
> 
> 
>  
> ____________________________________________________________________________________
> Food fight? Enjoy some healthy debate 
> in the Yahoo! Answers Food & Drink Q&A.
> http://answers.yahoo.com/dir/?link=list&sid=396545367
> 
> 




More information about the petsc-users mailing list