Allow a second variable expansion for prerequisites.
Section: Special targets and behavior control
Secondary expansion
makefile
makefile
.SECONDEXPANSION:
$(OUT_DIR)/%.o: $$(SRC_DIR)/%.c
cc -c $< -o $@Explanation
Advanced GNU make feature used with dynamic prerequisite lists.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Special targets and behavior control
Delete target on error
Remove a partially built target if the recipe fails.
One shell per recipe
Run all lines of a recipe in a single shell instance.
Disable parallelism
Force serial execution for all or selected targets.
Set explicit default goal
Choose which target runs when the user invokes plain `make`.