Hi Paul,

> This makefile should be written correctly, as:
>   all : copy1 copy2 copy3 copy4
>   copy1: Makefile
>           install -c -m 644 Makefile copy1
>   copy2: Makefile
>           install -c -m 644 Makefile copy2
>   copy3: Makefile
>           install -c -m 644 Makefile copy3
>   copy4: Makefile
>           install -c -m 644 Makefile copy4

The Makefile was simplified. In the real-world case [1], the STATEMENTS
is a recursive invocation of another Makefile, which is generated by
Automake, and for which I cannot create a separate targets
(because Automake just does not offer this).

Another real-world example (where a parallel make problem surely
exists, but wasn't reported so far) is this rule from

po-gram-gen.c po-gram-gen.h: po-gram-gen.y
        $(AM_V_GEN)$(SHELL) $(YLWRAP) $(srcdir)/po-gram-gen.y \
                                      y.tab.c po-gram-gen.c \
                                      y.tab.h po-gram-gen.h \
                                      y.output po-gram-gen.output \
                                      -- $(YACC) $(YFLAGS) $(AM_YFLAGS) \
        && sed -e 's|".*/po-gram-gen.y"|"po-gram-gen.y"|' < po-gram-gen.c > 
po-gram-gen.c-tmp \
        && rm -f po-gram-gen.c \
        && mv po-gram-gen.c-tmp $(srcdir)/po-gram-gen.c \
        && { test '$(srcdir)' = . || mv po-gram-gen.h $(srcdir)/po-gram-gen.h; }

It's the same type of problem, and the same mechanical change is needed
for proper support of parallel make.

> I really don't like to try to parse recipes and modify
> behavior depending on what is found.  It leads to a lot of unexpected
> consequences and confusion.

In the current state, supporting parallel make requires extra work
for the maintainer.

Or would you recommend that I add this snippet to the top-level
Makefile of all my projects?

# This package does not support parallel make.
# So, turn off parallel execution (at least in GNU make >= 4.0).


[1] https://lists.gnu.org/archive/html/bug-gettext/2019-05/msg00084.html

Bug-make mailing list

Reply via email to