bugmake - Bugs: bug #62441, Recursive make & PHONY =...

 
 

bug #62441: Recursive make & PHONY = targets being rebuilt [feature reques]

Submitter:  None
Submitted:  Wed 11 May 2022 03:48:10 PM UTC
   
 
Severity:  3 - Normal Item Group:  None
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 11 May 2022 04:45:22 PM UTC, comment #1: 

There's no new feature needed for this: this is something that's easily achievable today.  We prefer to use the mailing lists, either -email is unavailable- or bug-make@gnu.org, when asking for assistance and advice, not the bug tracker.  Then if something is really a bug it can be reported here.

You can do what you want by having other_file depend on a phony file, rather than making other_file itself phony.


other_file: FORCE
        $(MAKE) ... other_file

FORCE:


See info about force targets in the GNU make manual: https://www.gnu.org/software/make/manual/html_node/Force-Targets.html

Paul D. Smith <psmith>
Group administrator
Wed 11 May 2022 03:48:10 PM UTC, original submission:  

I have two makefiles:

Makefile

.PHONY: other_file
other_file:
        $(MAKE) -f Makefile2 other_file

my_file: other_file
        touch $@


Makefile2

other_file:
        touch $@



When I first run the command, it builds my_file and other_file as expected.

> make my_file --trace --no-print-directory
Makefile:6: target 'other_file' does not exist
make -f Makefile2 other_file
Makefile2:3: target 'other_file' does not exist
touch other_file
Makefile:9: update target 'my_file' due to: other_file
touch my_file


However, the next time I run the same command, it doesn't rebuild other_file, but it does rebuild my_file.

make my_file --trace --no-print-directory
Makefile:6: target 'other_file' does not exist
make -f Makefile2 other_file
make[1]: 'other_file' is up to date.
Makefile:9: update target 'my_file' due to: other_file
touch my_file


This is obviously because other_file is marked as PHONY.

What I would like is this functionality for recursive make support: When it is time to consider such a target, make will run its recipe unconditionally. After the recipe is run, make will use the target's timestamp to determine if other targets are out of date.

It would look something like:
Makefile

.RECURSIVE_MAKE: other_file
other_file:
        $(MAKE) -f Makefile2 other_file

my_file: other_file
        touch $@


Makefile2

other_file:
        touch $@



> make my_file --trace --no-print-directory
Makefile:6: target 'other_file' does not exist
make -f Makefile2 other_file
Makefile2:3: target 'other_file' does not exist
touch other_file
Makefile:9: update target 'my_file' due to: other_file
touch my_file

> make my_file --trace --no-print-directory
Makefile:6: target 'other_file' requires recursive make.
make -f Makefile2 other_file
make[1]: 'other_file' is up to date.
make: 'my_file' is up to date.


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-11 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code