On Mon, 2015-06-01 at 21:21 +0900, Luke Allardyce wrote: > That results in "make: *** No rule to make target '-lfoo', needed by > 'main.exe'. Stop.", unless of course libfoo.a is already installed.
Oh right. I forgot: the "-lxxx" form is only valid for system libraries or other pre-existing libraries that make doesn't need to build. You cannot use it for libraries make has to build, because make doesn't know what name to use for them. Remember make starts from the final target to be built and works backwards, looking at prerequisites. So when make sees a prerequisite like "-lfoo", it then tries to look up the name existing on the filesystem using the algorithms described in the manual. Since the file doesn't exist yet make doesn't know which one it should build. An option here would be for make to treat this like a pattern and try to find a rule to build each of the possible expansions of "-lfoo", but it doesn't do that. I'm not sure if that's something that would be useful to add, or not. Personally I think it's better to be explicit about prerequisites you want make to build, and just not use the "-lfoo" trick. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make