On Sun, 2019-12-22 at 17:02 +0000, Bogdan wrote:
> I'd also like to be able to link each executable with the appropriate set
> of libraries. However, I'm not entirely sure how to select them when the
> pattern rule gets executed (other than a hacky solution, like associating
> each executable with a .link file and then doing something like $(CC)
> $(LDFLAGS) -o $@ $< `cat [email protected]` but that's pretty horrid).
>
> I should note that I am trying to limit myself to POSIX make, including
> features coming to Issue 8 of the specification (there are quite a few
> things that GNU Make already has, fortunately). But if that's not at all
> possible, I might use a GNU Make-specific feature.
I don't really understand what you're trying to do; an example might help.
However, from what I do understand why don't you use recursive variable
names? This feature is widely available in all versions of make and I
think it's going to be added to the standard:
exe1_LIBS = -lfoo -lbar
exe2_LIBS = -lbiz -lbaz
exe%: ...
... $($@_LIBS)