blob: 491f75e68c5315b7d931a444ae718b6338e10991 [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#
Jonathan Nieder162213d2009-10-09 05:15:29 -0500285# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
286# (not v1.73 or v1.71).
287#
Jeff King79c461d2010-11-19 12:54:24 -0500288# Define ASCIIDOC_ROFF if your DocBook XSL does not escape raw roff directives
289# (versions 1.68.1 through v1.72).
Jonas Fonseca7f55cf42007-11-14 10:38:46 +0100290#
Thomas Rast204d3632009-10-22 10:19:06 +0200291# Define GNU_ROFF if your target system uses GNU groff. This forces
292# apostrophes to be ASCII so that cut&pasting examples to the shell
293# will work.
294#
brian m. carlsonec3366e2017-01-22 02:41:56 +0000295# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
296# documentation.
297#
298# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
299# Extensions Lab if you have it available.
300#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800301# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
302#
Jeff King499c2932009-04-03 15:32:20 -0400303# Define NO_PERL if you do not want Perl scripts or libraries at all.
304#
Todd Zullinger075321c2018-03-03 15:38:16 +0000305# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
306# copies of CPAN modules that serve as a fallback in case the modules
307# are not available on the system. This option is intended for
308# distributions that want to use their packaged versions of Perl
309# modules, instead of the fallbacks shipped with Git.
310#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800311# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
312# but /usr/bin/python2.7 on some platforms).
313#
Johan Herlandd4e1b472009-11-18 02:42:31 +0100314# Define NO_PYTHON if you do not want Python scripts or libraries at all.
315#
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700316# Define NO_TCLTK if you do not want Tcl/Tk GUI.
317#
Junio C Hamano71b40102016-03-08 15:47:57 -0800318# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
319# and egrep that are pickier when their input contains non-ASCII data.
320#
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400321# The TCL_PATH variable governs the location of the Tcl interpreter
322# used to optimize git-gui for your system. Only used if NO_TCLTK
323# is not set. Defaults to the bare 'tclsh'.
324#
325# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700326# If not set it defaults to the bare 'wish'. If it is set to the empty
327# string then NO_TCLTK will be forced (this is used by configure script).
328#
Brian Downing43fe9012008-02-05 15:10:44 -0600329# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
330# is a simplified version of the merge sort used in glibc. This is
331# recommended if Git triggers O(n^2) behavior in your platform's qsort().
332#
René Scharfe04ee8b82017-01-22 18:51:11 +0100333# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
334# compatible with the one described in C11 Annex K.
335#
Johannes Sixt34779c52009-04-20 10:17:00 +0200336# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
337# information on a not yet closed file that lstat would return for the same
338# file after it was closed.
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200339#
Johannes Schindelin348df162009-04-28 00:32:25 +0200340# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
341# when hardlinking a file to another name and unlinking the original file right
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200342# away (some NTFS drivers seem to zero the contents in that scenario).
Junio C Hamano2c8f8b12009-05-23 01:43:08 -0700343#
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +0000344# Define INSTALL_SYMLINKS if you prefer to have everything that can be
345# symlinked between bin/ and libexec/ to use relative symlinks between
346# the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and
347# NO_INSTALL_HARDLINKS which will also use symlinking by indirection
348# within the same directory in some cases, INSTALL_SYMLINKS will
349# always symlink to the final target directly.
350#
Johannes Schindelin3426e342009-05-11 13:02:18 +0200351# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
352# programs as a tar, where bin/ and libexec/ might be on different file systems.
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200353#
Junio C Hamano70de5e62012-05-02 15:12:10 -0700354# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
355# copies to install built-in git commands e.g. git-cat-file.
356#
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200357# Define USE_NED_ALLOCATOR if you want to replace the platforms default
358# memory allocators with the nedmalloc allocator written by Niall Douglas.
Jeff King02232ad2009-06-16 15:07:40 -0400359#
René Scharfeca2baa32016-09-03 17:59:15 +0200360# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
361# This is necessary when using a custom allocator in order to avoid
362# crashes due to allocation and free working on different 'heaps'.
363# It's defined automatically if USE_NED_ALLOCATOR is set.
364#
Johannes Schindelin2f895222016-09-21 20:24:04 +0200365# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
366# feature.
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500367#
Jeff King21aeafc2011-12-10 05:41:01 -0500368# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
369# user.
370#
Jakub Narebski63267de2009-09-01 13:39:20 +0200371# Define JSMIN to point to JavaScript minifier that functions as
372# a filter to have gitweb.js minified.
Junio C Hamano8678bc02009-12-01 11:28:15 -0800373#
Mark Rada0e6ce212010-04-02 20:35:05 -0400374# Define CSSMIN to point to a CSS minifier in order to generate a minified
375# version of gitweb.css
376#
Junio C Hamanoa3d023d2009-10-30 20:45:34 -0500377# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
378# you want to use something different. The value will be interpreted by the
379# shell at runtime when it is used.
380#
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500381# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
382# want to use something different. The value will be interpreted by the shell
383# if necessary when it is used. Examples:
384#
385# DEFAULT_EDITOR='~/bin/vi',
386# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
387# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
Jonathan Niederdfea5752010-01-26 09:52:49 -0600388#
Jonathan Nieder024c8432011-11-18 03:58:21 -0600389# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
390# header files to be automatically computed, to avoid rebuilding objects when
391# an unrelated header file changes. Define it to "no" to use the hard-coded
392# dependency rules. The default is "auto", which means to use computed header
393# dependencies if your compiler is detected to support it.
394#
Eyvind Bernhardsen942e7742010-06-04 21:29:08 +0200395# Define NATIVE_CRLF if your platform uses CRLF for line endings.
Thomas Rast6942efc2012-04-06 23:01:23 +0200396#
Jeff King42dcbb72012-06-02 15:01:12 -0400397# Define GIT_USER_AGENT if you want to change how git identifies itself during
398# network interactions. The default is "git/$(GIT_VERSION)".
Junio C Hamanoa88d7aa2012-06-21 14:42:38 -0700399#
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +0000400# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
401# (defaults to "man") if you want to have a different default when
402# "git help" is called without a parameter specifying the format.
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100403#
Ben Peart1f357b02018-09-18 23:29:36 +0000404# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100405# with a different indexfile format version. If it isn't set the index
406# file format used is index-v[23].
Junio C Hamanobdb830c2014-04-08 11:59:05 -0700407#
Jeff King66547542014-04-01 17:28:42 -0400408# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
409# return NULL when it receives a bogus time_t.
Karsten Blees148d6772014-07-12 02:05:42 +0200410#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400411# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -0800412#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400413# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
414#
415# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
416# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
Reuben Hawkins88e01182015-01-08 12:00:57 -0800417#
Kyle J. McKay290c8e72015-01-11 12:09:22 -0800418# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
419# compiles the following initialization:
420#
421# static const char s[] = ("FOO");
422#
423# and define it to "no" if you need to remove the parentheses () around the
424# constant. The default is "auto", which means to use parentheses if your
425# compiler is detected to support it.
Junio C Hamano551fc7a2015-03-20 13:11:49 -0700426#
Kyle J. McKay95290802015-03-07 23:14:36 -0800427# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
Jeff King0cc30e02015-04-16 05:01:38 -0400428#
429# Define HAVE_GETDELIM if your system has the getdelim() function.
Eric Wong995bc222016-08-04 11:40:25 +0000430#
Duy Nguyen18a4f6b2019-02-12 21:14:41 +0700431# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
432#
Clément Chigot400caaf2019-04-25 07:01:56 +0000433# Define NEED_ACCESS_ROOT_HANDLER if access() under root may success for X_OK
434# even if execution permission isn't granted for any user.
435#
Eric Wong995bc222016-08-04 11:40:25 +0000436# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
437# default environment variables to be passed when a pager is spawned, e.g.
438#
439# PAGER_ENV = LESS=FRX LV=-c
440#
441# to say "export LESS=FRX (and LV=-c) if the environment variable
442# LESS (and LV) is not set, respectively".
Eric Sunshineb2289402017-12-15 00:34:34 +0100443#
Jeff King3f824e92017-12-08 05:47:22 -0500444# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
445# running the test scripts (e.g., bash has better support for "set -x"
446# tracing).
Junio C Hamano07b747d2018-01-05 13:28:09 -0800447#
Eric Sunshineb2289402017-12-15 00:34:34 +0100448# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
449# which the built Git will run (for instance "x86_64").
Dan Jacques07d90ea2018-04-10 11:05:43 -0400450#
451# Define RUNTIME_PREFIX to configure Git to resolve its ancillary tooling and
452# support files relative to the location of the runtime binary, rather than
453# hard-coding them into the binary. Git installations built with RUNTIME_PREFIX
454# can be moved to arbitrary filesystem locations. RUNTIME_PREFIX also causes
455# Perl scripts to use a modified entry point header allowing them to resolve
456# support files at runtime.
Dan Jacques226c0dd2018-04-10 11:05:44 -0400457#
458# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
459# supports the KERN_PROC BSD sysctl function.
460#
461# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform
462# mounts a "procfs" filesystem capable of resolving the path of the current
463# executable. If defined, this must be the canonical path for the "procfs"
464# current executable path.
465#
466# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform
467# supports calling _NSGetExecutablePath to retrieve the path of the running
468# executable.
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -0400469#
470# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
471# the global variable _wpgmptr containing the absolute path of the current
472# executable (this is the case on Windows).
Junio C Hamanoe998e7a2018-05-08 15:59:21 +0900473#
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +0000474# Define DEVELOPER to enable more compiler warnings. Compiler version
475# and family are auto detected, but could be overridden by defining
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +0100476# COMPILER_FEATURES (see config.mak.dev). You can still set
477# CFLAGS="..." in combination with DEVELOPER enables, whether that's
478# for tweaking something unrelated (e.g. optimization level), or for
479# selectively overriding something DEVELOPER or one of the DEVOPTS
480# (see just below) brings in.
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000481#
482# When DEVELOPER is set, DEVOPTS can be used to control compiler
483# options. This variable contains keywords separated by
ryenus571fb962019-12-15 15:12:24 +0000484# whitespace. The following keywords are recognized:
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000485#
486# no-error:
487#
488# suppresses the -Werror that implicitly comes with
489# DEVELOPER=1. Useful for getting the full set of errors
490# without immediately dying, or for logging them.
Ævar Arnfjörð Bjarmason26d2e4f2018-04-14 19:19:46 +0000491#
492# extra-all:
493#
494# The DEVELOPER mode enables -Wextra with a few exceptions. By
495# setting this flag the exceptions are removed, and all of
496# -Wextra is used.
Beat Bolli729b3922018-07-24 21:26:43 +0200497#
498# pedantic:
499#
500# Enable -pedantic compilation. This also disables
501# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200502
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600503GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100504 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800505-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200506
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100507# Set our default configuration.
508#
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200509# Among the variables below, these:
510# gitexecdir
511# template_dir
Johannes Sixt9fb1e692011-05-09 10:24:55 +0200512# sysconfdir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100513# can be specified as a relative path some/where/else;
514# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200515# runtime figures out where they are based on the path to the executable.
John Keeping971f8532013-02-24 19:55:01 +0000516# Additionally, the following will be treated as relative by "git" if they
517# begin with "$(prefix)/":
518# mandir
519# infodir
520# htmldir
Dan Jacques07d90ea2018-04-10 11:05:43 -0400521# localedir
522# perllibdir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200523# This can help installing the suite in a relocatable way.
524
Pavel Roskinb05701c2005-08-06 01:36:15 -0400525prefix = $(HOME)
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000526bindir = $(prefix)/bin
John Keeping971f8532013-02-24 19:55:01 +0000527mandir = $(prefix)/share/man
528infodir = $(prefix)/share/info
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100529gitexecdir = libexec/git-core
David Aguilarbc7a96a2011-08-18 00:23:46 -0700530mergetoolsdir = $(gitexecdir)/mergetools
Johannes Sixt93547682007-06-11 10:02:17 +0200531sharedir = $(prefix)/share
Pavan Kumar Sunkarabc951962010-05-28 11:55:50 +0530532gitwebdir = $(sharedir)/gitweb
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000533perllibdir = $(sharedir)/perl5
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100534localedir = $(sharedir)/locale
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100535template_dir = share/git-core/templates
John Keeping971f8532013-02-24 19:55:01 +0000536htmldir = $(prefix)/share/doc/git-doc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100537ETC_GITCONFIG = $(sysconfdir)/gitconfig
Petr Onderka6df42ab2010-09-01 00:42:43 +0200538ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
Robert Schiele10861be2007-08-01 06:30:35 +0200539lib = lib
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100540# DESTDIR =
Johannes Schindelin352c8112009-05-23 10:04:48 +0200541pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700542
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000543bindir_relative = $(patsubst $(prefix)/%,%,$(bindir))
John Keeping971f8532013-02-24 19:55:01 +0000544mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
545infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +0000546gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400547localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
John Keeping971f8532013-02-24 19:55:01 +0000548htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400549perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
John Keeping971f8532013-02-24 19:55:01 +0000550
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000551export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200552
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100553# Set our default programs
Ævar Arnfjörð Bjarmason6d62c982011-12-20 23:40:47 +0000554CC = cc
Pavel Roskinb05701c2005-08-06 01:36:15 -0400555AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500556RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000557DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700558TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700559FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400560INSTALL = install
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400561TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700562TCLTK_PATH = wish
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +0000563XGETTEXT = xgettext
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100564MSGFMT = msgfmt
Remi Pommarelf8915872015-10-21 19:10:46 +0200565CURL_CONFIG = curl-config
Thomas Raste146d172010-07-26 09:43:41 +0200566GCOV = gcov
Ævar Arnfjörð Bjarmason9559f8f2019-02-22 15:41:23 +0100567STRIP = strip
René Scharfe63f0a752016-09-15 20:30:56 +0200568SPATCH = spatch
Linus Torvaldse83c5162005-04-07 15:13:13 -0700569
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400570export TCL_PATH TCLTK_PATH
571
Ævar Arnfjörð Bjarmason8fb2a232019-02-22 15:41:25 +0100572# Set our default LIBS variables
573PTHREAD_LIBS = -lpthread
Petr Baudis8d7f5862006-06-25 03:47:03 +0200574
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100575# Guard against environment variables
576BUILTIN_OBJS =
577BUILT_INS =
578COMPAT_CFLAGS =
579COMPAT_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500580XDIFF_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500581VCSSVN_OBJS =
Jeff Kingb8ba6292012-06-20 14:30:56 -0400582GENERATED_H =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500583EXTRA_CPPFLAGS =
Josh Steadmon5e472152018-10-12 17:58:40 -0700584FUZZ_OBJS =
585FUZZ_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100586LIB_OBJS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600587PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100588PROGRAMS =
Johannes Schindelin724d6352019-04-18 06:16:40 -0700589EXCLUDED_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100590SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100591SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100592SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800593SCRIPT_LIB =
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100594TEST_BUILTINS_OBJS =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600595TEST_PROGRAMS_NEED_X =
Denton Liu5dedf7d2019-09-16 12:23:11 -0700596THIRD_PARTY_SOURCES =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100597
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500598# Having this variable in your environment would break pipelines because
599# you cause "cd" to echo its destination to stdout. It can also take
600# scripts to unexpected places. If you like CDPATH, define it for your
601# interactive shell sessions without exporting it.
602unexport CDPATH
603
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700604SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700605SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700606SCRIPT_SH += git-filter-branch.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700607SCRIPT_SH += git-merge-octopus.sh
608SCRIPT_SH += git-merge-one-file.sh
609SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700610SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700611SCRIPT_SH += git-quiltimport.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700612SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700613SCRIPT_SH += git-submodule.sh
614SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200615
Jonathan Nieder46bac902010-01-31 11:46:53 -0800616SCRIPT_LIB += git-mergetool--lib
617SCRIPT_LIB += git-parse-remote
Alban Gruinc42abfe2018-05-28 14:34:19 +0200618SCRIPT_LIB += git-rebase--preserve-merges
Jonathan Nieder46bac902010-01-31 11:46:53 -0800619SCRIPT_LIB += git-sh-setup
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000620SCRIPT_LIB += git-sh-i18n
Jonathan Nieder46bac902010-01-31 11:46:53 -0800621
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700622SCRIPT_PERL += git-add--interactive.perl
623SCRIPT_PERL += git-archimport.perl
624SCRIPT_PERL += git-cvsexportcommit.perl
625SCRIPT_PERL += git-cvsimport.perl
626SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700627SCRIPT_PERL += git-send-email.perl
628SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700629
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400630SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500631
Matthieu Moy4c06b412013-02-08 18:31:16 +0100632# Generated files for scripts
633SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
634SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
635SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
636
637# Individual rules to allow e.g.
638# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
639# from subdirectories like contrib/*/
640.PHONY: build-perl-script build-sh-script build-python-script
641build-perl-script: $(SCRIPT_PERL_GEN)
642build-sh-script: $(SCRIPT_SH_GEN)
643build-python-script: $(SCRIPT_PYTHON_GEN)
644
645.PHONY: install-perl-script install-sh-script install-python-script
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700646install-sh-script: $(SCRIPT_SH_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500647 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700648install-perl-script: $(SCRIPT_PERL_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500649 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700650install-python-script: $(SCRIPT_PYTHON_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500651 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100652
653.PHONY: clean-perl-script clean-sh-script clean-python-script
654clean-sh-script:
655 $(RM) $(SCRIPT_SH_GEN)
656clean-perl-script:
657 $(RM) $(SCRIPT_PERL_GEN)
658clean-python-script:
659 $(RM) $(SCRIPT_PYTHON_GEN)
660
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700661SCRIPTS = $(SCRIPT_SH_GEN) \
662 $(SCRIPT_PERL_GEN) \
663 $(SCRIPT_PYTHON_GEN) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500664 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100665
Junio C Hamano2f769192010-09-28 16:08:38 -0500666ETAGS_TARGET = TAGS
667
Josh Steadmonaa658572019-01-15 14:25:50 -0800668FUZZ_OBJS += fuzz-commit-graph.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700669FUZZ_OBJS += fuzz-pack-headers.o
Josh Steadmon1127a982018-10-12 17:58:41 -0700670FUZZ_OBJS += fuzz-pack-idx.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700671
672# Always build fuzz objects even if not testing, to prevent bit-rot.
673all:: $(FUZZ_OBJS)
674
675FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
676
Junio C Hamano42f77402006-08-15 21:38:07 -0700677# Empty...
678EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100679
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700680# ... and all the rest that could be moved out of bindir to gitexecdir
681PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600682
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700683PROGRAM_OBJS += credential-store.o
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100684PROGRAM_OBJS += daemon.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600685PROGRAM_OBJS += fast-import.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700686PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600687PROGRAM_OBJS += imap-send.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700688PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600689PROGRAM_OBJS += shell.o
Florian Achleitner48ea9f92012-09-19 17:21:16 +0200690PROGRAM_OBJS += remote-testsvn.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600691
Michael Palimakaace5e972012-02-08 21:59:04 +1100692# Binary suffix, set to .exe for Windows builds
693X =
694
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600695PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700696
Heba Walyb3b18d12020-03-02 20:01:59 +0000697TEST_BUILTINS_OBJS += test-advise.o
Garima Singhf52207a2020-03-30 00:31:24 +0000698TEST_BUILTINS_OBJS += test-bloom.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100699TEST_BUILTINS_OBJS += test-chmtime.o
Nguyễn Thái Ngọc Duy0e2678a2018-03-24 08:44:34 +0100700TEST_BUILTINS_OBJS += test-config.o
Nguyễn Thái Ngọc Duye4998942018-03-24 08:44:35 +0100701TEST_BUILTINS_OBJS += test-ctype.o
Nguyễn Thái Ngọc Duya801a7c2018-03-24 08:44:36 +0100702TEST_BUILTINS_OBJS += test-date.o
Nguyễn Thái Ngọc Duy9153dde2018-03-24 08:44:37 +0100703TEST_BUILTINS_OBJS += test-delta.o
Daniel Ferreira150791a2019-07-10 20:58:57 -0300704TEST_BUILTINS_OBJS += test-dir-iterator.o
Nguyễn Thái Ngọc Duy1c854742018-03-24 08:44:38 +0100705TEST_BUILTINS_OBJS += test-drop-caches.o
Nguyễn Thái Ngọc Duy06ccb292018-03-24 08:44:39 +0100706TEST_BUILTINS_OBJS += test-dump-cache-tree.o
Nguyễn Thái Ngọc Duyf1ef0b02018-09-09 19:36:30 +0200707TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
Nguyễn Thái Ngọc Duy81330612018-03-24 08:44:40 +0100708TEST_BUILTINS_OBJS += test-dump-split-index.o
Nguyễn Thái Ngọc Duycd780f02018-09-09 19:36:27 +0200709TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
Nguyễn Thái Ngọc Duydbceb3e2018-03-24 08:44:41 +0100710TEST_BUILTINS_OBJS += test-example-decorate.o
Nguyễn Thái Ngọc Duyc6806682018-03-24 08:44:42 +0100711TEST_BUILTINS_OBJS += test-genrandom.o
Johannes Schindelind5cfd142019-02-14 13:33:12 -0800712TEST_BUILTINS_OBJS += test-genzeros.o
brian m. carlson50c817e2018-11-14 04:09:32 +0000713TEST_BUILTINS_OBJS += test-hash.o
Nguyễn Thái Ngọc Duy7c18cbd2018-03-24 08:44:43 +0100714TEST_BUILTINS_OBJS += test-hashmap.o
brian m. carlson37649b72018-11-14 04:09:34 +0000715TEST_BUILTINS_OBJS += test-hash-speed.o
Nguyễn Thái Ngọc Duycc6f6632018-03-24 08:44:44 +0100716TEST_BUILTINS_OBJS += test-index-version.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000717TEST_BUILTINS_OBJS += test-json-writer.o
Nguyễn Thái Ngọc Duy64eb82f2018-03-24 08:44:33 +0100718TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
Nguyễn Thái Ngọc Duy9080e752018-03-24 08:44:45 +0100719TEST_BUILTINS_OBJS += test-match-trees.o
Nguyễn Thái Ngọc Duy34889d32018-03-24 08:44:46 +0100720TEST_BUILTINS_OBJS += test-mergesort.o
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +0100721TEST_BUILTINS_OBJS += test-mktemp.o
Christian Couder11510de2019-06-15 12:06:59 +0200722TEST_BUILTINS_OBJS += test-oidmap.o
Nguyễn Thái Ngọc Duyc033cc12018-03-24 08:44:48 +0100723TEST_BUILTINS_OBJS += test-online-cpus.o
Nguyễn Thái Ngọc Duy2f17c782018-09-09 19:36:29 +0200724TEST_BUILTINS_OBJS += test-parse-options.o
Alexandr Miloslavskiyd0d0a352019-12-31 10:15:12 +0000725TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
Nguyễn Thái Ngọc Duyb8d5cf42018-03-24 08:44:49 +0100726TEST_BUILTINS_OBJS += test-path-utils.o
Nguyễn Thái Ngọc Duy8ea40cc2018-09-09 19:36:28 +0200727TEST_BUILTINS_OBJS += test-pkt-line.o
Nguyễn Thái Ngọc Duy15b75812018-03-24 08:44:50 +0100728TEST_BUILTINS_OBJS += test-prio-queue.o
SZEDER Gábor2bb74b52019-09-16 22:54:12 +0200729TEST_BUILTINS_OBJS += test-progress.o
Derrick Stoleeab176ac2018-07-20 16:33:15 +0000730TEST_BUILTINS_OBJS += test-reach.o
Nguyễn Thái Ngọc Duy5fbe6002018-03-24 08:44:51 +0100731TEST_BUILTINS_OBJS += test-read-cache.o
Derrick Stolee4bd05932019-11-12 16:58:20 +0000732TEST_BUILTINS_OBJS += test-read-graph.o
Derrick Stolee4d805602018-07-12 15:39:23 -0400733TEST_BUILTINS_OBJS += test-read-midx.o
Nguyễn Thái Ngọc Duy65370d82018-03-24 08:44:52 +0100734TEST_BUILTINS_OBJS += test-ref-store.o
Nguyễn Thái Ngọc Duy90385312018-03-24 08:44:53 +0100735TEST_BUILTINS_OBJS += test-regex.o
Jonathan Tandade47c2018-07-11 15:42:42 -0700736TEST_BUILTINS_OBJS += test-repository.o
Nguyễn Thái Ngọc Duy77d4b8c2018-03-24 08:44:54 +0100737TEST_BUILTINS_OBJS += test-revision-walking.o
Nguyễn Thái Ngọc Duyae6a51f2018-03-24 08:44:55 +0100738TEST_BUILTINS_OBJS += test-run-command.o
Nguyễn Thái Ngọc Duyff5fb8b2018-03-24 08:44:56 +0100739TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
Johannes Schindelinb7ce24d2019-04-18 06:16:51 -0700740TEST_BUILTINS_OBJS += test-serve-v2.o
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +0100741TEST_BUILTINS_OBJS += test-sha1.o
Nguyễn Thái Ngọc Duya0fe6e62018-09-09 19:36:26 +0200742TEST_BUILTINS_OBJS += test-sha1-array.o
brian m. carlson13eeedb2018-11-14 04:09:36 +0000743TEST_BUILTINS_OBJS += test-sha256.o
Nguyễn Thái Ngọc Duye154a6f2018-03-24 08:44:58 +0100744TEST_BUILTINS_OBJS += test-sigchain.o
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +0100745TEST_BUILTINS_OBJS += test-strcmp-offset.o
Nguyễn Thái Ngọc Duyc932a5f2018-03-24 08:45:00 +0100746TEST_BUILTINS_OBJS += test-string-list.o
Nguyễn Thái Ngọc Duyb6188212018-03-24 08:45:01 +0100747TEST_BUILTINS_OBJS += test-submodule-config.o
Antonio Ospite2b1257e2018-10-25 18:18:13 +0200748TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
Nguyễn Thái Ngọc Duy112edd62018-03-24 08:45:02 +0100749TEST_BUILTINS_OBJS += test-subprocess.o
Jeff Hostetlera15860d2019-02-22 14:25:10 -0800750TEST_BUILTINS_OBJS += test-trace2.o
Nguyễn Thái Ngọc Duy599fbd82018-03-24 08:45:03 +0100751TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
Johannes Schindelin22231902019-01-29 06:19:27 -0800752TEST_BUILTINS_OBJS += test-xml-encode.o
Nguyễn Thái Ngọc Duy04892892018-03-24 08:45:04 +0100753TEST_BUILTINS_OBJS += test-wildmatch.o
Jeff Hostetler06ba9d02018-09-11 13:06:01 -0700754TEST_BUILTINS_OBJS += test-windows-named-pipe.o
Nguyễn Thái Ngọc Duyc81f8432018-03-24 08:45:05 +0100755TEST_BUILTINS_OBJS += test-write-cache.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100756
Nguyễn Thái Ngọc Duyc9a1f412018-09-09 19:36:31 +0200757# Do not add more tests here unless they have extra dependencies. Add
758# them in TEST_BUILTINS_OBJS above.
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100759TEST_PROGRAMS_NEED_X += test-fake-ssh
David Barr3bbaec02010-08-09 17:39:43 -0500760TEST_PROGRAMS_NEED_X += test-line-buffer
David Barr21746aa2010-08-09 17:55:00 -0500761TEST_PROGRAMS_NEED_X += test-svn-fe
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100762TEST_PROGRAMS_NEED_X += test-tool
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600763
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700764TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100765
Junio C Hamano17368552008-02-23 11:08:25 -0800766# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800767# builtin/$C.o but is linked in as part of some other command.
768BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700769
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700770BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100771BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700772BUILT_INS += git-format-patch$X
773BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700774BUILT_INS += git-init$X
775BUILT_INS += git-merge-subtree$X
Nguyễn Thái Ngọc Duy46e91b62019-04-25 16:45:45 +0700776BUILT_INS += git-restore$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700777BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800778BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700779BUILT_INS += git-status$X
Nguyễn Thái Ngọc Duyd787d312019-03-29 17:39:05 +0700780BUILT_INS += git-switch$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700781BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700782
Junio C Hamanoad17f012009-08-07 12:09:29 -0700783# what 'all' will build and 'install' will install in gitexecdir,
784# excluding programs for built-in commands
Junio C Hamano6506e152007-02-06 21:27:09 -0800785ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
Linus Torvaldse83c5162005-04-07 15:13:13 -0700786
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700787# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400788OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700789
Matthew Ogilvieea925192009-12-02 22:14:05 -0700790# what test wrappers are needed and 'install' will install, in bindir
791BINDIR_PROGRAMS_NEED_X += git
792BINDIR_PROGRAMS_NEED_X += git-upload-pack
793BINDIR_PROGRAMS_NEED_X += git-receive-pack
794BINDIR_PROGRAMS_NEED_X += git-upload-archive
795BINDIR_PROGRAMS_NEED_X += git-shell
796
797BINDIR_PROGRAMS_NO_X += git-cvsserver
798
Ryan Anderson3d320512005-11-21 00:11:22 -0500799# Set paths to tools early so that they can be used for version tests.
800ifndef SHELL_PATH
801 SHELL_PATH = /bin/sh
802endif
803ifndef PERL_PATH
804 PERL_PATH = /usr/bin/perl
805endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100806ifndef PYTHON_PATH
807 PYTHON_PATH = /usr/bin/python
808endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700809
Luben Tuikov3a793472006-12-14 23:03:03 -0800810export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100811export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800812
Jeff King3f824e92017-12-08 05:47:22 -0500813TEST_SHELL_PATH = $(SHELL_PATH)
814
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100815LIB_FILE = libgit.a
816XDIFF_LIB = xdiff/lib.a
817VCSSVN_LIB = vcs-svn/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700818
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +0200819GENERATED_H += command-list.h
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700820
Denton Liucf6a2d22019-09-16 12:23:08 -0700821LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
Johannes Schindelin92b88eb2019-03-04 05:47:06 -0800822 $(FIND) . \
Jeff Kingd85b0df2014-08-25 16:00:42 -0400823 -name .git -prune -o \
824 -name t -prune -o \
825 -name Documentation -prune -o \
Denton Liucf6a2d22019-09-16 12:23:08 -0700826 -name '*.h' -print)))
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700827
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400828LIB_OBJS += abspath.o
Johannes Schindelinf83dff62019-11-13 12:40:57 +0000829LIB_OBJS += add-interactive.o
Johannes Schindelinf6aa7ec2019-12-13 08:07:48 +0000830LIB_OBJS += add-patch.o
Jeff King75194432009-09-09 07:38:58 -0400831LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700832LIB_OBJS += alias.o
833LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200834LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700835LIB_OBJS += archive.o
836LIB_OBJS += archive-tar.o
837LIB_OBJS += archive-zip.o
Jeff Kingc1189ca2011-09-13 17:57:57 -0400838LIB_OBJS += argv-array.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700839LIB_OBJS += attr.o
840LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100841LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500842LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700843LIB_OBJS += blob.o
Garima Singhf52207a2020-03-30 00:31:24 +0000844LIB_OBJS += bloom.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700845LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700846LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700847LIB_OBJS += bundle.o
848LIB_OBJS += cache-tree.o
Jeff King2b5ed372018-03-30 14:35:04 -0400849LIB_OBJS += chdir-notify.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000850LIB_OBJS += checkout.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700851LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700852LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700853LIB_OBJS += combine-diff.o
854LIB_OBJS += commit.o
Derrick Stolee08fd81c2018-04-02 16:34:19 -0400855LIB_OBJS += commit-graph.o
Derrick Stolee5227c382018-07-20 16:33:02 +0000856LIB_OBJS += commit-reach.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200857LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500858LIB_OBJS += compat/terminal.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700859LIB_OBJS += config.o
860LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700861LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700862LIB_OBJS += convert.o
863LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500864LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700865LIB_OBJS += csum-file.o
866LIB_OBJS += ctype.o
867LIB_OBJS += date.o
868LIB_OBJS += decorate.o
Jeff Kingc8d521f2018-08-16 08:13:07 +0200869LIB_OBJS += delta-islands.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700870LIB_OBJS += diffcore-break.o
871LIB_OBJS += diffcore-delta.o
872LIB_OBJS += diffcore-order.o
873LIB_OBJS += diffcore-pickaxe.o
874LIB_OBJS += diffcore-rename.o
875LIB_OBJS += diff-delta.o
876LIB_OBJS += diff-lib.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100877LIB_OBJS += diff-no-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700878LIB_OBJS += diff.o
879LIB_OBJS += dir.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200880LIB_OBJS += dir-iterator.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200881LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700882LIB_OBJS += entry.o
883LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500884LIB_OBJS += ewah/bitmap.o
885LIB_OBJS += ewah/ewah_bitmap.o
886LIB_OBJS += ewah/ewah_io.o
887LIB_OBJS += ewah/ewah_rlw.o
Stefan Bellerd807c4a2018-04-10 14:26:18 -0700888LIB_OBJS += exec-cmd.o
Jonathan Tanec062832018-06-14 15:54:28 -0700889LIB_OBJS += fetch-negotiator.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700890LIB_OBJS += fetch-pack.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700891LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400892LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100893LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700894LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700895LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700896LIB_OBJS += grep.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100897LIB_OBJS += hashmap.o
Johannes Schindelin22d87332018-08-13 04:33:00 -0700898LIB_OBJS += linear-assignment.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700899LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800900LIB_OBJS += hex.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700901LIB_OBJS += ident.o
Eric Sunshine126facf2018-07-22 05:57:05 -0400902LIB_OBJS += interdiff.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000903LIB_OBJS += json-writer.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200904LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200905LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100906LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100907LIB_OBJS += line-range.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700908LIB_OBJS += list-objects.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000909LIB_OBJS += list-objects-filter.o
910LIB_OBJS += list-objects-filter-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700911LIB_OBJS += ll-merge.o
912LIB_OBJS += lockfile.o
913LIB_OBJS += log-tree.o
Brandon Williams72d0ea02018-03-15 10:31:20 -0700914LIB_OBJS += ls-refs.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700915LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700916LIB_OBJS += mailmap.o
917LIB_OBJS += match-trees.o
Jameson Miller065feab2018-04-11 18:37:55 +0000918LIB_OBJS += mem-pool.o
Nguyễn Thái Ngọc Duydb699a82012-10-26 22:53:49 +0700919LIB_OBJS += merge.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800920LIB_OBJS += merge-blobs.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200921LIB_OBJS += merge-recursive.o
René Scharfe0db71e02012-04-01 00:10:11 +0200922LIB_OBJS += mergesort.o
Derrick Stoleea3407732018-07-12 15:39:21 -0400923LIB_OBJS += midx.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700924LIB_OBJS += name-hash.o
Jonathan Tanec062832018-06-14 15:54:28 -0700925LIB_OBJS += negotiator/default.o
Jonathan Tan42cc7482018-07-16 11:44:01 -0700926LIB_OBJS += negotiator/skipping.o
Johannes Schindelina97a7462009-10-09 12:21:57 +0200927LIB_OBJS += notes.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400928LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100929LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200930LIB_OBJS += notes-utils.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700931LIB_OBJS += object.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700932LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500933LIB_OBJS += oidset.o
Jonathan Tan4f39cd82017-08-18 15:20:16 -0700934LIB_OBJS += packfile.o
Vicent Martifff42752013-12-21 09:00:01 -0500935LIB_OBJS += pack-bitmap.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500936LIB_OBJS += pack-bitmap-write.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700937LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400938LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700939LIB_OBJS += pack-revindex.o
940LIB_OBJS += pack-write.o
941LIB_OBJS += pager.o
942LIB_OBJS += parse-options.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600943LIB_OBJS += parse-options-cb.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700944LIB_OBJS += patch-delta.o
945LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700946LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000947LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700948LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100949LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700950LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700951LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700952LIB_OBJS += progress.o
Christian Couder48de3152019-06-25 15:40:27 +0200953LIB_OBJS += promisor-remote.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500954LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700955LIB_OBJS += protocol.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700956LIB_OBJS += quote.o
Johannes Schindelind9c66f02018-08-13 04:33:04 -0700957LIB_OBJS += range-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700958LIB_OBJS += reachable.o
959LIB_OBJS += read-cache.o
Bert Wesarg88f85762020-01-27 08:04:27 +0100960LIB_OBJS += rebase.o
Alban Gruin145e05a2018-08-10 18:51:29 +0200961LIB_OBJS += rebase-interactive.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700962LIB_OBJS += reflog-walk.o
963LIB_OBJS += refs.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100964LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200965LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200966LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200967LIB_OBJS += refs/ref-cache.o
Brandon Williamsec0cb492018-05-16 15:57:48 -0700968LIB_OBJS += refspec.o
Karthik Nayakc95b7582015-06-14 01:07:27 +0530969LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700970LIB_OBJS += remote.o
Stefan Beller11bc0582018-04-10 14:26:21 -0700971LIB_OBJS += replace-object.o
Derrick Stolee7211b9e2019-08-13 11:37:43 -0700972LIB_OBJS += repo-settings.o
Brandon Williams359efef2017-06-22 11:43:32 -0700973LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200974LIB_OBJS += rerere.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800975LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700976LIB_OBJS += revision.o
977LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +0700978LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700979LIB_OBJS += sequencer.o
Brandon Williamsed10cb92018-03-15 10:31:19 -0700980LIB_OBJS += serve.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700981LIB_OBJS += server-info.o
982LIB_OBJS += setup.o
Jeff King902bb362011-05-19 17:34:33 -0400983LIB_OBJS += sha1-array.o
Junio C Hamano628522e2007-12-29 02:05:47 -0800984LIB_OBJS += sha1-lookup.o
Stefan Bellerfc1395f2018-04-10 14:26:20 -0700985LIB_OBJS += sha1-file.o
Stefan Bellere5e5e0882018-04-10 14:26:19 -0700986LIB_OBJS += sha1-name.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700987LIB_OBJS += shallow.o
988LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -0500989LIB_OBJS += sigchain.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +0700990LIB_OBJS += split-index.o
Johannes Schindelin97fff612019-09-30 10:21:54 -0700991LIB_OBJS += stable-qsort.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700992LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -0700993LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100994LIB_OBJS += string-list.o
Johannes Schindelin752c0c22009-10-19 14:38:32 +0200995LIB_OBJS += submodule.o
Heiko Voigt959b5452015-08-17 17:21:57 -0700996LIB_OBJS += submodule-config.o
Ben Peart99605d62017-05-05 11:28:01 -0400997LIB_OBJS += sub-process.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700998LIB_OBJS += symlinks.o
999LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +02001000LIB_OBJS += tempfile.o
Nguyễn Thái Ngọc Duy0ec79352018-10-27 19:29:59 +02001001LIB_OBJS += thread-utils.o
Jeff King2564d992016-10-03 16:49:11 -04001002LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001003LIB_OBJS += trace.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001004LIB_OBJS += trace2.o
1005LIB_OBJS += trace2/tr2_cfg.o
1006LIB_OBJS += trace2/tr2_cmd_name.o
1007LIB_OBJS += trace2/tr2_dst.o
1008LIB_OBJS += trace2/tr2_sid.o
Jeff Hostetlerbce9db62019-04-15 13:39:47 -07001009LIB_OBJS += trace2/tr2_sysenv.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001010LIB_OBJS += trace2/tr2_tbuf.o
1011LIB_OBJS += trace2/tr2_tgt_event.o
1012LIB_OBJS += trace2/tr2_tgt_normal.o
1013LIB_OBJS += trace2/tr2_tgt_perf.o
1014LIB_OBJS += trace2/tr2_tls.o
Christian Couder9385b5d2014-10-13 20:16:23 +02001015LIB_OBJS += trailer.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001016LIB_OBJS += transport.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -04001017LIB_OBJS += transport-helper.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001018LIB_OBJS += tree-diff.o
1019LIB_OBJS += tree.o
1020LIB_OBJS += tree-walk.o
1021LIB_OBJS += unpack-trees.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001022LIB_OBJS += upload-pack.o
Jeff King638794c2010-05-23 05:17:55 -04001023LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -07001024LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001025LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001026LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001027LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -07001028LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -04001029LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +07001030LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001031LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +07001032LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -04001033LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -07001034LIB_OBJS += wrapper.o
Stefan Bellerfa2656f2018-04-10 14:26:16 -07001035LIB_OBJS += write-or-die.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001036LIB_OBJS += ws.o
1037LIB_OBJS += wt-status.o
1038LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -05001039LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +02001040
Linus Torvalds81b50f32010-02-22 08:42:18 -08001041BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +08001042BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001043BUILTIN_OBJS += builtin/annotate.o
1044BUILTIN_OBJS += builtin/apply.o
1045BUILTIN_OBJS += builtin/archive.o
1046BUILTIN_OBJS += builtin/bisect--helper.o
1047BUILTIN_OBJS += builtin/blame.o
1048BUILTIN_OBJS += builtin/branch.o
1049BUILTIN_OBJS += builtin/bundle.o
1050BUILTIN_OBJS += builtin/cat-file.o
1051BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +00001052BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -04001053BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001054BUILTIN_OBJS += builtin/check-ref-format.o
1055BUILTIN_OBJS += builtin/checkout-index.o
1056BUILTIN_OBJS += builtin/checkout.o
1057BUILTIN_OBJS += builtin/clean.o
1058BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +07001059BUILTIN_OBJS += builtin/column.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001060BUILTIN_OBJS += builtin/commit-tree.o
1061BUILTIN_OBJS += builtin/commit.o
Derrick Stolee4ce58ee2018-04-02 16:34:18 -04001062BUILTIN_OBJS += builtin/commit-graph.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001063BUILTIN_OBJS += builtin/config.o
1064BUILTIN_OBJS += builtin/count-objects.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +02001065BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001066BUILTIN_OBJS += builtin/describe.o
1067BUILTIN_OBJS += builtin/diff-files.o
1068BUILTIN_OBJS += builtin/diff-index.o
1069BUILTIN_OBJS += builtin/diff-tree.o
1070BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +01001071BUILTIN_OBJS += builtin/difftool.o
Ævar Arnfjörð Bjarmasonb4f207f2019-06-21 12:18:06 +02001072BUILTIN_OBJS += builtin/env--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001073BUILTIN_OBJS += builtin/fast-export.o
1074BUILTIN_OBJS += builtin/fetch-pack.o
1075BUILTIN_OBJS += builtin/fetch.o
1076BUILTIN_OBJS += builtin/fmt-merge-msg.o
1077BUILTIN_OBJS += builtin/for-each-ref.o
1078BUILTIN_OBJS += builtin/fsck.o
1079BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -08001080BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001081BUILTIN_OBJS += builtin/grep.o
1082BUILTIN_OBJS += builtin/hash-object.o
1083BUILTIN_OBJS += builtin/help.o
1084BUILTIN_OBJS += builtin/index-pack.o
1085BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +02001086BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001087BUILTIN_OBJS += builtin/log.o
1088BUILTIN_OBJS += builtin/ls-files.o
1089BUILTIN_OBJS += builtin/ls-remote.o
1090BUILTIN_OBJS += builtin/ls-tree.o
1091BUILTIN_OBJS += builtin/mailinfo.o
1092BUILTIN_OBJS += builtin/mailsplit.o
1093BUILTIN_OBJS += builtin/merge.o
1094BUILTIN_OBJS += builtin/merge-base.o
1095BUILTIN_OBJS += builtin/merge-file.o
1096BUILTIN_OBJS += builtin/merge-index.o
1097BUILTIN_OBJS += builtin/merge-ours.o
1098BUILTIN_OBJS += builtin/merge-recursive.o
1099BUILTIN_OBJS += builtin/merge-tree.o
1100BUILTIN_OBJS += builtin/mktag.o
1101BUILTIN_OBJS += builtin/mktree.o
Derrick Stolee6a257f02018-07-12 15:39:20 -04001102BUILTIN_OBJS += builtin/multi-pack-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001103BUILTIN_OBJS += builtin/mv.o
1104BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -07001105BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001106BUILTIN_OBJS += builtin/pack-objects.o
1107BUILTIN_OBJS += builtin/pack-redundant.o
1108BUILTIN_OBJS += builtin/pack-refs.o
1109BUILTIN_OBJS += builtin/patch-id.o
1110BUILTIN_OBJS += builtin/prune-packed.o
1111BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001112BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001113BUILTIN_OBJS += builtin/push.o
Johannes Schindelin348ae562018-08-13 04:33:02 -07001114BUILTIN_OBJS += builtin/range-diff.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001115BUILTIN_OBJS += builtin/read-tree.o
Pratik Karki55071ea2018-08-07 01:16:09 +05451116BUILTIN_OBJS += builtin/rebase.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001117BUILTIN_OBJS += builtin/receive-pack.o
1118BUILTIN_OBJS += builtin/reflog.o
1119BUILTIN_OBJS += builtin/remote.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001120BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001121BUILTIN_OBJS += builtin/remote-fd.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001122BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001123BUILTIN_OBJS += builtin/replace.o
1124BUILTIN_OBJS += builtin/rerere.o
1125BUILTIN_OBJS += builtin/reset.o
1126BUILTIN_OBJS += builtin/rev-list.o
1127BUILTIN_OBJS += builtin/rev-parse.o
1128BUILTIN_OBJS += builtin/revert.o
1129BUILTIN_OBJS += builtin/rm.o
1130BUILTIN_OBJS += builtin/send-pack.o
1131BUILTIN_OBJS += builtin/shortlog.o
1132BUILTIN_OBJS += builtin/show-branch.o
Jeff Kingff417262018-05-28 05:38:53 -04001133BUILTIN_OBJS += builtin/show-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001134BUILTIN_OBJS += builtin/show-ref.o
Derrick Stolee94c09562019-11-21 22:04:33 +00001135BUILTIN_OBJS += builtin/sparse-checkout.o
Paul-Sebastian Ungureanu40af1462019-02-25 23:16:28 +00001136BUILTIN_OBJS += builtin/stash.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001137BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001138BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001139BUILTIN_OBJS += builtin/symbolic-ref.o
1140BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001141BUILTIN_OBJS += builtin/unpack-file.o
1142BUILTIN_OBJS += builtin/unpack-objects.o
1143BUILTIN_OBJS += builtin/update-index.o
1144BUILTIN_OBJS += builtin/update-ref.o
1145BUILTIN_OBJS += builtin/update-server-info.o
1146BUILTIN_OBJS += builtin/upload-archive.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001147BUILTIN_OBJS += builtin/upload-pack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001148BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001149BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001150BUILTIN_OBJS += builtin/verify-pack.o
1151BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001152BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001153BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001154
Denton Liu5dedf7d2019-09-16 12:23:11 -07001155# THIRD_PARTY_SOURCES is a list of patterns compatible with the
1156# $(filter) and $(filter-out) family of functions. They specify source
1157# files which are taken from some third-party source where we want to be
1158# less strict about issues such as coding style so we don't diverge from
1159# upstream unnecessarily (making merging in future changes easier).
1160THIRD_PARTY_SOURCES += compat/inet_ntop.c
1161THIRD_PARTY_SOURCES += compat/inet_pton.c
1162THIRD_PARTY_SOURCES += compat/nedmalloc/%
1163THIRD_PARTY_SOURCES += compat/obstack.%
1164THIRD_PARTY_SOURCES += compat/poll/%
1165THIRD_PARTY_SOURCES += compat/regex/%
1166THIRD_PARTY_SOURCES += sha1collisiondetection/%
1167THIRD_PARTY_SOURCES += sha1dc/%
1168
Jeff King3f2e2292016-07-01 01:58:58 -04001169GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +02001170EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001171
Jeff King42dcbb72012-06-02 15:01:12 -04001172GIT_USER_AGENT = git/$(GIT_VERSION)
1173
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001174ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1175DC_SHA1_SUBMODULE = auto
1176endif
1177
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001178# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1179# tweaked by config.* below as well as the command-line, both of
1180# which'll override these defaults.
1181CFLAGS = -g -O2 -Wall
1182LDFLAGS =
Ævar Arnfjörð Bjarmason0f50c8e2019-05-17 23:58:47 +02001183CC_LD_DYNPATH = -Wl,-rpath,
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001184BASIC_CFLAGS = -I.
1185BASIC_LDFLAGS =
1186
1187# library flags
1188ARFLAGS = rcs
1189PTHREAD_CFLAGS =
1190
1191# For the 'sparse' target
1192SPARSE_FLAGS ?=
1193SP_EXTRA_FLAGS =
1194
Jeff King960154b2019-05-06 19:43:34 -04001195# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
1196# usually result in less CPU usage at the cost of higher peak memory.
Jeff Kingbcb4edf2019-05-08 03:07:54 -04001197# Setting it to 0 will feed all files in a single spatch invocation.
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001198SPATCH_FLAGS = --all-includes --patch .
Jeff King960154b2019-05-06 19:43:34 -04001199SPATCH_BATCH_SIZE = 1
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001200
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001201include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001202-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001203-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001204
Matthieu Moyd6156282016-05-31 15:24:43 +02001205ifdef DEVELOPER
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +00001206include config.mak.dev
Matthieu Moyd6156282016-05-31 15:24:43 +02001207endif
1208
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +01001209ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001210ALL_LDFLAGS = $(LDFLAGS)
1211
René Scharfe425ca672017-07-15 19:18:56 +02001212comma := ,
1213empty :=
1214space := $(empty) $(empty)
1215
Jeff King56b5db32017-07-10 09:24:42 -04001216ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001217SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001218BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001219BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001220ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King566cf0b2017-07-10 09:24:50 -04001221BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
Jeff King07a20f52019-03-12 17:06:26 -04001222BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
Jeff King566cf0b2017-07-10 09:24:50 -04001223endif
Jeff King0e5bba52017-09-08 02:38:41 -04001224ifneq ($(filter leak,$(SANITIZERS)),)
1225BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
1226endif
Jeff Kingf65d07f2020-01-16 12:51:38 -05001227ifneq ($(filter address,$(SANITIZERS)),)
1228NO_REGEX = NeededForASAN
1229endif
Jeff King56b5db32017-07-10 09:24:42 -04001230endif
1231
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001232ifndef sysconfdir
1233ifeq ($(prefix),/usr)
1234sysconfdir = /etc
1235else
1236sysconfdir = etc
1237endif
1238endif
1239
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001240ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001241COMPUTE_HEADER_DEPENDENCIES = auto
1242endif
1243
1244ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001245dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Jonathan Nieder69789342011-11-18 17:23:24 -06001246 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1247 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001248 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001249ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001250override COMPUTE_HEADER_DEPENDENCIES = yes
1251else
1252override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001253endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001254endif
1255
Jonathan Nieder024c8432011-11-18 03:58:21 -06001256ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001257USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001258else
1259ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1260$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1261(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1262endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001263endif
1264
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001265ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001266SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
Jeff Hostetlerc444bf82019-06-19 14:06:06 -07001267BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001268PATH := $(SANE_TOOL_PATH):${PATH}
1269else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001270BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001271endif
1272
Eric Sunshineb2289402017-12-15 00:34:34 +01001273ifeq (,$(HOST_CPU))
1274 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1275else
1276 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1277endif
1278
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001279ifneq (,$(INLINE))
1280 BASIC_CFLAGS += -Dinline=$(INLINE)
1281endif
1282
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001283ifneq (,$(SOCKLEN_T))
1284 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1285endif
1286
Kyle J. McKay290c8e72015-01-11 12:09:22 -08001287ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
1288 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
1289else
1290ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
1291 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
1292endif
1293endif
1294
Brian Gernhardt59f86742006-12-12 12:01:47 -05001295ifeq ($(uname_S),Darwin)
1296 ifndef NO_FINK
1297 ifeq ($(shell test -d /sw/lib && echo y),y)
1298 BASIC_CFLAGS += -I/sw/include
1299 BASIC_LDFLAGS += -L/sw/lib
1300 endif
1301 endif
1302 ifndef NO_DARWIN_PORTS
1303 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1304 BASIC_CFLAGS += -I/opt/local/include
1305 BASIC_LDFLAGS += -L/opt/local/lib
1306 endif
1307 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001308 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001309 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001310 APPLE_COMMON_CRYPTO = YesPlease
1311 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1312 endif
David Aguilar29de2052013-05-11 01:22:26 -07001313 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001314 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001315endif
1316
David Aguilare1c06882009-05-31 01:35:51 -07001317ifdef NO_LIBGEN_H
1318 COMPAT_CFLAGS += -DNO_LIBGEN_H
1319 COMPAT_OBJS += compat/basename.o
1320endif
1321
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001322USE_LIBPCRE2 ?= $(USE_LIBPCRE)
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001323
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001324ifneq (,$(USE_LIBPCRE2))
1325 ifdef USE_LIBPCRE1
1326$(error Only set USE_LIBPCRE2 (or its alias USE_LIBPCRE) or USE_LIBPCRE1, not both!)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001327 endif
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001328
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001329 BASIC_CFLAGS += -DUSE_LIBPCRE2
1330 EXTLIBS += -lpcre2-8
1331endif
1332
1333ifdef USE_LIBPCRE1
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001334 BASIC_CFLAGS += -DUSE_LIBPCRE1
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001335 EXTLIBS += -lpcre
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00001336
1337ifdef NO_LIBPCRE1_JIT
1338 BASIC_CFLAGS += -DNO_LIBPCRE1_JIT
1339endif
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001340endif
1341
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001342ifdef LIBPCREDIR
1343 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1344 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Junio C Hamanobbfc63d2006-12-27 14:17:35 -08001345endif
1346
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001347ifdef HAVE_ALLOCA_H
1348 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1349endif
1350
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001351IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001352IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001353
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001354ifdef NO_CURL
1355 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001356 REMOTE_CURL_PRIMARY =
1357 REMOTE_CURL_ALIASES =
1358 REMOTE_CURL_NAMES =
Johannes Schindelin724d6352019-04-18 06:16:40 -07001359 EXCLUDED_PROGRAMS += git-http-fetch git-http-push
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001360else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001361 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001362 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
1363 BASIC_CFLAGS += -I$(CURLDIR)/include
James Knight23c4bbe2018-11-03 05:12:11 +00001364 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001365 else
James Knight23c4bbe2018-11-03 05:12:11 +00001366 CURL_LIBCURL =
Junio C Hamanob2feb642014-04-30 10:58:10 -07001367 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001368
1369ifdef CURL_LDFLAGS
1370 CURL_LIBCURL += $(CURL_LDFLAGS)
1371else
1372 CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs)
1373endif
Thomas Cortbc5f8132011-07-19 18:55:47 -04001374
Johannes Sixt4256f362010-01-19 16:39:12 +01001375 REMOTE_CURL_PRIMARY = git-remote-http$X
1376 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1377 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001378 PROGRAM_OBJS += http-fetch.o
1379 PROGRAMS += $(REMOTE_CURL_NAMES)
Remi Pommarelf8915872015-10-21 19:10:46 +02001380 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 -08001381 ifeq "$(curl_check)" "070908"
1382 ifndef NO_EXPAT
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001383 PROGRAM_OBJS += http-push.o
Johannes Schindelin724d6352019-04-18 06:16:40 -07001384 else
1385 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld08900982005-11-18 17:08:36 -08001386 endif
Johannes Schindelin724d6352019-04-18 06:16:40 -07001387 else
1388 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001389 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001390 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 +01001391 ifeq "$(curl_check)" "072200"
1392 USE_CURL_FOR_IMAP_SEND = YesPlease
1393 endif
1394 ifdef USE_CURL_FOR_IMAP_SEND
1395 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1396 IMAP_SEND_BUILDDEPS = http.o
1397 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1398 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001399 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001400 ifdef EXPATDIR
1401 BASIC_CFLAGS += -I$(EXPATDIR)/include
1402 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1403 else
1404 EXPAT_LIBEXPAT = -lexpat
1405 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001406 ifdef EXPAT_NEEDS_XMLPARSE_H
1407 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1408 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001409 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001410endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001411IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001412
Robert Schielebef19da2007-07-29 20:35:45 +02001413ifdef ZLIB_PATH
1414 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001415 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001416endif
1417EXTLIBS += -lz
1418
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001419ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001420 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001421 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001422 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001423 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001424 else
1425 OPENSSL_LINK =
1426 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001427 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001428 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001429 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001430else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001431 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001432 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001433endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001434ifdef NO_OPENSSL
1435 LIB_4_CRYPTO =
1436else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001437ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001438 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001439else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001440 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001441endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001442ifdef APPLE_COMMON_CRYPTO
1443 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1444endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001445endif
Eric Sunshinefdb1fbb2018-06-14 22:25:03 -04001446ifndef NO_ICONV
1447 ifdef NEEDS_LIBICONV
1448 ifdef ICONVDIR
1449 BASIC_CFLAGS += -I$(ICONVDIR)/include
1450 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1451 else
1452 ICONV_LINK =
1453 endif
1454 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1455 ICONV_LINK += -lintl
1456 endif
1457 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano455a7f32005-09-30 13:31:16 -07001458 endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001459endif
brian m. carlson79444c92019-02-12 00:52:06 +00001460ifdef ICONV_OMITS_BOM
1461 BASIC_CFLAGS += -DICONV_OMITS_BOM
1462endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001463ifdef NEEDS_LIBGEN
1464 EXTLIBS += -lgen
1465endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001466ifndef NO_GETTEXT
1467ifndef LIBC_CONTAINS_LIBINTL
1468 EXTLIBS += -lintl
1469endif
1470endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001471ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001472 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001473endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001474ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001475 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001476endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001477ifdef NEEDS_RESOLV
1478 EXTLIBS += -lresolv
1479endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001480ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001481 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001482endif
David Michael110d6982012-12-14 14:56:59 -05001483ifdef NO_GECOS_IN_PWENT
1484 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1485endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001486ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1487 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1488endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001489ifdef USE_NSEC
1490 BASIC_CFLAGS += -DUSE_NSEC
1491endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001492ifdef USE_ST_TIMESPEC
1493 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1494endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001495ifdef NO_NORETURN
1496 BASIC_CFLAGS += -DNO_NORETURN
1497endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001498ifdef NO_NSEC
1499 BASIC_CFLAGS += -DNO_NSEC
1500endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001501ifdef SNPRINTF_RETURNS_BOGUS
1502 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1503 COMPAT_OBJS += compat/snprintf.o
1504endif
Brandon Caseycba22522008-02-08 20:32:47 -06001505ifdef FREAD_READS_DIRECTORIES
1506 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1507 COMPAT_OBJS += compat/fopen.o
1508endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001509ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001510 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001511endif
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +00001512ifdef GETTEXT_POISON
Junio C Hamanoc6a9a302018-11-08 21:15:30 +00001513$(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 +00001514endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001515ifdef NO_GETTEXT
1516 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001517 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001518endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001519ifdef NO_POLL
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001520 NO_POLL_H = YesPlease
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001521 NO_SYS_POLL_H = YesPlease
1522 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1523 COMPAT_OBJS += compat/poll/poll.o
1524endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001525ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001526 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001527 COMPAT_OBJS += compat/strcasestr.o
1528endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001529ifdef NO_STRLCPY
1530 COMPAT_CFLAGS += -DNO_STRLCPY
1531 COMPAT_OBJS += compat/strlcpy.o
1532endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001533ifdef NO_STRTOUMAX
1534 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001535 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001536endif
1537ifdef NO_STRTOULL
1538 COMPAT_CFLAGS += -DNO_STRTOULL
1539endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001540ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001541 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001542 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001543endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001544ifdef NO_MKDTEMP
1545 COMPAT_CFLAGS += -DNO_MKDTEMP
1546 COMPAT_OBJS += compat/mkdtemp.o
1547endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001548ifdef MKDIR_WO_TRAILING_SLASH
1549 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1550 COMPAT_OBJS += compat/mkdir.o
1551endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001552ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001553 COMPAT_CFLAGS += -DNO_UNSETENV
1554 COMPAT_OBJS += compat/unsetenv.o
1555endif
Robert Schiele26009732008-01-24 19:34:46 +01001556ifdef NO_SYS_SELECT_H
1557 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1558endif
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001559ifdef NO_POLL_H
1560 BASIC_CFLAGS += -DNO_POLL_H
1561endif
Markus Duft28449232010-10-27 10:39:52 +02001562ifdef NO_SYS_POLL_H
1563 BASIC_CFLAGS += -DNO_SYS_POLL_H
1564endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001565ifdef NEEDS_SYS_PARAM_H
1566 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001567endif
Markus Duft28449232010-10-27 10:39:52 +02001568ifdef NO_INTTYPES_H
1569 BASIC_CFLAGS += -DNO_INTTYPES_H
1570endif
1571ifdef NO_INITGROUPS
1572 BASIC_CFLAGS += -DNO_INITGROUPS
1573endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001574ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001575 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001576 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001577else
1578 ifdef USE_WIN32_MMAP
1579 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1580 COMPAT_OBJS += compat/win32mmap.o
1581 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001582endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001583ifdef MMAP_PREVENTS_DELETE
1584 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1585endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001586ifdef OBJECT_CREATION_USES_RENAMES
1587 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001588endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001589ifdef NO_STRUCT_ITIMERVAL
1590 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001591 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001592endif
1593ifdef NO_SETITIMER
1594 COMPAT_CFLAGS += -DNO_SETITIMER
1595endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001596ifdef NO_PREAD
1597 COMPAT_CFLAGS += -DNO_PREAD
1598 COMPAT_OBJS += compat/pread.o
1599endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001600ifdef NO_FAST_WORKING_DIRECTORY
1601 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1602endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001603ifdef NO_TRUSTABLE_FILEMODE
1604 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1605endif
David Michaeld543d9c2014-12-03 21:24:17 -05001606ifdef NEEDS_MODE_TRANSLATION
1607 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1608 COMPAT_OBJS += compat/stat.o
1609endif
hpa49744d62005-09-28 16:52:21 -07001610ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001611 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001612endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001613ifdef NO_INTPTR_T
1614 COMPAT_CFLAGS += -DNO_INTPTR_T
1615endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001616ifdef NO_UINTMAX_T
1617 BASIC_CFLAGS += -Duintmax_t=uint32_t
1618endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001619ifdef NO_SOCKADDR_STORAGE
1620ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001621 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001622else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001623 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001624endif
hpa49744d62005-09-28 16:52:21 -07001625endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001626ifdef NO_INET_NTOP
1627 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001628 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001629endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001630ifdef NO_INET_PTON
1631 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001632 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001633endif
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001634ifdef NO_UNIX_SOCKETS
1635 BASIC_CFLAGS += -DNO_UNIX_SOCKETS
Johannes Schindelin724d6352019-04-18 06:16:40 -07001636 EXCLUDED_PROGRAMS += git-credential-cache git-credential-cache--daemon
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001637else
Johannes Sixt63203582011-12-12 22:12:56 +01001638 LIB_OBJS += unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001639 PROGRAM_OBJS += credential-cache.o
1640 PROGRAM_OBJS += credential-cache--daemon.o
1641endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001642
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001643ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001644 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001645endif
1646
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001647ifdef OLD_ICONV
1648 BASIC_CFLAGS += -DOLD_ICONV
1649endif
1650
David Symonds609a2282007-11-07 14:24:28 +11001651ifdef NO_DEFLATE_BOUND
1652 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1653endif
1654
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001655ifdef NO_POSIX_GOODIES
1656 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1657endif
1658
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001659ifdef APPLE_COMMON_CRYPTO
1660 # Apple CommonCrypto requires chunking
1661 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1662endif
1663
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001664ifdef OPENSSL_SHA1
1665 EXTLIBS += $(LIB_4_CRYPTO)
1666 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001667else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001668ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001669 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001670 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001671else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001672ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001673 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001674 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001675else
David Aguilar61067952013-05-19 06:23:35 -04001676ifdef APPLE_COMMON_CRYPTO
1677 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001678 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001679else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001680 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001681 BASIC_CFLAGS += -DSHA1_DC
1682 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001683ifdef DC_SHA1_EXTERNAL
1684 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001685 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001686$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001687 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001688 endif
1689 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1690 EXTLIBS += -lsha1detectcoll
1691else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001692ifdef DC_SHA1_SUBMODULE
1693 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1694 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1695 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1696else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001697 LIB_OBJS += sha1dc/sha1.o
1698 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001699endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001700 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001701 -DSHA1DC_NO_STANDARD_INCLUDES \
1702 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1703 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001704 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001705endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001706endif
1707endif
David Aguilar61067952013-05-19 06:23:35 -04001708endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001709endif
David Aguilar61067952013-05-19 06:23:35 -04001710
brian m. carlson4b4e2912018-11-14 04:09:38 +00001711ifdef OPENSSL_SHA256
1712 EXTLIBS += $(LIB_4_CRYPTO)
1713 BASIC_CFLAGS += -DSHA256_OPENSSL
1714else
brian m. carlson27dc04c2018-11-14 04:09:37 +00001715ifdef GCRYPT_SHA256
1716 BASIC_CFLAGS += -DSHA256_GCRYPT
1717 EXTLIBS += -lgcrypt
1718else
1719 LIB_OBJS += sha256/block/sha256.o
1720 BASIC_CFLAGS += -DSHA256_BLK
1721endif
brian m. carlson4b4e2912018-11-14 04:09:38 +00001722endif
brian m. carlson13eeedb2018-11-14 04:09:36 +00001723
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001724ifdef SHA1_MAX_BLOCK_SIZE
1725 LIB_OBJS += compat/sha1-chunked.o
1726 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1727endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001728ifdef NO_HSTRERROR
1729 COMPAT_CFLAGS += -DNO_HSTRERROR
1730 COMPAT_OBJS += compat/hstrerror.o
1731endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001732ifdef NO_MEMMEM
1733 COMPAT_CFLAGS += -DNO_MEMMEM
1734 COMPAT_OBJS += compat/memmem.o
1735endif
Matt Kraai40036be2012-12-18 14:03:55 -08001736ifdef NO_GETPAGESIZE
1737 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1738endif
Brian Downing43fe9012008-02-05 15:10:44 -06001739ifdef INTERNAL_QSORT
1740 COMPAT_CFLAGS += -DINTERNAL_QSORT
Brian Downing43fe9012008-02-05 15:10:44 -06001741endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001742ifdef HAVE_ISO_QSORT_S
1743 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1744else
1745 COMPAT_OBJS += compat/qsort_s.o
1746endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001747ifdef RUNTIME_PREFIX
1748 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1749endif
Alex Riesenb7774342007-03-07 00:44:49 +01001750
Junio C Hamano46059cc2008-11-15 04:08:14 -08001751ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001752 BASIC_CFLAGS += -DNO_PTHREADS
1753else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001754 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001755 EXTLIBS += $(PTHREAD_LIBS)
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001756endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001757
Chris Webbcb6a22c2010-04-13 10:07:13 +01001758ifdef HAVE_PATHS_H
1759 BASIC_CFLAGS += -DHAVE_PATHS_H
1760endif
1761
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001762ifdef HAVE_LIBCHARSET_H
1763 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001764 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001765endif
1766
David Michaelb3e103d2012-12-14 14:57:01 -05001767ifdef HAVE_STRINGS_H
1768 BASIC_CFLAGS += -DHAVE_STRINGS_H
1769endif
1770
Jeff King21aeafc2011-12-10 05:41:01 -05001771ifdef HAVE_DEV_TTY
1772 BASIC_CFLAGS += -DHAVE_DEV_TTY
1773endif
1774
Alex Riesen81a24b52008-03-05 00:15:39 +01001775ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1776 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1777endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001778ifdef UNRELIABLE_FSTAT
1779 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1780endif
Jeff King02232ad2009-06-16 15:07:40 -04001781ifdef NO_REGEX
1782 COMPAT_CFLAGS += -Icompat/regex
1783 COMPAT_OBJS += compat/regex/regex.o
1784endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001785ifdef NATIVE_CRLF
1786 BASIC_CFLAGS += -DNATIVE_CRLF
1787endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001788
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001789ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001790 COMPAT_CFLAGS += -Icompat/nedmalloc
1791 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1792 OVERRIDE_STRDUP = YesPlease
1793endif
1794
1795ifdef OVERRIDE_STRDUP
1796 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1797 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001798endif
1799
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001800ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1801 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1802endif
1803
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001804ifndef NO_MSGFMT_EXTENDED_OPTIONS
1805 MSGFMT += --check --statistics
1806endif
1807
Jeff King66547542014-04-01 17:28:42 -04001808ifdef GMTIME_UNRELIABLE_ERRORS
1809 COMPAT_OBJS += compat/gmtime.o
1810 BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
1811endif
1812
Karsten Blees148d6772014-07-12 02:05:42 +02001813ifdef HAVE_CLOCK_GETTIME
1814 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001815endif
1816
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001817ifdef HAVE_CLOCK_MONOTONIC
1818 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1819endif
1820
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001821ifdef NEEDS_LIBRT
1822 EXTLIBS += -lrt
1823endif
1824
Kyle J. McKay95290802015-03-07 23:14:36 -08001825ifdef HAVE_BSD_SYSCTL
1826 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1827endif
1828
Dan Jacques226c0dd2018-04-10 11:05:44 -04001829ifdef HAVE_BSD_KERN_PROC_SYSCTL
1830 BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
1831endif
1832
Jeff King0cc30e02015-04-16 05:01:38 -04001833ifdef HAVE_GETDELIM
1834 BASIC_CFLAGS += -DHAVE_GETDELIM
1835endif
1836
Dan Jacques226c0dd2018-04-10 11:05:44 -04001837ifneq ($(PROCFS_EXECUTABLE_PATH),)
1838 procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
1839 BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
1840endif
1841
1842ifdef HAVE_NS_GET_EXECUTABLE_PATH
1843 BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
1844endif
1845
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -04001846ifdef HAVE_WPGMPTR
1847 BASIC_CFLAGS += -DHAVE_WPGMPTR
1848endif
1849
Duy Nguyen18a4f6b2019-02-12 21:14:41 +07001850ifdef FILENO_IS_A_MACRO
1851 COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
1852 COMPAT_OBJS += compat/fileno.o
1853endif
1854
Clément Chigot400caaf2019-04-25 07:01:56 +00001855ifdef NEED_ACCESS_ROOT_HANDLER
1856 COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
1857 COMPAT_OBJS += compat/access.o
1858endif
1859
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001860ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001861NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001862endif
1863
Jeff King499c2932009-04-03 15:32:20 -04001864ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001865NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001866endif
1867
Johan Herlandd4e1b472009-11-18 02:42:31 +01001868ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001869NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001870endif
1871
Eric Wong995bc222016-08-04 11:40:25 +00001872ifndef PAGER_ENV
1873PAGER_ENV = LESS=FRX LV=-c
1874endif
1875
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001876QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001877QUIET_SUBDIR1 =
1878
John Keepingef49e052015-09-05 13:22:10 +01001879ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001880PRINT_DIR = --no-print-directory
1881else # "make -w"
1882NO_SUBDIR = :
1883endif
1884
John Keepingef49e052015-09-05 13:22:10 +01001885ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001886ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001887 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001888 QUIET_AR = @echo ' ' AR $@;
1889 QUIET_LINK = @echo ' ' LINK $@;
1890 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1891 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001892 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00001893 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001894 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00001895 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001896 QUIET_SP = @echo ' ' SP $<;
Denton Liub503a2d2019-09-25 01:21:01 -07001897 QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001898 QUIET_RC = @echo ' ' RC $@;
Denton Liu4f3c1dc2019-10-09 13:43:46 -07001899 QUIET_SPATCH = @echo ' ' SPATCH $<;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001900 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001901 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1902 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001903 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001904 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001905 export QUIET_BUILT_IN
1906endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001907endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001908
Junio C Hamano70de5e62012-05-02 15:12:10 -07001909ifdef NO_INSTALL_HARDLINKS
1910 export NO_INSTALL_HARDLINKS
1911endif
1912
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001913### profile feedback build
1914#
1915
1916# Can adjust this to be a global directory if you want to do extended
1917# data gathering
1918PROFILE_DIR := $(CURDIR)
1919
Johannes Sixte60ec752012-02-09 09:22:26 +01001920ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07001921 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001922 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001923 export CCACHE_DISABLE = t
1924 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01001925else
1926ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07001927 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001928 export CCACHE_DISABLE = t
1929 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001930endif
Johannes Sixte60ec752012-02-09 09:22:26 +01001931endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001932
Pavel Roskinaddf88e2006-07-09 03:44:30 -04001933# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001934
Johannes Schindelin32043c92007-02-14 12:48:14 +01001935ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02001936ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001937
1938DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1939bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001940bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001941mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00001942mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
1943infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001944perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001945localedir_SQ = $(subst ','\'',$(localedir))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001946localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001947gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +00001948gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001949template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00001950htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001951prefix_SQ = $(subst ','\'',$(prefix))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001952perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05301953gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001954
1955SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05001956TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001957PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01001958PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001959TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07001960DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08001961PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001962
Dan Jacques07d90ea2018-04-10 11:05:43 -04001963# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
1964# relative to each other and share an installation path.
1965#
1966# This is a dependency in:
1967# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
1968# - The runtime prefix Perl header (see
1969# "perl/header_templates/runtime_prefix.template.pl").
1970ifdef RUNTIME_PREFIX
1971
1972ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
1973$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
1974endif
1975
1976ifneq ($(filter /%,$(firstword $(localedir_relative))),)
1977$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
1978endif
1979
1980ifndef NO_PERL
1981ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
1982$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
1983endif
1984endif
1985
1986endif
1987
Jeff King3f2e2292016-07-01 01:58:58 -04001988# We must filter out any object files from $(GITLIBS),
1989# as it is typically used like:
1990#
1991# foo: foo.o $(GITLIBS)
1992# $(CC) $(filter %.o,$^) $(LIBS)
1993#
1994# where we use it as a dependency. Since we also pull object files
1995# from the dependency list, that would make each entry appear twice.
1996LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07001997
brian m. carlsonf18f8162017-03-11 22:28:18 +00001998BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08001999LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02002000
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05002001# Quote for C
2002
2003ifdef DEFAULT_EDITOR
2004DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
2005DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
2006
2007BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
2008endif
2009
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05002010ifdef DEFAULT_PAGER
2011DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
2012DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
2013
2014BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
2015endif
2016
Ben Waltonb3e34dd2012-03-30 21:33:21 -04002017ifdef SHELL_PATH
2018SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
2019SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
2020
2021BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
2022endif
2023
Jeff King42dcbb72012-06-02 15:01:12 -04002024GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
2025GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
2026GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04002027GIT-USER-AGENT: FORCE
2028 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04002029 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
2030 fi
Jeff King42dcbb72012-06-02 15:01:12 -04002031
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00002032ifdef DEFAULT_HELP_FORMAT
2033BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
2034endif
2035
Eric Wong995bc222016-08-04 11:40:25 +00002036PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
2037PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
2038PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
2039BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
2040
Petr Baudis8d7f5862006-06-25 03:47:03 +02002041ALL_CFLAGS += $(BASIC_CFLAGS)
2042ALL_LDFLAGS += $(BASIC_LDFLAGS)
2043
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00002044export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07002045
2046
Petr Baudis28818ff2005-07-29 17:50:24 +02002047### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07002048
Brandon Caseyc94c8e52008-08-07 14:03:42 -05002049SHELL = $(SHELL_PATH)
2050
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002051all:: shell_compatibility_test
2052
2053ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07002054all:: profile
2055endif
2056
2057profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002058 $(MAKE) PROFILE=GEN all
2059 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04002060 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
2061 $(MAKE) PROFILE=GEN -j1 perf; \
2062 else \
2063 echo "Skipping profile of perf tests..."; \
2064 fi
Andi Kleen066dd262014-07-07 23:35:11 -07002065 $(MAKE) PROFILE=USE all
2066
2067profile-fast: profile-clean
2068 $(MAKE) PROFILE=GEN all
2069 $(MAKE) PROFILE=GEN -j1 perf
2070 $(MAKE) PROFILE=USE all
2071
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002072
2073all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002074ifneq (,$X)
Sebastian Schuberthade2ca02009-10-27 12:23:33 +01002075 $(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 -08002076endif
Petr Baudis28818ff2005-07-29 17:50:24 +02002077
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002078all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002079ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07002080 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08002081 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002082endif
Ben Walton502be952010-03-20 10:48:08 -04002083 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04002084
Brandon Casey6dc46272008-08-07 14:06:26 -05002085please_set_SHELL_PATH_to_a_more_modern_shell:
2086 @$$(:)
2087
2088shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
2089
Junio C Hamano4dc00022006-01-12 21:42:25 -08002090strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05002091 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08002092
Jonathan Nieder7b63c772012-07-06 23:19:09 -05002093### Target-specific flags and dependencies
2094
2095# The generic compilation pattern rule and automatically
2096# computed header dependencies (falling back to a dependency on
2097# LIB_H) are enough to describe how most targets should be built,
2098# but some targets are special enough to need something a little
2099# different.
2100#
2101# - When a source file "foo.c" #includes a generated header file,
2102# we need to list that dependency for the "foo.o" target.
2103#
2104# We also list it from other targets that are built from foo.c
2105# like "foo.sp" and "foo.s", even though that is easy to forget
2106# to do because the generated header is already present around
2107# after a regular build attempt.
2108#
2109# - Some code depends on configuration kept in makefile
2110# variables. The target-specific variable EXTRA_CPPFLAGS can
2111# be used to convey that information to the C preprocessor
2112# using -D options.
2113#
2114# The "foo.o" target should have a corresponding dependency on
2115# a file that changes when the value of the makefile variable
2116# changes. For example, targets making use of the
2117# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
2118#
2119# Technically the ".sp" and ".s" targets do not need this
2120# dependency because they are force-built, but they get the
2121# same dependency for consistency. This way, you do not have to
2122# know how each target is implemented. And it means the
2123# dependencies here will not need to change if the force-build
2124# details change some day.
2125
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002126git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04002127git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002128 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2129 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2130 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07002131
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002132git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04002133 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2134 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07002135
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002136help.sp help.s help.o: command-list.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01002137
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002138builtin/help.sp builtin/help.s builtin/help.o: command-list.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002139builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002140 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2141 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2142 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07002143
Jeff King520a6cd2012-06-20 14:32:22 -04002144version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04002145version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04002146 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01002147 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
Johannes Schindelin5cf8e062018-06-27 21:35:23 +02002148 '-DGIT_BUILT_FROM_COMMIT="$(shell \
2149 GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2150 git rev-parse -q --verify HEAD 2>/dev/null)"'
Jeff King816fb462012-06-02 14:51:42 -04002151
Junio C Hamano91730802006-04-10 17:37:58 -07002152$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02002153 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002154 ln $< $@ 2>/dev/null || \
2155 ln -s $< $@ 2>/dev/null || \
2156 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07002157
Nguyễn Thái Ngọc Duyf318d732018-05-10 10:46:41 +02002158command-list.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07002159
Nguyễn Thái Ngọc Duy76b993a2018-10-27 08:22:34 +02002160command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
Johannes Schindelin724d6352019-04-18 06:16:40 -07002161 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2162 $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
2163 command-list.txt >$@+ && mv $@+ $@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002164
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002165SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
Jeff Kingb5295f32012-06-20 14:32:19 -04002166 $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002167 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
2168 $(perllibdir_SQ)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002169define cmd_munge_script
2170$(RM) $@ $@+ && \
2171sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2172 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002173 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002174 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002175 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08002176 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002177 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04002178 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
2179 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Junio C Hamano71b40102016-03-08 15:47:57 -08002180 -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00002181 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002182 $@.sh >$@+
2183endef
2184
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002185GIT-SCRIPT-DEFINES: FORCE
2186 @FLAGS='$(SCRIPT_DEFINES)'; \
2187 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002188 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002189 echo "$$FLAGS" >$@; \
2190 fi
2191
2192
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002193$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002194 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002195 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002196 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002197
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002198$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002199 $(QUIET_GEN)$(cmd_munge_script) && \
2200 mv $@+ $@
2201
Johannes Schindelinadb59de2018-11-06 06:55:50 -08002202git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002203 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01002204 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
2205 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06002206 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002207
Jeff Kinge204b002014-11-18 12:43:09 -05002208# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002209$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05002210
Dan Jacques07d90ea2018-04-10 11:05:43 -04002211# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
2212# since the locale directory is injected.
2213perl_localedir_SQ = $(localedir_SQ)
Alex Riesenf8487182006-12-04 10:50:04 +01002214
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002215ifndef NO_PERL
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002216PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002217PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002218
Dan Jacques07d90ea2018-04-10 11:05:43 -04002219PERL_DEFINES := $(PERL_PATH_SQ) $(PERLLIB_EXTRA_SQ) $(perllibdir_SQ)
2220PERL_DEFINES += $(RUNTIME_PREFIX)
2221
2222# Support Perl runtime prefix. In this mode, a different header is installed
2223# into Perl scripts.
2224ifdef RUNTIME_PREFIX
2225
2226PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
2227
2228# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
2229# at runtime.
2230perl_localedir_SQ =
2231
2232endif
2233
2234PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
2235
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002236$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
Emil Medve4cb08df2007-07-14 12:51:44 -05002237 $(QUIET_GEN)$(RM) $@ $@+ && \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002238 sed -e '1{' \
2239 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Alejandro R. Sedeño66000542018-06-25 15:13:25 -04002240 -e ' r GIT-PERL-HEADER' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002241 -e ' G' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002242 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07002243 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002244 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002245 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002246 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002247
Dan Jacques07d90ea2018-04-10 11:05:43 -04002248PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002249GIT-PERL-DEFINES: FORCE
2250 @FLAGS='$(PERL_DEFINES)'; \
2251 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2252 echo >&2 " * new perl-specific parameters"; \
2253 echo "$$FLAGS" >$@; \
2254 fi
2255
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002256GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
2257 $(QUIET_GEN)$(RM) $@ && \
2258 INSTLIBDIR='$(perllibdir_SQ)' && \
2259 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
2260 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
2261 sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
Jonathan Nieder64f982b2018-04-23 16:25:35 -07002262 -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002263 -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
2264 -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
2265 -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002266 $< >$@+ && \
2267 mv $@+ $@
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002268
Christian Hessed8698982018-04-19 06:44:40 +09002269.PHONY: perllibdir
Christian Hessecfb3a472018-04-10 15:36:41 +02002270perllibdir:
2271 @echo '$(perllibdir_SQ)'
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002272
2273.PHONY: gitweb
2274gitweb:
2275 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2276
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002277git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002278 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002279 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002280 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002281else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002282$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Jeff King499c2932009-04-03 15:32:20 -04002283 $(QUIET_GEN)$(RM) $@ $@+ && \
2284 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2285 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2286 unimplemented.sh >$@+ && \
2287 chmod +x $@+ && \
2288 mv $@+ $@
2289endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002290
Jonathan Niederca2051d2014-11-18 10:43:47 -08002291# This makes sure we depend on the NO_PYTHON setting itself.
2292$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2293
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002294ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002295$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2296$(SCRIPT_PYTHON_GEN): % : %.py
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002297 $(QUIET_GEN)$(RM) $@ $@+ && \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002298 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002299 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002300 chmod +x $@+ && \
2301 mv $@+ $@
2302else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002303$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002304 $(QUIET_GEN)$(RM) $@ $@+ && \
2305 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2306 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2307 unimplemented.sh >$@+ && \
2308 chmod +x $@+ && \
2309 mv $@+ $@
2310endif # NO_PYTHON
2311
Jeff King7f1b6972013-02-21 01:26:14 -05002312CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
2313 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
2314 configure.ac >configure.ac+ && \
2315 autoconf -o configure configure.ac+ && \
2316 $(RM) configure.ac+
2317
Jeff King520a6cd2012-06-20 14:32:22 -04002318configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002319 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002320
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002321ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002322# We avoid depending on 'configure' here, because it gets rebuilt
2323# every time GIT-VERSION-FILE is modified, only to update the embedded
2324# version number string, which config.status does not care about. We
2325# do want to recheck when the platform/environment detection logic
2326# changes, hence this depends on configure.ac.
2327config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002328 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002329 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002330 ./config.status --recheck; \
2331 else \
2332 ./configure; \
2333 fi
2334reconfigure config.mak.autogen: config.status
2335 $(QUIET_GEN)./config.status
2336.PHONY: reconfigure # This is a convenience target.
2337endif
2338
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002339XDIFF_OBJS += xdiff/xdiffi.o
2340XDIFF_OBJS += xdiff/xprepare.o
2341XDIFF_OBJS += xdiff/xutils.o
2342XDIFF_OBJS += xdiff/xemit.o
2343XDIFF_OBJS += xdiff/xmerge.o
2344XDIFF_OBJS += xdiff/xpatience.o
Junio C Hamanod4755362012-01-27 11:04:28 -08002345XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002346
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002347VCSSVN_OBJS += vcs-svn/line_buffer.o
Jonathan Nieder9d2f5dd2011-01-02 21:54:58 -06002348VCSSVN_OBJS += vcs-svn/sliding_window.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002349VCSSVN_OBJS += vcs-svn/fast_export.o
Jonathan Niederddcc8c52010-12-25 05:11:32 -06002350VCSSVN_OBJS += vcs-svn/svndiff.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002351VCSSVN_OBJS += vcs-svn/svndump.o
2352
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002353TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002354OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
2355 $(XDIFF_OBJS) \
2356 $(VCSSVN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07002357 $(FUZZ_OBJS) \
Jeff King3f2e2292016-07-01 01:58:58 -04002358 common-main.o \
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002359 git.o
2360ifndef NO_CURL
2361 OBJECTS += http.o http-walker.o remote-curl.o
2362endif
Jonathan Niederc3739912010-01-26 09:52:11 -06002363
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002364dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002365dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002366
Jonathan Nieder024c8432011-11-18 03:58:21 -06002367ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002368$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002369 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002370
2371missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002372dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002373dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002374endif
2375
Jonathan Nieder024c8432011-11-18 03:58:21 -06002376ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002377dep_dirs =
2378missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002379dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002380endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002381
2382ASM_SRC := $(wildcard $(OBJECTS:o=S))
2383ASM_OBJ := $(ASM_SRC:S=o)
2384C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002385
Jonathan Nieder30248882010-01-26 09:51:24 -06002386.SUFFIXES:
2387
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002388$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05002389 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002390$(ASM_OBJ): %.o: %.S 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
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002393%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002394 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002395
2396ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2397# Take advantage of gcc's on-the-fly dependency generation
2398# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2399dep_files_present := $(wildcard $(dep_files))
2400ifneq ($(dep_files_present),)
2401include $(dep_files_present)
2402endif
2403else
Jonathan Niederdfea5752010-01-26 09:52:49 -06002404# Dependencies on header files, for platforms that do not support
2405# the gcc -MMD option.
2406#
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002407# Dependencies on automatically generated headers such as command-list.h
Jonathan Niederdfea5752010-01-26 09:52:49 -06002408# should _not_ be included here, since they are necessary even when
2409# building an object for the first time.
Pavel Roskinb05701c2005-08-06 01:36:15 -04002410
Johannes Schindelin92b88eb2019-03-04 05:47:06 -08002411$(OBJECTS): $(LIB_H) $(GENERATED_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002412endif
Junio C Hamano7a590132005-08-06 13:10:43 -07002413
Stefan Bellerd807c4a2018-04-10 14:26:18 -07002414exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
2415exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002416 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002417 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002418 '-DBINDIR="$(bindir_relative_SQ)"' \
Philip Oakley4d5b4c22018-04-21 13:18:42 +02002419 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002420
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002421builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002422builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002423 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002424
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002425config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002426config.sp config.s config.o: EXTRA_CPPFLAGS = \
2427 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002428
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002429attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002430attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2431 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002432
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002433gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002434gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002435 -DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002436
Ramsay Jones15caca22019-02-05 02:27:48 +00002437http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002438 -DCURL_DISABLE_TYPECHECK
2439
Ramsay Jones15caca22019-02-05 02:27:48 +00002440pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
Ramsay Jones54360a12018-02-12 00:21:02 +00002441
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002442ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002443http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002444endif
2445
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002446ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002447compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2448 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002449endif
2450
René Scharfed555ff52010-09-11 11:59:18 +02002451ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002452compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002453 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones15caca22019-02-05 02:27:48 +00002454compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002455endif
2456
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002457git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002458 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002459
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002460git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002461 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002462 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002463
John Keepingfd78ced2014-01-25 13:11:44 +00002464git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002465 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002466 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002467git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002468 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002469 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002470
Florian Achleitner48ea9f92012-09-19 17:21:16 +02002471git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
2472 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
2473 $(VCSSVN_LIB)
2474
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002475$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2476 $(QUIET_LNCP)$(RM) $@ && \
2477 ln $< $@ 2>/dev/null || \
2478 ln -s $< $@ 2>/dev/null || \
2479 cp $< $@
2480
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002481$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002482 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002483 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002484
Petr Baudis28818ff2005-07-29 17:50:24 +02002485$(LIB_FILE): $(LIB_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002486 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002487
Linus Torvalds34435462006-03-24 20:13:22 -08002488$(XDIFF_LIB): $(XDIFF_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002489 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002490
Jonathan Nieder3f527372010-08-09 17:04:29 -05002491$(VCSSVN_LIB): $(VCSSVN_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002492 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002493
Jonathan Nieder5b586192012-03-31 03:44:53 -05002494export DEFAULT_EDITOR DEFAULT_PAGER
2495
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07002496Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
2497 @EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
2498 if test x"$$EXCLUDED" != \
2499 x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
2500 echo >&2 " * new documentation flags"; \
2501 echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
2502 fi
2503
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002504.PHONY: doc man man-perl html info pdf
2505doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002506 $(MAKE) -C Documentation all
2507
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002508man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002509 $(MAKE) -C Documentation man
2510
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002511man-perl: perl/build/man/man3/Git.3pm
2512
Michael J Gruber414851a2008-09-10 10:19:34 +02002513html:
2514 $(MAKE) -C Documentation html
2515
David Kastrup47398092007-08-06 12:22:57 +02002516info:
2517 $(MAKE) -C Documentation info
2518
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002519pdf:
2520 $(MAKE) -C Documentation pdf
2521
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002522XGETTEXT_FLAGS = \
2523 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002524 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002525 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2526 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002527XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2528 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002529XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2530 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002531XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002532 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002533LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002534LOCALIZED_SH = $(SCRIPT_SH)
2535LOCALIZED_SH += git-parse-remote.sh
Alban Gruinc42abfe2018-05-28 14:34:19 +02002536LOCALIZED_SH += git-rebase--preserve-merges.sh
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002537LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002538LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002539
2540ifdef XGETTEXT_INCLUDE_TESTS
2541LOCALIZED_C += t/t0200/test.c
2542LOCALIZED_SH += t/t0200/test.sh
2543LOCALIZED_PERL += t/t0200/test.perl
2544endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002545
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002546## Note that this is meant to be run only by the localization coordinator
2547## under a very controlled condition, i.e. (1) it is to be run in a
2548## Git repository (not a tarball extract), (2) any local modifications
2549## will be lost.
2550## Gettext tools cannot work with our own custom PRItime type, so
2551## we replace PRItime with PRIuMAX. We need to update this to
2552## PRIdMAX if we switch to a signed type later.
2553
Jonathan Nieder1f319632014-08-22 00:32:08 -04002554po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002555 # All modifications will be reverted at the end, so we do not
2556 # want to have any local change.
2557 git diff --quiet HEAD && git diff --quiet --cached
2558
2559 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2560 do \
2561 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2562 cat "$$s+" >"$$s" && rm "$$s+"; \
2563 done
2564
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002565 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2566 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2567 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002568 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2569 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002570
2571 # Reverting the munged source, leaving only the updated $@
2572 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002573 mv $@+ $@
2574
Elia Pintoe6be2652015-12-15 15:21:00 +00002575.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002576pot: po/git.pot
2577
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002578POFILES := $(wildcard po/*.po)
2579MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2580
2581ifndef NO_GETTEXT
2582all:: $(MOFILES)
2583endif
2584
2585po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2586 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2587
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002588LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2589LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002590LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2591LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002592
2593ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002594all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002595ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002596all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002597endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002598NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002599endif
2600
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002601perl/build/lib/%.pm: perl/%.pm
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002602 $(QUIET_GEN)mkdir -p $(dir $@) && \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002603 sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002604 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2605 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002606
2607perl/build/man/man3/Git.3pm: perl/Git.pm
2608 $(QUIET_GEN)mkdir -p $(dir $@) && \
2609 pod2man $< $@
2610
Jeff Kinge951ebc2016-12-14 09:26:55 -05002611FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002612 git ls-files \
2613 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002614 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002615 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002616 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002617 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002618 $(FIND) . \
2619 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002620 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002621 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002622 -o \( -name build -type d -prune \) \
2623 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002624 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002625 -o \( -name '*.sh' -type f -print \) \
Denton Liu43f8c892019-09-16 12:23:14 -07002626 | sed -e 's|^\./||' \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002627 )
Junio C Hamano33533972011-10-18 00:26:18 -07002628
Junio C Hamano2f769192010-09-28 16:08:38 -05002629$(ETAGS_TARGET): FORCE
2630 $(RM) $(ETAGS_TARGET)
Junio C Hamano33533972011-10-18 00:26:18 -07002631 $(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002632
Junio C Hamano2f769192010-09-28 16:08:38 -05002633tags: FORCE
Emil Medve4cb08df2007-07-14 12:51:44 -05002634 $(RM) tags
Junio C Hamano33533972011-10-18 00:26:18 -07002635 $(FIND_SOURCE_FILES) | xargs ctags -a
Petr Baudis28818ff2005-07-29 17:50:24 +02002636
Kristof Provosta2a91502007-10-06 16:24:42 +02002637cscope:
2638 $(RM) cscope*
Junio C Hamano33533972011-10-18 00:26:18 -07002639 $(FIND_SOURCE_FILES) | xargs cscope -b
Kristof Provosta2a91502007-10-06 16:24:42 +02002640
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002641### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002642TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2643 $(localedir_SQ)
2644
2645GIT-PREFIX: FORCE
2646 @FLAGS='$(TRACK_PREFIX)'; \
2647 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002648 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002649 echo "$$FLAGS" >GIT-PREFIX; \
2650 fi
2651
2652TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002653
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002654GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002655 @FLAGS='$(TRACK_CFLAGS)'; \
2656 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002657 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002658 echo "$$FLAGS" >GIT-CFLAGS; \
2659 fi
2660
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002661TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2662
2663GIT-LDFLAGS: FORCE
2664 @FLAGS='$(TRACK_LDFLAGS)'; \
2665 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002666 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002667 echo "$$FLAGS" >GIT-LDFLAGS; \
2668 fi
2669
Junio C Hamanobfce5082008-07-25 12:35:10 -07002670# We need to apply sq twice, once to protect from the shell
2671# that runs GIT-BUILD-OPTIONS, and then again to protect it
2672# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002673GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002674 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002675 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002676 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2677 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2678 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2679 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2680 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002681 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002682 @echo USE_LIBPCRE1=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE1)))'\' >>$@+
2683 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00002684 @echo NO_LIBPCRE1_JIT=\''$(subst ','\'',$(subst ','\'',$(NO_LIBPCRE1_JIT)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002685 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002686 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002687 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2688 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002689 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002690 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
Johannes Schindelin8abfdf42018-11-14 08:32:11 -08002691 @echo X=\'$(X)\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002692ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002693 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002694endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002695ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002696 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002697endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002698ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002699 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002700endif
2701ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002702 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002703endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002704 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002705ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002706 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002707endif
2708ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002709 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002710endif
2711ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002712 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002713endif
2714ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002715 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002716endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002717ifdef GIT_PERF_MAKE_COMMAND
2718 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2719endif
Jeff King3d893612017-02-25 04:37:07 -05002720ifdef GIT_INTEROP_MAKE_OPTS
2721 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2722endif
Ben Peart1f357b02018-09-18 23:29:36 +00002723ifdef GIT_TEST_INDEX_VERSION
2724 @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002725endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002726 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002727
Christian Couder96a46472012-12-18 16:26:38 +01002728### Detect Python interpreter path changes
2729ifndef NO_PYTHON
2730TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002731
Christian Couder96a46472012-12-18 16:26:38 +01002732GIT-PYTHON-VARS: FORCE
2733 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002734 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002735 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002736 echo "$$VARS" >$@; \
2737 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002738endif
2739
Matthew Ogilvieea925192009-12-02 22:14:05 -07002740test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2741
2742all:: $(TEST_PROGRAMS) $(test_bindir_programs)
2743
2744bin-wrappers/%: wrap-for-bin.sh
2745 @mkdir -p bin-wrappers
2746 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2747 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Johannes Schindelin3a94cb32019-07-29 13:08:16 -07002748 -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 -07002749 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002750
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002751# GNU make supports exporting all variables by "export" without parameters.
2752# However, the environment gets quite big, and some programs have problems
2753# with that.
2754
Johannes Schindelin140245b2006-07-07 13:26:31 +02002755export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002756export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002757
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002758### Testing rules
2759
Junio C Hamano96651ef2007-04-28 15:32:49 -07002760test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002761 $(MAKE) -C t/ all
2762
Thomas Rast342e9ef2012-02-17 11:25:09 +01002763perf: all
2764 $(MAKE) -C t/perf/ all
2765
2766.PHONY: test perf
2767
Jeff King4df7c8a2016-07-01 03:59:44 -04002768t/helper/test-line-buffer$X: $(VCSSVN_LIB)
René Scharfeb4285c72009-01-17 16:50:13 +01002769
Jeff King4df7c8a2016-07-01 03:59:44 -04002770t/helper/test-svn-fe$X: $(VCSSVN_LIB)
David Barr21746aa2010-08-09 17:55:00 -05002771
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002772.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002773
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002774t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2775
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002776t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
David Barr1d73b522010-08-09 17:34:42 -05002777 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002778
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +01002779check-sha1:: t/helper/test-tool$X
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002780 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002781
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002782SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2783
2784$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
2785 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
Ramsay Jones15caca22019-02-05 02:27:48 +00002786 $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $<
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002787
2788.PHONY: sparse $(SP_OBJ)
2789sparse: $(SP_OBJ)
2790
Junio C Hamanof3719842019-12-13 15:15:34 -08002791EXCEPT_HDRS := command-list.h unicode-width.h compat/% xdiff/%
Ramsay Jonesf23aa182019-03-06 00:11:13 +00002792ifndef GCRYPT_SHA256
2793 EXCEPT_HDRS += sha256/gcrypt.h
2794endif
Denton Liucf6a2d22019-09-16 12:23:08 -07002795CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002796HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
Denton Liub503a2d2019-09-25 01:21:01 -07002797HCC = $(HCO:hco=hcc)
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002798
Denton Liub503a2d2019-09-25 01:21:01 -07002799%.hcc: %.h
2800 @echo '#include "git-compat-util.h"' >$@
2801 @echo '#include "$<"' >>$@
2802
2803$(HCO): %.hco: %.hcc FORCE
2804 $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002805
2806.PHONY: hdr-check $(HCO)
2807hdr-check: $(HCO)
2808
Brandon Williams21188052017-08-14 14:30:46 -07002809.PHONY: style
2810style:
2811 git clang-format --style file --diff --extensions c,h
2812
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002813check: command-list.h
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01002814 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002815 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07002816 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002817 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002818 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07002819 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002820 exit 1; \
2821 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02002822
Denton Liu9027af52019-09-16 12:23:16 -07002823FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
2824COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02002825
2826%.cocci.patch: %.cocci $(COCCI_SOURCES)
Denton Liu4f3c1dc2019-10-09 13:43:46 -07002827 $(QUIET_SPATCH) \
Jeff Kingbcb4edf2019-05-08 03:07:54 -04002828 if test $(SPATCH_BATCH_SIZE) = 0; then \
2829 limit=; \
2830 else \
2831 limit='-n $(SPATCH_BATCH_SIZE)'; \
2832 fi; \
2833 if ! echo $(COCCI_SOURCES) | xargs $$limit \
Jeff King960154b2019-05-06 19:43:34 -04002834 $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
2835 >$@+ 2>$@.log; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002836 then \
2837 cat $@.log; \
2838 exit 1; \
2839 fi; \
2840 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02002841 if test -s $@; \
2842 then \
2843 echo ' ' SPATCH result: $@; \
2844 fi
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002845coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
René Scharfe63f0a752016-09-15 20:30:56 +02002846
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002847# See contrib/coccinelle/README
2848coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
2849
2850.PHONY: coccicheck coccicheck-pending
Petr Baudis28818ff2005-07-29 17:50:24 +02002851
Petr Baudis28818ff2005-07-29 17:50:24 +02002852### Installation rules
2853
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002854ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002855template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002856else
2857template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002858endif
2859export template_instdir
2860
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002861ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002862gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002863else
2864gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002865endif
2866gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
2867export gitexec_instdir
2868
David Aguilarbc7a96a2011-08-18 00:23:46 -07002869ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2870mergetools_instdir = $(mergetoolsdir)
2871else
2872mergetools_instdir = $(prefix)/$(mergetoolsdir)
2873endif
2874mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2875
Matthew Ogilvieea925192009-12-02 22:14:05 -07002876install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
2877
Elia Pintoe6be2652015-12-15 15:21:00 +00002878.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07002879profile-install: profile
2880 $(MAKE) install
2881
2882profile-fast-install: profile-fast
2883 $(MAKE) install
2884
Andreas Ericssond6ebd252005-11-22 00:44:15 +01002885install: all
Robert Schiele41650762007-12-01 18:05:40 +01002886 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002887 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2888 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08002889 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthew Ogilvieea925192009-12-02 22:14:05 -07002890 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07002891ifdef MSVC
2892 # We DO NOT install the individual foo.o.pdb files because they
2893 # have already been rolled up into the exe's pdb file.
2894 # We DO NOT have pdb files for the builtin commands (like git-status.exe)
2895 # because it is just a copy/hardlink of git.exe, rather than a unique binary.
2896 $(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2897 $(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2898 $(INSTALL) git-upload-pack.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2899 $(INSTALL) git-credential-store.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2900 $(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2901 $(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2902 $(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2903 $(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2904 $(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2905 $(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2906 $(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2907 $(INSTALL) git-remote-testsvn.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2908 $(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2909 $(INSTALL) git-show-index.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2910ifndef DEBUG
2911 $(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2912 $(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2913else
2914 $(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2915 $(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2916endif
2917endif
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01002918 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07002919 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05002920 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002921ifndef NO_GETTEXT
2922 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
2923 (cd po/build/locale && $(TAR) cf - .) | \
2924 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
2925endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07002926ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002927 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
2928 (cd perl/build/lib && $(TAR) cf - .) | \
2929 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07002930 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07002931endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002932ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002933 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002934 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002935endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002936ifneq (,$X)
Eric Blaked4b19022009-04-28 06:28:31 -06002937 $(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 -08002938endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002939
Johannes Sixt46beb552008-07-21 21:19:51 +02002940 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002941 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002942 destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07002943 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05002944 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
2945 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002946 test -n "$(INSTALL_SYMLINKS)" && \
2947 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
2948 { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
2949 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
2950 cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
Brandon Casey76d079a2010-07-23 12:50:45 -05002951 done; \
2952 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05002953 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
2954 $(RM) "$$bindir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002955 test -n "$(INSTALL_SYMLINKS)" && \
2956 ln -s "git$X" "$$bindir/$$p" || \
2957 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2958 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2959 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2960 cp "$$bindir/git$X" "$$bindir/$$p" || exit; } \
Brandon Casey40919c42010-07-23 12:50:44 -05002961 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002962 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06002963 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002964 test -n "$(INSTALL_SYMLINKS)" && \
2965 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
2966 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2967 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2968 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2969 cp "$$execdir/git$X" "$$execdir/$$p" || exit; } \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002970 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07002971 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
2972 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002973 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002974 test -n "$(INSTALL_SYMLINKS)" && \
2975 ln -s "git-remote-http$X" "$$execdir/$$p" || \
2976 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2977 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2978 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2979 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
Brandon Casey49a43f52010-07-06 14:56:51 -07002980 done && \
Johannes Sixt7b4b59a2008-07-21 21:19:58 +02002981 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
Petr Baudis28818ff2005-07-29 17:50:24 +02002982
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002983.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00002984.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02002985install-gitweb:
2986 $(MAKE) -C gitweb install
2987
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002988install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002989 $(MAKE) -C Documentation install
2990
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002991install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002992 $(MAKE) -C Documentation install-man
2993
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002994install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002995 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
2996 (cd perl/build/man/man3 && $(TAR) cf - .) | \
2997 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
2998
Teemu Likonenae081f32008-06-10 11:34:25 +03002999install-html:
3000 $(MAKE) -C Documentation install-html
3001
David Kastrup47398092007-08-06 12:22:57 +02003002install-info:
3003 $(MAKE) -C Documentation install-info
3004
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01003005install-pdf:
3006 $(MAKE) -C Documentation install-pdf
3007
Eric Wong6538d1e2006-12-23 08:26:09 -08003008quick-install-doc:
3009 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02003010
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003011quick-install-man:
3012 $(MAKE) -C Documentation quick-install-man
3013
Michael J Gruber6fe570d2008-09-09 22:44:17 +02003014quick-install-html:
3015 $(MAKE) -C Documentation quick-install-html
3016
Petr Baudis28818ff2005-07-29 17:50:24 +02003017
3018
3019### Maintainer's dist rules
3020
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01003021GIT_TARNAME = git-$(GIT_VERSION)
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02003022dist: git-archive$(X) configure
Junio C Hamano9ccb64c2006-10-05 02:26:12 -07003023 ./git-archive --format=tar \
3024 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003025 @mkdir -p $(GIT_TARNAME)
Junio C Hamanoab214332016-04-04 23:42:41 -07003026 @cp configure $(GIT_TARNAME)
H. Peter Anvin181129d2006-01-09 18:07:01 -08003027 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05003028 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
H. Peter Anvin181129d2006-01-09 18:07:01 -08003029 $(TAR) rf $(GIT_TARNAME).tar \
Matthias Lederhoferf58494b2007-06-18 23:30:36 +02003030 $(GIT_TARNAME)/configure \
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05003031 $(GIT_TARNAME)/version \
Shawn O. Pearce115f0fe2007-03-12 13:40:31 -04003032 $(GIT_TARNAME)/git-gui/version
Ævar Arnfjörð Bjarmasonbc2ed312017-12-08 22:29:58 +00003033ifdef DC_SHA1_SUBMODULE
3034 @mkdir -p $(GIT_TARNAME)/sha1collisiondetection/lib
3035 @cp sha1collisiondetection/LICENSE.txt \
3036 $(GIT_TARNAME)/sha1collisiondetection/
3037 @cp sha1collisiondetection/LICENSE.txt \
3038 $(GIT_TARNAME)/sha1collisiondetection/
3039 @cp sha1collisiondetection/lib/sha1.[ch] \
3040 $(GIT_TARNAME)/sha1collisiondetection/lib/
3041 @cp sha1collisiondetection/lib/ubc_check.[ch] \
3042 $(GIT_TARNAME)/sha1collisiondetection/lib/
3043 $(TAR) rf $(GIT_TARNAME).tar \
3044 $(GIT_TARNAME)/sha1collisiondetection/LICENSE.txt \
3045 $(GIT_TARNAME)/sha1collisiondetection/lib/sha1.[ch] \
3046 $(GIT_TARNAME)/sha1collisiondetection/lib/ubc_check.[ch]
3047endif
Emil Medve4cb08df2007-07-14 12:51:44 -05003048 @$(RM) -r $(GIT_TARNAME)
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06003049 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003050
Junio C Hamanoab214332016-04-04 23:42:41 -07003051rpm::
3052 @echo >&2 "Use distro packaged sources to run rpmbuild"
3053 @false
3054.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07003055
Johannes Schindelin46689312019-10-04 08:09:36 -07003056ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
3057OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
3058endif
3059
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003060artifacts-tar:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) \
3061 GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003062 $(MOFILES)
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003063 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
3064 SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
3065 test -n "$(ARTIFACTS_DIRECTORY)"
3066 mkdir -p "$(ARTIFACTS_DIRECTORY)"
3067 $(TAR) czf "$(ARTIFACTS_DIRECTORY)/artifacts.tar.gz" $^ templates/blt/
3068.PHONY: artifacts-tar
3069
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003070htmldocs = git-htmldocs-$(GIT_VERSION)
3071manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00003072.PHONY: dist-doc distclean
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003073dist-doc:
Emil Medve4cb08df2007-07-14 12:51:44 -05003074 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003075 mkdir .doc-tmp-dir
3076 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
3077 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
3078 gzip -n -9 -f $(htmldocs).tar
3079 :
Emil Medve4cb08df2007-07-14 12:51:44 -05003080 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07003081 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02003082 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003083 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07003084 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003085 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003086 install
3087 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
3088 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05003089 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003090
Petr Baudis28818ff2005-07-29 17:50:24 +02003091### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06003092
Mathias Megyei922aa802007-10-04 23:49:19 +02003093distclean: clean
3094 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02003095 $(RM) config.log config.status config.cache
3096 $(RM) config.mak.autogen config.mak.append
3097 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02003098
Theodore Ts'of2d713f2012-02-06 01:00:17 -05003099profile-clean:
3100 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3101 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3102
SZEDER Gábor1a966382018-07-23 15:51:00 +02003103cocciclean:
3104 $(RM) contrib/coccinelle/*.cocci.patch*
3105
3106clean: profile-clean coverage-clean cocciclean
Junio C Hamano7897d842016-04-15 10:06:52 -07003107 $(RM) *.res
3108 $(RM) $(OBJECTS)
Vicent Martie1273102013-11-14 07:43:51 -05003109 $(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08003110 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003111 $(RM) $(TEST_PROGRAMS)
Josh Steadmon5e472152018-10-12 17:58:40 -07003112 $(RM) $(FUZZ_PROGRAMS)
Denton Liub503a2d2019-09-25 01:21:01 -07003113 $(RM) $(HCC)
Matt Kraai61564ca2013-02-13 07:57:48 -08003114 $(RM) -r bin-wrappers $(dep_dirs)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003115 $(RM) -r po/build/
Junio C Hamanof3719842019-12-13 15:15:34 -08003116 $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
Emil Medve4cb08df2007-07-14 12:51:44 -05003117 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
3118 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
3119 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02003120 $(MAKE) -C Documentation/ clean
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07003121 $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
Jeff King499c2932009-04-03 15:32:20 -04003122ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01003123 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003124 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04003125endif
Petr Baudisb1edc532006-06-24 04:34:29 +02003126 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07003127 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003128ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003129 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003130 $(MAKE) -C git-gui clean
3131endif
Christian Couder8f26aa42012-12-18 16:26:37 +01003132 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08003133 $(RM) GIT-USER-AGENT GIT-PREFIX
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04003134 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003135ifdef MSVC
3136 $(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3137 $(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3138 $(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3139 $(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3140 $(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3141 $(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3142 $(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3143 $(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3144 $(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3145 $(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3146 $(RM) compat/vcbuild/MSVC-DEFS-GEN
3147endif
Junio C Hamano9b88fce2005-12-27 14:40:17 -08003148
SZEDER Gábor1a966382018-07-23 15:51:00 +02003149.PHONY: all install profile-clean cocciclean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05003150.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Junio C Hamano2f769192010-09-28 16:08:38 -05003151.PHONY: FORCE cscope
Junio C Hamanod89056c2005-12-19 17:59:58 -08003152
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003153### Check documentation
3154#
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003155ALL_COMMANDS = $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS)
3156ALL_COMMANDS += git
3157ALL_COMMANDS += gitk
3158ALL_COMMANDS += gitweb
Jeff Kingeb285012012-08-08 16:56:42 -04003159ALL_COMMANDS += git-gui git-citool
Elia Pintoe6be2652015-12-15 15:21:00 +00003160
3161.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003162check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07003163 $(MAKE) -C Documentation lint-docs
Johannes Schindelin5ee42462019-03-25 14:41:39 -07003164 @(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003165 do \
3166 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003167 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02003168 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08003169 git-fsck-objects | git-init-db | \
Johannes Schindelin31cf4a62019-04-18 06:16:46 -07003170 git-remote-* | git-stage | git-legacy-* | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08003171 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003172 esac ; \
3173 test -f "Documentation/$$v.txt" || \
3174 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02003175 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08003176 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003177 case "$$v" in \
3178 git) ;; \
3179 *) echo "no link: $$v";; \
3180 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003181 done; \
3182 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02003183 sed -e '1,/^### command list/d' \
3184 -e '/^#/d' \
Johannes Schindelin8e6d6952019-03-25 14:41:38 -07003185 -e '/guide$$/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003186 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08003187 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04003188 $(MAKE) -C Documentation print-man1 | \
3189 grep '\.txt$$' | \
Johannes Schindelin057ccba2019-03-25 14:41:37 -07003190 sed -e 's|^|documented |' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003191 -e 's/\.txt//'; \
3192 ) | while read how cmd; \
3193 do \
Johannes Schindelin7c3bd712019-04-18 06:16:42 -07003194 case " $(patsubst %$X,%,$(ALL_COMMANDS) $(EXCLUDED_PROGRAMS)) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003195 *" $$cmd "*) ;; \
3196 *) echo "removed but $$how: $$cmd" ;; \
3197 esac; \
3198 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08003199
3200### Make sure built-ins do not have dups and listed in git.c
3201#
3202check-builtins::
3203 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08003204
Thomas Rast901c3692009-02-19 12:13:35 +01003205### Test suite coverage testing
3206#
Thomas Rast0c38a952013-05-13 23:27:25 +02003207.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00003208.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003209.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01003210
3211coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02003212 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02003213 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01003214
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003215object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003216coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003217 $(RM) $(addsuffix *.gcov,$(object_dirs))
3218 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003219 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003220 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003221 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01003222
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003223coverage-clean: coverage-clean-results
3224 $(RM) $(addsuffix *.gcno,$(object_dirs))
3225
Thomas Rast901c3692009-02-19 12:13:35 +01003226COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
3227COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003228GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01003229
Thomas Rast0c38a952013-05-13 23:27:25 +02003230coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01003231 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02003232
3233coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01003234 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02003235 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01003236
Derrick Stolee22991202019-01-29 09:05:18 -08003237coverage-prove: coverage-clean-results coverage-compile
3238 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
3239 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
3240 -j1 test
3241
Thomas Rast901c3692009-02-19 12:13:35 +01003242coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003243 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02003244 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003245 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00003246
3247coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01003248 grep '^function.*called 0 ' *.c.gcov \
3249 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003250 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003251
3252cover_db: coverage-report
3253 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003254
3255cover_db_html: cover_db
3256 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07003257
Josh Steadmon5e472152018-10-12 17:58:40 -07003258
3259### Fuzz testing
3260#
3261# Building fuzz targets generally requires a special set of compiler flags that
3262# are not necessarily appropriate for general builds, and that vary greatly
3263# depending on the compiler version used.
3264#
3265# An example command to build against libFuzzer from LLVM 4.0.0:
3266#
3267# make CC=clang CXX=clang++ \
Josh Steadmon8b7c2ee2019-01-15 14:25:52 -08003268# CFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
Josh Steadmon5e472152018-10-12 17:58:40 -07003269# LIB_FUZZING_ENGINE=/usr/lib/llvm-4.0/lib/libFuzzer.a \
3270# fuzz-all
3271#
Josh Steadmon927c77e2018-11-14 11:41:47 -08003272FUZZ_CXXFLAGS ?= $(CFLAGS)
3273
Josh Steadmon5e472152018-10-12 17:58:40 -07003274.PHONY: fuzz-all
3275
3276$(FUZZ_PROGRAMS): all
Josh Steadmon927c77e2018-11-14 11:41:47 -08003277 $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07003278 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3279
3280fuzz-all: $(FUZZ_PROGRAMS)