Structured Programming Lab Make and Makefile
Structured Programming Lab Make and Makefile
Author’s Name
February 2, 2024
1 Introduction to make
The make command is a powerful tool used for automating the build process
in Unix-based systems. It utilizes a file, typically named Makefile, which con-
tains directives for building a software project. These directives include targets,
dependencies, and the shell commands to execute.
1.1 Features
• Efficiently recompiles only the necessary parts of a project by checking file
timestamps.
• Supports conditional execution for complex build processes.
• Highly customizable for a wide range of tasks beyond software compilation.
make is favored for its simplicity and effectiveness, especially in projects with
many components.
2 Overview of Makefiles
A Makefile is a key tool in automating the build process in software develop-
ment, particularly when using the make utility. It defines how software projects
are compiled and linked, specifying dependencies among source files to compile
only what’s necessary.
1
• Recipes: Commands executed by make to produce the target from the
prerequisites.
Makefiles streamline the development process, enabling developers to com-
pile and maintain projects efficiently across different environments.
5 Makefile
1 hello : hello . c
2 gcc -o hello hello . c
To compile the program, run make in the terminal. This will use the gcc
command specified in the Makefile to compile hello.c into an executable
named hello.