[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #58961] Document dynamic phony targets.
From: |
Dmitry Goncharov |
Subject: |
[bug #58961] Document dynamic phony targets. |
Date: |
Sat, 15 Aug 2020 10:44:42 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 |
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/
- [bug #58961] Document dynamic phony targets.,
Dmitry Goncharov <=