Course in Make

Course in C/C++ application build using Make

The tool Make in the *NIX world has existed for a long time and constitutes the foundation for automatic build of a lot of C/C++ applications. In this kickstart-course we focus on GNU Make in Linux environment and focus on to give you the knowledge you need to directly after the course be able to create effective and maintenance friendly build-script with the help of Make
This is what you will learn
  • Build C/C++ applicationer with many source-codes and including-files distributed on different subdirectories
  • Write archive files (*.a) and dynamically linked library files (*.so), via make
  • Write makefiles that use implied compiling rules
  • Write makefiles that have their own compiling rules and dependences
Course Contents

Overview and Background

Short about how make has evolved and how to install

  • History
  • GNU Make
  • Installation
  • Prerequisites

Quick overview of compilation

Short about different compiling steps and typical use of GCC and other programs to prepare for the examples and exercises of the course

  • Using GCC
  • Compilation modules
  • Common compiler flags
  • Linking
  • Linking libraries
  • Creating archives
  • Creating DLLs

Basic Syntax

Basics about make and how to compile a C++ program with several source code files and include files

  • Makefiles
  • Simple rules syntax
  • Targets
  • Actions
  • Dependencies
  • Variables
  • Handling long lines

Writing Rules

Here we go through how make handles rules, with other words targets with associated dependencies and different ways to design those.

  • How make handle rules
  • Some typical rules and how to simplify them
  • Using filename wildcards
  • Setting search path using VPATH and vpath
  • Declaring phony targets

Writing Actions

Here we go through how to write shell commands, that are performed for a matched rule

  • Understading how make handles an action
  • Using make variables in actions
  • Suppressing action echo

Using Variables

Here we go through how to handle variables in make, and that there are two different types of variables in GNU Make and how to expand variable values

  • Lazy-expand variables
  • Eager-expand variables
  • Substitution of variables
  • Appending to a variable value
  • Conditional assignment
  • Dealing with leading and trailing spaces
  • Multi-line variable values
  • Setting variables outside of the makefile
  • Some built-in variables

Built-in Functions

One often overlooked attribute of make is that there are a number of useful funtions to manipulate variable values and filesystem data. Here we go through all the embedded functions in make that we think one should be familiar with.

  • Invocation syntax and recommendations
  • [object Object]
  • [object Object]
  • Using foreach
  • Writing to and reading from files
  • Inspecting variables
  • Writing log messages
  • Invoking shell commands

Using Implicit Rules

A powerful property for make is that there is a large amout of embedded rules for how to compile C/C++/Fortran/Pascal program. Here we go through the most important rules and which associated variables one ought to be familiar with.

  • What is an implicit rule and how can it be used
  • Overview of implicit rules for C/C++ programs
  • Overview of implicit variables used in implicit actions

Writing Pattern Rules

asdf as df as

  • What is a pattern rule
  • Syntax for pattern rules
  • Using automatic variables in actions of pattern rules

Using Conditionals

fad asd fa sdf

  • Conditionals syntax
  • Comparing values
  • Checking variable definition

Advanced Usage

adfa dsf a ds

  • Dry running
  • Touching targets
  • Alterate makefiles
  • Recommended conventions
  • Recommended targets
  • Running parallel targets
  • Recursive make files

Debugging Make

  • Show rules
  • Debug printouts
  • Tracing
Duration1 Days
AudienceC/C++ developers working in a *NIX environment
PrerequisitesExperience of building C/C++ applications using a command-line compiler
  • Ubuntu Linux @ VirtualBox or WSL @ Windows-10
  • GNU C/C++ compiler, make and build-utils
Course Dates
2020-02-14Stockholm11 000 kr
2020-03-06Stockholm11 000 kr
2020-03-27Stockholm 11 000 kr
2020-04-17Stockholm 11 000 kr
2020-05-08Stockholm 11 000 kr
2020-05-28Stockholm 11 000 kr

Same-Company Discout

We offer a 20% discount for additional participants from the same company and at the same course date. Read more here.

Teaching Language

Our printed course material is always authored in English. The oral presentation in our classrooms is generally in Swedish, unless all participants agree to that we perform the course in English.

On-Site Course

If you order an On-Site course, we will come to you and hold the course in your office. The price is determined by our price model and is based on the number of course days, number of participants and any travel and lodging.

Read more about out price modell and term of sales here.

Related Courses
Modern C++5Beginner Show
BASH Shell Scripts Programming1 BeginnerShow