• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

gnumake, make

gnumake, make

gnumake GNU make utility to maintain groups of programs.
gnumake [-f <makefile.] [<option>] ... [<target>] ...

For more details, see the make.info file.
In OS X /usr/bin/make is a symbolic link to /usr/bin/gnumake.
The make utility determines automatically which pieces of a large program need to be recompiled, and issues the commands to recompile them. The make utility is not limited to programs. It can be used to describe any task where some files must be updated automatically from others whenever the others change.
To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program, and then states the commands for updating each file. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files.
After a suitable makefile exists, each time you change source files, this simple shell command:

performs all necessary recompilations. The gnnumake program uses the makefile database and the last-modification times of files to decide which files need to be updated. For each of those files, it issues the commands recorded in the database.
make executes commands in the makefile to update one or more targets, where the target is typically a program. If -f is not present, make looks for the makefiles GNUmakefile, makefile, and Makefile, in that order. Normally, you should call your makefile either makefile or Makefile. Note that on Mac OS X, makefile and Makefile are identical due to the case-insensitive HFS+ file system. We recommend using Makefile. GNUmake is not recommended because it would not be understood by other versions of make. If makefile is -, the standard input is read.
make updates a target if it depends on prerequisite files that have been modified since the target was last modified, or if the target does not exist.
-m The options are ignored for compatibility with other versions of make.
-C <dir> Changes to directory <dir> before reading the makefiles or doing anything else. If multiple C options are specified, each is interpreted relative to the previous one. This is typically used with recursive invocations of make.
-d Prints debugging information in addition to normal processing.
-e Gives variables taken from the environment precedence over variables from makefiles.
-f <file> Uses <file> as the makefile.
-i Ignores all errors in commands executed to remake files.
-I <dir>  
-I<dir> Specifies a directory <dir> to search for included makefiles. If several -I options are used to specify several directories, the directories are searched in the order specified. Unlike the arguments to other flags of make, the directories given with -I flags may come directly after the flag: I<dir> is allowed, as well as -I <dir>. This syntax is allowed for compatibility with the C preprocessor's -I flag.
-j <jobs> Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make does not limit the number of jobs that can run simultaneously.
-k Continues as much as possible after an error. Although the target that failed and those that depend on it can't be made, the other dependencies of these targets can be processed all the same.
-l <load> Specifies that no new jobs (commands) should be started if there are other jobs running and the load average is at least <load> (a floating-point number). With no argument, removes a previous load limit.
-n Prints commands that would be executed, but does not execute them.
-o <file> Does not remake the file <file> even if it is older than its dependencies, and does not remake anything on account of changes in <file>. Essentially the file is treated as very old and its rules are ignored.
-p Prints the database (rules and variable values) that results from reading the makefiles; then executes as usual or as otherwise specified. This also prints the version information by the -v switch. To print the database without trying to remake any files, use make -p -f/dev/null.
-q Question mode. Does not run any commands, or print anything. Just returns an exit status that is zero if the specified targets are already up to date, nonzero, or otherwise.
-r Eliminates use of the built-in implicit rules. Also clears out the default list of suffixes for suffix rules.
-s Silent operation. Does not print the commands as they are executed.
-S Cancels the effect of -k option. This is never necessary except in a recursive make when -k might be inherited from the top-level make via MAKEFLAGS, or if you set -k in MAKEFILES in your environment.
-t Touches files (marks them up-to-date without really changing them) instead of running their commands.
-v Prints the version of the make program plus a copyright, list of authors, and notice that there is no warranty.
-w Prints a message containing the working directory before and after other processing. This might be useful for tracking down errors from complicated nests of recursive make commands.
-W <file> Pretends that the target has just been modified. When used with -n, this shows you what would happen if you were to modify the file. Without -n, it is almost the same as running touch on the given file before running make, except that the modification time is changed only in the imagination of make.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint