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.


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to