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



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
+condition as a prerequisites of .PHONY will not achieve the desired effect.
+       @@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
+However, if there is a file called print-OBJ in the current directory, then
+rule will not be executed.
+Declaring @samp{print-%} a prerequisite of .PHONY will not work, because
+you say @samp{make print-OBJ} the target is @samp{print-OBJ}, not
+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



Reply to this item at:


  Message sent via Savannah

Reply via email to