bug-make
[Top][All Lists]
Advanced

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

Re: "make -jN" requires mechanical changes to a Makefile


From: Bruno Haible
Subject: Re: "make -jN" requires mechanical changes to a Makefile
Date: Fri, 10 May 2019 23:52:19 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-145-generic; KDE/5.18.0; x86_64; ; )

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
  install-textstyle.h
  install-textstyle_stdbool.h
  install-textstyle_version.h
  install-textstyle_woe32dll.h
(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
gettext/gettext-tools/src/Makefile.am:

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).
GNUMAKEFLAGS = -j1

Bruno

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




reply via email to

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