That already seems to have been fixed:

martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ cat Makefile
MAKEFLAGS += --warn-undefined-variables

a: $(foo); touch $@
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ ~/download/make/make 
--version
GNU Make 4.3.90
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://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.
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ ~/download/make/make
Makefile:3: warning: undefined variable 'foo'
touch a
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$

That's today's git... and wasn't actually the point I wanted to make, which was:

martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ rm a
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 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.
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ make
touch a
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ rm a
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$ make 
--warn-undefined-variables
Makefile:3: warning: undefined variable 'foo'
touch a
martind@sirius:~/tmp/make-undefined-variables-2022-01-27$

________________________________
From: Bug-make <bug-make-bounces+martin.dorey=hds....@gnu.org> on behalf of 
Alejandro Colomar (man-pages) <alx.manpa...@gmail.com>
Sent: Thursday, January 27, 2022 16:09
To: bug-make@gnu.org <bug-make@gnu.org>
Subject: [BUG] --warn-undefined-variable is not triggered in prerequisites

***** EXTERNAL EMAIL *****

Hi,

Consider the following scenario:


$ ls
Makefile
$ cat Makefile
MAKEFLAGS += --warn-undefined-variables

a: $(foo)
        touch $@
$ make
touch a
$ ls
a  Makefile



I'd like make to warn about this.  It took me a while to debug a
Makefile bug, which I thought was not happening, since make should have
warned me.  Isn't this supposed to trigger the warning?

Thanks,

Alex

--
Alejandro Colomar
Linux man-pages comaintainer; 
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kernel.org%2Fdoc%2Fman-pages%2F&amp;data=04%7C01%7CMartin.Dorey%40hitachivantara.com%7Cdb85b53f39a34294e34b08d9e1f2772c%7C18791e1761594f52a8d4de814ca8284a%7C0%7C0%7C637789253777309722%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=DujTmko3LBJ%2BC8v%2BMkT4F1%2Ff0ErpexYxaSkNSqajGiA%3D&amp;reserved=0
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.alejandro-colomar.es%2F&amp;data=04%7C01%7CMartin.Dorey%40hitachivantara.com%7Cdb85b53f39a34294e34b08d9e1f2772c%7C18791e1761594f52a8d4de814ca8284a%7C0%7C0%7C637789253777309722%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=V%2FMNo%2B3sMYu4LA5qK6q4SiKGg1rKRBQTuKUzhXh%2Fshc%3D&amp;reserved=0

Reply via email to