On Mon, 2015-06-01 at 20:57 +0900, Luke Allardyce wrote:
> It's kind of strange that make seems to determine that the lib doesn't
> need remaking but can't then find it, but the manual only mentions
> when "-l" is a prerequisite so are they simply not supported when used
> as targets on their own like this?

Correct.  The -l version is only expanded in prerequisites.  This
feature is only available so you can write a rule like this:

  foo: foo.o -lfoo
          $(LINK.c) -o $@ $^

and have it work properly (that is, add "foo.o -lfoo" to the link line
as the expansion of "$^").  Fancy support for "-lfoo" is not needed in a
target context, because no tools build targets named "-lfoo".

> The following works
> 
> main.exe: -lfoo
> -lfoo libfoo.a: libfoo.a(foo.o) ;

You can remove the "-lfoo" from the target line altogether; it's
useless:

  main.exe: -lfoo
  libfoo.a: libfoo.a(foo.o) ;


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to