"make" - Manage Program Build Process

Provides a tutorial example on how to use the 'make' tool to manage the build process of large programs that have multiple components.

What Is "make" - "make" is a utility tool to manage the build (compile, link, install, test, etc.) process of large programs that have multiple components. "make" can determine automatically which source code files of the program need to be recompiled, and issue the commands to recompile them. You can actually use "make" to describe any task where some files must be updated automatically from others whenever the others change.

You can follow this tutorial to install and verify the "make" tool on CentOS 8 systems.

1. Install "make":

herong$ sudo dnf install make
Package make-1:4.2.1-9.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

herong$ sudo dnf info make
Installed Packages
Name         : make
Epoch        : 1
Version      : 4.2.1
Release      : 9.el8
Architecture : x86_64
Size         : 1.4 M
Source       : make-4.2.1-9.el8.src.rpm
Repository   : @System
From repo    : BaseOS
Summary      : A GNU tool which simplifies the build process for users
URL          : http://www.gnu.org/software/make/
License      : GPLv3+
Description  : A GNU tool for controlling the generation of executables and other
             : non-source files of a program from the program's source files. Make
             : allows users to build and install packages without any significant
             : knowledge about the details of the build process. The details about
             : how the program should be built are provided for make in the program's
             : makefile.

2. Verify "make" version:

herong$ make --version

GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.

3. Create a "Makefile" with one task:

herong$ cat Makefile

compile: hello.cpp
  g++ -o hello hello.cpp

4. Run the task specified in the "Makefile":

herong$ make compile

g++ -o hello hello.cpp

5. Verify result:

herong$ ./hello
Hello world! From C++.

Ok. I can use the "make" tool to automate any tasks on my CentOS 8 computer now.

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Software Package Manager on CentOS - DNF and YUM

 Running Apache Web Server (httpd) on Linux Systems

 Running PHP Scripts on Linux Systems

 Running MySQL Database Server on Linux Systems

 Running Python Scripts on Linux Systems

 vsftpd - Very Secure FTP Daemon

 Postfix - Mail Transport Agent (MTA)

 Dovecot - IMAP and POP3 Server

 Email Client Tools - Mail User Agents (MUA)

 LDAP (Lightweight Directory Access Protocol)

GCC - C/C++ Compiler

 Install GCC C/C++ Compilers

 "g++ --verbose" - GCC Compiler Steps and Settings

 "g++ -I..." and CPATH Environment Variable

 "g++ -l..." to Link with Library Files

 "g++ -c" and "ar src" to Build Static Library

 "g++ -shared" to Build Dynamic Library

 "ldd" - Dynamic Library Dependency Checker

"make" - Manage Program Build Process

 Graphics Environments on Linux

 Conda - Environment and Package Manager

 Tools and Utilities

 Administrative Tasks

 References

 Full Version in PDF/EPUB