Re: Using "-l" libraries as targets

2015-06-02 Thread Jed Brown
Paul Smith writes: > Well, of course I was assuming that your link line would add "-L." or > similar so that you know that the local directory is always searched > first. Even that will typically prefer ./libfoo.so over ./libfoo.a unless you're also using -static or similar. > I don't have time

Re: Using "-l" libraries as targets

2015-06-02 Thread Paul Smith
On Tue, 2015-06-02 at 17:46 +0200, Jed Brown wrote: > Paul Smith writes: > > I think it's better to just always use "libfoo.a" as a prerequisite, if > > that's what you want. It's easy enough to use patsubst in the recipe to > > convert them to -l options, if you want: > > > >$(LINK.cc) -o $@

Re: Using "-l" libraries as targets

2015-06-02 Thread Jed Brown
Paul Smith writes: > I think it's better to just always use "libfoo.a" as a prerequisite, if > that's what you want. It's easy enough to use patsubst in the recipe to > convert them to -l options, if you want: > >$(LINK.cc) -o $@ $(patsubst lib%.a,-l%,$^) But please don't do this because som

Re: Using "-l" libraries as targets

2015-06-01 Thread Paul Smith
We prefer inline posting to top-posting, on the mailing lists. On Mon, 2015-06-01 at 13:11 +, lukeallard...@gmail.com wrote: > It’s probably a very nice case, but having a prerequisite > like “-lfoo” that matches a “libfoo.a” target would be useful for > decoupling say one makefile with the ru

Re: Using "-l" libraries as targets

2015-06-01 Thread lukeallardyce
It’s probably a very nice case, but having a prerequisite like “-lfoo” that matches a “libfoo.a” target would be useful for decoupling say one makefile with the rule “main.exe: -lfoo” and another in subdir “foo” that has “libfoo.a: libfoo.a(foo/foo.o)”. The only change needed to have make choose

Re: Using "-l" libraries as targets

2015-06-01 Thread Paul Smith
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 lib

Re: Using "-l" libraries as targets

2015-06-01 Thread Luke Allardyce
That results in "make: *** No rule to make target '-lfoo', needed by 'main.exe'. Stop.", unless of course libfoo.a is already installed. On 1 June 2015 at 21:11, Paul Smith wrote: > On Mon, 2015-06-01 at 20:57 +0900, Luke Allardyce wrote: >> It's kind of strange that make seems to determine tha

Re: Using "-l" libraries as targets

2015-06-01 Thread Paul Smith
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 l