help-make
[Top][All Lists]
Advanced

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

best practice for serialization of dependencies of a target


From: Bruno Haible
Subject: best practice for serialization of dependencies of a target
Date: Sun, 26 Jun 2022 03:20:01 +0200

Hi,

When I have a Makefile rule

target: $(DEPS1) $(DEPS2)
        command1

it is guaranteed that $(DEPS1) and $(DEPS2) will be done, including their
dependencies, before command1 is started.
However, with -j, $(DEPS1) and $(DEPS2) are being made in parallel. If this
is not desired, I can transform this rule to

target: $(DEPS1)
        test -z "$(DEPS2)" || $(MAKE) $(DEPS2)
        command1

or (equivalently?)

target: $(DEPS1)
        $(MAKE) target2
target2: $(DEPS2)
        command1
.PHONY: target2

The question is: Are these two rewrites really equivalent? If not, how
do they differ, and what is the best practice?

Bruno






reply via email to

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