[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #63125] Automatic variables in Secondary Expansion don't work as do
From: |
Riccardo P. Bestetti |
Subject: |
[bug #63125] Automatic variables in Secondary Expansion don't work as documented |
Date: |
Wed, 28 Sep 2022 16:24:03 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?63125>
Summary: Automatic variables in Secondary Expansion don't
work as documented
Project: make
Submitter: vmsh0
Submitted: Wed 28 Sep 2022 08:24:02 PM UTC
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: 4.3
Operating System: POSIX-Based
Fixed Release: None
Triage Status: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Wed 28 Sep 2022 08:24:02 PM UTC By: Riccardo P. Bestetti <vmsh0>
The GNU Make manual on Secondary Expansion[1] reports in section "Secondary
Expansion of Explicit Rules":
"The $$< variable evaluates to the first prerequisite in the first rule for
this target."
As such, with the Makefile reported at the end of this submission (Makefile),
I would expect the output "foo.1 foo.2 foo.1" or "foo.2 foo.1 foo.1". Instead,
I get the output "foo.1 foo.2".
Note that this doesn't only work unexpectedly for the $$< second expansion
automatic variable, but also for the other automatic variables, which also
expand to the empty string.
See Exhibit 1 and Exhibit 2, both at the end of this submission, to observe
that the unexpected behaviour doesn't present e.g. in Make 3.81.
[1]:
https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html
----
Makefile
.SECONDEXPANSION:
foo: foo.1
foo: foo.2 $$<
@echo $^
foo.%:
@echo -n
----
Exhibit 1: Make 4.3
$ ls -lah
total 12K
drwxr-xr-x 2 random random 4.0K Sep 28 22:13 .
drwxr-xr-x 17 random random 4.0K Sep 28 21:50 ..
-rw-r--r-- 1 random random 73 Sep 28 22:13 Makefile
$ md5sum Makefile
c21dd3f5b109590fa5112b50afc986d6 Makefile
$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ make
foo.2 foo.1
----
Exhibit 2: Make 3.81
$ ls -lah
total 12K
drwxr-xr-x 2 root root 4.0K Sep 28 16:14 .
drwx------ 1 1000 1000 4.0K Sep 28 16:14 ..
-rw-r--r-- 1 root root 73 Sep 28 16:11 Makefile
$ md5sum Makefile
c21dd3f5b109590fa5112b50afc986d6 Makefile
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu
$ make
foo.2 foo.1 foo.1
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63125>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #63125] Automatic variables in Secondary Expansion don't work as documented,
Riccardo P. Bestetti <=