make Command Examples in Linux

In most cases, once the makefile is created, simply issuing make and then make file without arguments will install the application. This is because the make command automatically looks for the makefile in the current directory. You can, however, issue make with various options.

make Command Examples

1. Call the first target specified in the Makefile (usually named “all”):

# make

2. Call a specific target:

# make target

3. Call a specific target, executing 4 jobs at a time in parallel:

# make -j4 target

4. Use a specific Makefile:

# make --file file

5. Execute make from another directory:

# make --directory directory

6. Force making of a target, even if source files are unchanged:

# make --always-make target

7. Override a variable defined in the Makefile:

# make target variable=new_value

8. Override variables defined in the Makefile by the environment:

# make --environment-overrides target
Related Post