The previous answer is incorrect: there is no difference between () and {} for Make.
If you use $$ in the recipe, then $ "escaped" and passed to the shell. Then the shell can make the difference between $() or ${} . But it depends entirely on the shell and has nothing to do with Make or make files.
In the recipe command that you specify
for dir in ${DIR}; do (cd $${dir}; ${MAKE}); done
Do it:
- replaces the
DIR value, for ${DIR} , and it could also be $(DIR) - replaces
$$ with $ ("escaping", so $ can be passed to the shell) - replaces the
MAKE value for ${MAKE} , again it could be $(MAKE) . The MAKE value is automatically set using Make to the make executable that is used. - passes the resulting string to the shell for execution - the shell then interprets the remaining
${} as it wants.
CC , like MAKE , is one of those variables that are predefined by Make, so it "works" even if you don't set it yourself.
By the way, the best way to write this recipe for "target" is
.PHONY: $(DIR) target: $(DIR) $(DIR): $(MAKE) -C $@
Please refer to the manual for an explanation of strange things.
source share