blob: 90aa329eb7836824a7a45383e4b5b157124d815c [file] [log] [blame]
Junio C Hamano2731d042005-12-01 12:26:41 -08001# The default target of this Makefile is...
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002all::
Junio C Hamano2731d042005-12-01 12:26:41 -08003
Shawn O. Pearce2314c942007-03-06 02:09:14 -05004# Define V=1 to have a more verbose compile.
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05005#
Junio C Hamano0e0aea52009-06-05 18:36:15 -05006# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
7#
8# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
9# to PATH if your tools in /usr/bin are broken.
10#
Gary V. Vaughane88a1352010-05-14 09:31:42 +000011# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
12# system headers do not define a socklen_t type.
13#
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +000014# Define INLINE to a suitable substitute (such as '__inline' or '') if git
15# fails to compile with errors about undefined inline functions or similar.
16#
Ian Liu Rodrigues3b2c5412014-09-13 11:20:22 -030017# Define SNPRINTF_RETURNS_BOGUS if you are on a system which snprintf()
Michal Rokosc4582f92008-03-05 16:46:13 +010018# or vsnprintf() return -1 instead of number of characters which would
19# have been written to the final string if enough space had been available.
20#
Ian Liu Rodrigues3b2c5412014-09-13 11:20:22 -030021# Define FREAD_READS_DIRECTORIES if you are on a system which succeeds
Jeff King3adf9fd2017-06-14 01:30:18 -040022# when attempting to read from an fopen'ed directory (or even to fopen
23# it at all).
Brandon Caseycba22522008-02-08 20:32:47 -060024#
Linus Torvalds765ac8e2006-02-28 15:07:20 -080025# Define NO_OPENSSL environment variable if you do not have OpenSSL.
Petr Baudis5bdac8b2005-07-29 17:48:26 +020026#
Ævar Arnfjörð Bjarmason072473e2017-05-20 21:42:04 +000027# Define USE_LIBPCRE if you have and want to use libpcre. Various
28# commands such as log and grep offer runtime options to use
29# Perl-compatible regular expressions instead of standard or extended
30# POSIX regular expressions.
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +020031#
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +000032# USE_LIBPCRE is a synonym for USE_LIBPCRE2, define USE_LIBPCRE1
33# instead if you'd like to use the legacy version 1 of the PCRE
34# library. Support for version 1 will likely be removed in some future
35# release of Git, as upstream has all but abandoned it.
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +000036#
Carlo Marcelo Arenas Belón8991da62019-08-25 11:22:22 -070037# When using USE_LIBPCRE1, define NO_LIBPCRE1_JIT if you want to
38# disable JIT even if supported by your library.
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +000039#
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +000040# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
41# in /foo/bar/include and /foo/bar/lib directories. Which version of
42# PCRE this points to determined by the USE_LIBPCRE1 and USE_LIBPCRE2
43# variables.
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +020044#
Kirill Smelkov61f76a32014-03-27 18:22:50 +040045# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
46#
Tay Ray Chuand24d9052011-08-03 20:07:57 +080047# Define NO_CURL if you do not have libcurl installed. git-http-fetch and
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080048# git-http-push are not built, and you cannot use http:// and https://
Tay Ray Chuand24d9052011-08-03 20:07:57 +080049# transports (neither smart nor dumb).
Johannes Schindelinb2c0bd62005-07-31 02:14:23 +020050#
Patrick Mauritz6d9bbc52005-09-19 16:11:19 +020051# Define CURLDIR=/foo/bar if your curl header and library files are in
Junio C Hamanob2feb642014-04-30 10:58:10 -070052# /foo/bar/include and /foo/bar/lib directories.
Patrick Mauritz6d9bbc52005-09-19 16:11:19 +020053#
Remi Pommarelf8915872015-10-21 19:10:46 +020054# Define CURL_CONFIG to curl's configuration program that prints information
55# about the library (e.g., its version number). The default is 'curl-config'.
56#
James Knight23c4bbe2018-11-03 05:12:11 +000057# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl,
58# if you do not want to rely on the libraries provided by CURL_CONFIG. The
59# default value is a result of `curl-config --libs`. An example value for
60# CURL_LDFLAGS is as follows:
61#
62# CURL_LDFLAGS=-lcurl
63#
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080064# Define NO_EXPAT if you do not have expat installed. git-http-push is
Tay Ray Chuand24d9052011-08-03 20:07:57 +080065# not built, and you cannot push using http:// and https:// transports (dumb).
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080066#
Serge van den Boom85b45182009-01-28 21:43:57 +010067# Define EXPATDIR=/foo/bar if your expat header and library files are in
68# /foo/bar/include and /foo/bar/lib directories.
69#
Matt Kraai081fd8d2013-02-11 14:03:45 -080070# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
71# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
72#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010073# Define NO_GETTEXT if you don't want Git output to be translated.
74# A translated Git requires GNU libintl or another gettext implementation,
75# plus libintl-perl at runtime.
76#
Alex Riesenad17ea72012-01-23 14:04:29 -080077# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
78# the installed gettext translation of the shell scripts output.
79#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010080# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
81# trust the langinfo.h's nl_langinfo(CODESET) function to return the
82# current character set. GNU and Solaris have a nl_langinfo(CODESET),
83# FreeBSD can use either, but MinGW and some others need to use
84# libcharset.h's locale_charset() instead.
85#
Дилян Палаузов3064b132014-03-11 23:37:33 +010086# Define CHARSET_LIB to the library you need to link with in order to
Дилян Палаузовb5225282012-02-12 17:23:36 +010087# use locale_charset() function. On some platforms this needs to set to
Дилян Палаузов3064b132014-03-11 23:37:33 +010088# -lcharset, on others to -liconv .
Дилян Палаузовb5225282012-02-12 17:23:36 +010089#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010090# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
91# need -lintl when linking.
92#
93# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
94# doesn't support GNU extensions like --check and --statistics
95#
Chris Webbcb6a22c2010-04-13 10:07:13 +010096# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
97# it specifies.
98#
Junio C Hamano63be37b2006-01-19 17:13:57 -080099# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
Eric Blakea50dec22010-04-01 16:43:54 -0600100# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
Junio C Hamano63be37b2006-01-19 17:13:57 -0800101#
David Michaelb3e103d2012-12-14 14:57:01 -0500102# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
103#
Linus Torvaldsef34af22005-09-18 18:30:50 -0700104# Define NO_STRCASESTR if you don't have strcasestr.
105#
René Scharfeb21b9f12007-09-07 00:32:54 +0200106# Define NO_MEMMEM if you don't have memmem.
107#
Matt Kraai40036be2012-12-18 14:03:55 -0800108# Define NO_GETPAGESIZE if you don't have getpagesize.
109#
Peter Eriksen817151e2006-06-24 16:01:25 +0200110# Define NO_STRLCPY if you don't have strlcpy.
111#
Nick Alcocke3eed7f2011-11-02 15:46:22 +0000112# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
113# C library. If your compiler also does not support long long or does not have
Jason Riedybc6b4f52007-02-19 16:22:56 -0800114# strtoull, define NO_STRTOULL.
115#
Jason Riedye40b61f2005-12-02 15:08:28 -0800116# Define NO_SETENV if you don't have setenv in the C library.
117#
Jakub Narebskibfa8fcc2008-01-18 02:03:51 +0100118# Define NO_UNSETENV if you don't have unsetenv in the C library.
119#
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -0400120# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
121#
Joachim Schmitzdc9f4622012-09-08 19:01:31 +0200122# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
123#
Rafael Gieschke590e0812011-05-19 13:37:55 +0200124# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
125# in the C library.
126#
David Aguilare1c06882009-05-31 01:35:51 -0700127# Define NO_LIBGEN_H if you don't have libgen.h.
128#
Brandon Caseyecc395c2009-07-10 12:10:45 -0500129# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
130#
Robert Schiele26009732008-01-24 19:34:46 +0100131# Define NO_SYS_SELECT_H if you don't have sys/select.h.
132#
Junio C Hamano9f0bb902006-05-02 00:40:24 -0700133# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
134# Enable it on Windows. By default, symrefs are still used.
Pavel Roskin2fabd212005-11-15 00:59:50 -0500135#
Pavel Roskin02853582006-07-09 02:44:58 -0700136# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
Eric Wong60d02cc2006-07-06 00:14:16 -0700137# tests. These tests take up a significant amount of the total test time
138# but are not needed unless you plan to talk to SVN repos.
139#
Shawn Pearce8eb38ca2006-07-24 00:28:28 -0400140# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
141# installed in /sw, but don't want GIT to link against any libraries
142# installed there. If defined you may specify your own (or Fink's)
143# include directories and library directories by defining CFLAGS
144# and LDFLAGS appropriately.
145#
146# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
147# have DarwinPorts installed in /opt/local, but don't want GIT to
148# link against any libraries installed there. If defined you may
149# specify your own (or DarwinPort's) include directories and
150# library directories by defining CFLAGS and LDFLAGS appropriately.
151#
David Aguilar4dcd7732013-05-19 06:23:34 -0400152# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
153# and do not want to use Apple's CommonCrypto library. This allows you
154# to provide your own OpenSSL library, for example from MacPorts.
155#
Jonathan Niederf2001972012-07-23 01:29:14 -0500156# Define BLK_SHA1 environment variable to make use of the bundled
157# optimized C SHA1 routine.
Linus Torvaldsd7c208a2009-08-05 16:13:20 -0700158#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200159# Define PPC_SHA1 environment variable when running make to make use of
160# a bundled SHA1 routine optimized for PowerPC.
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700161#
Jeff King8325e432017-03-16 18:09:12 -0400162# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
163# algorithm. This is slower, but may detect attempted collision attacks.
164# Takes priority over other *_SHA1 knobs.
165#
Takashi Iwai3964cbb2017-08-15 14:04:17 +0200166# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
167# git with the external SHA1 collision-detect library.
168# Without this option, i.e. the default behavior is to build git with its
169# own built-in code (or submodule).
170#
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +0000171# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
172# sha1collisiondetection shipped as a submodule instead of the
173# non-submodule copy in sha1dc/. This is an experimental option used
174# by the git project to migrate to using sha1collisiondetection as a
175# submodule.
176#
Junio C Hamanoe6b07da2017-03-17 10:00:15 -0700177# Define OPENSSL_SHA1 environment variable when running make to link
178# with the SHA1 routine from openssl library.
179#
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -0800180# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
181# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
182# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
183#
brian m. carlson27dc04c2018-11-14 04:09:37 +0000184# Define BLK_SHA256 to use the built-in SHA-256 routines.
185#
186# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt.
187#
brian m. carlson4b4e2912018-11-14 04:09:38 +0000188# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL.
189#
Brian Gernhardt0460dba2009-09-08 09:54:38 -0400190# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
191#
192# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200193#
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700194# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200195#
Joachim Schmitz6c109902012-09-19 12:03:30 +0200196# Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
197#
Justin Lebar01689902014-03-31 15:11:46 -0700198# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
Joachim Schmitz6c109902012-09-19 12:03:30 +0200199#
200# Define NO_UINTMAX_T if you don't have uintmax_t.
201#
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200202# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
203# Patrick Mauritz).
204#
Brandon Casey70cf9912009-06-05 18:36:10 -0500205# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
206# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
207# inet_ntop and inet_pton additionally reside there.
208#
Johannes Schindelin730d48a2005-10-08 15:54:36 -0700209# Define NO_MMAP if you want to avoid mmap.
210#
Michael Haggerty5b633612017-09-25 10:00:10 +0200211# Define MMAP_PREVENTS_DELETE if a file that is currently mmapped cannot be
212# deleted or cannot be replaced using rename().
213#
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +0700214# Define NO_POLL_H if you don't have poll.h.
215#
Joachim Schmitz6d45eb12012-09-17 23:16:39 +0200216# Define NO_SYS_POLL_H if you don't have sys/poll.h.
217#
218# Define NO_POLL if you do not have or don't want to use poll().
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +0700219# This also implies NO_POLL_H and NO_SYS_POLL_H.
Joachim Schmitz6d45eb12012-09-17 23:16:39 +0200220#
Junio C Hamanob2d05e02012-12-18 09:35:33 -0800221# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
222# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
223# we want to know more about the issue.
David Michael6ede7202012-12-14 14:56:58 -0500224#
Junio C Hamano46059cc2008-11-15 04:08:14 -0800225# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
226#
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100227# Define NO_PREAD if you have a problem with pread() system call (e.g.
Eric Blakea50dec22010-04-01 16:43:54 -0600228# cygwin1.dll before v1.5.22).
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100229#
Joachim Schmitz7f9e8482012-09-08 18:54:34 +0200230# Define NO_SETITIMER if you don't have setitimer()
231#
232# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
233# This also implies NO_SETITIMER
234#
Shawn O. Pearce1510fea2006-12-14 06:15:57 -0500235# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
236# generally faster on your platform than accessing the working directory.
237#
Shawn O. Pearcec8697532006-12-30 23:53:55 -0500238# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
239# the executable mode bit, but doesn't really do so.
240#
David Michaeld543d9c2014-12-03 21:24:17 -0500241# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
242# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
243# usual 0xF000).
244#
hpa49744d62005-09-28 16:52:21 -0700245# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
246#
Johannes Sixt63203582011-12-12 22:12:56 +0100247# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
248#
Junio C Hamanobdc37f52006-01-19 17:13:32 -0800249# Define NO_SOCKADDR_STORAGE if your platform does not have struct
250# sockaddr_storage.
251#
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +0100252# Define NO_ICONV if your libc does not properly support iconv.
253#
Ramsay Jonesfd547a92007-03-03 18:29:03 +0000254# Define OLD_ICONV if your library has an old iconv(), where the second
255# (input buffer pointer) parameter is declared with type (const char **).
256#
brian m. carlson79444c92019-02-12 00:52:06 +0000257# Define ICONV_OMITS_BOM if your iconv implementation does not write a
258# byte-order mark (BOM) when writing UTF-16 or UTF-32 and always writes in
259# big-endian format.
260#
David Symonds609a2282007-11-07 14:24:28 +1100261# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
262#
Junio C Hamano6520c842011-06-18 18:07:03 -0700263# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
264# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
265#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200266# Define USE_NSEC below if you want git to care about sub-second file mtimes
Karsten Bleesb1ffafa2015-07-01 21:10:52 +0200267# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
268# Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
269# on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
270# on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
271# Documentation/technical/racy-git.txt for details.
Junio C Hamanof6af75d2006-06-23 17:57:48 -0700272#
Brian Gernhardtc5673832009-03-08 16:04:28 -0400273# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
274# "st_ctim"
275#
Kjetil Barvikc06ff492009-03-04 18:47:40 +0100276# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
277# available. This automatically turns USE_NSEC off.
278#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200279# Define USE_STDEV below if you want git to care about the underlying device
Johannes Schindelin10455d22007-11-30 11:35:23 +0000280# change being considered an inode change from the update-index perspective.
Alex Riesenf8487182006-12-04 10:50:04 +0100281#
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +0200282# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
283# field that counts the on-disk footprint in 512-byte blocks.
284#
Thomas Rast204d3632009-10-22 10:19:06 +0200285# Define GNU_ROFF if your target system uses GNU groff. This forces
286# apostrophes to be ASCII so that cut&pasting examples to the shell
287# will work.
288#
brian m. carlsonec3366e2017-01-22 02:41:56 +0000289# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
290# documentation.
291#
292# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
293# Extensions Lab if you have it available.
294#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800295# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
296#
Jeff King499c2932009-04-03 15:32:20 -0400297# Define NO_PERL if you do not want Perl scripts or libraries at all.
298#
Todd Zullinger075321c2018-03-03 15:38:16 +0000299# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
300# copies of CPAN modules that serve as a fallback in case the modules
301# are not available on the system. This option is intended for
302# distributions that want to use their packaged versions of Perl
303# modules, instead of the fallbacks shipped with Git.
304#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800305# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
306# but /usr/bin/python2.7 on some platforms).
307#
Johan Herlandd4e1b472009-11-18 02:42:31 +0100308# Define NO_PYTHON if you do not want Python scripts or libraries at all.
309#
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700310# Define NO_TCLTK if you do not want Tcl/Tk GUI.
311#
Junio C Hamano71b40102016-03-08 15:47:57 -0800312# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
313# and egrep that are pickier when their input contains non-ASCII data.
314#
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400315# The TCL_PATH variable governs the location of the Tcl interpreter
316# used to optimize git-gui for your system. Only used if NO_TCLTK
317# is not set. Defaults to the bare 'tclsh'.
318#
319# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700320# If not set it defaults to the bare 'wish'. If it is set to the empty
321# string then NO_TCLTK will be forced (this is used by configure script).
322#
Brian Downing43fe9012008-02-05 15:10:44 -0600323# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
324# is a simplified version of the merge sort used in glibc. This is
325# recommended if Git triggers O(n^2) behavior in your platform's qsort().
326#
René Scharfe04ee8b82017-01-22 18:51:11 +0100327# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
328# compatible with the one described in C11 Annex K.
329#
Johannes Sixt34779c52009-04-20 10:17:00 +0200330# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
331# information on a not yet closed file that lstat would return for the same
332# file after it was closed.
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200333#
Johannes Schindelin348df162009-04-28 00:32:25 +0200334# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
335# when hardlinking a file to another name and unlinking the original file right
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200336# away (some NTFS drivers seem to zero the contents in that scenario).
Junio C Hamano2c8f8b12009-05-23 01:43:08 -0700337#
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +0000338# Define INSTALL_SYMLINKS if you prefer to have everything that can be
339# symlinked between bin/ and libexec/ to use relative symlinks between
340# the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and
341# NO_INSTALL_HARDLINKS which will also use symlinking by indirection
342# within the same directory in some cases, INSTALL_SYMLINKS will
343# always symlink to the final target directly.
344#
Johannes Schindelin3426e342009-05-11 13:02:18 +0200345# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
346# programs as a tar, where bin/ and libexec/ might be on different file systems.
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200347#
Junio C Hamano70de5e62012-05-02 15:12:10 -0700348# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
349# copies to install built-in git commands e.g. git-cat-file.
350#
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200351# Define USE_NED_ALLOCATOR if you want to replace the platforms default
352# memory allocators with the nedmalloc allocator written by Niall Douglas.
Jeff King02232ad2009-06-16 15:07:40 -0400353#
René Scharfeca2baa32016-09-03 17:59:15 +0200354# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
355# This is necessary when using a custom allocator in order to avoid
356# crashes due to allocation and free working on different 'heaps'.
357# It's defined automatically if USE_NED_ALLOCATOR is set.
358#
Johannes Schindelin2f895222016-09-21 20:24:04 +0200359# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
360# feature.
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500361#
Jeff King21aeafc2011-12-10 05:41:01 -0500362# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
363# user.
364#
Jakub Narebski63267de2009-09-01 13:39:20 +0200365# Define JSMIN to point to JavaScript minifier that functions as
366# a filter to have gitweb.js minified.
Junio C Hamano8678bc02009-12-01 11:28:15 -0800367#
Mark Rada0e6ce212010-04-02 20:35:05 -0400368# Define CSSMIN to point to a CSS minifier in order to generate a minified
369# version of gitweb.css
370#
Junio C Hamanoa3d023d2009-10-30 20:45:34 -0500371# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
372# you want to use something different. The value will be interpreted by the
373# shell at runtime when it is used.
374#
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500375# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
376# want to use something different. The value will be interpreted by the shell
377# if necessary when it is used. Examples:
378#
379# DEFAULT_EDITOR='~/bin/vi',
380# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
381# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
Jonathan Niederdfea5752010-01-26 09:52:49 -0600382#
Jonathan Nieder024c8432011-11-18 03:58:21 -0600383# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
384# header files to be automatically computed, to avoid rebuilding objects when
385# an unrelated header file changes. Define it to "no" to use the hard-coded
386# dependency rules. The default is "auto", which means to use computed header
387# dependencies if your compiler is detected to support it.
388#
Eyvind Bernhardsen942e7742010-06-04 21:29:08 +0200389# Define NATIVE_CRLF if your platform uses CRLF for line endings.
Thomas Rast6942efc2012-04-06 23:01:23 +0200390#
Jeff King42dcbb72012-06-02 15:01:12 -0400391# Define GIT_USER_AGENT if you want to change how git identifies itself during
392# network interactions. The default is "git/$(GIT_VERSION)".
Junio C Hamanoa88d7aa2012-06-21 14:42:38 -0700393#
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +0000394# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
395# (defaults to "man") if you want to have a different default when
396# "git help" is called without a parameter specifying the format.
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100397#
Ben Peart1f357b02018-09-18 23:29:36 +0000398# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100399# with a different indexfile format version. If it isn't set the index
400# file format used is index-v[23].
Junio C Hamanobdb830c2014-04-08 11:59:05 -0700401#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400402# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -0800403#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400404# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
405#
406# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
407# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
Reuben Hawkins88e01182015-01-08 12:00:57 -0800408#
Kyle J. McKay290c8e72015-01-11 12:09:22 -0800409# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
410# compiles the following initialization:
411#
412# static const char s[] = ("FOO");
413#
414# and define it to "no" if you need to remove the parentheses () around the
415# constant. The default is "auto", which means to use parentheses if your
416# compiler is detected to support it.
Junio C Hamano551fc7a2015-03-20 13:11:49 -0700417#
Kyle J. McKay95290802015-03-07 23:14:36 -0800418# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
Jeff King0cc30e02015-04-16 05:01:38 -0400419#
420# Define HAVE_GETDELIM if your system has the getdelim() function.
Eric Wong995bc222016-08-04 11:40:25 +0000421#
Duy Nguyen18a4f6b2019-02-12 21:14:41 +0700422# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
423#
Clément Chigot400caaf2019-04-25 07:01:56 +0000424# Define NEED_ACCESS_ROOT_HANDLER if access() under root may success for X_OK
425# even if execution permission isn't granted for any user.
426#
Eric Wong995bc222016-08-04 11:40:25 +0000427# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
428# default environment variables to be passed when a pager is spawned, e.g.
429#
430# PAGER_ENV = LESS=FRX LV=-c
431#
432# to say "export LESS=FRX (and LV=-c) if the environment variable
433# LESS (and LV) is not set, respectively".
Eric Sunshineb2289402017-12-15 00:34:34 +0100434#
Jeff King3f824e92017-12-08 05:47:22 -0500435# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
436# running the test scripts (e.g., bash has better support for "set -x"
437# tracing).
Junio C Hamano07b747d2018-01-05 13:28:09 -0800438#
Eric Sunshineb2289402017-12-15 00:34:34 +0100439# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
440# which the built Git will run (for instance "x86_64").
Dan Jacques07d90ea2018-04-10 11:05:43 -0400441#
442# Define RUNTIME_PREFIX to configure Git to resolve its ancillary tooling and
443# support files relative to the location of the runtime binary, rather than
444# hard-coding them into the binary. Git installations built with RUNTIME_PREFIX
445# can be moved to arbitrary filesystem locations. RUNTIME_PREFIX also causes
446# Perl scripts to use a modified entry point header allowing them to resolve
447# support files at runtime.
Dan Jacques226c0dd2018-04-10 11:05:44 -0400448#
449# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
450# supports the KERN_PROC BSD sysctl function.
451#
452# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform
453# mounts a "procfs" filesystem capable of resolving the path of the current
454# executable. If defined, this must be the canonical path for the "procfs"
455# current executable path.
456#
457# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform
458# supports calling _NSGetExecutablePath to retrieve the path of the running
459# executable.
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -0400460#
461# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
462# the global variable _wpgmptr containing the absolute path of the current
463# executable (this is the case on Windows).
Junio C Hamanoe998e7a2018-05-08 15:59:21 +0900464#
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +0000465# Define DEVELOPER to enable more compiler warnings. Compiler version
466# and family are auto detected, but could be overridden by defining
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +0100467# COMPILER_FEATURES (see config.mak.dev). You can still set
468# CFLAGS="..." in combination with DEVELOPER enables, whether that's
469# for tweaking something unrelated (e.g. optimization level), or for
470# selectively overriding something DEVELOPER or one of the DEVOPTS
471# (see just below) brings in.
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000472#
473# When DEVELOPER is set, DEVOPTS can be used to control compiler
474# options. This variable contains keywords separated by
ryenus571fb962019-12-15 15:12:24 +0000475# whitespace. The following keywords are recognized:
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000476#
477# no-error:
478#
479# suppresses the -Werror that implicitly comes with
480# DEVELOPER=1. Useful for getting the full set of errors
481# without immediately dying, or for logging them.
Ævar Arnfjörð Bjarmason26d2e4f2018-04-14 19:19:46 +0000482#
483# extra-all:
484#
485# The DEVELOPER mode enables -Wextra with a few exceptions. By
486# setting this flag the exceptions are removed, and all of
487# -Wextra is used.
Beat Bolli729b3922018-07-24 21:26:43 +0200488#
489# pedantic:
490#
491# Enable -pedantic compilation. This also disables
492# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200493
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600494GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100495 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800496-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200497
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100498# Set our default configuration.
499#
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200500# Among the variables below, these:
501# gitexecdir
502# template_dir
Johannes Sixt9fb1e692011-05-09 10:24:55 +0200503# sysconfdir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100504# can be specified as a relative path some/where/else;
505# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200506# runtime figures out where they are based on the path to the executable.
John Keeping971f8532013-02-24 19:55:01 +0000507# Additionally, the following will be treated as relative by "git" if they
508# begin with "$(prefix)/":
509# mandir
510# infodir
511# htmldir
Dan Jacques07d90ea2018-04-10 11:05:43 -0400512# localedir
513# perllibdir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200514# This can help installing the suite in a relocatable way.
515
Pavel Roskinb05701c2005-08-06 01:36:15 -0400516prefix = $(HOME)
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000517bindir = $(prefix)/bin
John Keeping971f8532013-02-24 19:55:01 +0000518mandir = $(prefix)/share/man
519infodir = $(prefix)/share/info
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100520gitexecdir = libexec/git-core
David Aguilarbc7a96a2011-08-18 00:23:46 -0700521mergetoolsdir = $(gitexecdir)/mergetools
Johannes Sixt93547682007-06-11 10:02:17 +0200522sharedir = $(prefix)/share
Pavan Kumar Sunkarabc951962010-05-28 11:55:50 +0530523gitwebdir = $(sharedir)/gitweb
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000524perllibdir = $(sharedir)/perl5
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100525localedir = $(sharedir)/locale
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100526template_dir = share/git-core/templates
John Keeping971f8532013-02-24 19:55:01 +0000527htmldir = $(prefix)/share/doc/git-doc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100528ETC_GITCONFIG = $(sysconfdir)/gitconfig
Petr Onderka6df42ab2010-09-01 00:42:43 +0200529ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
Robert Schiele10861be2007-08-01 06:30:35 +0200530lib = lib
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100531# DESTDIR =
Johannes Schindelin352c8112009-05-23 10:04:48 +0200532pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700533
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000534bindir_relative = $(patsubst $(prefix)/%,%,$(bindir))
John Keeping971f8532013-02-24 19:55:01 +0000535mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
536infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +0000537gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400538localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
John Keeping971f8532013-02-24 19:55:01 +0000539htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400540perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
John Keeping971f8532013-02-24 19:55:01 +0000541
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000542export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200543
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100544# Set our default programs
Ævar Arnfjörð Bjarmason6d62c982011-12-20 23:40:47 +0000545CC = cc
Pavel Roskinb05701c2005-08-06 01:36:15 -0400546AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500547RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000548DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700549TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700550FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400551INSTALL = install
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400552TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700553TCLTK_PATH = wish
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +0000554XGETTEXT = xgettext
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100555MSGFMT = msgfmt
Remi Pommarelf8915872015-10-21 19:10:46 +0200556CURL_CONFIG = curl-config
Thomas Raste146d172010-07-26 09:43:41 +0200557GCOV = gcov
Ævar Arnfjörð Bjarmason9559f8f2019-02-22 15:41:23 +0100558STRIP = strip
René Scharfe63f0a752016-09-15 20:30:56 +0200559SPATCH = spatch
Linus Torvaldse83c5162005-04-07 15:13:13 -0700560
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400561export TCL_PATH TCLTK_PATH
562
Ævar Arnfjörð Bjarmason8fb2a232019-02-22 15:41:25 +0100563# Set our default LIBS variables
564PTHREAD_LIBS = -lpthread
Petr Baudis8d7f5862006-06-25 03:47:03 +0200565
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100566# Guard against environment variables
567BUILTIN_OBJS =
568BUILT_INS =
569COMPAT_CFLAGS =
570COMPAT_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500571XDIFF_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500572VCSSVN_OBJS =
Jeff Kingb8ba6292012-06-20 14:30:56 -0400573GENERATED_H =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500574EXTRA_CPPFLAGS =
Josh Steadmon5e472152018-10-12 17:58:40 -0700575FUZZ_OBJS =
576FUZZ_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100577LIB_OBJS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600578PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100579PROGRAMS =
Johannes Schindelin724d6352019-04-18 06:16:40 -0700580EXCLUDED_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100581SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100582SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100583SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800584SCRIPT_LIB =
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100585TEST_BUILTINS_OBJS =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600586TEST_PROGRAMS_NEED_X =
Denton Liu5dedf7d2019-09-16 12:23:11 -0700587THIRD_PARTY_SOURCES =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100588
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500589# Having this variable in your environment would break pipelines because
590# you cause "cd" to echo its destination to stdout. It can also take
591# scripts to unexpected places. If you like CDPATH, define it for your
592# interactive shell sessions without exporting it.
593unexport CDPATH
594
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700595SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700596SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700597SCRIPT_SH += git-filter-branch.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700598SCRIPT_SH += git-merge-octopus.sh
599SCRIPT_SH += git-merge-one-file.sh
600SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700601SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700602SCRIPT_SH += git-quiltimport.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700603SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700604SCRIPT_SH += git-submodule.sh
605SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200606
Jonathan Nieder46bac902010-01-31 11:46:53 -0800607SCRIPT_LIB += git-mergetool--lib
608SCRIPT_LIB += git-parse-remote
Alban Gruinc42abfe2018-05-28 14:34:19 +0200609SCRIPT_LIB += git-rebase--preserve-merges
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000610SCRIPT_LIB += git-sh-i18n
Denton Liu805d9ea2020-03-21 05:21:20 -0400611SCRIPT_LIB += git-sh-setup
Jonathan Nieder46bac902010-01-31 11:46:53 -0800612
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700613SCRIPT_PERL += git-add--interactive.perl
614SCRIPT_PERL += git-archimport.perl
615SCRIPT_PERL += git-cvsexportcommit.perl
616SCRIPT_PERL += git-cvsimport.perl
617SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700618SCRIPT_PERL += git-send-email.perl
619SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700620
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400621SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500622
Matthieu Moy4c06b412013-02-08 18:31:16 +0100623# Generated files for scripts
624SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
625SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
626SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
627
628# Individual rules to allow e.g.
629# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
630# from subdirectories like contrib/*/
631.PHONY: build-perl-script build-sh-script build-python-script
632build-perl-script: $(SCRIPT_PERL_GEN)
633build-sh-script: $(SCRIPT_SH_GEN)
634build-python-script: $(SCRIPT_PYTHON_GEN)
635
636.PHONY: install-perl-script install-sh-script install-python-script
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700637install-sh-script: $(SCRIPT_SH_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500638 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700639install-perl-script: $(SCRIPT_PERL_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500640 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700641install-python-script: $(SCRIPT_PYTHON_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500642 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100643
644.PHONY: clean-perl-script clean-sh-script clean-python-script
645clean-sh-script:
646 $(RM) $(SCRIPT_SH_GEN)
647clean-perl-script:
648 $(RM) $(SCRIPT_PERL_GEN)
649clean-python-script:
650 $(RM) $(SCRIPT_PYTHON_GEN)
651
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700652SCRIPTS = $(SCRIPT_SH_GEN) \
653 $(SCRIPT_PERL_GEN) \
654 $(SCRIPT_PYTHON_GEN) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500655 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100656
Junio C Hamano2f769192010-09-28 16:08:38 -0500657ETAGS_TARGET = TAGS
658
Josh Steadmonaa658572019-01-15 14:25:50 -0800659FUZZ_OBJS += fuzz-commit-graph.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700660FUZZ_OBJS += fuzz-pack-headers.o
Josh Steadmon1127a982018-10-12 17:58:41 -0700661FUZZ_OBJS += fuzz-pack-idx.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700662
663# Always build fuzz objects even if not testing, to prevent bit-rot.
664all:: $(FUZZ_OBJS)
665
666FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
667
Junio C Hamano42f77402006-08-15 21:38:07 -0700668# Empty...
669EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100670
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700671# ... and all the rest that could be moved out of bindir to gitexecdir
672PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600673
Emily Shaffer238b4392020-04-16 14:18:04 -0700674PROGRAM_OBJS += bugreport.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700675PROGRAM_OBJS += credential-store.o
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100676PROGRAM_OBJS += daemon.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600677PROGRAM_OBJS += fast-import.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700678PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600679PROGRAM_OBJS += imap-send.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400680PROGRAM_OBJS += remote-testsvn.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700681PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600682PROGRAM_OBJS += shell.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600683
Michael Palimakaace5e972012-02-08 21:59:04 +1100684# Binary suffix, set to .exe for Windows builds
685X =
686
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600687PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700688
Heba Walyb3b18d12020-03-02 20:01:59 +0000689TEST_BUILTINS_OBJS += test-advise.o
Garima Singhf52207a2020-03-30 00:31:24 +0000690TEST_BUILTINS_OBJS += test-bloom.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100691TEST_BUILTINS_OBJS += test-chmtime.o
Nguyễn Thái Ngọc Duy0e2678a2018-03-24 08:44:34 +0100692TEST_BUILTINS_OBJS += test-config.o
Nguyễn Thái Ngọc Duye4998942018-03-24 08:44:35 +0100693TEST_BUILTINS_OBJS += test-ctype.o
Nguyễn Thái Ngọc Duya801a7c2018-03-24 08:44:36 +0100694TEST_BUILTINS_OBJS += test-date.o
Nguyễn Thái Ngọc Duy9153dde2018-03-24 08:44:37 +0100695TEST_BUILTINS_OBJS += test-delta.o
Daniel Ferreira150791a2019-07-10 20:58:57 -0300696TEST_BUILTINS_OBJS += test-dir-iterator.o
Nguyễn Thái Ngọc Duy1c854742018-03-24 08:44:38 +0100697TEST_BUILTINS_OBJS += test-drop-caches.o
Nguyễn Thái Ngọc Duy06ccb292018-03-24 08:44:39 +0100698TEST_BUILTINS_OBJS += test-dump-cache-tree.o
Nguyễn Thái Ngọc Duyf1ef0b02018-09-09 19:36:30 +0200699TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
Nguyễn Thái Ngọc Duy81330612018-03-24 08:44:40 +0100700TEST_BUILTINS_OBJS += test-dump-split-index.o
Nguyễn Thái Ngọc Duycd780f02018-09-09 19:36:27 +0200701TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
Nguyễn Thái Ngọc Duydbceb3e2018-03-24 08:44:41 +0100702TEST_BUILTINS_OBJS += test-example-decorate.o
Nguyễn Thái Ngọc Duyc6806682018-03-24 08:44:42 +0100703TEST_BUILTINS_OBJS += test-genrandom.o
Johannes Schindelind5cfd142019-02-14 13:33:12 -0800704TEST_BUILTINS_OBJS += test-genzeros.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400705TEST_BUILTINS_OBJS += test-hash-speed.o
brian m. carlson50c817e2018-11-14 04:09:32 +0000706TEST_BUILTINS_OBJS += test-hash.o
Nguyễn Thái Ngọc Duy7c18cbd2018-03-24 08:44:43 +0100707TEST_BUILTINS_OBJS += test-hashmap.o
Nguyễn Thái Ngọc Duycc6f6632018-03-24 08:44:44 +0100708TEST_BUILTINS_OBJS += test-index-version.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000709TEST_BUILTINS_OBJS += test-json-writer.o
Nguyễn Thái Ngọc Duy64eb82f2018-03-24 08:44:33 +0100710TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
Nguyễn Thái Ngọc Duy9080e752018-03-24 08:44:45 +0100711TEST_BUILTINS_OBJS += test-match-trees.o
Nguyễn Thái Ngọc Duy34889d32018-03-24 08:44:46 +0100712TEST_BUILTINS_OBJS += test-mergesort.o
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +0100713TEST_BUILTINS_OBJS += test-mktemp.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700714TEST_BUILTINS_OBJS += test-oid-array.o
Christian Couder11510de2019-06-15 12:06:59 +0200715TEST_BUILTINS_OBJS += test-oidmap.o
Nguyễn Thái Ngọc Duyc033cc12018-03-24 08:44:48 +0100716TEST_BUILTINS_OBJS += test-online-cpus.o
Nguyễn Thái Ngọc Duy2f17c782018-09-09 19:36:29 +0200717TEST_BUILTINS_OBJS += test-parse-options.o
Alexandr Miloslavskiyd0d0a352019-12-31 10:15:12 +0000718TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
Nguyễn Thái Ngọc Duyb8d5cf42018-03-24 08:44:49 +0100719TEST_BUILTINS_OBJS += test-path-utils.o
Nguyễn Thái Ngọc Duy8ea40cc2018-09-09 19:36:28 +0200720TEST_BUILTINS_OBJS += test-pkt-line.o
Nguyễn Thái Ngọc Duy15b75812018-03-24 08:44:50 +0100721TEST_BUILTINS_OBJS += test-prio-queue.o
SZEDER Gábor2bb74b52019-09-16 22:54:12 +0200722TEST_BUILTINS_OBJS += test-progress.o
Derrick Stoleeab176ac2018-07-20 16:33:15 +0000723TEST_BUILTINS_OBJS += test-reach.o
Nguyễn Thái Ngọc Duy5fbe6002018-03-24 08:44:51 +0100724TEST_BUILTINS_OBJS += test-read-cache.o
Derrick Stolee4bd05932019-11-12 16:58:20 +0000725TEST_BUILTINS_OBJS += test-read-graph.o
Derrick Stolee4d805602018-07-12 15:39:23 -0400726TEST_BUILTINS_OBJS += test-read-midx.o
Nguyễn Thái Ngọc Duy65370d82018-03-24 08:44:52 +0100727TEST_BUILTINS_OBJS += test-ref-store.o
Nguyễn Thái Ngọc Duy90385312018-03-24 08:44:53 +0100728TEST_BUILTINS_OBJS += test-regex.o
Jonathan Tandade47c2018-07-11 15:42:42 -0700729TEST_BUILTINS_OBJS += test-repository.o
Nguyễn Thái Ngọc Duy77d4b8c2018-03-24 08:44:54 +0100730TEST_BUILTINS_OBJS += test-revision-walking.o
Nguyễn Thái Ngọc Duyae6a51f2018-03-24 08:44:55 +0100731TEST_BUILTINS_OBJS += test-run-command.o
Nguyễn Thái Ngọc Duyff5fb8b2018-03-24 08:44:56 +0100732TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
Johannes Schindelinb7ce24d2019-04-18 06:16:51 -0700733TEST_BUILTINS_OBJS += test-serve-v2.o
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +0100734TEST_BUILTINS_OBJS += test-sha1.o
brian m. carlson13eeedb2018-11-14 04:09:36 +0000735TEST_BUILTINS_OBJS += test-sha256.o
Nguyễn Thái Ngọc Duye154a6f2018-03-24 08:44:58 +0100736TEST_BUILTINS_OBJS += test-sigchain.o
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +0100737TEST_BUILTINS_OBJS += test-strcmp-offset.o
Nguyễn Thái Ngọc Duyc932a5f2018-03-24 08:45:00 +0100738TEST_BUILTINS_OBJS += test-string-list.o
Nguyễn Thái Ngọc Duyb6188212018-03-24 08:45:01 +0100739TEST_BUILTINS_OBJS += test-submodule-config.o
Antonio Ospite2b1257e2018-10-25 18:18:13 +0200740TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
Nguyễn Thái Ngọc Duy112edd62018-03-24 08:45:02 +0100741TEST_BUILTINS_OBJS += test-subprocess.o
Jeff Hostetlera15860d2019-02-22 14:25:10 -0800742TEST_BUILTINS_OBJS += test-trace2.o
Nguyễn Thái Ngọc Duy599fbd82018-03-24 08:45:03 +0100743TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
Nguyễn Thái Ngọc Duy04892892018-03-24 08:45:04 +0100744TEST_BUILTINS_OBJS += test-wildmatch.o
Jeff Hostetler06ba9d02018-09-11 13:06:01 -0700745TEST_BUILTINS_OBJS += test-windows-named-pipe.o
Nguyễn Thái Ngọc Duyc81f8432018-03-24 08:45:05 +0100746TEST_BUILTINS_OBJS += test-write-cache.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400747TEST_BUILTINS_OBJS += test-xml-encode.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100748
Nguyễn Thái Ngọc Duyc9a1f412018-09-09 19:36:31 +0200749# Do not add more tests here unless they have extra dependencies. Add
750# them in TEST_BUILTINS_OBJS above.
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100751TEST_PROGRAMS_NEED_X += test-fake-ssh
David Barr3bbaec02010-08-09 17:39:43 -0500752TEST_PROGRAMS_NEED_X += test-line-buffer
David Barr21746aa2010-08-09 17:55:00 -0500753TEST_PROGRAMS_NEED_X += test-svn-fe
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100754TEST_PROGRAMS_NEED_X += test-tool
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600755
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700756TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100757
Junio C Hamano17368552008-02-23 11:08:25 -0800758# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800759# builtin/$C.o but is linked in as part of some other command.
760BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700761
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700762BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100763BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700764BUILT_INS += git-format-patch$X
765BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700766BUILT_INS += git-init$X
767BUILT_INS += git-merge-subtree$X
Nguyễn Thái Ngọc Duy46e91b62019-04-25 16:45:45 +0700768BUILT_INS += git-restore$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700769BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800770BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700771BUILT_INS += git-status$X
Nguyễn Thái Ngọc Duyd787d312019-03-29 17:39:05 +0700772BUILT_INS += git-switch$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700773BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700774
Junio C Hamanoad17f012009-08-07 12:09:29 -0700775# what 'all' will build and 'install' will install in gitexecdir,
776# excluding programs for built-in commands
Junio C Hamano6506e152007-02-06 21:27:09 -0800777ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
Linus Torvaldse83c5162005-04-07 15:13:13 -0700778
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700779# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400780OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700781
Matthew Ogilvieea925192009-12-02 22:14:05 -0700782# what test wrappers are needed and 'install' will install, in bindir
783BINDIR_PROGRAMS_NEED_X += git
Matthew Ogilvieea925192009-12-02 22:14:05 -0700784BINDIR_PROGRAMS_NEED_X += git-receive-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700785BINDIR_PROGRAMS_NEED_X += git-shell
Denton Liu805d9ea2020-03-21 05:21:20 -0400786BINDIR_PROGRAMS_NEED_X += git-upload-archive
787BINDIR_PROGRAMS_NEED_X += git-upload-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700788
789BINDIR_PROGRAMS_NO_X += git-cvsserver
790
Ryan Anderson3d320512005-11-21 00:11:22 -0500791# Set paths to tools early so that they can be used for version tests.
792ifndef SHELL_PATH
793 SHELL_PATH = /bin/sh
794endif
795ifndef PERL_PATH
796 PERL_PATH = /usr/bin/perl
797endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100798ifndef PYTHON_PATH
799 PYTHON_PATH = /usr/bin/python
800endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700801
Luben Tuikov3a793472006-12-14 23:03:03 -0800802export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100803export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800804
Jeff King3f824e92017-12-08 05:47:22 -0500805TEST_SHELL_PATH = $(SHELL_PATH)
806
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100807LIB_FILE = libgit.a
808XDIFF_LIB = xdiff/lib.a
809VCSSVN_LIB = vcs-svn/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700810
Emily Shaffer709df952020-04-16 14:18:03 -0700811GENERATED_H += config-list.h
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +0200812GENERATED_H += command-list.h
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700813
Denton Liucf6a2d22019-09-16 12:23:08 -0700814LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
Johannes Schindelin92b88eb2019-03-04 05:47:06 -0800815 $(FIND) . \
Jeff Kingd85b0df2014-08-25 16:00:42 -0400816 -name .git -prune -o \
817 -name t -prune -o \
818 -name Documentation -prune -o \
Denton Liucf6a2d22019-09-16 12:23:08 -0700819 -name '*.h' -print)))
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700820
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400821LIB_OBJS += abspath.o
Johannes Schindelinf83dff62019-11-13 12:40:57 +0000822LIB_OBJS += add-interactive.o
Johannes Schindelinf6aa7ec2019-12-13 08:07:48 +0000823LIB_OBJS += add-patch.o
Jeff King75194432009-09-09 07:38:58 -0400824LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700825LIB_OBJS += alias.o
826LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200827LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700828LIB_OBJS += archive-tar.o
829LIB_OBJS += archive-zip.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400830LIB_OBJS += archive.o
Jeff Kingc1189ca2011-09-13 17:57:57 -0400831LIB_OBJS += argv-array.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700832LIB_OBJS += attr.o
833LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100834LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500835LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700836LIB_OBJS += blob.o
Garima Singhf52207a2020-03-30 00:31:24 +0000837LIB_OBJS += bloom.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700838LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700839LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700840LIB_OBJS += bundle.o
841LIB_OBJS += cache-tree.o
Jeff King2b5ed372018-03-30 14:35:04 -0400842LIB_OBJS += chdir-notify.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000843LIB_OBJS += checkout.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700844LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700845LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700846LIB_OBJS += combine-diff.o
Derrick Stolee08fd81c2018-04-02 16:34:19 -0400847LIB_OBJS += commit-graph.o
Derrick Stolee5227c382018-07-20 16:33:02 +0000848LIB_OBJS += commit-reach.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400849LIB_OBJS += commit.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200850LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500851LIB_OBJS += compat/terminal.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700852LIB_OBJS += config.o
853LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700854LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700855LIB_OBJS += convert.o
856LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500857LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700858LIB_OBJS += csum-file.o
859LIB_OBJS += ctype.o
860LIB_OBJS += date.o
861LIB_OBJS += decorate.o
Jeff Kingc8d521f2018-08-16 08:13:07 +0200862LIB_OBJS += delta-islands.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400863LIB_OBJS += diff-delta.o
864LIB_OBJS += diff-lib.o
865LIB_OBJS += diff-no-index.o
866LIB_OBJS += diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700867LIB_OBJS += diffcore-break.o
868LIB_OBJS += diffcore-delta.o
869LIB_OBJS += diffcore-order.o
870LIB_OBJS += diffcore-pickaxe.o
871LIB_OBJS += diffcore-rename.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200872LIB_OBJS += dir-iterator.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400873LIB_OBJS += dir.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200874LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700875LIB_OBJS += entry.o
876LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500877LIB_OBJS += ewah/bitmap.o
878LIB_OBJS += ewah/ewah_bitmap.o
879LIB_OBJS += ewah/ewah_io.o
880LIB_OBJS += ewah/ewah_rlw.o
Stefan Bellerd807c4a2018-04-10 14:26:18 -0700881LIB_OBJS += exec-cmd.o
Jonathan Tanec062832018-06-14 15:54:28 -0700882LIB_OBJS += fetch-negotiator.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700883LIB_OBJS += fetch-pack.o
Denton Liuce6521e2020-03-23 21:07:51 -0400884LIB_OBJS += fmt-merge-msg.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700885LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400886LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100887LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700888LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700889LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700890LIB_OBJS += grep.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100891LIB_OBJS += hashmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700892LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800893LIB_OBJS += hex.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700894LIB_OBJS += ident.o
Eric Sunshine126facf2018-07-22 05:57:05 -0400895LIB_OBJS += interdiff.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000896LIB_OBJS += json-writer.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200897LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200898LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100899LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100900LIB_OBJS += line-range.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400901LIB_OBJS += linear-assignment.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000902LIB_OBJS += list-objects-filter-options.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400903LIB_OBJS += list-objects-filter.o
904LIB_OBJS += list-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700905LIB_OBJS += ll-merge.o
906LIB_OBJS += lockfile.o
907LIB_OBJS += log-tree.o
Brandon Williams72d0ea02018-03-15 10:31:20 -0700908LIB_OBJS += ls-refs.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700909LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700910LIB_OBJS += mailmap.o
911LIB_OBJS += match-trees.o
Jameson Miller065feab2018-04-11 18:37:55 +0000912LIB_OBJS += mem-pool.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800913LIB_OBJS += merge-blobs.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200914LIB_OBJS += merge-recursive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400915LIB_OBJS += merge.o
René Scharfe0db71e02012-04-01 00:10:11 +0200916LIB_OBJS += mergesort.o
Derrick Stoleea3407732018-07-12 15:39:21 -0400917LIB_OBJS += midx.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700918LIB_OBJS += name-hash.o
Jonathan Tanec062832018-06-14 15:54:28 -0700919LIB_OBJS += negotiator/default.o
Jonathan Tan42cc7482018-07-16 11:44:01 -0700920LIB_OBJS += negotiator/skipping.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400921LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100922LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200923LIB_OBJS += notes-utils.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400924LIB_OBJS += notes.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700925LIB_OBJS += object.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700926LIB_OBJS += oid-array.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700927LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500928LIB_OBJS += oidset.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500929LIB_OBJS += pack-bitmap-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400930LIB_OBJS += pack-bitmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700931LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400932LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700933LIB_OBJS += pack-revindex.o
934LIB_OBJS += pack-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400935LIB_OBJS += packfile.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700936LIB_OBJS += pager.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600937LIB_OBJS += parse-options-cb.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400938LIB_OBJS += parse-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700939LIB_OBJS += patch-delta.o
940LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700941LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000942LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700943LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100944LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700945LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700946LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700947LIB_OBJS += progress.o
Christian Couder48de3152019-06-25 15:40:27 +0200948LIB_OBJS += promisor-remote.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500949LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700950LIB_OBJS += protocol.o
Denton Liu9460fd42020-03-23 21:07:52 -0400951LIB_OBJS += prune-packed.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700952LIB_OBJS += quote.o
Johannes Schindelind9c66f02018-08-13 04:33:04 -0700953LIB_OBJS += range-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700954LIB_OBJS += reachable.o
955LIB_OBJS += read-cache.o
Alban Gruin145e05a2018-08-10 18:51:29 +0200956LIB_OBJS += rebase-interactive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400957LIB_OBJS += rebase.o
958LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700959LIB_OBJS += reflog-walk.o
960LIB_OBJS += refs.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100961LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200962LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200963LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200964LIB_OBJS += refs/ref-cache.o
Brandon Williamsec0cb492018-05-16 15:57:48 -0700965LIB_OBJS += refspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700966LIB_OBJS += remote.o
Stefan Beller11bc0582018-04-10 14:26:21 -0700967LIB_OBJS += replace-object.o
Derrick Stolee7211b9e2019-08-13 11:37:43 -0700968LIB_OBJS += repo-settings.o
Brandon Williams359efef2017-06-22 11:43:32 -0700969LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200970LIB_OBJS += rerere.o
Denton Liub309a972020-04-07 10:28:00 -0400971LIB_OBJS += reset.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800972LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700973LIB_OBJS += revision.o
974LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +0700975LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700976LIB_OBJS += sequencer.o
Brandon Williamsed10cb92018-03-15 10:31:19 -0700977LIB_OBJS += serve.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700978LIB_OBJS += server-info.o
979LIB_OBJS += setup.o
Stefan Bellerfc1395f2018-04-10 14:26:20 -0700980LIB_OBJS += sha1-file.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400981LIB_OBJS += sha1-lookup.o
Stefan Bellere5e5e0882018-04-10 14:26:19 -0700982LIB_OBJS += sha1-name.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700983LIB_OBJS += shallow.o
984LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -0500985LIB_OBJS += sigchain.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +0700986LIB_OBJS += split-index.o
Johannes Schindelin97fff612019-09-30 10:21:54 -0700987LIB_OBJS += stable-qsort.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700988LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -0700989LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100990LIB_OBJS += string-list.o
Ben Peart99605d62017-05-05 11:28:01 -0400991LIB_OBJS += sub-process.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400992LIB_OBJS += submodule-config.o
993LIB_OBJS += submodule.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700994LIB_OBJS += symlinks.o
995LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +0200996LIB_OBJS += tempfile.o
Nguyễn Thái Ngọc Duy0ec79352018-10-27 19:29:59 +0200997LIB_OBJS += thread-utils.o
Jeff King2564d992016-10-03 16:49:11 -0400998LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700999LIB_OBJS += trace.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001000LIB_OBJS += trace2.o
1001LIB_OBJS += trace2/tr2_cfg.o
1002LIB_OBJS += trace2/tr2_cmd_name.o
1003LIB_OBJS += trace2/tr2_dst.o
1004LIB_OBJS += trace2/tr2_sid.o
Jeff Hostetlerbce9db62019-04-15 13:39:47 -07001005LIB_OBJS += trace2/tr2_sysenv.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001006LIB_OBJS += trace2/tr2_tbuf.o
1007LIB_OBJS += trace2/tr2_tgt_event.o
1008LIB_OBJS += trace2/tr2_tgt_normal.o
1009LIB_OBJS += trace2/tr2_tgt_perf.o
1010LIB_OBJS += trace2/tr2_tls.o
Christian Couder9385b5d2014-10-13 20:16:23 +02001011LIB_OBJS += trailer.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -04001012LIB_OBJS += transport-helper.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001013LIB_OBJS += transport.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001014LIB_OBJS += tree-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001015LIB_OBJS += tree-walk.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001016LIB_OBJS += tree.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001017LIB_OBJS += unpack-trees.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001018LIB_OBJS += upload-pack.o
Jeff King638794c2010-05-23 05:17:55 -04001019LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -07001020LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001021LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001022LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001023LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -07001024LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -04001025LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +07001026LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001027LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +07001028LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -04001029LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -07001030LIB_OBJS += wrapper.o
Stefan Bellerfa2656f2018-04-10 14:26:16 -07001031LIB_OBJS += write-or-die.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001032LIB_OBJS += ws.o
1033LIB_OBJS += wt-status.o
1034LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -05001035LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +02001036
Linus Torvalds81b50f32010-02-22 08:42:18 -08001037BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +08001038BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001039BUILTIN_OBJS += builtin/annotate.o
1040BUILTIN_OBJS += builtin/apply.o
1041BUILTIN_OBJS += builtin/archive.o
1042BUILTIN_OBJS += builtin/bisect--helper.o
1043BUILTIN_OBJS += builtin/blame.o
1044BUILTIN_OBJS += builtin/branch.o
1045BUILTIN_OBJS += builtin/bundle.o
1046BUILTIN_OBJS += builtin/cat-file.o
1047BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +00001048BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -04001049BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001050BUILTIN_OBJS += builtin/check-ref-format.o
1051BUILTIN_OBJS += builtin/checkout-index.o
1052BUILTIN_OBJS += builtin/checkout.o
1053BUILTIN_OBJS += builtin/clean.o
1054BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +07001055BUILTIN_OBJS += builtin/column.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001056BUILTIN_OBJS += builtin/commit-graph.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001057BUILTIN_OBJS += builtin/commit-tree.o
1058BUILTIN_OBJS += builtin/commit.o
1059BUILTIN_OBJS += builtin/config.o
1060BUILTIN_OBJS += builtin/count-objects.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +02001061BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001062BUILTIN_OBJS += builtin/describe.o
1063BUILTIN_OBJS += builtin/diff-files.o
1064BUILTIN_OBJS += builtin/diff-index.o
1065BUILTIN_OBJS += builtin/diff-tree.o
1066BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +01001067BUILTIN_OBJS += builtin/difftool.o
Ævar Arnfjörð Bjarmasonb4f207f2019-06-21 12:18:06 +02001068BUILTIN_OBJS += builtin/env--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001069BUILTIN_OBJS += builtin/fast-export.o
1070BUILTIN_OBJS += builtin/fetch-pack.o
1071BUILTIN_OBJS += builtin/fetch.o
1072BUILTIN_OBJS += builtin/fmt-merge-msg.o
1073BUILTIN_OBJS += builtin/for-each-ref.o
1074BUILTIN_OBJS += builtin/fsck.o
1075BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -08001076BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001077BUILTIN_OBJS += builtin/grep.o
1078BUILTIN_OBJS += builtin/hash-object.o
1079BUILTIN_OBJS += builtin/help.o
1080BUILTIN_OBJS += builtin/index-pack.o
1081BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +02001082BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001083BUILTIN_OBJS += builtin/log.o
1084BUILTIN_OBJS += builtin/ls-files.o
1085BUILTIN_OBJS += builtin/ls-remote.o
1086BUILTIN_OBJS += builtin/ls-tree.o
1087BUILTIN_OBJS += builtin/mailinfo.o
1088BUILTIN_OBJS += builtin/mailsplit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001089BUILTIN_OBJS += builtin/merge-base.o
1090BUILTIN_OBJS += builtin/merge-file.o
1091BUILTIN_OBJS += builtin/merge-index.o
1092BUILTIN_OBJS += builtin/merge-ours.o
1093BUILTIN_OBJS += builtin/merge-recursive.o
1094BUILTIN_OBJS += builtin/merge-tree.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001095BUILTIN_OBJS += builtin/merge.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001096BUILTIN_OBJS += builtin/mktag.o
1097BUILTIN_OBJS += builtin/mktree.o
Derrick Stolee6a257f02018-07-12 15:39:20 -04001098BUILTIN_OBJS += builtin/multi-pack-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001099BUILTIN_OBJS += builtin/mv.o
1100BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -07001101BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001102BUILTIN_OBJS += builtin/pack-objects.o
1103BUILTIN_OBJS += builtin/pack-redundant.o
1104BUILTIN_OBJS += builtin/pack-refs.o
1105BUILTIN_OBJS += builtin/patch-id.o
1106BUILTIN_OBJS += builtin/prune-packed.o
1107BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001108BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001109BUILTIN_OBJS += builtin/push.o
Johannes Schindelin348ae562018-08-13 04:33:02 -07001110BUILTIN_OBJS += builtin/range-diff.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001111BUILTIN_OBJS += builtin/read-tree.o
Pratik Karki55071ea2018-08-07 01:16:09 +05451112BUILTIN_OBJS += builtin/rebase.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001113BUILTIN_OBJS += builtin/receive-pack.o
1114BUILTIN_OBJS += builtin/reflog.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001115BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001116BUILTIN_OBJS += builtin/remote-fd.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001117BUILTIN_OBJS += builtin/remote.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001118BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001119BUILTIN_OBJS += builtin/replace.o
1120BUILTIN_OBJS += builtin/rerere.o
1121BUILTIN_OBJS += builtin/reset.o
1122BUILTIN_OBJS += builtin/rev-list.o
1123BUILTIN_OBJS += builtin/rev-parse.o
1124BUILTIN_OBJS += builtin/revert.o
1125BUILTIN_OBJS += builtin/rm.o
1126BUILTIN_OBJS += builtin/send-pack.o
1127BUILTIN_OBJS += builtin/shortlog.o
1128BUILTIN_OBJS += builtin/show-branch.o
Jeff Kingff417262018-05-28 05:38:53 -04001129BUILTIN_OBJS += builtin/show-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001130BUILTIN_OBJS += builtin/show-ref.o
Derrick Stolee94c09562019-11-21 22:04:33 +00001131BUILTIN_OBJS += builtin/sparse-checkout.o
Paul-Sebastian Ungureanu40af1462019-02-25 23:16:28 +00001132BUILTIN_OBJS += builtin/stash.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001133BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001134BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001135BUILTIN_OBJS += builtin/symbolic-ref.o
1136BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001137BUILTIN_OBJS += builtin/unpack-file.o
1138BUILTIN_OBJS += builtin/unpack-objects.o
1139BUILTIN_OBJS += builtin/update-index.o
1140BUILTIN_OBJS += builtin/update-ref.o
1141BUILTIN_OBJS += builtin/update-server-info.o
1142BUILTIN_OBJS += builtin/upload-archive.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001143BUILTIN_OBJS += builtin/upload-pack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001144BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001145BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001146BUILTIN_OBJS += builtin/verify-pack.o
1147BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001148BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001149BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001150
Denton Liu5dedf7d2019-09-16 12:23:11 -07001151# THIRD_PARTY_SOURCES is a list of patterns compatible with the
1152# $(filter) and $(filter-out) family of functions. They specify source
1153# files which are taken from some third-party source where we want to be
1154# less strict about issues such as coding style so we don't diverge from
1155# upstream unnecessarily (making merging in future changes easier).
1156THIRD_PARTY_SOURCES += compat/inet_ntop.c
1157THIRD_PARTY_SOURCES += compat/inet_pton.c
1158THIRD_PARTY_SOURCES += compat/nedmalloc/%
1159THIRD_PARTY_SOURCES += compat/obstack.%
1160THIRD_PARTY_SOURCES += compat/poll/%
1161THIRD_PARTY_SOURCES += compat/regex/%
1162THIRD_PARTY_SOURCES += sha1collisiondetection/%
1163THIRD_PARTY_SOURCES += sha1dc/%
1164
Jeff King3f2e2292016-07-01 01:58:58 -04001165GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +02001166EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001167
Jeff King42dcbb72012-06-02 15:01:12 -04001168GIT_USER_AGENT = git/$(GIT_VERSION)
1169
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001170ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1171DC_SHA1_SUBMODULE = auto
1172endif
1173
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001174# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1175# tweaked by config.* below as well as the command-line, both of
1176# which'll override these defaults.
1177CFLAGS = -g -O2 -Wall
1178LDFLAGS =
Ævar Arnfjörð Bjarmason0f50c8e2019-05-17 23:58:47 +02001179CC_LD_DYNPATH = -Wl,-rpath,
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001180BASIC_CFLAGS = -I.
1181BASIC_LDFLAGS =
1182
1183# library flags
1184ARFLAGS = rcs
1185PTHREAD_CFLAGS =
1186
1187# For the 'sparse' target
1188SPARSE_FLAGS ?=
1189SP_EXTRA_FLAGS =
1190
Jeff King960154b2019-05-06 19:43:34 -04001191# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
1192# usually result in less CPU usage at the cost of higher peak memory.
Jeff Kingbcb4edf2019-05-08 03:07:54 -04001193# Setting it to 0 will feed all files in a single spatch invocation.
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001194SPATCH_FLAGS = --all-includes --patch .
Jeff King960154b2019-05-06 19:43:34 -04001195SPATCH_BATCH_SIZE = 1
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001196
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001197include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001198-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001199-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001200
Matthieu Moyd6156282016-05-31 15:24:43 +02001201ifdef DEVELOPER
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +00001202include config.mak.dev
Matthieu Moyd6156282016-05-31 15:24:43 +02001203endif
1204
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +01001205ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001206ALL_LDFLAGS = $(LDFLAGS)
1207
René Scharfe425ca672017-07-15 19:18:56 +02001208comma := ,
1209empty :=
1210space := $(empty) $(empty)
1211
Jeff King56b5db32017-07-10 09:24:42 -04001212ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001213SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001214BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001215BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001216ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King566cf0b2017-07-10 09:24:50 -04001217BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
Jeff King07a20f52019-03-12 17:06:26 -04001218BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
Jeff King566cf0b2017-07-10 09:24:50 -04001219endif
Jeff King0e5bba52017-09-08 02:38:41 -04001220ifneq ($(filter leak,$(SANITIZERS)),)
1221BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
1222endif
Jeff Kingf65d07f2020-01-16 12:51:38 -05001223ifneq ($(filter address,$(SANITIZERS)),)
1224NO_REGEX = NeededForASAN
1225endif
Jeff King56b5db32017-07-10 09:24:42 -04001226endif
1227
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001228ifndef sysconfdir
1229ifeq ($(prefix),/usr)
1230sysconfdir = /etc
1231else
1232sysconfdir = etc
1233endif
1234endif
1235
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001236ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001237COMPUTE_HEADER_DEPENDENCIES = auto
1238endif
1239
1240ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001241dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Jonathan Nieder69789342011-11-18 17:23:24 -06001242 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1243 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001244 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001245ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001246override COMPUTE_HEADER_DEPENDENCIES = yes
1247else
1248override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001249endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001250endif
1251
Jonathan Nieder024c8432011-11-18 03:58:21 -06001252ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001253USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001254else
1255ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1256$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1257(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1258endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001259endif
1260
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001261ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001262SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
Jeff Hostetlerc444bf82019-06-19 14:06:06 -07001263BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001264PATH := $(SANE_TOOL_PATH):${PATH}
1265else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001266BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001267endif
1268
Eric Sunshineb2289402017-12-15 00:34:34 +01001269ifeq (,$(HOST_CPU))
1270 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1271else
1272 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1273endif
1274
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001275ifneq (,$(INLINE))
1276 BASIC_CFLAGS += -Dinline=$(INLINE)
1277endif
1278
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001279ifneq (,$(SOCKLEN_T))
1280 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1281endif
1282
Kyle J. McKay290c8e72015-01-11 12:09:22 -08001283ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
1284 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
1285else
1286ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
1287 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
1288endif
1289endif
1290
Brian Gernhardt59f86742006-12-12 12:01:47 -05001291ifeq ($(uname_S),Darwin)
1292 ifndef NO_FINK
1293 ifeq ($(shell test -d /sw/lib && echo y),y)
1294 BASIC_CFLAGS += -I/sw/include
1295 BASIC_LDFLAGS += -L/sw/lib
1296 endif
1297 endif
1298 ifndef NO_DARWIN_PORTS
1299 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1300 BASIC_CFLAGS += -I/opt/local/include
1301 BASIC_LDFLAGS += -L/opt/local/lib
1302 endif
1303 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001304 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001305 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001306 APPLE_COMMON_CRYPTO = YesPlease
1307 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1308 endif
David Aguilar29de2052013-05-11 01:22:26 -07001309 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001310 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001311endif
1312
David Aguilare1c06882009-05-31 01:35:51 -07001313ifdef NO_LIBGEN_H
1314 COMPAT_CFLAGS += -DNO_LIBGEN_H
1315 COMPAT_OBJS += compat/basename.o
1316endif
1317
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001318USE_LIBPCRE2 ?= $(USE_LIBPCRE)
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001319
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001320ifneq (,$(USE_LIBPCRE2))
1321 ifdef USE_LIBPCRE1
1322$(error Only set USE_LIBPCRE2 (or its alias USE_LIBPCRE) or USE_LIBPCRE1, not both!)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001323 endif
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001324
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001325 BASIC_CFLAGS += -DUSE_LIBPCRE2
1326 EXTLIBS += -lpcre2-8
1327endif
1328
1329ifdef USE_LIBPCRE1
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001330 BASIC_CFLAGS += -DUSE_LIBPCRE1
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001331 EXTLIBS += -lpcre
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00001332
1333ifdef NO_LIBPCRE1_JIT
1334 BASIC_CFLAGS += -DNO_LIBPCRE1_JIT
1335endif
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001336endif
1337
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001338ifdef LIBPCREDIR
1339 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1340 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Junio C Hamanobbfc63d2006-12-27 14:17:35 -08001341endif
1342
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001343ifdef HAVE_ALLOCA_H
1344 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1345endif
1346
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001347IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001348IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001349
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001350ifdef NO_CURL
1351 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001352 REMOTE_CURL_PRIMARY =
1353 REMOTE_CURL_ALIASES =
1354 REMOTE_CURL_NAMES =
Johannes Schindelin724d6352019-04-18 06:16:40 -07001355 EXCLUDED_PROGRAMS += git-http-fetch git-http-push
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001356else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001357 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001358 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
Jeff King897d68e2020-03-26 04:08:55 -04001359 CURL_CFLAGS = -I$(CURLDIR)/include
James Knight23c4bbe2018-11-03 05:12:11 +00001360 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001361 else
Jeff King897d68e2020-03-26 04:08:55 -04001362 CURL_CFLAGS =
James Knight23c4bbe2018-11-03 05:12:11 +00001363 CURL_LIBCURL =
Junio C Hamanob2feb642014-04-30 10:58:10 -07001364 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001365
Jeff King94a88e22020-03-26 04:06:45 -04001366 ifndef CURL_LDFLAGS
Jeff King05738312020-04-04 10:58:29 -04001367 CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
Jeff King94a88e22020-03-26 04:06:45 -04001368 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001369 CURL_LIBCURL += $(CURL_LDFLAGS)
Thomas Cortbc5f8132011-07-19 18:55:47 -04001370
Jeff King897d68e2020-03-26 04:08:55 -04001371 ifndef CURL_CFLAGS
Jeff King05738312020-04-04 10:58:29 -04001372 CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
Jeff King897d68e2020-03-26 04:08:55 -04001373 endif
1374 BASIC_CFLAGS += $(CURL_CFLAGS)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001375
Johannes Sixt4256f362010-01-19 16:39:12 +01001376 REMOTE_CURL_PRIMARY = git-remote-http$X
1377 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1378 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001379 PROGRAM_OBJS += http-fetch.o
1380 PROGRAMS += $(REMOTE_CURL_NAMES)
Remi Pommarelf8915872015-10-21 19:10:46 +02001381 curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
Nick Hengeveld08900982005-11-18 17:08:36 -08001382 ifeq "$(curl_check)" "070908"
1383 ifndef NO_EXPAT
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001384 PROGRAM_OBJS += http-push.o
Johannes Schindelin724d6352019-04-18 06:16:40 -07001385 else
1386 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld08900982005-11-18 17:08:36 -08001387 endif
Johannes Schindelin724d6352019-04-18 06:16:40 -07001388 else
1389 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001390 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001391 curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001392 ifeq "$(curl_check)" "072200"
1393 USE_CURL_FOR_IMAP_SEND = YesPlease
1394 endif
1395 ifdef USE_CURL_FOR_IMAP_SEND
1396 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1397 IMAP_SEND_BUILDDEPS = http.o
1398 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1399 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001400 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001401 ifdef EXPATDIR
1402 BASIC_CFLAGS += -I$(EXPATDIR)/include
1403 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1404 else
1405 EXPAT_LIBEXPAT = -lexpat
1406 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001407 ifdef EXPAT_NEEDS_XMLPARSE_H
1408 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1409 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001410 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001411endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001412IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001413
Robert Schielebef19da2007-07-29 20:35:45 +02001414ifdef ZLIB_PATH
1415 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001416 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001417endif
1418EXTLIBS += -lz
1419
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001420ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001421 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001422 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001423 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001424 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001425 else
1426 OPENSSL_LINK =
1427 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001428 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001429 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001430 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001431else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001432 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001433 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001434endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001435ifdef NO_OPENSSL
1436 LIB_4_CRYPTO =
1437else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001438ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001439 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001440else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001441 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001442endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001443ifdef APPLE_COMMON_CRYPTO
1444 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1445endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001446endif
Eric Sunshinefdb1fbb2018-06-14 22:25:03 -04001447ifndef NO_ICONV
1448 ifdef NEEDS_LIBICONV
1449 ifdef ICONVDIR
1450 BASIC_CFLAGS += -I$(ICONVDIR)/include
1451 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1452 else
1453 ICONV_LINK =
1454 endif
1455 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1456 ICONV_LINK += -lintl
1457 endif
1458 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano455a7f32005-09-30 13:31:16 -07001459 endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001460endif
brian m. carlson79444c92019-02-12 00:52:06 +00001461ifdef ICONV_OMITS_BOM
1462 BASIC_CFLAGS += -DICONV_OMITS_BOM
1463endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001464ifdef NEEDS_LIBGEN
1465 EXTLIBS += -lgen
1466endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001467ifndef NO_GETTEXT
1468ifndef LIBC_CONTAINS_LIBINTL
1469 EXTLIBS += -lintl
1470endif
1471endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001472ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001473 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001474endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001475ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001476 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001477endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001478ifdef NEEDS_RESOLV
1479 EXTLIBS += -lresolv
1480endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001481ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001482 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001483endif
David Michael110d6982012-12-14 14:56:59 -05001484ifdef NO_GECOS_IN_PWENT
1485 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1486endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001487ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1488 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1489endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001490ifdef USE_NSEC
1491 BASIC_CFLAGS += -DUSE_NSEC
1492endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001493ifdef USE_ST_TIMESPEC
1494 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1495endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001496ifdef NO_NORETURN
1497 BASIC_CFLAGS += -DNO_NORETURN
1498endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001499ifdef NO_NSEC
1500 BASIC_CFLAGS += -DNO_NSEC
1501endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001502ifdef SNPRINTF_RETURNS_BOGUS
1503 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1504 COMPAT_OBJS += compat/snprintf.o
1505endif
Brandon Caseycba22522008-02-08 20:32:47 -06001506ifdef FREAD_READS_DIRECTORIES
1507 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1508 COMPAT_OBJS += compat/fopen.o
1509endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001510ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001511 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001512endif
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +00001513ifdef GETTEXT_POISON
Junio C Hamanoc6a9a302018-11-08 21:15:30 +00001514$(warning The GETTEXT_POISON option has been removed in favor of runtime GIT_TEST_GETTEXT_POISON. See t/README!)
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +00001515endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001516ifdef NO_GETTEXT
1517 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001518 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001519endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001520ifdef NO_POLL
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001521 NO_POLL_H = YesPlease
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001522 NO_SYS_POLL_H = YesPlease
1523 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1524 COMPAT_OBJS += compat/poll/poll.o
1525endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001526ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001527 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001528 COMPAT_OBJS += compat/strcasestr.o
1529endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001530ifdef NO_STRLCPY
1531 COMPAT_CFLAGS += -DNO_STRLCPY
1532 COMPAT_OBJS += compat/strlcpy.o
1533endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001534ifdef NO_STRTOUMAX
1535 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001536 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001537endif
1538ifdef NO_STRTOULL
1539 COMPAT_CFLAGS += -DNO_STRTOULL
1540endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001541ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001542 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001543 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001544endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001545ifdef NO_MKDTEMP
1546 COMPAT_CFLAGS += -DNO_MKDTEMP
1547 COMPAT_OBJS += compat/mkdtemp.o
1548endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001549ifdef MKDIR_WO_TRAILING_SLASH
1550 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1551 COMPAT_OBJS += compat/mkdir.o
1552endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001553ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001554 COMPAT_CFLAGS += -DNO_UNSETENV
1555 COMPAT_OBJS += compat/unsetenv.o
1556endif
Robert Schiele26009732008-01-24 19:34:46 +01001557ifdef NO_SYS_SELECT_H
1558 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1559endif
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001560ifdef NO_POLL_H
1561 BASIC_CFLAGS += -DNO_POLL_H
1562endif
Markus Duft28449232010-10-27 10:39:52 +02001563ifdef NO_SYS_POLL_H
1564 BASIC_CFLAGS += -DNO_SYS_POLL_H
1565endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001566ifdef NEEDS_SYS_PARAM_H
1567 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001568endif
Markus Duft28449232010-10-27 10:39:52 +02001569ifdef NO_INTTYPES_H
1570 BASIC_CFLAGS += -DNO_INTTYPES_H
1571endif
1572ifdef NO_INITGROUPS
1573 BASIC_CFLAGS += -DNO_INITGROUPS
1574endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001575ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001576 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001577 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001578else
1579 ifdef USE_WIN32_MMAP
1580 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1581 COMPAT_OBJS += compat/win32mmap.o
1582 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001583endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001584ifdef MMAP_PREVENTS_DELETE
1585 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1586endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001587ifdef OBJECT_CREATION_USES_RENAMES
1588 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001589endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001590ifdef NO_STRUCT_ITIMERVAL
1591 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001592 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001593endif
1594ifdef NO_SETITIMER
1595 COMPAT_CFLAGS += -DNO_SETITIMER
1596endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001597ifdef NO_PREAD
1598 COMPAT_CFLAGS += -DNO_PREAD
1599 COMPAT_OBJS += compat/pread.o
1600endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001601ifdef NO_FAST_WORKING_DIRECTORY
1602 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1603endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001604ifdef NO_TRUSTABLE_FILEMODE
1605 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1606endif
David Michaeld543d9c2014-12-03 21:24:17 -05001607ifdef NEEDS_MODE_TRANSLATION
1608 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1609 COMPAT_OBJS += compat/stat.o
1610endif
hpa49744d62005-09-28 16:52:21 -07001611ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001612 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001613endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001614ifdef NO_INTPTR_T
1615 COMPAT_CFLAGS += -DNO_INTPTR_T
1616endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001617ifdef NO_UINTMAX_T
1618 BASIC_CFLAGS += -Duintmax_t=uint32_t
1619endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001620ifdef NO_SOCKADDR_STORAGE
1621ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001622 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001623else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001624 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001625endif
hpa49744d62005-09-28 16:52:21 -07001626endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001627ifdef NO_INET_NTOP
1628 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001629 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001630endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001631ifdef NO_INET_PTON
1632 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001633 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001634endif
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001635ifdef NO_UNIX_SOCKETS
1636 BASIC_CFLAGS += -DNO_UNIX_SOCKETS
Johannes Schindelin724d6352019-04-18 06:16:40 -07001637 EXCLUDED_PROGRAMS += git-credential-cache git-credential-cache--daemon
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001638else
Johannes Sixt63203582011-12-12 22:12:56 +01001639 LIB_OBJS += unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001640 PROGRAM_OBJS += credential-cache.o
1641 PROGRAM_OBJS += credential-cache--daemon.o
1642endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001643
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001644ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001645 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001646endif
1647
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001648ifdef OLD_ICONV
1649 BASIC_CFLAGS += -DOLD_ICONV
1650endif
1651
David Symonds609a2282007-11-07 14:24:28 +11001652ifdef NO_DEFLATE_BOUND
1653 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1654endif
1655
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001656ifdef NO_POSIX_GOODIES
1657 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1658endif
1659
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001660ifdef APPLE_COMMON_CRYPTO
1661 # Apple CommonCrypto requires chunking
1662 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1663endif
1664
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001665ifdef OPENSSL_SHA1
1666 EXTLIBS += $(LIB_4_CRYPTO)
1667 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001668else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001669ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001670 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001671 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001672else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001673ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001674 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001675 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001676else
David Aguilar61067952013-05-19 06:23:35 -04001677ifdef APPLE_COMMON_CRYPTO
1678 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001679 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001680else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001681 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001682 BASIC_CFLAGS += -DSHA1_DC
1683 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001684ifdef DC_SHA1_EXTERNAL
1685 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001686 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001687$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001688 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001689 endif
1690 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1691 EXTLIBS += -lsha1detectcoll
1692else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001693ifdef DC_SHA1_SUBMODULE
1694 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1695 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1696 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1697else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001698 LIB_OBJS += sha1dc/sha1.o
1699 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001700endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001701 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001702 -DSHA1DC_NO_STANDARD_INCLUDES \
1703 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1704 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001705 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001706endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001707endif
1708endif
David Aguilar61067952013-05-19 06:23:35 -04001709endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001710endif
David Aguilar61067952013-05-19 06:23:35 -04001711
brian m. carlson4b4e2912018-11-14 04:09:38 +00001712ifdef OPENSSL_SHA256
1713 EXTLIBS += $(LIB_4_CRYPTO)
1714 BASIC_CFLAGS += -DSHA256_OPENSSL
1715else
brian m. carlson27dc04c2018-11-14 04:09:37 +00001716ifdef GCRYPT_SHA256
1717 BASIC_CFLAGS += -DSHA256_GCRYPT
1718 EXTLIBS += -lgcrypt
1719else
1720 LIB_OBJS += sha256/block/sha256.o
1721 BASIC_CFLAGS += -DSHA256_BLK
1722endif
brian m. carlson4b4e2912018-11-14 04:09:38 +00001723endif
brian m. carlson13eeedb2018-11-14 04:09:36 +00001724
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001725ifdef SHA1_MAX_BLOCK_SIZE
1726 LIB_OBJS += compat/sha1-chunked.o
1727 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1728endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001729ifdef NO_HSTRERROR
1730 COMPAT_CFLAGS += -DNO_HSTRERROR
1731 COMPAT_OBJS += compat/hstrerror.o
1732endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001733ifdef NO_MEMMEM
1734 COMPAT_CFLAGS += -DNO_MEMMEM
1735 COMPAT_OBJS += compat/memmem.o
1736endif
Matt Kraai40036be2012-12-18 14:03:55 -08001737ifdef NO_GETPAGESIZE
1738 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1739endif
Brian Downing43fe9012008-02-05 15:10:44 -06001740ifdef INTERNAL_QSORT
1741 COMPAT_CFLAGS += -DINTERNAL_QSORT
Brian Downing43fe9012008-02-05 15:10:44 -06001742endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001743ifdef HAVE_ISO_QSORT_S
1744 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1745else
1746 COMPAT_OBJS += compat/qsort_s.o
1747endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001748ifdef RUNTIME_PREFIX
1749 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1750endif
Alex Riesenb7774342007-03-07 00:44:49 +01001751
Junio C Hamano46059cc2008-11-15 04:08:14 -08001752ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001753 BASIC_CFLAGS += -DNO_PTHREADS
1754else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001755 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001756 EXTLIBS += $(PTHREAD_LIBS)
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001757endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001758
Chris Webbcb6a22c2010-04-13 10:07:13 +01001759ifdef HAVE_PATHS_H
1760 BASIC_CFLAGS += -DHAVE_PATHS_H
1761endif
1762
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001763ifdef HAVE_LIBCHARSET_H
1764 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001765 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001766endif
1767
David Michaelb3e103d2012-12-14 14:57:01 -05001768ifdef HAVE_STRINGS_H
1769 BASIC_CFLAGS += -DHAVE_STRINGS_H
1770endif
1771
Jeff King21aeafc2011-12-10 05:41:01 -05001772ifdef HAVE_DEV_TTY
1773 BASIC_CFLAGS += -DHAVE_DEV_TTY
1774endif
1775
Alex Riesen81a24b52008-03-05 00:15:39 +01001776ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1777 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1778endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001779ifdef UNRELIABLE_FSTAT
1780 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1781endif
Jeff King02232ad2009-06-16 15:07:40 -04001782ifdef NO_REGEX
1783 COMPAT_CFLAGS += -Icompat/regex
1784 COMPAT_OBJS += compat/regex/regex.o
1785endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001786ifdef NATIVE_CRLF
1787 BASIC_CFLAGS += -DNATIVE_CRLF
1788endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001789
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001790ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001791 COMPAT_CFLAGS += -Icompat/nedmalloc
1792 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1793 OVERRIDE_STRDUP = YesPlease
1794endif
1795
1796ifdef OVERRIDE_STRDUP
1797 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1798 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001799endif
1800
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001801ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1802 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1803endif
1804
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001805ifndef NO_MSGFMT_EXTENDED_OPTIONS
1806 MSGFMT += --check --statistics
1807endif
1808
Karsten Blees148d6772014-07-12 02:05:42 +02001809ifdef HAVE_CLOCK_GETTIME
1810 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001811endif
1812
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001813ifdef HAVE_CLOCK_MONOTONIC
1814 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1815endif
1816
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001817ifdef NEEDS_LIBRT
1818 EXTLIBS += -lrt
1819endif
1820
Kyle J. McKay95290802015-03-07 23:14:36 -08001821ifdef HAVE_BSD_SYSCTL
1822 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1823endif
1824
Dan Jacques226c0dd2018-04-10 11:05:44 -04001825ifdef HAVE_BSD_KERN_PROC_SYSCTL
1826 BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
1827endif
1828
Jeff King0cc30e02015-04-16 05:01:38 -04001829ifdef HAVE_GETDELIM
1830 BASIC_CFLAGS += -DHAVE_GETDELIM
1831endif
1832
Dan Jacques226c0dd2018-04-10 11:05:44 -04001833ifneq ($(PROCFS_EXECUTABLE_PATH),)
1834 procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
1835 BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
1836endif
1837
1838ifdef HAVE_NS_GET_EXECUTABLE_PATH
1839 BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
1840endif
1841
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -04001842ifdef HAVE_WPGMPTR
1843 BASIC_CFLAGS += -DHAVE_WPGMPTR
1844endif
1845
Duy Nguyen18a4f6b2019-02-12 21:14:41 +07001846ifdef FILENO_IS_A_MACRO
1847 COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
1848 COMPAT_OBJS += compat/fileno.o
1849endif
1850
Clément Chigot400caaf2019-04-25 07:01:56 +00001851ifdef NEED_ACCESS_ROOT_HANDLER
1852 COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
1853 COMPAT_OBJS += compat/access.o
1854endif
1855
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001856ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001857NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001858endif
1859
Jeff King499c2932009-04-03 15:32:20 -04001860ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001861NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001862endif
1863
Johan Herlandd4e1b472009-11-18 02:42:31 +01001864ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001865NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001866endif
1867
Eric Wong995bc222016-08-04 11:40:25 +00001868ifndef PAGER_ENV
1869PAGER_ENV = LESS=FRX LV=-c
1870endif
1871
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001872QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001873QUIET_SUBDIR1 =
1874
John Keepingef49e052015-09-05 13:22:10 +01001875ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001876PRINT_DIR = --no-print-directory
1877else # "make -w"
1878NO_SUBDIR = :
1879endif
1880
John Keepingef49e052015-09-05 13:22:10 +01001881ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001882ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001883 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001884 QUIET_AR = @echo ' ' AR $@;
1885 QUIET_LINK = @echo ' ' LINK $@;
1886 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1887 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001888 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00001889 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001890 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00001891 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001892 QUIET_SP = @echo ' ' SP $<;
Denton Liub503a2d2019-09-25 01:21:01 -07001893 QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001894 QUIET_RC = @echo ' ' RC $@;
Denton Liu4f3c1dc2019-10-09 13:43:46 -07001895 QUIET_SPATCH = @echo ' ' SPATCH $<;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001896 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001897 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1898 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001899 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001900 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001901 export QUIET_BUILT_IN
1902endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001903endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001904
Junio C Hamano70de5e62012-05-02 15:12:10 -07001905ifdef NO_INSTALL_HARDLINKS
1906 export NO_INSTALL_HARDLINKS
1907endif
1908
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001909### profile feedback build
1910#
1911
1912# Can adjust this to be a global directory if you want to do extended
1913# data gathering
1914PROFILE_DIR := $(CURDIR)
1915
Johannes Sixte60ec752012-02-09 09:22:26 +01001916ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07001917 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001918 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001919 export CCACHE_DISABLE = t
1920 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01001921else
1922ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07001923 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001924 export CCACHE_DISABLE = t
1925 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001926endif
Johannes Sixte60ec752012-02-09 09:22:26 +01001927endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001928
Pavel Roskinaddf88e2006-07-09 03:44:30 -04001929# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001930
Johannes Schindelin32043c92007-02-14 12:48:14 +01001931ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02001932ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001933
1934DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1935bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001936bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001937mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00001938mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
1939infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001940perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001941localedir_SQ = $(subst ','\'',$(localedir))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001942localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001943gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +00001944gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001945template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00001946htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001947prefix_SQ = $(subst ','\'',$(prefix))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001948perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05301949gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001950
1951SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05001952TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001953PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01001954PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001955TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07001956DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08001957PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001958
Dan Jacques07d90ea2018-04-10 11:05:43 -04001959# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
1960# relative to each other and share an installation path.
1961#
1962# This is a dependency in:
1963# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
1964# - The runtime prefix Perl header (see
1965# "perl/header_templates/runtime_prefix.template.pl").
1966ifdef RUNTIME_PREFIX
1967
1968ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
1969$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
1970endif
1971
1972ifneq ($(filter /%,$(firstword $(localedir_relative))),)
1973$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
1974endif
1975
1976ifndef NO_PERL
1977ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
1978$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
1979endif
1980endif
1981
1982endif
1983
Jeff King3f2e2292016-07-01 01:58:58 -04001984# We must filter out any object files from $(GITLIBS),
1985# as it is typically used like:
1986#
1987# foo: foo.o $(GITLIBS)
1988# $(CC) $(filter %.o,$^) $(LIBS)
1989#
1990# where we use it as a dependency. Since we also pull object files
1991# from the dependency list, that would make each entry appear twice.
1992LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07001993
brian m. carlsonf18f8162017-03-11 22:28:18 +00001994BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08001995LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02001996
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05001997# Quote for C
1998
1999ifdef DEFAULT_EDITOR
2000DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
2001DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
2002
2003BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
2004endif
2005
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05002006ifdef DEFAULT_PAGER
2007DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
2008DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
2009
2010BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
2011endif
2012
Ben Waltonb3e34dd2012-03-30 21:33:21 -04002013ifdef SHELL_PATH
2014SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
2015SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
2016
2017BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
2018endif
2019
Jeff King42dcbb72012-06-02 15:01:12 -04002020GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
2021GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
2022GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04002023GIT-USER-AGENT: FORCE
2024 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04002025 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
2026 fi
Jeff King42dcbb72012-06-02 15:01:12 -04002027
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00002028ifdef DEFAULT_HELP_FORMAT
2029BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
2030endif
2031
Eric Wong995bc222016-08-04 11:40:25 +00002032PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
2033PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
2034PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
2035BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
2036
Petr Baudis8d7f5862006-06-25 03:47:03 +02002037ALL_CFLAGS += $(BASIC_CFLAGS)
2038ALL_LDFLAGS += $(BASIC_LDFLAGS)
2039
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00002040export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07002041
2042
Petr Baudis28818ff2005-07-29 17:50:24 +02002043### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07002044
Brandon Caseyc94c8e52008-08-07 14:03:42 -05002045SHELL = $(SHELL_PATH)
2046
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002047all:: shell_compatibility_test
2048
2049ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07002050all:: profile
2051endif
2052
2053profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002054 $(MAKE) PROFILE=GEN all
2055 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04002056 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
2057 $(MAKE) PROFILE=GEN -j1 perf; \
2058 else \
2059 echo "Skipping profile of perf tests..."; \
2060 fi
Andi Kleen066dd262014-07-07 23:35:11 -07002061 $(MAKE) PROFILE=USE all
2062
2063profile-fast: profile-clean
2064 $(MAKE) PROFILE=GEN all
2065 $(MAKE) PROFILE=GEN -j1 perf
2066 $(MAKE) PROFILE=USE all
2067
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002068
2069all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002070ifneq (,$X)
Sebastian Schuberthade2ca02009-10-27 12:23:33 +01002071 $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002072endif
Petr Baudis28818ff2005-07-29 17:50:24 +02002073
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002074all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002075ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07002076 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08002077 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002078endif
Ben Walton502be952010-03-20 10:48:08 -04002079 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04002080
Brandon Casey6dc46272008-08-07 14:06:26 -05002081please_set_SHELL_PATH_to_a_more_modern_shell:
2082 @$$(:)
2083
2084shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
2085
Junio C Hamano4dc00022006-01-12 21:42:25 -08002086strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05002087 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08002088
Jonathan Nieder7b63c772012-07-06 23:19:09 -05002089### Target-specific flags and dependencies
2090
2091# The generic compilation pattern rule and automatically
2092# computed header dependencies (falling back to a dependency on
2093# LIB_H) are enough to describe how most targets should be built,
2094# but some targets are special enough to need something a little
2095# different.
2096#
2097# - When a source file "foo.c" #includes a generated header file,
2098# we need to list that dependency for the "foo.o" target.
2099#
2100# We also list it from other targets that are built from foo.c
2101# like "foo.sp" and "foo.s", even though that is easy to forget
2102# to do because the generated header is already present around
2103# after a regular build attempt.
2104#
2105# - Some code depends on configuration kept in makefile
2106# variables. The target-specific variable EXTRA_CPPFLAGS can
2107# be used to convey that information to the C preprocessor
2108# using -D options.
2109#
2110# The "foo.o" target should have a corresponding dependency on
2111# a file that changes when the value of the makefile variable
2112# changes. For example, targets making use of the
2113# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
2114#
2115# Technically the ".sp" and ".s" targets do not need this
2116# dependency because they are force-built, but they get the
2117# same dependency for consistency. This way, you do not have to
2118# know how each target is implemented. And it means the
2119# dependencies here will not need to change if the force-build
2120# details change some day.
2121
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002122git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04002123git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002124 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2125 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2126 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07002127
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002128git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04002129 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2130 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07002131
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002132help.sp help.s help.o: command-list.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01002133
Emily Shaffer709df952020-04-16 14:18:03 -07002134builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002135builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002136 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2137 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2138 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07002139
Jeff King520a6cd2012-06-20 14:32:22 -04002140version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04002141version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04002142 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01002143 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
Johannes Schindelin5cf8e062018-06-27 21:35:23 +02002144 '-DGIT_BUILT_FROM_COMMIT="$(shell \
2145 GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2146 git rev-parse -q --verify HEAD 2>/dev/null)"'
Jeff King816fb462012-06-02 14:51:42 -04002147
Junio C Hamano91730802006-04-10 17:37:58 -07002148$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02002149 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002150 ln $< $@ 2>/dev/null || \
2151 ln -s $< $@ 2>/dev/null || \
2152 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07002153
Emily Shaffer709df952020-04-16 14:18:03 -07002154config-list.h: generate-configlist.sh
2155
2156config-list.h:
2157 $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
2158 >$@+ && mv $@+ $@
2159
Nguyễn Thái Ngọc Duyf318d732018-05-10 10:46:41 +02002160command-list.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07002161
Nguyễn Thái Ngọc Duy76b993a2018-10-27 08:22:34 +02002162command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
Johannes Schindelin724d6352019-04-18 06:16:40 -07002163 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2164 $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
2165 command-list.txt >$@+ && mv $@+ $@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002166
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002167SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
Jeff Kingb5295f32012-06-20 14:32:19 -04002168 $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002169 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
2170 $(perllibdir_SQ)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002171define cmd_munge_script
2172$(RM) $@ $@+ && \
2173sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2174 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002175 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002176 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002177 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08002178 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002179 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04002180 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
2181 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Junio C Hamano71b40102016-03-08 15:47:57 -08002182 -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00002183 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002184 $@.sh >$@+
2185endef
2186
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002187GIT-SCRIPT-DEFINES: FORCE
2188 @FLAGS='$(SCRIPT_DEFINES)'; \
2189 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002190 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002191 echo "$$FLAGS" >$@; \
2192 fi
2193
2194
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002195$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002196 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002197 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002198 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002199
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002200$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002201 $(QUIET_GEN)$(cmd_munge_script) && \
2202 mv $@+ $@
2203
Johannes Schindelinadb59de2018-11-06 06:55:50 -08002204git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002205 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01002206 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
2207 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06002208 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002209
Jeff Kinge204b002014-11-18 12:43:09 -05002210# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002211$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05002212
Dan Jacques07d90ea2018-04-10 11:05:43 -04002213# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
2214# since the locale directory is injected.
2215perl_localedir_SQ = $(localedir_SQ)
Alex Riesenf8487182006-12-04 10:50:04 +01002216
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002217ifndef NO_PERL
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002218PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002219PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002220
Dan Jacques07d90ea2018-04-10 11:05:43 -04002221PERL_DEFINES := $(PERL_PATH_SQ) $(PERLLIB_EXTRA_SQ) $(perllibdir_SQ)
2222PERL_DEFINES += $(RUNTIME_PREFIX)
2223
2224# Support Perl runtime prefix. In this mode, a different header is installed
2225# into Perl scripts.
2226ifdef RUNTIME_PREFIX
2227
2228PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
2229
2230# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
2231# at runtime.
2232perl_localedir_SQ =
2233
2234endif
2235
2236PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
2237
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002238$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
Emil Medve4cb08df2007-07-14 12:51:44 -05002239 $(QUIET_GEN)$(RM) $@ $@+ && \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002240 sed -e '1{' \
2241 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Alejandro R. Sedeño66000542018-06-25 15:13:25 -04002242 -e ' r GIT-PERL-HEADER' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002243 -e ' G' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002244 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07002245 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002246 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002247 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002248 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002249
Dan Jacques07d90ea2018-04-10 11:05:43 -04002250PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002251GIT-PERL-DEFINES: FORCE
2252 @FLAGS='$(PERL_DEFINES)'; \
2253 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2254 echo >&2 " * new perl-specific parameters"; \
2255 echo "$$FLAGS" >$@; \
2256 fi
2257
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002258GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
2259 $(QUIET_GEN)$(RM) $@ && \
2260 INSTLIBDIR='$(perllibdir_SQ)' && \
2261 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
2262 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
2263 sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
Jonathan Nieder64f982b2018-04-23 16:25:35 -07002264 -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002265 -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
2266 -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
2267 -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002268 $< >$@+ && \
2269 mv $@+ $@
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002270
Christian Hessed8698982018-04-19 06:44:40 +09002271.PHONY: perllibdir
Christian Hessecfb3a472018-04-10 15:36:41 +02002272perllibdir:
2273 @echo '$(perllibdir_SQ)'
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002274
2275.PHONY: gitweb
2276gitweb:
2277 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2278
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002279git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002280 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002281 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002282 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002283else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002284$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Jeff King499c2932009-04-03 15:32:20 -04002285 $(QUIET_GEN)$(RM) $@ $@+ && \
2286 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2287 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2288 unimplemented.sh >$@+ && \
2289 chmod +x $@+ && \
2290 mv $@+ $@
2291endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002292
Jonathan Niederca2051d2014-11-18 10:43:47 -08002293# This makes sure we depend on the NO_PYTHON setting itself.
2294$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2295
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002296ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002297$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2298$(SCRIPT_PYTHON_GEN): % : %.py
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002299 $(QUIET_GEN)$(RM) $@ $@+ && \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002300 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002301 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002302 chmod +x $@+ && \
2303 mv $@+ $@
2304else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002305$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002306 $(QUIET_GEN)$(RM) $@ $@+ && \
2307 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2308 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2309 unimplemented.sh >$@+ && \
2310 chmod +x $@+ && \
2311 mv $@+ $@
2312endif # NO_PYTHON
2313
Jeff King7f1b6972013-02-21 01:26:14 -05002314CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
2315 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
2316 configure.ac >configure.ac+ && \
2317 autoconf -o configure configure.ac+ && \
2318 $(RM) configure.ac+
2319
Jeff King520a6cd2012-06-20 14:32:22 -04002320configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002321 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002322
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002323ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002324# We avoid depending on 'configure' here, because it gets rebuilt
2325# every time GIT-VERSION-FILE is modified, only to update the embedded
2326# version number string, which config.status does not care about. We
2327# do want to recheck when the platform/environment detection logic
2328# changes, hence this depends on configure.ac.
2329config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002330 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002331 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002332 ./config.status --recheck; \
2333 else \
2334 ./configure; \
2335 fi
2336reconfigure config.mak.autogen: config.status
2337 $(QUIET_GEN)./config.status
2338.PHONY: reconfigure # This is a convenience target.
2339endif
2340
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002341XDIFF_OBJS += xdiff/xdiffi.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002342XDIFF_OBJS += xdiff/xemit.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002343XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002344XDIFF_OBJS += xdiff/xmerge.o
2345XDIFF_OBJS += xdiff/xpatience.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002346XDIFF_OBJS += xdiff/xprepare.o
2347XDIFF_OBJS += xdiff/xutils.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002348
Denton Liu805d9ea2020-03-21 05:21:20 -04002349VCSSVN_OBJS += vcs-svn/fast_export.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002350VCSSVN_OBJS += vcs-svn/line_buffer.o
Jonathan Nieder9d2f5dd2011-01-02 21:54:58 -06002351VCSSVN_OBJS += vcs-svn/sliding_window.o
Jonathan Niederddcc8c52010-12-25 05:11:32 -06002352VCSSVN_OBJS += vcs-svn/svndiff.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002353VCSSVN_OBJS += vcs-svn/svndump.o
2354
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002355TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002356OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
2357 $(XDIFF_OBJS) \
2358 $(VCSSVN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07002359 $(FUZZ_OBJS) \
Jeff King3f2e2292016-07-01 01:58:58 -04002360 common-main.o \
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002361 git.o
2362ifndef NO_CURL
2363 OBJECTS += http.o http-walker.o remote-curl.o
2364endif
Jonathan Niederc3739912010-01-26 09:52:11 -06002365
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002366dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002367dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002368
Jonathan Nieder024c8432011-11-18 03:58:21 -06002369ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002370$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002371 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002372
2373missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002374dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002375dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002376endif
2377
Jonathan Nieder024c8432011-11-18 03:58:21 -06002378ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002379dep_dirs =
2380missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002381dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002382endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002383
2384ASM_SRC := $(wildcard $(OBJECTS:o=S))
2385ASM_OBJ := $(ASM_SRC:S=o)
2386C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002387
Jonathan Nieder30248882010-01-26 09:51:24 -06002388.SUFFIXES:
2389
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002390$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05002391 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002392$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05002393 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002394
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002395%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002396 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002397
2398ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2399# Take advantage of gcc's on-the-fly dependency generation
2400# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2401dep_files_present := $(wildcard $(dep_files))
2402ifneq ($(dep_files_present),)
2403include $(dep_files_present)
2404endif
2405else
Jonathan Niederdfea5752010-01-26 09:52:49 -06002406# Dependencies on header files, for platforms that do not support
2407# the gcc -MMD option.
2408#
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002409# Dependencies on automatically generated headers such as command-list.h
Jonathan Niederdfea5752010-01-26 09:52:49 -06002410# should _not_ be included here, since they are necessary even when
2411# building an object for the first time.
Pavel Roskinb05701c2005-08-06 01:36:15 -04002412
Johannes Schindelin92b88eb2019-03-04 05:47:06 -08002413$(OBJECTS): $(LIB_H) $(GENERATED_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002414endif
Junio C Hamano7a590132005-08-06 13:10:43 -07002415
Stefan Bellerd807c4a2018-04-10 14:26:18 -07002416exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
2417exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002418 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002419 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002420 '-DBINDIR="$(bindir_relative_SQ)"' \
Philip Oakley4d5b4c22018-04-21 13:18:42 +02002421 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002422
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002423builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002424builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002425 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002426
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002427config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002428config.sp config.s config.o: EXTRA_CPPFLAGS = \
2429 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002430
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002431attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002432attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2433 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002434
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002435gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002436gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002437 -DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002438
Ramsay Jones15caca22019-02-05 02:27:48 +00002439http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002440 -DCURL_DISABLE_TYPECHECK
2441
Ramsay Jones15caca22019-02-05 02:27:48 +00002442pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
Ramsay Jones54360a12018-02-12 00:21:02 +00002443
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002444ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002445http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002446endif
2447
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002448ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002449compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2450 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002451endif
2452
René Scharfed555ff52010-09-11 11:59:18 +02002453ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002454compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002455 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones15caca22019-02-05 02:27:48 +00002456compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002457endif
2458
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002459git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002460 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002461
Emily Shaffer238b4392020-04-16 14:18:04 -07002462git-bugreport$X: bugreport.o GIT-LDFLAGS $(GITLIBS)
2463 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
2464 $(LIBS)
2465
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002466git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002467 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002468 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002469
John Keepingfd78ced2014-01-25 13:11:44 +00002470git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002471 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002472 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002473git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002474 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002475 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002476
Florian Achleitner48ea9f92012-09-19 17:21:16 +02002477git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
2478 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
2479 $(VCSSVN_LIB)
2480
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002481$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2482 $(QUIET_LNCP)$(RM) $@ && \
2483 ln $< $@ 2>/dev/null || \
2484 ln -s $< $@ 2>/dev/null || \
2485 cp $< $@
2486
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002487$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002488 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002489 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002490
Petr Baudis28818ff2005-07-29 17:50:24 +02002491$(LIB_FILE): $(LIB_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002492 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002493
Linus Torvalds34435462006-03-24 20:13:22 -08002494$(XDIFF_LIB): $(XDIFF_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002495 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002496
Jonathan Nieder3f527372010-08-09 17:04:29 -05002497$(VCSSVN_LIB): $(VCSSVN_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002498 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002499
Jonathan Nieder5b586192012-03-31 03:44:53 -05002500export DEFAULT_EDITOR DEFAULT_PAGER
2501
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07002502Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
2503 @EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
2504 if test x"$$EXCLUDED" != \
2505 x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
2506 echo >&2 " * new documentation flags"; \
2507 echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
2508 fi
2509
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002510.PHONY: doc man man-perl html info pdf
2511doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002512 $(MAKE) -C Documentation all
2513
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002514man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002515 $(MAKE) -C Documentation man
2516
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002517man-perl: perl/build/man/man3/Git.3pm
2518
Michael J Gruber414851a2008-09-10 10:19:34 +02002519html:
2520 $(MAKE) -C Documentation html
2521
David Kastrup47398092007-08-06 12:22:57 +02002522info:
2523 $(MAKE) -C Documentation info
2524
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002525pdf:
2526 $(MAKE) -C Documentation pdf
2527
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002528XGETTEXT_FLAGS = \
2529 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002530 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002531 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2532 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002533XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2534 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002535XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2536 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002537XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002538 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002539LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002540LOCALIZED_SH = $(SCRIPT_SH)
2541LOCALIZED_SH += git-parse-remote.sh
Alban Gruinc42abfe2018-05-28 14:34:19 +02002542LOCALIZED_SH += git-rebase--preserve-merges.sh
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002543LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002544LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002545
2546ifdef XGETTEXT_INCLUDE_TESTS
2547LOCALIZED_C += t/t0200/test.c
2548LOCALIZED_SH += t/t0200/test.sh
2549LOCALIZED_PERL += t/t0200/test.perl
2550endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002551
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002552## Note that this is meant to be run only by the localization coordinator
2553## under a very controlled condition, i.e. (1) it is to be run in a
2554## Git repository (not a tarball extract), (2) any local modifications
2555## will be lost.
2556## Gettext tools cannot work with our own custom PRItime type, so
2557## we replace PRItime with PRIuMAX. We need to update this to
2558## PRIdMAX if we switch to a signed type later.
2559
Jonathan Nieder1f319632014-08-22 00:32:08 -04002560po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002561 # All modifications will be reverted at the end, so we do not
2562 # want to have any local change.
2563 git diff --quiet HEAD && git diff --quiet --cached
2564
2565 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2566 do \
2567 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2568 cat "$$s+" >"$$s" && rm "$$s+"; \
2569 done
2570
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002571 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2572 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2573 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002574 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2575 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002576
2577 # Reverting the munged source, leaving only the updated $@
2578 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002579 mv $@+ $@
2580
Elia Pintoe6be2652015-12-15 15:21:00 +00002581.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002582pot: po/git.pot
2583
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002584POFILES := $(wildcard po/*.po)
2585MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2586
2587ifndef NO_GETTEXT
2588all:: $(MOFILES)
2589endif
2590
2591po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2592 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2593
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002594LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2595LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002596LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2597LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002598
2599ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002600all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002601ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002602all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002603endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002604NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002605endif
2606
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002607perl/build/lib/%.pm: perl/%.pm
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002608 $(QUIET_GEN)mkdir -p $(dir $@) && \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002609 sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002610 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2611 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002612
2613perl/build/man/man3/Git.3pm: perl/Git.pm
2614 $(QUIET_GEN)mkdir -p $(dir $@) && \
2615 pod2man $< $@
2616
Jeff Kinge951ebc2016-12-14 09:26:55 -05002617FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002618 git ls-files \
2619 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002620 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002621 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002622 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002623 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002624 $(FIND) . \
2625 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002626 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002627 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002628 -o \( -name build -type d -prune \) \
2629 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002630 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002631 -o \( -name '*.sh' -type f -print \) \
Denton Liu43f8c892019-09-16 12:23:14 -07002632 | sed -e 's|^\./||' \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002633 )
Junio C Hamano33533972011-10-18 00:26:18 -07002634
Junio C Hamano2f769192010-09-28 16:08:38 -05002635$(ETAGS_TARGET): FORCE
2636 $(RM) $(ETAGS_TARGET)
Junio C Hamano33533972011-10-18 00:26:18 -07002637 $(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002638
Junio C Hamano2f769192010-09-28 16:08:38 -05002639tags: FORCE
Emil Medve4cb08df2007-07-14 12:51:44 -05002640 $(RM) tags
Junio C Hamano33533972011-10-18 00:26:18 -07002641 $(FIND_SOURCE_FILES) | xargs ctags -a
Petr Baudis28818ff2005-07-29 17:50:24 +02002642
Kristof Provosta2a91502007-10-06 16:24:42 +02002643cscope:
2644 $(RM) cscope*
Junio C Hamano33533972011-10-18 00:26:18 -07002645 $(FIND_SOURCE_FILES) | xargs cscope -b
Kristof Provosta2a91502007-10-06 16:24:42 +02002646
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002647### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002648TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2649 $(localedir_SQ)
2650
2651GIT-PREFIX: FORCE
2652 @FLAGS='$(TRACK_PREFIX)'; \
2653 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002654 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002655 echo "$$FLAGS" >GIT-PREFIX; \
2656 fi
2657
2658TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002659
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002660GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002661 @FLAGS='$(TRACK_CFLAGS)'; \
2662 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002663 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002664 echo "$$FLAGS" >GIT-CFLAGS; \
2665 fi
2666
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002667TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2668
2669GIT-LDFLAGS: FORCE
2670 @FLAGS='$(TRACK_LDFLAGS)'; \
2671 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002672 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002673 echo "$$FLAGS" >GIT-LDFLAGS; \
2674 fi
2675
Junio C Hamanobfce5082008-07-25 12:35:10 -07002676# We need to apply sq twice, once to protect from the shell
2677# that runs GIT-BUILD-OPTIONS, and then again to protect it
2678# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002679GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002680 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002681 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002682 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2683 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2684 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2685 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2686 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002687 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002688 @echo USE_LIBPCRE1=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE1)))'\' >>$@+
2689 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00002690 @echo NO_LIBPCRE1_JIT=\''$(subst ','\'',$(subst ','\'',$(NO_LIBPCRE1_JIT)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002691 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002692 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002693 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2694 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002695 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002696 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
Johannes Schindelin8abfdf42018-11-14 08:32:11 -08002697 @echo X=\'$(X)\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002698ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002699 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002700endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002701ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002702 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002703endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002704ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002705 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002706endif
2707ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002708 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002709endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002710 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002711ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002712 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002713endif
2714ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002715 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002716endif
2717ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002718 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002719endif
2720ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002721 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002722endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002723ifdef GIT_PERF_MAKE_COMMAND
2724 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2725endif
Jeff King3d893612017-02-25 04:37:07 -05002726ifdef GIT_INTEROP_MAKE_OPTS
2727 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2728endif
Ben Peart1f357b02018-09-18 23:29:36 +00002729ifdef GIT_TEST_INDEX_VERSION
2730 @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002731endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002732 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002733
Christian Couder96a46472012-12-18 16:26:38 +01002734### Detect Python interpreter path changes
2735ifndef NO_PYTHON
2736TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002737
Christian Couder96a46472012-12-18 16:26:38 +01002738GIT-PYTHON-VARS: FORCE
2739 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002740 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002741 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002742 echo "$$VARS" >$@; \
2743 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002744endif
2745
Matthew Ogilvieea925192009-12-02 22:14:05 -07002746test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2747
2748all:: $(TEST_PROGRAMS) $(test_bindir_programs)
2749
2750bin-wrappers/%: wrap-for-bin.sh
2751 @mkdir -p bin-wrappers
2752 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2753 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Johannes Schindelin3a94cb32019-07-29 13:08:16 -07002754 -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
Matthew Ogilvieea925192009-12-02 22:14:05 -07002755 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002756
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002757# GNU make supports exporting all variables by "export" without parameters.
2758# However, the environment gets quite big, and some programs have problems
2759# with that.
2760
Johannes Schindelin140245b2006-07-07 13:26:31 +02002761export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002762export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002763
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002764### Testing rules
2765
Junio C Hamano96651ef2007-04-28 15:32:49 -07002766test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002767 $(MAKE) -C t/ all
2768
Thomas Rast342e9ef2012-02-17 11:25:09 +01002769perf: all
2770 $(MAKE) -C t/perf/ all
2771
2772.PHONY: test perf
2773
Jeff King4df7c8a2016-07-01 03:59:44 -04002774t/helper/test-line-buffer$X: $(VCSSVN_LIB)
René Scharfeb4285c72009-01-17 16:50:13 +01002775
Jeff King4df7c8a2016-07-01 03:59:44 -04002776t/helper/test-svn-fe$X: $(VCSSVN_LIB)
David Barr21746aa2010-08-09 17:55:00 -05002777
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002778.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002779
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002780t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2781
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002782t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
David Barr1d73b522010-08-09 17:34:42 -05002783 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002784
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +01002785check-sha1:: t/helper/test-tool$X
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002786 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002787
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002788SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2789
2790$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
2791 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
Ramsay Jones15caca22019-02-05 02:27:48 +00002792 $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $<
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002793
2794.PHONY: sparse $(SP_OBJ)
2795sparse: $(SP_OBJ)
2796
Emily Shaffer709df952020-04-16 14:18:03 -07002797EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/%
Ramsay Jonesf23aa182019-03-06 00:11:13 +00002798ifndef GCRYPT_SHA256
2799 EXCEPT_HDRS += sha256/gcrypt.h
2800endif
Denton Liucf6a2d22019-09-16 12:23:08 -07002801CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002802HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
Denton Liub503a2d2019-09-25 01:21:01 -07002803HCC = $(HCO:hco=hcc)
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002804
Denton Liub503a2d2019-09-25 01:21:01 -07002805%.hcc: %.h
2806 @echo '#include "git-compat-util.h"' >$@
2807 @echo '#include "$<"' >>$@
2808
2809$(HCO): %.hco: %.hcc FORCE
2810 $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002811
2812.PHONY: hdr-check $(HCO)
2813hdr-check: $(HCO)
2814
Brandon Williams21188052017-08-14 14:30:46 -07002815.PHONY: style
2816style:
2817 git clang-format --style file --diff --extensions c,h
2818
Emily Shaffer709df952020-04-16 14:18:03 -07002819check: config-list.h command-list.h
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01002820 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002821 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07002822 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002823 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002824 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07002825 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002826 exit 1; \
2827 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02002828
Denton Liu9027af52019-09-16 12:23:16 -07002829FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
2830COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02002831
2832%.cocci.patch: %.cocci $(COCCI_SOURCES)
Denton Liu4f3c1dc2019-10-09 13:43:46 -07002833 $(QUIET_SPATCH) \
Jeff Kingbcb4edf2019-05-08 03:07:54 -04002834 if test $(SPATCH_BATCH_SIZE) = 0; then \
2835 limit=; \
2836 else \
2837 limit='-n $(SPATCH_BATCH_SIZE)'; \
2838 fi; \
2839 if ! echo $(COCCI_SOURCES) | xargs $$limit \
Jeff King960154b2019-05-06 19:43:34 -04002840 $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
2841 >$@+ 2>$@.log; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002842 then \
2843 cat $@.log; \
2844 exit 1; \
2845 fi; \
2846 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02002847 if test -s $@; \
2848 then \
2849 echo ' ' SPATCH result: $@; \
2850 fi
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002851coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
René Scharfe63f0a752016-09-15 20:30:56 +02002852
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002853# See contrib/coccinelle/README
2854coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
2855
2856.PHONY: coccicheck coccicheck-pending
Petr Baudis28818ff2005-07-29 17:50:24 +02002857
Petr Baudis28818ff2005-07-29 17:50:24 +02002858### Installation rules
2859
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002860ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002861template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002862else
2863template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002864endif
2865export template_instdir
2866
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002867ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002868gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002869else
2870gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002871endif
2872gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
2873export gitexec_instdir
2874
David Aguilarbc7a96a2011-08-18 00:23:46 -07002875ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2876mergetools_instdir = $(mergetoolsdir)
2877else
2878mergetools_instdir = $(prefix)/$(mergetoolsdir)
2879endif
2880mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2881
Matthew Ogilvieea925192009-12-02 22:14:05 -07002882install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
2883
Elia Pintoe6be2652015-12-15 15:21:00 +00002884.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07002885profile-install: profile
2886 $(MAKE) install
2887
2888profile-fast-install: profile-fast
2889 $(MAKE) install
2890
Andreas Ericssond6ebd252005-11-22 00:44:15 +01002891install: all
Robert Schiele41650762007-12-01 18:05:40 +01002892 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002893 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2894 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08002895 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthew Ogilvieea925192009-12-02 22:14:05 -07002896 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07002897ifdef MSVC
2898 # We DO NOT install the individual foo.o.pdb files because they
2899 # have already been rolled up into the exe's pdb file.
2900 # We DO NOT have pdb files for the builtin commands (like git-status.exe)
2901 # because it is just a copy/hardlink of git.exe, rather than a unique binary.
2902 $(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2903 $(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2904 $(INSTALL) git-upload-pack.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2905 $(INSTALL) git-credential-store.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2906 $(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2907 $(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2908 $(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2909 $(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2910 $(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2911 $(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2912 $(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2913 $(INSTALL) git-remote-testsvn.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2914 $(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2915 $(INSTALL) git-show-index.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2916ifndef DEBUG
2917 $(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2918 $(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2919else
2920 $(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2921 $(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2922endif
2923endif
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01002924 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07002925 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05002926 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002927ifndef NO_GETTEXT
2928 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
2929 (cd po/build/locale && $(TAR) cf - .) | \
2930 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
2931endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07002932ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002933 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
2934 (cd perl/build/lib && $(TAR) cf - .) | \
2935 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07002936 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07002937endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002938ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002939 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002940 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002941endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002942ifneq (,$X)
Eric Blaked4b19022009-04-28 06:28:31 -06002943 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002944endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002945
Johannes Sixt46beb552008-07-21 21:19:51 +02002946 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002947 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002948 destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07002949 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05002950 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
2951 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002952 test -n "$(INSTALL_SYMLINKS)" && \
2953 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
2954 { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
2955 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
2956 cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
Brandon Casey76d079a2010-07-23 12:50:45 -05002957 done; \
2958 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05002959 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
2960 $(RM) "$$bindir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002961 test -n "$(INSTALL_SYMLINKS)" && \
2962 ln -s "git$X" "$$bindir/$$p" || \
2963 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2964 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2965 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2966 cp "$$bindir/git$X" "$$bindir/$$p" || exit; } \
Brandon Casey40919c42010-07-23 12:50:44 -05002967 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002968 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06002969 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002970 test -n "$(INSTALL_SYMLINKS)" && \
2971 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
2972 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2973 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2974 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2975 cp "$$execdir/git$X" "$$execdir/$$p" || exit; } \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002976 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07002977 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
2978 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002979 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002980 test -n "$(INSTALL_SYMLINKS)" && \
2981 ln -s "git-remote-http$X" "$$execdir/$$p" || \
2982 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2983 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2984 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2985 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
Brandon Casey49a43f52010-07-06 14:56:51 -07002986 done && \
Johannes Sixt7b4b59a2008-07-21 21:19:58 +02002987 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
Petr Baudis28818ff2005-07-29 17:50:24 +02002988
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002989.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00002990.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02002991install-gitweb:
2992 $(MAKE) -C gitweb install
2993
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002994install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002995 $(MAKE) -C Documentation install
2996
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002997install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002998 $(MAKE) -C Documentation install-man
2999
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003000install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003001 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
3002 (cd perl/build/man/man3 && $(TAR) cf - .) | \
3003 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
3004
Teemu Likonenae081f32008-06-10 11:34:25 +03003005install-html:
3006 $(MAKE) -C Documentation install-html
3007
David Kastrup47398092007-08-06 12:22:57 +02003008install-info:
3009 $(MAKE) -C Documentation install-info
3010
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01003011install-pdf:
3012 $(MAKE) -C Documentation install-pdf
3013
Eric Wong6538d1e2006-12-23 08:26:09 -08003014quick-install-doc:
3015 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02003016
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003017quick-install-man:
3018 $(MAKE) -C Documentation quick-install-man
3019
Michael J Gruber6fe570d2008-09-09 22:44:17 +02003020quick-install-html:
3021 $(MAKE) -C Documentation quick-install-html
3022
Petr Baudis28818ff2005-07-29 17:50:24 +02003023
3024
3025### Maintainer's dist rules
3026
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01003027GIT_TARNAME = git-$(GIT_VERSION)
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02003028dist: git-archive$(X) configure
Junio C Hamano9ccb64c2006-10-05 02:26:12 -07003029 ./git-archive --format=tar \
3030 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003031 @mkdir -p $(GIT_TARNAME)
Junio C Hamanoab214332016-04-04 23:42:41 -07003032 @cp configure $(GIT_TARNAME)
H. Peter Anvin181129d2006-01-09 18:07:01 -08003033 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05003034 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
H. Peter Anvin181129d2006-01-09 18:07:01 -08003035 $(TAR) rf $(GIT_TARNAME).tar \
Matthias Lederhoferf58494b2007-06-18 23:30:36 +02003036 $(GIT_TARNAME)/configure \
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05003037 $(GIT_TARNAME)/version \
Shawn O. Pearce115f0fe2007-03-12 13:40:31 -04003038 $(GIT_TARNAME)/git-gui/version
Ævar Arnfjörð Bjarmasonbc2ed312017-12-08 22:29:58 +00003039ifdef DC_SHA1_SUBMODULE
3040 @mkdir -p $(GIT_TARNAME)/sha1collisiondetection/lib
3041 @cp sha1collisiondetection/LICENSE.txt \
3042 $(GIT_TARNAME)/sha1collisiondetection/
3043 @cp sha1collisiondetection/LICENSE.txt \
3044 $(GIT_TARNAME)/sha1collisiondetection/
3045 @cp sha1collisiondetection/lib/sha1.[ch] \
3046 $(GIT_TARNAME)/sha1collisiondetection/lib/
3047 @cp sha1collisiondetection/lib/ubc_check.[ch] \
3048 $(GIT_TARNAME)/sha1collisiondetection/lib/
3049 $(TAR) rf $(GIT_TARNAME).tar \
3050 $(GIT_TARNAME)/sha1collisiondetection/LICENSE.txt \
3051 $(GIT_TARNAME)/sha1collisiondetection/lib/sha1.[ch] \
3052 $(GIT_TARNAME)/sha1collisiondetection/lib/ubc_check.[ch]
3053endif
Emil Medve4cb08df2007-07-14 12:51:44 -05003054 @$(RM) -r $(GIT_TARNAME)
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06003055 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003056
Junio C Hamanoab214332016-04-04 23:42:41 -07003057rpm::
3058 @echo >&2 "Use distro packaged sources to run rpmbuild"
3059 @false
3060.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07003061
Johannes Schindelin46689312019-10-04 08:09:36 -07003062ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
3063OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
3064endif
3065
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003066artifacts-tar:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) \
3067 GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003068 $(MOFILES)
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003069 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
3070 SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
3071 test -n "$(ARTIFACTS_DIRECTORY)"
3072 mkdir -p "$(ARTIFACTS_DIRECTORY)"
3073 $(TAR) czf "$(ARTIFACTS_DIRECTORY)/artifacts.tar.gz" $^ templates/blt/
3074.PHONY: artifacts-tar
3075
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003076htmldocs = git-htmldocs-$(GIT_VERSION)
3077manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00003078.PHONY: dist-doc distclean
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003079dist-doc:
Emil Medve4cb08df2007-07-14 12:51:44 -05003080 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003081 mkdir .doc-tmp-dir
3082 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
3083 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
3084 gzip -n -9 -f $(htmldocs).tar
3085 :
Emil Medve4cb08df2007-07-14 12:51:44 -05003086 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07003087 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02003088 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003089 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07003090 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003091 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003092 install
3093 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
3094 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05003095 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003096
Petr Baudis28818ff2005-07-29 17:50:24 +02003097### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06003098
Mathias Megyei922aa802007-10-04 23:49:19 +02003099distclean: clean
3100 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02003101 $(RM) config.log config.status config.cache
3102 $(RM) config.mak.autogen config.mak.append
3103 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02003104
Theodore Ts'of2d713f2012-02-06 01:00:17 -05003105profile-clean:
3106 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3107 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3108
SZEDER Gábor1a966382018-07-23 15:51:00 +02003109cocciclean:
3110 $(RM) contrib/coccinelle/*.cocci.patch*
3111
3112clean: profile-clean coverage-clean cocciclean
Junio C Hamano7897d842016-04-15 10:06:52 -07003113 $(RM) *.res
3114 $(RM) $(OBJECTS)
Vicent Martie1273102013-11-14 07:43:51 -05003115 $(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08003116 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003117 $(RM) $(TEST_PROGRAMS)
Josh Steadmon5e472152018-10-12 17:58:40 -07003118 $(RM) $(FUZZ_PROGRAMS)
Denton Liub503a2d2019-09-25 01:21:01 -07003119 $(RM) $(HCC)
Matt Kraai61564ca2013-02-13 07:57:48 -08003120 $(RM) -r bin-wrappers $(dep_dirs)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003121 $(RM) -r po/build/
Junio C Hamanof3719842019-12-13 15:15:34 -08003122 $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
Emil Medve4cb08df2007-07-14 12:51:44 -05003123 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
3124 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
3125 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02003126 $(MAKE) -C Documentation/ clean
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07003127 $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
Jeff King499c2932009-04-03 15:32:20 -04003128ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01003129 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003130 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04003131endif
Petr Baudisb1edc532006-06-24 04:34:29 +02003132 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07003133 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003134ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003135 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003136 $(MAKE) -C git-gui clean
3137endif
Christian Couder8f26aa42012-12-18 16:26:37 +01003138 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08003139 $(RM) GIT-USER-AGENT GIT-PREFIX
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04003140 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003141ifdef MSVC
3142 $(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3143 $(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3144 $(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3145 $(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3146 $(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3147 $(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3148 $(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3149 $(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3150 $(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3151 $(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3152 $(RM) compat/vcbuild/MSVC-DEFS-GEN
3153endif
Junio C Hamano9b88fce2005-12-27 14:40:17 -08003154
SZEDER Gábor1a966382018-07-23 15:51:00 +02003155.PHONY: all install profile-clean cocciclean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05003156.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Junio C Hamano2f769192010-09-28 16:08:38 -05003157.PHONY: FORCE cscope
Junio C Hamanod89056c2005-12-19 17:59:58 -08003158
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003159### Check documentation
3160#
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003161ALL_COMMANDS = $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS)
3162ALL_COMMANDS += git
Denton Liu805d9ea2020-03-21 05:21:20 -04003163ALL_COMMANDS += git-citool
3164ALL_COMMANDS += git-gui
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003165ALL_COMMANDS += gitk
3166ALL_COMMANDS += gitweb
Elia Pintoe6be2652015-12-15 15:21:00 +00003167
3168.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003169check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07003170 $(MAKE) -C Documentation lint-docs
Johannes Schindelin5ee42462019-03-25 14:41:39 -07003171 @(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003172 do \
3173 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003174 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02003175 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08003176 git-fsck-objects | git-init-db | \
Johannes Schindelin31cf4a62019-04-18 06:16:46 -07003177 git-remote-* | git-stage | git-legacy-* | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08003178 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003179 esac ; \
3180 test -f "Documentation/$$v.txt" || \
3181 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02003182 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08003183 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003184 case "$$v" in \
3185 git) ;; \
3186 *) echo "no link: $$v";; \
3187 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003188 done; \
3189 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02003190 sed -e '1,/^### command list/d' \
3191 -e '/^#/d' \
Johannes Schindelin8e6d6952019-03-25 14:41:38 -07003192 -e '/guide$$/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003193 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08003194 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04003195 $(MAKE) -C Documentation print-man1 | \
3196 grep '\.txt$$' | \
Johannes Schindelin057ccba2019-03-25 14:41:37 -07003197 sed -e 's|^|documented |' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003198 -e 's/\.txt//'; \
3199 ) | while read how cmd; \
3200 do \
Johannes Schindelin7c3bd712019-04-18 06:16:42 -07003201 case " $(patsubst %$X,%,$(ALL_COMMANDS) $(EXCLUDED_PROGRAMS)) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003202 *" $$cmd "*) ;; \
3203 *) echo "removed but $$how: $$cmd" ;; \
3204 esac; \
3205 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08003206
3207### Make sure built-ins do not have dups and listed in git.c
3208#
3209check-builtins::
3210 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08003211
Thomas Rast901c3692009-02-19 12:13:35 +01003212### Test suite coverage testing
3213#
Thomas Rast0c38a952013-05-13 23:27:25 +02003214.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00003215.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003216.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01003217
3218coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02003219 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02003220 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01003221
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003222object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003223coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003224 $(RM) $(addsuffix *.gcov,$(object_dirs))
3225 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003226 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003227 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003228 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01003229
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003230coverage-clean: coverage-clean-results
3231 $(RM) $(addsuffix *.gcno,$(object_dirs))
3232
Thomas Rast901c3692009-02-19 12:13:35 +01003233COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
3234COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003235GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01003236
Thomas Rast0c38a952013-05-13 23:27:25 +02003237coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01003238 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02003239
3240coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01003241 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02003242 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01003243
Derrick Stolee22991202019-01-29 09:05:18 -08003244coverage-prove: coverage-clean-results coverage-compile
3245 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
3246 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
3247 -j1 test
3248
Thomas Rast901c3692009-02-19 12:13:35 +01003249coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003250 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02003251 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003252 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00003253
3254coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01003255 grep '^function.*called 0 ' *.c.gcov \
3256 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003257 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003258
3259cover_db: coverage-report
3260 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003261
3262cover_db_html: cover_db
3263 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07003264
Josh Steadmon5e472152018-10-12 17:58:40 -07003265
3266### Fuzz testing
3267#
3268# Building fuzz targets generally requires a special set of compiler flags that
3269# are not necessarily appropriate for general builds, and that vary greatly
3270# depending on the compiler version used.
3271#
3272# An example command to build against libFuzzer from LLVM 4.0.0:
3273#
3274# make CC=clang CXX=clang++ \
Josh Steadmon8b7c2ee2019-01-15 14:25:52 -08003275# CFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
Josh Steadmon5e472152018-10-12 17:58:40 -07003276# LIB_FUZZING_ENGINE=/usr/lib/llvm-4.0/lib/libFuzzer.a \
3277# fuzz-all
3278#
Josh Steadmon927c77e2018-11-14 11:41:47 -08003279FUZZ_CXXFLAGS ?= $(CFLAGS)
3280
Josh Steadmon5e472152018-10-12 17:58:40 -07003281.PHONY: fuzz-all
3282
3283$(FUZZ_PROGRAMS): all
Josh Steadmon927c77e2018-11-14 11:41:47 -08003284 $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07003285 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3286
3287fuzz-all: $(FUZZ_PROGRAMS)