[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamics files managed by Makefile

From: Kaz Kylheku
Subject: Re: Dynamics files managed by Makefile
Date: Tue, 18 Oct 2022 10:08:42 -0700
User-agent: Roundcube Webmail/1.4.13

On 2022-10-17 09:35, Patrick Begou wrote:
> Hi all,
> I'm stuck for several days with writing a Makefile with source files 
> dynamically generated. This problem raises because of a bug in a compiler 
> when a fortran file uses too many modules and I have to split it 
> automatically. The original fortran file is dynamically generated too but 
> with a constant name.
> So I have a main file automatically created by the Makefile: master.f90
> This file will be splitted in master_1.f90, master_2.f90, master_3.f90.... 
> etc (number of file not known), each of them is a fortran module and master 
> will be rewritted to use these module. This is done by a special target and a 
> bash script. It works.

Since this is a workaround for a compiler problem, a good
approach would be to treat these files as temporaries that
the toolchain knows about, but the build system doesn't.

The build system (make) only needs to know about master.f90.
Whenever master.f90 is newer than its object file, or the object
file doesn't exist, it has to be:

- split master.f90 into master_1.f90, master_2.f90 ....
- separately compile these
- delete the split sources
- partially link the resulting .o files into a single one (or use archives)
- delete the original .o files

This is all encapsulated in the recipe, which is invoked by a rule
that only knows about a single source and object file.

(Note that the way I laid out the steps above, if the compilation
fails, the split pieces aren't deleted, which is a feature.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]