Calculate selective rebuild time

A developer runs make console after editing only api.h. Before the edit, every output was current. The edited header now has a strictly newer timestamp than every output. The rules and recipe durations are below. Recipes execute serially, succeed, and update their targets. Ignore make's overhead and assume no other changes.


Find the incremental build time and the time saved compared with rebuilding all four objects and the executable from scratch. Give both answers in seconds, as exact integers.


makefile
console: main.o core.o parser.o view.o
	cc main.o core.o parser.o view.o -o console
main.o: main.c api.h
	cc -c main.c -o main.o
core.o: core.c api.h
	cc -c core.c -o core.o
parser.o: parser.c parser.h
	cc -c parser.c -o parser.o
view.o: view.c api.h
	cc -c view.c -o view.o


Target updated by recipe

Duration (s)

main.o

3

core.o

5

parser.o

11

view.o

7

console

2

Your answers

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: