If the following rule is in the makefile:
$(OBJ)/%.o: $(SRC)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
Each file corresponding to the prefix ./obj/and sufix .owill have its own kernel passed in %, so I can provide some dependencies based on its name.
But let's say I have a rule that I specify the target objects one after another that I want:
OBJECTS=abc.o bca.o cba.o
$(OBJECTS): $(SRC)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
How to make the trunk %actually work for the current name of the target being executed? Just use %does not work, either $@.
Note that I am trying to write the actual target name into my own dependency. For example, when make executes the rule for abc.o, it will include $(SRC)/abc.cjust it (something like $(patsubst %.o, $(SRC)/%.c, MAGIC_TARGET_NAME_VARIABLE)).