URL:
  <https://savannah.gnu.org/bugs/?66237>

                 Summary: Grouped target dependencies don't function properly
in dry-run mode
                   Group: make
               Submitter: hjalfi
               Submitted: Fri 20 Sep 2024 12:31:11 PM UTC
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.3
        Operating System: None
           Fixed Release: None
           Triage Status: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 20 Sep 2024 12:31:11 PM UTC By: David Given <hjalfi>
I have a makefile where I'm trying to build multiple targets in a single rule,
and I'm using the grouped target feature.

Here's my sample makefile:

obj1 &: source
        touch $@

obj2: obj1
        touch $@

If I create `source` and then try to build `obj2`, it behaves as expected,
touching first `obj1` and then `obj2`. Fine.

But then I do this:

$ touch source
$ make -n obj2
touch obj1

It rebuilt `obj1`, but it didn't rebuild `obj2` for some reason. However, if I
change the `&:` to a `:` --- only possible because in my test case I only have
a single target --- it works fine:

$ cat test.mk
obj1 : source
        touch $@

obj2: obj1
        touch $@
$ touch source
$ make -f test.mk obj2 -n
touch obj1
touch obj2

If I try this with `-d`, I get the following from the first, failed example:

...
touch obj1
  Successfully remade target file 'obj1'.
 Finished prerequisites of target file 'obj2'.
 Prerequisite 'obj1' is older than target 'obj2'.
No need to remake target 'obj2'.

...but this from the second, working one:

...
touch obj1
  Successfully remade target file 'obj1'.
 Finished prerequisites of target file 'obj2'.
 Prerequisite 'obj1' is newer than target 'obj2'.
Must remake target 'obj2'.
touch obj2
Successfully remade target file 'obj2'.

It feels to me that in the `&:` case, it's failing to remember that it's
fake-built `obj1` when looking at the dependencies for `obj2`, meaning that it
then stats the real file and gets the wrong timestamp.

Is this a bug, or is it intended (but surprising) behaviour?







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66237>

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

Attachment: signature.asc
Description: PGP signature

Reply via email to