[bug #60077] Deterministic $@ for grouped targets patch

2021-05-13 Thread Todd Lowe
Follow-up Comment #4, bug #60077 (project make):

I've had a bit more time and am uploading a patch with my latest version. 
Unfortunately I'm not sure when I'll be able to test it in production, but I
wanted to share sooner than later.

This one adds new automatic variables for grouped targets, both explicit and
pattern along with new grouped targets and variables test cases.

$(@<) Is the first specified target
$(@^) Is the list of targets in the order specified in the goal definition.
$(@https://file.savannah.gnu.org/file/0001-SV60077-add-grouped-targets-automatic-variables.patch?file_id=51432>



___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60595] make doesn't always restart when a makefile is rebuilt

2021-05-13 Thread André Chalella
URL:
  

 Summary: make doesn't always restart when a makefile is
rebuilt
 Project: make
Submitted by: andrechalella
Submitted on: Thu 13 May 2021 07:32:32 AM UTC
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: 4.3
Operating System: Any
   Fixed Release: None
   Triage Status: None

___

Details:

GNU make manual, in section 3.5 How Makefiles Are Remade
,
says:

> After all makefiles have been checked, if any have actually been changed,
make starts with a clean slate and reads all the makefiles over again.

I found the hard way this is not _quite_ true. If, during makefile rebuilding
("Updating makefiles"), the following conditions are met, then make won't
restart, carrying on as if nothing was updated.

0 One makefile is rebuilt as a *prerequisite* of another makefile;
0 The *goal* makefile of #1 is not rebuilt (e.g. recipe executes but exits
without modifying the file, so its mtime doesn't change).

I know this may seem an obscure corner case and maybe it is, and I apologize
if that's the case. I don't have much experience with "real world" makefiles;
I write mine based on the manual (which is excellent) and the rebuild-restart
functionality has made possible for me to write a simple yet powerful
dependency resolver for Fortran .

The thing is, it stopped working when I incidentally changed "include
$(files2) $(files1)" to "include $(files1) $(files2)" somewhere in it, and it
took me a couple days, many rounds of "make -d" and reading the source to
understand why.

(in the example line above, $(files1) are distant prerequisites to $(files2))

I can and will (at least for now) keep the original, working order, but it is
kind of the "wrong" order of files logic-wise, plus it only works because make
rebuilds makefiles in the reversed order in which they were included. I know
why make rebuilds in reverse and it's a valid reason, but as Paul said in
another answer it is an implementation detail and I wouldn't like to rely on
it.

I can provide a minimal working example if the issue is not clear enough.

I see two possible solutions:

0 In main.c:2272 (case us_none) check current mtimes against makefile_mtimes[]
and jump to re_exec if any is newer.
0 If it must not be fixed in code, a small update on the docs to specify that
makefiles rebuilt as prerequisites do not count for restarting make.

Thanks,
André




___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/