On Tue, Sep 22, 2026 at 2:58 PM Jon Forrest <[email protected]> wrote:

> I've been thinking about what this means. What is gained (or lost)
> by treating each prerequisite as a target rather than checking
> each prerequisite when a rule is being evaluated? Or, are they
> functionally the same, and only affect error messages?

Not clear what you mean by "checking each prerequisite" or what you
mean by "they".
Make looks to update its top target. Make finds a rule, and goes
through the list of prerequisites and updates each prerequisite. In
order to update a prerequisite, make looks for a rule, etc.
e.g.
all: hello.tsk
hello.tsk: hello.o; gcc -o $@ $<
hello.o: hello.c hello.h; gcc -o $@ -c $<

You tell make to build 'all'. It does not surprise you that make
builds hello.tsk and hello.o in order to build 'all'.
It is possible to add a rule to update hello.h or hello.c and make
will update hello.h and hello.c.
If there is no rule, then hello.c and hello.h (in this example) have
to be in the filesystem. Otherwise, make will fail with the "there is
no rule" message.
You can observe it yourself in action by specifying --debug=i.

regards, Dmitry

Reply via email to