1MAKE(1)                          User Commands                         MAKE(1)
2
3
4

NAME

6       make - GNU Make utility to maintain groups of programs
7

SYNOPSIS

9       make [OPTION]... [TARGET]...
10

DESCRIPTION

12       The  make  utility will determine automatically which pieces of a large
13       program need to be recompiled, and  issue  the  commands  to  recompile
14       them.   The  manual describes the GNU implementation of make, which was
15       written by Richard Stallman and Roland McGrath, and is currently  main‐
16       tained  by  Paul  Smith.   Our examples show C programs, since they are
17       very common, but you can use make with any programming  language  whose
18       compiler can be run with a shell command.  In fact, make is not limited
19       to programs.  You can use it to describe any task where some files must
20       be updated automatically from others whenever the others change.
21
22       To  prepare to use make, you must write a file called the makefile that
23       describes the relationships among files in your program,  and  provides
24       commands  for  updating  each  file.   In a program, typically the exe‐
25       cutable file is updated from object files, which are in  turn  made  by
26       compiling source files.
27
28       Once  a  suitable  makefile  exists,  each  time you change some source
29       files, this simple shell command:
30
31              make
32
33       suffices to perform all necessary  recompilations.   The  make  program
34       uses  the  makefile  description and the last-modification times of the
35       files to decide which of the files need to be  updated.   For  each  of
36       those files, it issues the commands recorded in the makefile.
37
38       make  executes  commands in the makefile to update one or more targets,
39       where target is typically a program.  If no -f option is present,  make
40       will  look  for  the  makefiles GNUmakefile, makefile, and Makefile, in
41       that order.
42
43       Normally you should call your makefile  either  makefile  or  Makefile.
44       (We  recommend  Makefile because it appears prominently near the begin‐
45       ning of a directory listing, right near other important files  such  as
46       README.)   The  first name checked, GNUmakefile, is not recommended for
47       most makefiles.  You should use this name if you have a  makefile  that
48       is  specific  to GNU Make, and will not be understood by other versions
49       of make.  If makefile is '-', the standard input is read.
50
51       make updates a target if it depends on  prerequisite  files  that  have
52       been modified since the target was last modified, or if the target does
53       not exist.
54

OPTIONS

