[bug #58961] Document dynamic phony targets.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #58961] Document dynamic phony targets.

David Boyce-5
URL:
  <https://savannah.gnu.org/bugs/?58961>

                 Summary: Document dynamic phony targets.
                 Project: make
            Submitted by: dgoncharov
            Submitted on: Sat 15 Aug 2020 02:44:41 PM UTC
                Severity: 3 - Normal
              Item Group: Documentation
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: None
        Operating System: None
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

Document dynamic phony targets.

diff --git a/doc/make.texi b/doc/make.texi
index 21573c0..a8aa3a2 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -2829,6 +2829,28 @@ cleandiff :
         rm *.diff
 @end example
 
+.PHONY works with prerequisites statically defined in the makefile.
+Declaring a target that changes depending on user input or some other
external
+condition as a prerequisites of .PHONY will not achieve the desired effect.
+
+@example
+print-%:
+       @@echo $* = $($*)
+@end example
+
+This rule will print the value of a variable specified by the user on the
+command line.
+
+If you say @samp{make print-OBJ}, make will print the value of variable
@var{obj}.
+However, if there is a file called print-OBJ in the current directory, then
this
+rule will not be executed.
+
+Declaring @samp{print-%} a prerequisite of .PHONY will not work, because
when
+you say @samp{make print-OBJ} the target is @samp{print-OBJ}, not
+@samp{print-%}.
+
+You can force such target. @xref{Force Targets}.
+
 @node Force Targets, Empty Targets, Phony Targets, Rules
 @section Rules without Recipes or Prerequisites
 @cindex force targets




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 15 Aug 2020 02:44:41 PM UTC  Name: doc_dynamic_phony_targets.diff
Size: 1KiB   By: dgoncharov

<http://savannah.gnu.org/bugs/download.php?file_id=49676>

    _______________________________________________________

Reply to this item at:

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

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


Reply | Threaded
Open this post in threaded view
|

[bug #58961] Document dynamic phony targets.

David Boyce-5
Additional Item Attachment, bug #58961 (project make):

File name: doc_dynamic_phony_targets.diff Size:1 KB
   
<https://file.savannah.gnu.org/file/doc_dynamic_phony_targets.diff?file_id=49677>



    _______________________________________________________

Reply to this item at:

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

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


Reply | Threaded
Open this post in threaded view
|

[bug #58961] Document dynamic phony targets.

David Boyce-5
Follow-up Comment #1, bug #58961 (project make):

Please use the latest attached file.

    _______________________________________________________

Reply to this item at:

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

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