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: Paul Smith
Subject: Re: "make -jN" requires mechanical changes to a Makefile
Date: Fri, 10 May 2019 17:35:10 -0400
User-agent: Evolution 3.30.1-1build1

On Fri, 2019-05-10 at 22:49 +0200, Bruno Haible wrote:
> But supporting parallel requires, in some cases, mechanical changes to a
> Makefile. How about if GNU make was improved to not require me to make these
> changes?
> 
> Namely, consider this Makefile:
> ===================================================
> all : copy1 copy2 copy3 copy4
> 
> copy1 copy2 copy3 copy4: Makefile
>         install -c -m 644 Makefile copy1
>         install -c -m 644 Makefile copy2
>         install -c -m 644 Makefile copy3
>         install -c -m 644 Makefile copy4
> ===================================================

Well, IMO this makefile is just wrong.  For example, in the above
makefile if you run "make copy3" it will install all the files, which
is incorrect.

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

then it will work properly in both parallel and non-parallel modes, and
it will do the right thing for invocations like "make copy3".

I understand that this requires changes to the makefile... but
incorrect code needs to be changed to be correct, rather than having
the compiler try to fix it for you.  At least, that's my current
thinking about this.

Also in general 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.




reply via email to

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