I know that the variable MAKECMDGOALS In GNU Make will contain the names of final goals for the run, i.e. the targets included on the command line.

However I'd like to check if a target will be made, whether as a goal or as an intermediate step. Is this possible without recursive make runs or some other complicated mechanism? I'd prefer a portable solution (at least to Darwin) but GNU-specific answers are fine too.

  • is it possible to run in dry-run mode? make -n? – NinjaGaiden Jan 4 '17 at 2:47
  • @user3589054 I mean from within Make itself. – shadowtalker Jan 4 '17 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.