On Mon, 2025-07-28 at 08:59 +0000, Jerome Saint-Martin wrote: > > Hello GNU Make team, > > > Recently, I spent quite some time debugging a Makefile issue, only to > realize that I had mistakenly written `==` instead of `=` when assigning a > variable (e.g., `CXX == g++` instead of `CXX = g++`). Make simply reported an > undefined variable later on, which made the root cause harder to spot. > > > This kind of mistake is easy to make, especially for C++ developers who > are used to writing `==` in conditionals. In C++, compilers like GCC emit > warnings such as “value computed is not used” when an expression like `x == > y;` is written outside a conditional context. > > > Would it be feasible for GNU Make to emit a warning when `==` is > encountered in a context that looks like a variable assignment, but isn’t a > conditional test? I believe this could help many users catch such typos early. >
Certainly, and since GNU make is open source, you can contribute that improvement. You probably want to first find occurrences of '=' in its source code. I found about 30 occurrences of them. So experimenting should be reasonably easy. Regards. -- Basile STARYNKEVITCH <bas...@starynkevitch.net> 8 rue de la Faïencerie http://starynkevitch.net/Basile/ 92340 Bourg-la-Reine https://github.com/bstarynk France https://github.com/RefPerSys/RefPerSys