| 1 | .TH MAKE 1 "22 August 1989" "GNU" "LOCAL USER COMMANDS" | 
|---|
| 2 | .SH NAME | 
|---|
| 3 | make \- GNU make utility to maintain groups of programs | 
|---|
| 4 | .SH SYNOPSIS | 
|---|
| 5 | .B "make " | 
|---|
| 6 | [ | 
|---|
| 7 | .B \-f | 
|---|
| 8 | .I makefile | 
|---|
| 9 | ] [ options ] ... [ targets ] ... | 
|---|
| 10 | .SH WARNING | 
|---|
| 11 | This man page is an extract of the documentation of GNU | 
|---|
| 12 | .IR make . | 
|---|
| 13 | It is updated only occasionally, because the GNU project does not use nroff. | 
|---|
| 14 | For complete, current documentation, refer to the Info file | 
|---|
| 15 | .B make.info | 
|---|
| 16 | which is made from the Texinfo source file | 
|---|
| 17 | .BR make.texi . | 
|---|
| 18 | .SH DESCRIPTION | 
|---|
| 19 | .LP | 
|---|
| 20 | The purpose of the | 
|---|
| 21 | .I make | 
|---|
| 22 | utility is to determine automatically which | 
|---|
| 23 | pieces of a large program need to be recompiled, and issue the commands to | 
|---|
| 24 | recompile them. | 
|---|
| 25 | The manual describes the GNU implementation of | 
|---|
| 26 | .IR make , | 
|---|
| 27 | which was written by Richard Stallman and Roland McGrath, and is | 
|---|
| 28 | currently maintained by Paul Smith. | 
|---|
| 29 | Our examples show C programs, since they are most common, but you can use | 
|---|
| 30 | .I make | 
|---|
| 31 | with any programming language whose compiler can be run with a | 
|---|
| 32 | shell command. | 
|---|
| 33 | In fact, | 
|---|
| 34 | .I make | 
|---|
| 35 | is not limited to programs. | 
|---|
| 36 | You can use it to describe any task where some files must be | 
|---|
| 37 | updated automatically from others whenever the others change. | 
|---|
| 38 | .LP | 
|---|
| 39 | To prepare to use | 
|---|
| 40 | .IR make , | 
|---|
| 41 | you must write a file called the | 
|---|
| 42 | .I makefile | 
|---|
| 43 | that describes the relationships among files in your program, and the | 
|---|
| 44 | states the commands for updating each file. | 
|---|
| 45 | In a program, typically the executable file is updated from object | 
|---|
| 46 | files, which are in turn made by compiling source files. | 
|---|
| 47 | .LP | 
|---|
| 48 | Once a suitable makefile exists, each time you change some source files, | 
|---|
| 49 | this simple shell command: | 
|---|
| 50 | .sp 1 | 
|---|
| 51 | .RS | 
|---|
| 52 | .B make | 
|---|
| 53 | .RE | 
|---|
| 54 | .sp 1 | 
|---|
| 55 | suffices to perform all necessary recompilations. | 
|---|
| 56 | The | 
|---|
| 57 | .I make | 
|---|
| 58 | program uses the makefile data base and the last-modification times | 
|---|
| 59 | of the files to decide which of the files need to be updated. | 
|---|
| 60 | For each of those files, it issues the commands recorded in the data base. | 
|---|
| 61 | .LP | 
|---|
| 62 | .I make | 
|---|
| 63 | executes commands in the | 
|---|
| 64 | .I makefile | 
|---|
| 65 | to update | 
|---|
| 66 | one or more target | 
|---|
| 67 | .IR names , | 
|---|
| 68 | where | 
|---|
| 69 | .I name | 
|---|
| 70 | is typically a program. | 
|---|
| 71 | If no | 
|---|
| 72 | .B \-f | 
|---|
| 73 | option is present, | 
|---|
| 74 | .I make | 
|---|
| 75 | will look for the makefiles | 
|---|
| 76 | .IR GNUmakefile , | 
|---|
| 77 | .IR makefile , | 
|---|
| 78 | and | 
|---|
| 79 | .IR Makefile , | 
|---|
| 80 | in that order. | 
|---|
| 81 | .LP | 
|---|
| 82 | Normally you should call your makefile either | 
|---|
| 83 | .I makefile | 
|---|
| 84 | or | 
|---|
| 85 | .IR Makefile . | 
|---|
| 86 | (We recommend | 
|---|
| 87 | .I Makefile | 
|---|
| 88 | because it appears prominently near the beginning of a directory | 
|---|
| 89 | listing, right near other important files such as | 
|---|
| 90 | .IR  README .) | 
|---|
| 91 | The first name checked, | 
|---|
| 92 | .IR GNUmakefile , | 
|---|
| 93 | is not recommended for most makefiles. | 
|---|
| 94 | You should use this name if you have a makefile that is specific to GNU | 
|---|
| 95 | .IR make , | 
|---|
| 96 | and will not be understood by other versions of | 
|---|
| 97 | .IR make . | 
|---|
| 98 | If | 
|---|
| 99 | .I makefile | 
|---|
| 100 | is `\-', the standard input is read. | 
|---|
| 101 | .LP | 
|---|
| 102 | .I make | 
|---|
| 103 | updates a target if it depends on prerequisite files | 
|---|
| 104 | that have been modified since the target was last modified, | 
|---|
| 105 | or if the target does not exist. | 
|---|
| 106 | .SH OPTIONS | 
|---|
| 107 | .sp 1 | 
|---|
| 108 | .TP 0.5i | 
|---|
| 109 | .BR \-b , " \-m" | 
|---|
| 110 | These options are ignored for compatibility with other versions of | 
|---|
| 111 | .IR make . | 
|---|
| 112 | .TP 0.5i | 
|---|
| 113 | .BR \-B , " \-\-always\-make" | 
|---|
| 114 | Unconditionally make all targets. | 
|---|
| 115 | .TP 0.5i | 
|---|
| 116 | \fB\-C\fR \fIdir\fR, \fB\-\-directory\fR=\fIdir\fR | 
|---|
| 117 | Change to directory | 
|---|
| 118 | .I dir | 
|---|
| 119 | before reading the makefiles or doing anything else. | 
|---|
| 120 | If multiple | 
|---|
| 121 | .B \-C | 
|---|
| 122 | options are specified, each is interpreted relative to the | 
|---|
| 123 | previous one: | 
|---|
| 124 | .BR "\-C " / | 
|---|
| 125 | .BR "\-C " etc | 
|---|
| 126 | is equivalent to | 
|---|
| 127 | .BR "\-C " /etc. | 
|---|
| 128 | This is typically used with recursive invocations of | 
|---|
| 129 | .IR make . | 
|---|
| 130 | .TP 0.5i | 
|---|
| 131 | .B \-d | 
|---|
| 132 | Print debugging information in addition to normal processing. | 
|---|
| 133 | The debugging information says which files are being considered for | 
|---|
| 134 | remaking, which file-times are being compared and with what results, | 
|---|
| 135 | which files actually need to be remade, which implicit rules are | 
|---|
| 136 | considered and which are applied---everything interesting about how | 
|---|
| 137 | .I make | 
|---|
| 138 | decides what to do. | 
|---|
| 139 | .TP 0.5i | 
|---|
| 140 | .BI \-\-debug "[=FLAGS]" | 
|---|
| 141 | Print debugging information in addition to normal processing. | 
|---|
| 142 | If the | 
|---|
| 143 | .I FLAGS | 
|---|
| 144 | are omitted, then the behavior is the same as if | 
|---|
| 145 | .B \-d | 
|---|
| 146 | was specified. | 
|---|
| 147 | .I FLAGS | 
|---|
| 148 | may be | 
|---|
| 149 | .I a | 
|---|
| 150 | for all debugging output (same as using | 
|---|
| 151 | .BR \-d ), | 
|---|
| 152 | .I b | 
|---|
| 153 | for basic debugging, | 
|---|
| 154 | .I v | 
|---|
| 155 | for more verbose basic debugging, | 
|---|
| 156 | .I i | 
|---|
| 157 | for showing implicit rules, | 
|---|
| 158 | .I j | 
|---|
| 159 | for details on invocation of commands, and | 
|---|
| 160 | .I m | 
|---|
| 161 | for debugging while remaking makefiles. | 
|---|
| 162 | .TP 0.5i | 
|---|
| 163 | .BR \-e , " \-\-environment\-overrides" | 
|---|
| 164 | Give variables taken from the environment precedence | 
|---|
| 165 | over variables from makefiles. | 
|---|
| 166 | .TP 0.5i | 
|---|
| 167 | \fB\-f\fR \fIfile\fR, \fB\-\-file\fR=\fIfile\fR, \fB\-\-makefile\fR=\fIFILE\fR | 
|---|
| 168 | Use | 
|---|
| 169 | .I file | 
|---|
| 170 | as a makefile. | 
|---|
| 171 | .TP 0.5i | 
|---|
| 172 | .BR \-i , " \-\-ignore\-errors" | 
|---|
| 173 | Ignore all errors in commands executed to remake files. | 
|---|
| 174 | .TP 0.5i | 
|---|
| 175 | \fB\-I\fR \fIdir\fR, \fB\-\-include\-dir\fR=\fIdir\fR | 
|---|
| 176 | Specifies a directory | 
|---|
| 177 | .I dir | 
|---|
| 178 | to search for included makefiles. | 
|---|
| 179 | If several | 
|---|
| 180 | .B \-I | 
|---|
| 181 | options are used to specify several directories, the directories are | 
|---|
| 182 | searched in the order specified. | 
|---|
| 183 | Unlike the arguments to other flags of | 
|---|
| 184 | .IR make , | 
|---|
| 185 | directories given with | 
|---|
| 186 | .B \-I | 
|---|
| 187 | flags may come directly after the flag: | 
|---|
| 188 | .BI \-I dir | 
|---|
| 189 | is allowed, as well as | 
|---|
| 190 | .BI "\-I " dir. | 
|---|
| 191 | This syntax is allowed for compatibility with the C | 
|---|
| 192 | preprocessor's | 
|---|
| 193 | .B \-I | 
|---|
| 194 | flag. | 
|---|
| 195 | .TP 0.5i | 
|---|
| 196 | \fB\-j\fR [\fIjobs\fR], \fB\-\-jobs\fR[=\fIjobs\fR] | 
|---|
| 197 | Specifies the number of | 
|---|
| 198 | .I jobs | 
|---|
| 199 | (commands) to run simultaneously. | 
|---|
| 200 | If there is more than one | 
|---|
| 201 | .B \-j | 
|---|
| 202 | option, the last one is effective. | 
|---|
| 203 | If the | 
|---|
| 204 | .B \-j | 
|---|
| 205 | option is given without an argument, | 
|---|
| 206 | .IR make | 
|---|
| 207 | will not limit the number of jobs that can run simultaneously. | 
|---|
| 208 | .TP 0.5i | 
|---|
| 209 | .BR \-k , " \-\-keep\-going" | 
|---|
| 210 | Continue as much as possible after an error. | 
|---|
| 211 | While the target that failed, and those that depend on it, cannot | 
|---|
| 212 | be remade, the other dependencies of these targets can be processed | 
|---|
| 213 | all the same. | 
|---|
| 214 | .TP 0.5i | 
|---|
| 215 | \fB\-l\fR [\fIload\fR], \fB\-\-load\-average\fR[=\fIload\fR] | 
|---|
| 216 | Specifies that no new jobs (commands) should be started if there are | 
|---|
| 217 | others jobs running and the load average is at least | 
|---|
| 218 | .I load | 
|---|
| 219 | (a floating-point number). | 
|---|
| 220 | With no argument, removes a previous load limit. | 
|---|
| 221 | .TP 0.5i | 
|---|
| 222 | .BR \-L , " \-\-check\-symlink\-times" | 
|---|
| 223 | Use the latest mtime between symlinks and target. | 
|---|
| 224 | .TP 0.5i | 
|---|
| 225 | .BR \-n , " \-\-just\-print" , " \-\-dry\-run" , " \-\-recon" | 
|---|
| 226 | Print the commands that would be executed, but do not execute them. | 
|---|
| 227 | .TP 0.5i | 
|---|
| 228 | \fB\-o\fR \fIfile\fR, \fB\-\-old\-file\fR=\fIfile\fR, \fB\-\-assume\-old\fR=\fIfile\fR | 
|---|
| 229 | Do not remake the file | 
|---|
| 230 | .I file | 
|---|
| 231 | even if it is older than its dependencies, and do not remake anything | 
|---|
| 232 | on account of changes in | 
|---|
| 233 | .IR file . | 
|---|
| 234 | Essentially the file is treated as very old and its rules are ignored. | 
|---|
| 235 | .TP 0.5i | 
|---|
| 236 | .BR \-p , " \-\-print\-data\-base" | 
|---|
| 237 | Print the data base (rules and variable values) that results from | 
|---|
| 238 | reading the makefiles; then execute as usual or as otherwise | 
|---|
| 239 | specified. | 
|---|
| 240 | This also prints the version information given by the | 
|---|
| 241 | .B \-v | 
|---|
| 242 | switch (see below). | 
|---|
| 243 | To print the data base without trying to remake any files, use | 
|---|
| 244 | .B make | 
|---|
| 245 | .B \-p | 
|---|
| 246 | .BI \-f /dev/null. | 
|---|
| 247 | .TP 0.5i | 
|---|
| 248 | .BR \-q , " \-\-question" | 
|---|
| 249 | ``Question mode''. | 
|---|
| 250 | Do not run any commands, or print anything; just return an exit status | 
|---|
| 251 | that is zero if the specified targets are already up to date, nonzero | 
|---|
| 252 | otherwise. | 
|---|
| 253 | .TP 0.5i | 
|---|
| 254 | .BR \-r , " \-\-no\-builtin\-rules" | 
|---|
| 255 | Eliminate use of the built\-in implicit rules. | 
|---|
| 256 | Also clear out the default list of suffixes for suffix rules. | 
|---|
| 257 | .TP 0.5i | 
|---|
| 258 | .BR \-R , " \-\-no\-builtin\-variables" | 
|---|
| 259 | Don't define any built\-in variables. | 
|---|
| 260 | .TP 0.5i | 
|---|
| 261 | .BR \-s , " \-\-silent" , " \-\-quiet" | 
|---|
| 262 | Silent operation; do not print the commands as they are executed. | 
|---|
| 263 | .TP 0.5i | 
|---|
| 264 | .BR \-S , " \-\-no\-keep\-going" , " \-\-stop" | 
|---|
| 265 | Cancel the effect of the | 
|---|
| 266 | .B \-k | 
|---|
| 267 | option. | 
|---|
| 268 | This is never necessary except in a recursive | 
|---|
| 269 | .I make | 
|---|
| 270 | where | 
|---|
| 271 | .B \-k | 
|---|
| 272 | might be inherited from the top-level | 
|---|
| 273 | .I make | 
|---|
| 274 | via MAKEFLAGS or if you set | 
|---|
| 275 | .B \-k | 
|---|
| 276 | in MAKEFLAGS in your environment. | 
|---|
| 277 | .TP 0.5i | 
|---|
| 278 | .BR \-t , " \-\-touch" | 
|---|
| 279 | Touch files (mark them up to date without really changing them) | 
|---|
| 280 | instead of running their commands. | 
|---|
| 281 | This is used to pretend that the commands were done, in order to fool | 
|---|
| 282 | future invocations of | 
|---|
| 283 | .IR make . | 
|---|
| 284 | .TP 0.5i | 
|---|
| 285 | .BR \-v , " \-\-version" | 
|---|
| 286 | Print the version of the | 
|---|
| 287 | .I make | 
|---|
| 288 | program plus a copyright, a list of authors and a notice that there | 
|---|
| 289 | is no warranty. | 
|---|
| 290 | .TP 0.5i | 
|---|
| 291 | .BR \-w , " \-\-print\-directory" | 
|---|
| 292 | Print a message containing the working directory | 
|---|
| 293 | before and after other processing. | 
|---|
| 294 | This may be useful for tracking down errors from complicated nests of | 
|---|
| 295 | recursive | 
|---|
| 296 | .I make | 
|---|
| 297 | commands. | 
|---|
| 298 | .TP 0.5i | 
|---|
| 299 | .B \-\-no\-print\-directory | 
|---|
| 300 | Turn off | 
|---|
| 301 | .BR \-w , | 
|---|
| 302 | even if it was turned on implicitly. | 
|---|
| 303 | .TP 0.5i | 
|---|
| 304 | \fB\-W\fR \fIfile\fR, \fB\-\-what\-if\fR=\fIfile\fR, \fB\-\-new\-file\fR=\fIfile\fR, \fB\-\-assume\-new\fR=\fIfile\fR | 
|---|
| 305 | Pretend that the target | 
|---|
| 306 | .I file | 
|---|
| 307 | has just been modified. | 
|---|
| 308 | When used with the | 
|---|
| 309 | .B \-n | 
|---|
| 310 | flag, this shows you what would happen if you were to modify that file. | 
|---|
| 311 | Without | 
|---|
| 312 | .BR \-n , | 
|---|
| 313 | it is almost the same as running a | 
|---|
| 314 | .I touch | 
|---|
| 315 | command on the given file before running | 
|---|
| 316 | .IR make , | 
|---|
| 317 | except that the modification time is changed only in the imagination of | 
|---|
| 318 | .IR make . | 
|---|
| 319 | .TP 0.5i | 
|---|
| 320 | .B \-\-warn\-undefined\-variables | 
|---|
| 321 | Warn when an undefined variable is referenced. | 
|---|
| 322 | .SH "EXIT STATUS" | 
|---|
| 323 | GNU | 
|---|
| 324 | .I make | 
|---|
| 325 | exits with a status of zero if all makefiles were successfully parsed | 
|---|
| 326 | and no targets that were built failed.  A status of one will be returned | 
|---|
| 327 | if the | 
|---|
| 328 | .B \-q | 
|---|
| 329 | flag was used and | 
|---|
| 330 | .I make | 
|---|
| 331 | determines that a target needs to be rebuilt.  A status of two will be | 
|---|
| 332 | returned if any errors were encountered. | 
|---|
| 333 | .SH "SEE ALSO" | 
|---|
| 334 | .I "The GNU Make Manual" | 
|---|
| 335 | .SH BUGS | 
|---|
| 336 | See the chapter `Problems and Bugs' in | 
|---|
| 337 | .IR "The GNU Make Manual" . | 
|---|
| 338 | .SH AUTHOR | 
|---|
| 339 | This manual page contributed by Dennis Morse of Stanford University. | 
|---|
| 340 | It has been reworked by Roland McGrath.  Further updates contributed by | 
|---|
| 341 | Mike Frysinger. | 
|---|
| 342 | .SH "COPYRIGHT" | 
|---|
| 343 | Copyright (C) 1992, 1993, 1996, 1999 Free Software Foundation, Inc. | 
|---|
| 344 | This file is part of GNU | 
|---|
| 345 | .IR make . | 
|---|
| 346 | .LP | 
|---|
| 347 | GNU | 
|---|
| 348 | .I make | 
|---|
| 349 | is free software; you can redistribute it and/or modify it under the | 
|---|
| 350 | terms of the GNU General Public License as published by the Free | 
|---|
| 351 | Software Foundation; either version 2, or (at your option) any later | 
|---|
| 352 | version. | 
|---|
| 353 | .LP | 
|---|
| 354 | GNU | 
|---|
| 355 | .I make | 
|---|
| 356 | is distributed in the hope that it will be useful, but WITHOUT ANY | 
|---|
| 357 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|---|
| 358 | FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License | 
|---|
| 359 | for more details. | 
|---|
| 360 | .LP | 
|---|
| 361 | You should have received a copy of the GNU General Public License | 
|---|
| 362 | along with GNU | 
|---|
| 363 | .IR make ; | 
|---|
| 364 | see the file COPYING.  If not, write to the Free Software Foundation, | 
|---|
| 365 | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | 
|---|