Learn C++ Online

Build systems: make

Today's lesson is presented by Josh Asplund

On this page
This lesson contains approximately 35 minutes of video content.

An introduction to make

Defining variables

Evaluating multiple rules

Special targets

Automatic variables

Questions

Q1

QMake Q1

This question is ungraded.

What is a makefile? Select the best answer.

Questions 2-6

Please answer questions 2-6 with respect to the following Makefile:

CXX=clang++
CXX_FLAGS=-std=c++20 -Iincludes -g -fstandalone-debug -O0 -Wall -Wextra -Werror

exec: bin/exec
tests: bin/tests

bin/exec: ./src/main.cc ./src/functions.cc
	$(CXX) $(CXX_FLAGS) $^ -o $@

bin/tests: ./tests/tests.cc ./src/functions.cc
	$(CXX) $(CXX_FLAGS) $^ -o $@

.DEFAULT_GOAL := tests
.PHONY: exec tests clean

clean:
	rm -f bin/*

Q2

QMake Q2

This question is ungraded.

Why was exec a phony target? Select the best answer.

Q3

QMake Q3

This question is ungraded.

What source files will make exec compile?

Q4

QMake Q4

This question is ungraded.

Given the following make command/commands, which command/commands generate the executable bin/tests? Select the single best, most comprehensive answer.

Q5

QMake Q5

This question is ungraded.

What will make clean do? Select the single best answer.

Q6

QMake Q6

This question is ungraded.

Is CXX is a variable?