For questions pertaining to make, a utility that automates the build process by managing dependencies amongst targets. Use this tag for questions about make itself or questions about issues arising from using the make command-line utility.

The make utility is driven by optional configuration files (makefiles) and built-in rules that take components and create an output file, typically an executable file. The configuration files and built-in rules define how to create an output file from the given input files. The rules consist of a target, dependencies, and commands to execute to create the output file. If the output exists and is newer than all the dependency files, no action is taken.

For example, if creating an executable file hello.exe requires two source files, hello.c and hello.h then a makefile could look like this:

hello.exe: hello.c hello.h
    cc hello.c -i hello.h -o hello

If the timestamps for hello.c and hello.h are older than for hello.exe then the cc command is executed. There are numerous macros predefined that for simple tasks a simple makefile (or even no makefile) is needed.

Further reading

Why can't gcc find libevent when building tmux from source?

What is the purpose of the 'install' command?

make fatal error: openssl/sha.h: No such file or directory

External References


Wikipedia Makefile

make specification (The Open Group Base Specifications Issue 7, 2018 edition)