need help with makefile

Paul T. Bauman pbauman at ices.utexas.edu
Sat Mar 3 13:43:05 CST 2007


Aaron,

Don't want to be rude and interject, but I looked at the unsteady.F file 
- I've always had trouble compiling when 'use statements' come after 
variable declarations.  Give a try putting things in this order:

program

use modules

implicit none

include statements

variable declarations

code

end program

This always works for me, not matter what compiler.  Also, since you've 
named the file .F, you MUST have -qfree (or the correct statement, intel 
compilers it's -fpp) otherwise you will get errors since, by default, .F 
will use f77 fixed format and you are using free format, although, now 
that I think about, some compilers will override if you use mpif90 
version, but I've had mixed luck with that.  If you name the files .f90, 
they will be compiled in free format by default (similar for .F90, but 
now with pre processing).

Again, just my two cents in trying to help.

Paul

P. Aaron Lott wrote:
>
> All of the source files are first compiled using
>
> mpif90 -C -g  -qdpc -qautodbl=dbl4 -qinitauto -Wl,-framework 
> -Wl,vecLib  -c  file.f90
>
> On each file, this creates the appropriate .o and .mod files. Also, 
> these are compiled in order such that if a file B depends on a module 
> defined in another file A, then A would be compiled before B
>
> Then the executable is created by running
>
> mpif90 -C -g  -qdpc -qautodbl=dbl4 -qinitauto -Wl,-framework 
> -Wl,vecLib  -o executable  all_object_files.o
>
>
> I'm attaching the Makefile here
>
>
>
>
> -Aaron
>
>
>
>
> On Mar 3, 2007, at 12:36 PM, Satish Balay wrote:
>
>> What is the command that correctly compiles this file? [from your
>> original makefile]
>>
>> Satish
>>
>> On Sat, 3 Mar 2007, P. Aaron Lott wrote:
>>
>>>
>>> Hi Satish,
>>>
>>> I tried the order of the use statements and the include, but it 
>>> didn't seem to
>>> matter. I really don't know much about make files or the linking 
>>> process with
>>> compilers but it seems like the compiler statement
>>>
>>> /usr/local/mpich-1.2.5.2/bin/mpif90 -c  -I. -g  __unsteady_ex.F -o
>>> unsteady_ex.o
>>>
>>> is trying to make an object file unsteady_ex.o
>>>
>>> However, unsteady_ex.F depends on many other object files before 
>>> this can be
>>> compiled. During the make process the first file dealt with is 
>>> unsteady_ex.F,
>>> which before using petsc, unsteady_ex.f90 was the last to be 
>>> compiled. It
>>> seems like there should be some way to compile the rest of my 
>>> program first
>>> and then perform this step at the end.
>>>
>>>
>>> I'm not sure if there's some way to rearrange things in the makefile 
>>> command
>>> in order to do this or not. Do you have any ideas?
>>>
>>> Thanks,
>>>
>>> -Aaron
>>>
>>>
>>>
>>> $(CMD)  : $(SOBJS)
>>>     -${FLINKER} $(FLAGS)  -o $(EXENAME) $(SOBJS)
>>>
>>>
>>>
>>>
>>>
>>> On Mar 3, 2007, at 12:07 PM, Satish Balay wrote:
>>>
>>>> I can't spot any obvious issues here.. Is it possible that the
>>>> #include should go after the 'use statements'? [I don't know enough
>>>> about f90 issues here]
>>>>
>>>> Satish
>>>>
>>>> On Sat, 3 Mar 2007, P. Aaron Lott wrote:
>>>>
>>>>>
>>>>> Hi Satish,
>>>>>
>>>>> I'm attaching the file to this e-mail.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> -Aaron
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> P. Aaron Lott
>>> Ph.D. Candidate
>>> 4239 Computer and Space Sciences Building
>>> University of Maryland
>>> College Park, MD 20742-4015
>>>
>>> palott at ipst.umd.edu
>>> http://www.lcv.umd.edu/~palott
>>> Office: 301.405.4894
>>> Fax:      301.314.0827
>>>
>>>
>>
>
> P. Aaron Lott
> Ph.D. Candidate
> 4239 Computer and Space Sciences Building
> University of Maryland
> College Park, MD 20742-4015
>
> palott at ipst.umd.edu
> http://www.lcv.umd.edu/~palott
> Office: 301.405.4894
> Fax:      301.314.0827
>
>




More information about the petsc-users mailing list