File control by Make

Background

To enable executable from source code in a project, it usually requires a set of command lines to work it out.

In software development, this step is called ‘building’, however it’s never be an easy task for human by input lines.

As a result, since 1976, a build automation tool, Make, was birth from Bell Lab to automate building process for C.

Make can not only build up executable by defining file dependency ruleset, but also collect project tasks by listing.

Thanks to this gift, a numerous of software projects are still using Make to manage and run the project procedures.

Advantages

  1. Manage and keep different kinds of tasks other than build process
  2. Have clear syntax and light effort by directly using current shell commands
  3. Contain smart mechanism to determine the tasks to run and files to build
  4. Enable the user to build and install without knowing the details

Usage

Make searches the current directory for the makefile to use, then runs the specified target(s) from that file.

Inside makefile, there are set of rule, it contains commands to build a target file from source files with dependencies.

After that, you can specify particular target(s) to run task(s) or update file(s). The following is the structure of a rule,

# Makefile: a file with set of Make rules
# Common look of a rule
# []: optional
target1 [target2 ...]: [component1 ...]
#	[command 1]
#	[command 2]
#	...
#	[command n]

Comments