[Top][All Lists]

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

Re: Dynamics files managed by Makefile

From: Patrick Begou
Subject: Re: Dynamics files managed by Makefile
Date: Tue, 18 Oct 2022 09:16:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

Thanks Paul for your quick and detailed answer.

I had build a small example to test my build process, but unfortunately it works fine with make 🙁 The application is very large (several hundreds of files) and complex (generating many intermediate files in the build process, but with known static names for most of them). May be all these steps can confuse Make tool.

I will read more in detail the documentation and specially the 3.7 section you suggest. I was just picking informations in the different sections, may be not fully understanding the Make strategy when processing a Makefile.


Le 17/10/2022 à 18:49, Paul Smith a écrit :
On Mon, 2022-10-17 at 18:35 +0200, Patrick Begou wrote:
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.
I'm not 100% sure that I understand the situation; it would be much
better if you provided the rules you're trying to write, or even better
a small working example.

But I suppose you mean that there is some tool that takes one input
file and generates a set of output files with an unknown set of names,
then you want to build all those output files.

It turns out that make is not very good at handling this type of
problem: that's why languages such as for example Java, which generate
output files based on the class names rather than input files names, do
not use makefiles (most of the time).

The most straightforward way to do this is to use a recursive
invocation of make: the top-level invocation would split the files,
then invoke a sub-make which would build the files; the sub-make could
use $(wildcard ...) etc. because it would only be invoked after the
spit completed.

But I'm unable with make to get a list of these new master_x.f90
files for the compilation, seams that my variable:

SPLIT_SRC=$(wildcard master_*.f90)

is always empty and only evaluated at the startup.
That's not quite true.  The variable SPLIT_SRC is set to the string
"$(wildcard master_*.f90)".  It will be evaluated when the variable
"$(SPLIT_SRC)" is evaluated in your makefile.  The way in which
variables are evaluated is described here:

So if you try to use this variable as a set of targets or
prerequisites, then it will be evaluated when those targets /
prerequisites are parsed (that is while the makefile is being read in)
and it will be empty.

reply via email to

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