Hi Peter, On 6/1/23 21:42, Peter Radisson wrote: > > > Am 01.06.23 um 03:39 schrieb Dmitry Goncharov: >> On Wed, May 31, 2023 at 12:40 PM <radisso...@web.de> wrote: >>> today i had a strange problem with a long used makefile (GNU Make 4.3). >>> It found a file called "all.sh" and did a "cat <all.sh >all". >> >> That's not a strange problem. That's the default make behavior. >> > > In the moment when you suddenly see that kind of problem is is strange, > i did not remember imediately that .sh was a registered suffix. > The list of predefined suffixes is in "Catalogue of Built-In Rules" > not the first place to look, actually i used google to find it, > searching sh in a document is ambitious. > >>> I use makefile for a long time but that effect happend the first time to me. >>> It would be helpful to improve the documentation that people will be aware >>> that this can happen. The phony section has some hints this way, maybe this >>> is a good example to show what happens if you do not use phony. >> >> What piece of documentation do you think is missing? >> Did you see documentation on default suffix rules? > > I read that years ago, i remembered when i saw the PHONY page, and > confirmed with make -p. I very much recommend casting the following spells, which protect you from hidden magic stuff that make(1) does by default and I find very confusing.
MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-variables MAKEFLAGS += --warn-undefined-variables Do that, and you'll rarely find surprises. Cheers, Alex > > I use make a lot but only a subset and as seen sometimes i get a > surprise. A beginner may be even more surprised (non of my coworkers > spotted the problem). > > IMHO there is a lack examples in the decumentation that are intentionaly > wrong (or show unintended side effects), examples that demonstrate *why* > someone sould do certain things (For now i will add more .PHONY in my > makefiles). > > hope that helps, > >> >> regards, Dmitry >