change to make - error when Makefile doesn't exist

Hartmut Brandt hartmut.brandt at dlr.de
Sun Nov 30 07:44:03 PST 2008


Eitan Adler wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I stupidly forgot to make a backup so I can't provide a diff but in
> src/usr.bin
> I changed
>          TryReadMakefile("Makefile");
> to
>           if (!TryReadMakefile("Makefile"))
>                   Fatal("Makefile could not be opened");
> That way you could differentiate between the Makefile not existing and
> the target not existing.
>
> gmake provided the following error message:
> gmake: *** No targets specified and no makefile found.  Stop.
>
>   
It is perfectly valid to have no makefile yet to run make. Make has a 
number of builtin rules. If, for example, you have a file x.c then 'make 
x' or 'make x.o' make will cause make to compile x.c even without a 
makefile. But if you have no Makefile, you must specify a target. 
Otherwise how would make know what to make? So the error message is 
quite exact: it is an error to have no makefile AND to specify no target.

harti


More information about the freebsd-hackers mailing list