[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Linking inside of pattern rules
From: |
Bogdan |
Subject: |
Linking inside of pattern rules |
Date: |
Sun, 22 Dec 2019 17:02:43 +0000 (UTC) |
Hi,
I'm looking for a suggestion on how to achieve something a bit unusual.
Simplifying things a bit for the purpose of this question, I have a pattern
rule that looks something like this:
$(BIN_DIR)/%: | $(BIN_DIR)
$(CC) $(LDFLAGS) -o $@ $<
and in a separate files, I have entries such as the following:
$(BIN_DIR)/foo: $(FOO_OBJ_FILES:%=$(OBJ_DIR)/%)
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 $@.link` 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.
Thanks,
Bogdan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Linking inside of pattern rules,
Bogdan <=