I encountered a surprising corner case recently; not clear whether it
constitutes a bug.

The documentation is clear that when an include file is not found make sits
on the message for a while in case the file can be made. That I understand,
but there are two surprising behaviors which result. First, only the most
recent missing include file message seems to be cached:

$ cat Makefile
include no_such_file_1
include no_such_file_2
include no_such_file_3
all:;@:

$ make
Makefile:3: no_such_file_3: No such file or directory
make: *** No rule to make target 'no_such_file_3'.  Stop.

Second, if make is aborted by $(error ...) no cached messages are printed
at all:

$ cat Makefile
include no_such_file_1
include no_such_file_2
include no_such_file_3
$(error DIE HERE)
all:;@:

$ make
Makefile:4: *** DIE HERE.  Stop.

Imagine a config file which is supposed to set BASEDIR followed by an
assert to make sure it's present:

include cfgfile
$(if $(BASEDIR),,$(error Error: BASEDIR not set))

The result of not finding cfgfile is *only* the "BASEDIR not set" error -
nothing about the include file. It's easy to see how a person could waste
lots of time going through the code in cfgfile trying to figure out why it
doesn't set BASEDIR before eventually realizing it isn't included at all.
So: bug or just-how-it-is?

David
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to