1

Consider a top level makefile with below content,

TEST_DIR ?= folder_1

%:
        make -C $(TEST_DIR) $@

This is used to get optional argument of TEST_DIR and perform the given target in that directory.

If I want to do a dry-run using below command,

make --dry-run all

It doesn't perform it recursively. Only top-level dry-run happens. How to solve this issue?

Rohan Ghige
  • 479
  • 5
  • 11
  • Either use `${MAKE}` (or `$(MAKE)`) in place of `make`, or use `+` as a prefix to the command. See also [What do `@`, `-` and `+` do as prefixes to recipe lines in makefiles?](https://stackoverflow.com/a/3477400/15168). Using `+` is POSIX-standard [`make`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html) notation; it is not a GNU Make extension. Using `${MAKE}` is widely supported — possibly more so than `+` prefixes. There are dangers to the `${MAKE}` notation — see the Rationale section of the POSIX specification (though I'm not convinced that `+` avoids them). – Jonathan Leffler Apr 12 '20 at 06:19
  • See also this documenation for GNU make: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html – MadScientist Apr 12 '20 at 13:42

0 Answers0