56       -b, -m
57            These options are ignored for compatibility with other versions of
58            make.
59
60       -B, --always-make
61            Unconditionally make all targets.
62
63       -C dir, --directory=dir
64            Change to directory dir before reading the makefiles or doing any‐
65            thing else.  If multiple -C options are specified, each is  inter‐
66            preted  relative to the previous one: -C / -C etc is equivalent to
67            -C /etc.  This is typically used  with  recursive  invocations  of
68            make.
69
70       -d   Print debugging information in addition to normal processing.  The
71            debugging information says which files are  being  considered  for
72            remaking,  which  file-times  are being compared and with what re‐
73            sults, which files actually need  to  be  remade,  which  implicit
74            rules  are considered and which are applied---everything interest‐
75            ing about how make decides what to do.
76
77       --debug[=FLAGS]
78            Print debugging information in addition to normal processing.   If
79            the  FLAGS are omitted, then the behavior is the same as if -d was
80            specified.  FLAGS may be any or all of the following names, comma-
81            or  space-separated.  Only the first character is significant: the
82            rest may be omitted: all for all debugging output (same  as  using
83            -d), basic for basic debugging, verbose for more verbose basic de‐
84            bugging, implicit for showing  implicit  rule  search  operations,
85            jobs for details on invocation of commands, makefile for debugging
86            while remaking makefiles, print shows all  recipes  that  are  run
87            even  if they are silent, and why shows the reason make decided to
88            rebuild each target.  Use none to disable all  previous  debugging
89            flags.
90
91       -e, --environment-overrides
92            Give  variables  taken  from the environment precedence over vari‐
93            ables from makefiles.
94
95       -E string, --eval string
96            Interpret string using the eval function, before parsing any make‐
97            files.
98
99       -f file, --file=file, --makefile=FILE
100            Use file as a makefile.
101
102       -i, --ignore-errors
103            Ignore all errors in commands executed to remake files.
104
105       -I dir, --include-dir=dir
106            Specifies  a  directory  dir to search for included makefiles.  If
107            several -I options are used to specify  several  directories,  the
108            directories are searched in the order specified.  Unlike the argu‐
109            ments to other flags of make, directories given with -I flags  may
110            come directly after the flag: -Idir is allowed, as well as -I dir.
111            This syntax is allowed for compatibility with the C preprocessor's
112            -I flag.
113
114       -j [jobs], --jobs[=jobs]
115            Specifies the number of jobs (commands) to run simultaneously.  If
116            there is more than one -j option, the last one is  effective.   If
117            the  -j  option  is given without an argument, make will not limit
118            the number of jobs that can run simultaneously.
119
120       --jobserver-style=style
121            The style of jobserver to use.  The style  may  be  one  of  fifo,
122            pipe, or sem (Windows only).
123
124       -k, --keep-going
125            Continue  as  much  as  possible after an error.  While the target
126            that failed, and those that depend on it, cannot  be  remade,  the
127            other dependencies of these targets can be processed all the same.
128
129       -l [load], --load-average[=load]
130            Specifies  that  no new jobs (commands) should be started if there
131            are others jobs running and the load average is at least  load  (a
132            floating-point number).  With no argument, removes a previous load
133            limit.
134
135       -L, --check-symlink-times
136            Use the latest mtime between symlinks and target.
137
138       -n, --just-print, --dry-run, --recon
139            Print the commands that would be executed, but do not execute them
140            (except in certain circumstances).
141
142       -o file, --old-file=file, --assume-old=file
143            Do not remake the file file even if it is older than its dependen‐
144            cies, and do not remake anything on account of  changes  in  file.
145            Essentially  the file is treated as very old and its rules are ig‐
146            nored.
147
148       -O[type], --output-sync[=type]
149            When running multiple jobs in parallel with -j, ensure the  output
150            of  each  job  is collected together rather than interspersed with
151            output from other jobs.  If type is not specified or is target the
152            output from the entire recipe for each target is grouped together.
153            If type is line the output from each command line within a  recipe
154            is grouped together.  If type is recurse output from an entire re‐
155            cursive make is grouped together.  If type is none output synchro‐
156            nization is disabled.
157
158       -p, --print-data-base
159            Print  the data base (rules and variable values) that results from
160            reading the makefiles; then execute as usual or as otherwise spec‐
161            ified.   This  also prints the version information given by the -v
162            switch (see below).  To print the data base without trying to  re‐
163            make any files, use make -p -f/dev/null.
164
165       -q, --question
166            ``Question  mode''.   Do  not run any commands, or print anything;
167            just return an exit status that is zero if the  specified  targets
168            are already up to date, nonzero otherwise.
169
170       -r, --no-builtin-rules
171            Eliminate  use of the built-in implicit rules.  Also clear out the
172            default list of suffixes for suffix rules.
173
174       -R, --no-builtin-variables
175            Don't define any built-in variables.
176
177       -s, --silent, --quiet
178            Silent operation; do not print the commands as they are executed.
179
180       --no-silent
181            Cancel the effect of the -s option.
182
183       -S, --no-keep-going, --stop
184            Cancel the effect of the -k option.
185
186       -t, --touch
187            Touch files (mark them up to date without  really  changing  them)
188            instead  of  running their commands.  This is used to pretend that
189            the commands were done, in order to  fool  future  invocations  of
190            make.
191
192       --trace
193            Information  about  the disposition of each target is printed (why
194            the target is being rebuilt and what commands are run  to  rebuild
195            it).
196
197       -v, --version
198            Print  the version of the make program plus a copyright, a list of
199            authors and a notice that there is no warranty.
200
201       -w, --print-directory
202            Print a message containing the working directory before and  after
203            other  processing.   This  may  be useful for tracking down errors
204            from complicated nests of recursive make commands.
205
206       --no-print-directory
207            Turn off -w, even if it was turned on implicitly.
208
209       --shuffle[=MODE]
210            Enable shuffling of goal and prerequisite ordering.  MODE  is  one
211            of  none  to disable shuffle mode, random to shuffle prerequisites
212            in random order, reverse to consider prerequisites in reverse  or‐
213            der,  or  an  integer <seed> which enables random mode with a spe‐
214            cific seed value.  If MODE is omitted the default is random.
215
216       -W file, --what-if=file, --new-file=file, --assume-new=file
217            Pretend that the target file has just been  modified.   When  used
218            with  the -n flag, this shows you what would happen if you were to
219            modify that file.  Without -n, it is almost the same as running  a
220            touch  command  on the given file before running make, except that
221            the modification time is changed only in the imagination of make.
222
223       --warn-undefined-variables
224            Warn when an undefined variable is referenced.
225

EXIT STATUS

227       GNU Make exits with a status of zero if all makefiles were successfully
228       parsed  and no targets that were built failed.  A status of one will be
229       returned if the -q flag was used and  make  determines  that  a  target
230       needs  to  be  rebuilt.  A status of two will be returned if any errors
231       were encountered.
232

SEE ALSO

234       The full documentation for make is maintained as a Texinfo manual.   If
235       the  info  and  make  programs are properly installed at your site, the
236       command
237
238              info make
239
240       should give you access to the complete manual.
241

BUGS

243       See the chapter ``Problems and Bugs'' in The GNU Make Manual.
244

AUTHOR

246       This manual page contributed by Dennis Morse  of  Stanford  University.
247       Further updates contributed by Mike Frysinger.  It has been reworked by
248       Roland McGrath.  Maintained by Paul Smith.
249
251       Copyright © 1992-1993, 1996-2023 Free Software Foundation,  Inc.   This
252       file is part of GNU Make.
253
254       GNU Make is free software; you can redistribute it and/or modify it un‐
255       der the terms of the GNU General Public License  as  published  by  the
256       Free  Software Foundation; either version 3 of the License, or (at your
257       option) any later version.
258
259       GNU Make is distributed in the hope that it will be useful, but WITHOUT
260       ANY  WARRANTY;  without even the implied warranty of MERCHANTABILITY or
261       FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General  Public  License
262       for more details.
263
264       You should have received a copy of the GNU General Public License along
265       with this program.  If not, see https://www.gnu.org/licenses/.
266
267
268
269GNU                               26 May 2023                          MAKE(1)
Impressum