Trace a build after a recipe fails

A project uses the complete GNU Makefile below. Every recipe line begins with a tab, and each recipe contains exactly one command.


makefile
.PHONY: all
all: package report

package: fault.o valid.o
	./link-package

report: stats.o
	./make-report

fault.o:
	./compile-fault

valid.o:
	./compile-valid

stats.o:
	./compile-stats


All five output files are initially absent. Every script exists and is executable. The command ./compile-fault returns a nonzero exit status and creates no output. Every other command, if executed, succeeds and creates its named target. There are no additional rules, inherited make options, or instructions to ignore errors.


Dependencies connect three object files to package and report targets, which both feed the all target.


Consider two independent runs, each starting from this same initial state. Both use -j1, so recipes execute serially and prerequisites are considered in their listed order. Complete the table with exact integer counts. Count a recipe as attempted when its command starts, including a command that fails. Do not count the recipe-free target all as a recipe.

CommandRecipe attemptsSuccessful recipesFailed recipes
make -j1 all
make -j1 -k all

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Makefiles Questions: