Skip to content

Commit 8461c1b

Browse files
committed
Reword final note on make for larger projects
- explicitly note the buildin rules and variables - note that make is usually combined with external scripts
1 parent 932f994 commit 8461c1b

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

learn/building_programs/build_tools.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ $(PROG):
115115
Note how we declare variables in ``make``, you should always declare your local
116116
variables with ``:=``. To access the content of a variable we use the ``$(...)``,
117117
note that we have to enclose the variable name in parenthesis.
118+
119+
{% capture note %}
120+
121+
The declaration of variables is usually done with ``:=``, but ``make`` does
122+
support *recursively expanded* variables as well with ``=``.
123+
Normally, the first kind of declaration is wanted, as they are more predictable
124+
and do not have a runtime overhead from the recursive expansion.
125+
{% endcapture %}
126+
{% include note.html title="Note" content=note %}
127+
118128
We introduced a dependency of the rule all, namely the content of the variable
119129
``PROG``, also we modified the printout, we want to see all the dependencies
120130
of this rule, which are stored in the variable ``$^``.
@@ -260,24 +270,18 @@ Now you know enough about ``make`` to use it for building small projects.
260270

261271
{% capture note %}
262272

263-
You might have noticed that ``make`` is not particularly easy to use and
264-
it can be from time to time difficult to understand what is going
265-
on under the hood.
266273
In this guide, we avoided and disabled a lot of the commonly used ``make``
267274
features that can be particularly troublesome if not used correctly, we highly
268-
recommend staying away from them if you do not feel confident working with
269-
``make``.
270-
271-
While ``make`` is indeed a handy tool to automate short interdependent
272-
workflows and to build small projects, it should *never* be used to build
273-
larger projects, like scientific programs.
274-
In particular modern Fortran programs can hardly be handled by a ``make``
275-
build system.
276-
277-
To use ``make`` in a larger project, you cannot rely on ``make`` alone, usually
278-
other tools are used to generate the ``Makefile`` completely or in parts.
275+
recommend staying away from the buildin rules and variables if you do not feel
276+
confident working with ``make``, but explicitly declare all variables and rules.
277+
278+
You will find that ``make`` is capable tool to automate short interdependent
279+
workflows and to build small projects. But for larger projects, you will
280+
probably soon run against some of it limitations. Usually, ``make`` is therefore
281+
not used alone but combined with other tools to generate the ``Makefile``
282+
completely or in parts.
279283
{% endcapture %}
280-
{% include tip.html title="Important" content=note %}
284+
{% include note.html title="Note" content=note %}
281285

282286

283287
## The meson build system

0 commit comments

Comments
 (0)