There appears to a problem in the way that GNU make 3.80 on both Solaris and Windows Y2K works with an undefined include file name.  If a given include file is not found, then make will print "No such file or directory" and then exit.  If no file name is given at all, then it will print "no file name for `include'" and continue processing.  I believe that the behavior should be than if no file name is given, then it should print the error message and then exit.
 
Here is a simplified example of a badly written makefile that went horribly wrong because someone did a "make clean" but GNU didn't exit after the include file was not found.
 
INCLUDE_FILE:sh=/usr/bin/pwd | /usr/bin/awk -F/ '{print $(NF-1)}'
 
include $(INCLUDE_FILE)
 
clean:
    @echo removing everything in $(OBJDIR) which is defined in the include file
    rm -rf $(OBJDIR)/*
 
The shell command to call pwd which should have returned a real include file name didn't work so $(INCLUDE_FILE) evaluated to null (This shell command works with Solaris make though).  You can imagine what happened when someone with root priviledges did a make clean using GNU make and this makefile.  Previously this makefile was always used with Solaris make which would exit if the include file was not found.
 
Here is my fix which causes GNU make to exit when no file name is given but preserves the behavior of "-include" which ignores the error.
 
file read.c:
 
775: error (fstart,
776:                _("no file name for `%sinclude'"), noerror ? "-" : "");
777:      if (!noerror)        <---ADDED
778:        exit(EXIT_FAILURE);    <---ADDED
779:      continue;
Thanks,
Don Brock
[EMAIL PROTECTED]
 

Reply via email to