blob: 3225e37b638a3249910a7b0010d1315a47165c8c [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#
Jeff King2b081012021-02-26 01:14:35 -050025# Define OPEN_RETURNS_EINTR if your open() system call may return EINTR
26# when a signal is received (as opposed to restarting).
27#
Linus Torvalds765ac8e2006-02-28 15:07:20 -080028# Define NO_OPENSSL environment variable if you do not have OpenSSL.
Petr Baudis5bdac8b2005-07-29 17:48:26 +020029#
Ævar Arnfjörð Bjarmason072473e2017-05-20 21:42:04 +000030# Define USE_LIBPCRE if you have and want to use libpcre. Various
31# commands such as log and grep offer runtime options to use
32# Perl-compatible regular expressions instead of standard or extended
33# POSIX regular expressions.
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +020034#
Ævar Arnfjörð Bjarmason75997302021-01-24 02:58:33 +010035# Only libpcre version 2 is supported. USE_LIBPCRE2 is a synonym for
36# USE_LIBPCRE, support for the old USE_LIBPCRE1 has been removed.
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +000037#
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +000038# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
Ævar Arnfjörð Bjarmason75997302021-01-24 02:58:33 +010039# in /foo/bar/include and /foo/bar/lib directories.
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +020040#
Kirill Smelkov61f76a32014-03-27 18:22:50 +040041# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
42#
Tay Ray Chuand24d9052011-08-03 20:07:57 +080043# Define NO_CURL if you do not have libcurl installed. git-http-fetch and
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080044# git-http-push are not built, and you cannot use http:// and https://
Tay Ray Chuand24d9052011-08-03 20:07:57 +080045# transports (neither smart nor dumb).
Johannes Schindelinb2c0bd62005-07-31 02:14:23 +020046#
Patrick Mauritz6d9bbc52005-09-19 16:11:19 +020047# Define CURLDIR=/foo/bar if your curl header and library files are in
Junio C Hamanob2feb642014-04-30 10:58:10 -070048# /foo/bar/include and /foo/bar/lib directories.
Patrick Mauritz6d9bbc52005-09-19 16:11:19 +020049#
Remi Pommarelf8915872015-10-21 19:10:46 +020050# Define CURL_CONFIG to curl's configuration program that prints information
51# about the library (e.g., its version number). The default is 'curl-config'.
52#
James Knight23c4bbe2018-11-03 05:12:11 +000053# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl,
54# if you do not want to rely on the libraries provided by CURL_CONFIG. The
55# default value is a result of `curl-config --libs`. An example value for
56# CURL_LDFLAGS is as follows:
57#
58# CURL_LDFLAGS=-lcurl
59#
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080060# Define NO_EXPAT if you do not have expat installed. git-http-push is
Tay Ray Chuand24d9052011-08-03 20:07:57 +080061# not built, and you cannot push using http:// and https:// transports (dumb).
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080062#
Serge van den Boom85b45182009-01-28 21:43:57 +010063# Define EXPATDIR=/foo/bar if your expat header and library files are in
64# /foo/bar/include and /foo/bar/lib directories.
65#
Matt Kraai081fd8d2013-02-11 14:03:45 -080066# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
67# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
68#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010069# Define NO_GETTEXT if you don't want Git output to be translated.
70# A translated Git requires GNU libintl or another gettext implementation,
71# plus libintl-perl at runtime.
72#
Alex Riesenad17ea72012-01-23 14:04:29 -080073# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
74# the installed gettext translation of the shell scripts output.
75#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010076# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
77# trust the langinfo.h's nl_langinfo(CODESET) function to return the
78# current character set. GNU and Solaris have a nl_langinfo(CODESET),
79# FreeBSD can use either, but MinGW and some others need to use
80# libcharset.h's locale_charset() instead.
81#
Дилян Палаузов3064b132014-03-11 23:37:33 +010082# Define CHARSET_LIB to the library you need to link with in order to
Дилян Палаузовb5225282012-02-12 17:23:36 +010083# use locale_charset() function. On some platforms this needs to set to
Дилян Палаузов3064b132014-03-11 23:37:33 +010084# -lcharset, on others to -liconv .
Дилян Палаузовb5225282012-02-12 17:23:36 +010085#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010086# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
87# need -lintl when linking.
88#
89# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
90# doesn't support GNU extensions like --check and --statistics
91#
Chris Webbcb6a22c2010-04-13 10:07:13 +010092# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
93# it specifies.
94#
Junio C Hamano63be37b2006-01-19 17:13:57 -080095# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
Eric Blakea50dec22010-04-01 16:43:54 -060096# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
Junio C Hamano63be37b2006-01-19 17:13:57 -080097#
David Michaelb3e103d2012-12-14 14:57:01 -050098# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
99#
Linus Torvaldsef34af22005-09-18 18:30:50 -0700100# Define NO_STRCASESTR if you don't have strcasestr.
101#
René Scharfeb21b9f12007-09-07 00:32:54 +0200102# Define NO_MEMMEM if you don't have memmem.
103#
Matt Kraai40036be2012-12-18 14:03:55 -0800104# Define NO_GETPAGESIZE if you don't have getpagesize.
105#
Peter Eriksen817151e2006-06-24 16:01:25 +0200106# Define NO_STRLCPY if you don't have strlcpy.
107#
Nick Alcocke3eed7f2011-11-02 15:46:22 +0000108# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
109# C library. If your compiler also does not support long long or does not have
Jason Riedybc6b4f52007-02-19 16:22:56 -0800110# strtoull, define NO_STRTOULL.
111#
Jason Riedye40b61f2005-12-02 15:08:28 -0800112# Define NO_SETENV if you don't have setenv in the C library.
113#
Jakub Narebskibfa8fcc2008-01-18 02:03:51 +0100114# Define NO_UNSETENV if you don't have unsetenv in the C library.
115#
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -0400116# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
117#
Joachim Schmitzdc9f4622012-09-08 19:01:31 +0200118# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
119#
Rafael Gieschke590e0812011-05-19 13:37:55 +0200120# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
121# in the C library.
122#
David Aguilare1c06882009-05-31 01:35:51 -0700123# Define NO_LIBGEN_H if you don't have libgen.h.
124#
Brandon Caseyecc395c2009-07-10 12:10:45 -0500125# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
126#
Robert Schiele26009732008-01-24 19:34:46 +0100127# Define NO_SYS_SELECT_H if you don't have sys/select.h.
128#
Junio C Hamano9f0bb902006-05-02 00:40:24 -0700129# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
130# Enable it on Windows. By default, symrefs are still used.
Pavel Roskin2fabd212005-11-15 00:59:50 -0500131#
Pavel Roskin02853582006-07-09 02:44:58 -0700132# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
Eric Wong60d02cc2006-07-06 00:14:16 -0700133# tests. These tests take up a significant amount of the total test time
134# but are not needed unless you plan to talk to SVN repos.
135#
Shawn Pearce8eb38ca2006-07-24 00:28:28 -0400136# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
137# installed in /sw, but don't want GIT to link against any libraries
138# installed there. If defined you may specify your own (or Fink's)
139# include directories and library directories by defining CFLAGS
140# and LDFLAGS appropriately.
141#
142# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
143# have DarwinPorts installed in /opt/local, but don't want GIT to
144# link against any libraries installed there. If defined you may
145# specify your own (or DarwinPort's) include directories and
146# library directories by defining CFLAGS and LDFLAGS appropriately.
147#
David Aguilar4dcd7732013-05-19 06:23:34 -0400148# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
149# and do not want to use Apple's CommonCrypto library. This allows you
150# to provide your own OpenSSL library, for example from MacPorts.
151#
Jonathan Niederf2001972012-07-23 01:29:14 -0500152# Define BLK_SHA1 environment variable to make use of the bundled
153# optimized C SHA1 routine.
Linus Torvaldsd7c208a2009-08-05 16:13:20 -0700154#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200155# Define PPC_SHA1 environment variable when running make to make use of
156# a bundled SHA1 routine optimized for PowerPC.
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700157#
Jeff King8325e432017-03-16 18:09:12 -0400158# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
159# algorithm. This is slower, but may detect attempted collision attacks.
160# Takes priority over other *_SHA1 knobs.
161#
Takashi Iwai3964cbb2017-08-15 14:04:17 +0200162# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
163# git with the external SHA1 collision-detect library.
164# Without this option, i.e. the default behavior is to build git with its
165# own built-in code (or submodule).
166#
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +0000167# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
168# sha1collisiondetection shipped as a submodule instead of the
169# non-submodule copy in sha1dc/. This is an experimental option used
170# by the git project to migrate to using sha1collisiondetection as a
171# submodule.
172#
Junio C Hamanoe6b07da2017-03-17 10:00:15 -0700173# Define OPENSSL_SHA1 environment variable when running make to link
174# with the SHA1 routine from openssl library.
175#
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -0800176# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
177# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
178# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
179#
brian m. carlson27dc04c2018-11-14 04:09:37 +0000180# Define BLK_SHA256 to use the built-in SHA-256 routines.
181#
182# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt.
183#
brian m. carlson4b4e2912018-11-14 04:09:38 +0000184# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL.
185#
Brian Gernhardt0460dba2009-09-08 09:54:38 -0400186# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
187#
188# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200189#
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700190# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200191#
Joachim Schmitz6c109902012-09-19 12:03:30 +0200192# Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
193#
Justin Lebar01689902014-03-31 15:11:46 -0700194# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
Joachim Schmitz6c109902012-09-19 12:03:30 +0200195#
196# Define NO_UINTMAX_T if you don't have uintmax_t.
197#
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200198# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
199# Patrick Mauritz).
200#
Brandon Casey70cf9912009-06-05 18:36:10 -0500201# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
202# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
203# inet_ntop and inet_pton additionally reside there.
204#
Johannes Schindelin730d48a2005-10-08 15:54:36 -0700205# Define NO_MMAP if you want to avoid mmap.
206#
Michael Haggerty5b633612017-09-25 10:00:10 +0200207# Define MMAP_PREVENTS_DELETE if a file that is currently mmapped cannot be
208# deleted or cannot be replaced using rename().
209#
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +0700210# Define NO_POLL_H if you don't have poll.h.
211#
Joachim Schmitz6d45eb12012-09-17 23:16:39 +0200212# Define NO_SYS_POLL_H if you don't have sys/poll.h.
213#
214# 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 +0700215# This also implies NO_POLL_H and NO_SYS_POLL_H.
Joachim Schmitz6d45eb12012-09-17 23:16:39 +0200216#
Junio C Hamanob2d05e02012-12-18 09:35:33 -0800217# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
218# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
219# we want to know more about the issue.
David Michael6ede7202012-12-14 14:56:58 -0500220#
Junio C Hamano46059cc2008-11-15 04:08:14 -0800221# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
222#
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100223# Define NO_PREAD if you have a problem with pread() system call (e.g.
Eric Blakea50dec22010-04-01 16:43:54 -0600224# cygwin1.dll before v1.5.22).
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100225#
Joachim Schmitz7f9e8482012-09-08 18:54:34 +0200226# Define NO_SETITIMER if you don't have setitimer()
227#
228# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
229# This also implies NO_SETITIMER
230#
Shawn O. Pearce1510fea2006-12-14 06:15:57 -0500231# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
232# generally faster on your platform than accessing the working directory.
233#
Shawn O. Pearcec8697532006-12-30 23:53:55 -0500234# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
235# the executable mode bit, but doesn't really do so.
236#
David Michaeld543d9c2014-12-03 21:24:17 -0500237# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
238# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
239# usual 0xF000).
240#
hpa49744d62005-09-28 16:52:21 -0700241# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
242#
Johannes Sixt63203582011-12-12 22:12:56 +0100243# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
244#
Junio C Hamanobdc37f52006-01-19 17:13:32 -0800245# Define NO_SOCKADDR_STORAGE if your platform does not have struct
246# sockaddr_storage.
247#
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +0100248# Define NO_ICONV if your libc does not properly support iconv.
249#
Ramsay Jonesfd547a92007-03-03 18:29:03 +0000250# Define OLD_ICONV if your library has an old iconv(), where the second
251# (input buffer pointer) parameter is declared with type (const char **).
252#
brian m. carlson79444c92019-02-12 00:52:06 +0000253# Define ICONV_OMITS_BOM if your iconv implementation does not write a
254# byte-order mark (BOM) when writing UTF-16 or UTF-32 and always writes in
255# big-endian format.
256#
David Symonds609a2282007-11-07 14:24:28 +1100257# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
258#
Junio C Hamano6520c842011-06-18 18:07:03 -0700259# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
260# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
261#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200262# Define USE_NSEC below if you want git to care about sub-second file mtimes
Karsten Bleesb1ffafa2015-07-01 21:10:52 +0200263# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
264# Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
265# on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
266# on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
267# Documentation/technical/racy-git.txt for details.
Junio C Hamanof6af75d2006-06-23 17:57:48 -0700268#
Brian Gernhardtc5673832009-03-08 16:04:28 -0400269# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
270# "st_ctim"
271#
Kjetil Barvikc06ff492009-03-04 18:47:40 +0100272# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
273# available. This automatically turns USE_NSEC off.
274#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200275# Define USE_STDEV below if you want git to care about the underlying device
Johannes Schindelin10455d22007-11-30 11:35:23 +0000276# change being considered an inode change from the update-index perspective.
Alex Riesenf8487182006-12-04 10:50:04 +0100277#
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +0200278# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
279# field that counts the on-disk footprint in 512-byte blocks.
280#
Thomas Rast204d3632009-10-22 10:19:06 +0200281# Define GNU_ROFF if your target system uses GNU groff. This forces
282# apostrophes to be ASCII so that cut&pasting examples to the shell
283# will work.
284#
brian m. carlsonec3366e2017-01-22 02:41:56 +0000285# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
286# documentation.
287#
288# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
289# Extensions Lab if you have it available.
290#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800291# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
292#
Jeff King499c2932009-04-03 15:32:20 -0400293# Define NO_PERL if you do not want Perl scripts or libraries at all.
294#
Todd Zullinger075321c2018-03-03 15:38:16 +0000295# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
296# copies of CPAN modules that serve as a fallback in case the modules
297# are not available on the system. This option is intended for
298# distributions that want to use their packaged versions of Perl
299# modules, instead of the fallbacks shipped with Git.
300#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800301# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
Đoàn Trần Công Danhfcedbc12020-12-10 21:30:17 +0700302# but /usr/bin/python2.7 or /usr/bin/python3 on some platforms).
Junio C Hamanocdbada72013-01-13 22:48:07 -0800303#
Johan Herlandd4e1b472009-11-18 02:42:31 +0100304# Define NO_PYTHON if you do not want Python scripts or libraries at all.
305#
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700306# Define NO_TCLTK if you do not want Tcl/Tk GUI.
307#
Junio C Hamano71b40102016-03-08 15:47:57 -0800308# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
309# and egrep that are pickier when their input contains non-ASCII data.
310#
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400311# The TCL_PATH variable governs the location of the Tcl interpreter
312# used to optimize git-gui for your system. Only used if NO_TCLTK
313# is not set. Defaults to the bare 'tclsh'.
314#
315# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700316# If not set it defaults to the bare 'wish'. If it is set to the empty
317# string then NO_TCLTK will be forced (this is used by configure script).
318#
Brian Downing43fe9012008-02-05 15:10:44 -0600319# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
320# is a simplified version of the merge sort used in glibc. This is
321# recommended if Git triggers O(n^2) behavior in your platform's qsort().
322#
René Scharfe04ee8b82017-01-22 18:51:11 +0100323# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
324# compatible with the one described in C11 Annex K.
325#
Johannes Sixt34779c52009-04-20 10:17:00 +0200326# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
327# information on a not yet closed file that lstat would return for the same
328# file after it was closed.
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200329#
Johannes Schindelin348df162009-04-28 00:32:25 +0200330# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
331# when hardlinking a file to another name and unlinking the original file right
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200332# away (some NTFS drivers seem to zero the contents in that scenario).
Junio C Hamano2c8f8b12009-05-23 01:43:08 -0700333#
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +0000334# Define INSTALL_SYMLINKS if you prefer to have everything that can be
335# symlinked between bin/ and libexec/ to use relative symlinks between
336# the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and
337# NO_INSTALL_HARDLINKS which will also use symlinking by indirection
338# within the same directory in some cases, INSTALL_SYMLINKS will
339# always symlink to the final target directly.
340#
Johannes Schindelin3426e342009-05-11 13:02:18 +0200341# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
342# programs as a tar, where bin/ and libexec/ might be on different file systems.
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200343#
Junio C Hamano70de5e62012-05-02 15:12:10 -0700344# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
345# copies to install built-in git commands e.g. git-cat-file.
346#
Johannes Schindelin179227d2020-09-21 22:28:16 +0000347# Define SKIP_DASHED_BUILT_INS if you do not need the dashed versions of the
348# built-ins to be linked/copied at all.
349#
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200350# Define USE_NED_ALLOCATOR if you want to replace the platforms default
351# memory allocators with the nedmalloc allocator written by Niall Douglas.
Jeff King02232ad2009-06-16 15:07:40 -0400352#
René Scharfeca2baa32016-09-03 17:59:15 +0200353# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
354# This is necessary when using a custom allocator in order to avoid
355# crashes due to allocation and free working on different 'heaps'.
356# It's defined automatically if USE_NED_ALLOCATOR is set.
357#
Johannes Schindelin2f895222016-09-21 20:24:04 +0200358# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
359# feature.
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500360#
Jeff King21aeafc2011-12-10 05:41:01 -0500361# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
362# user.
363#
Jakub Narebski63267de2009-09-01 13:39:20 +0200364# Define JSMIN to point to JavaScript minifier that functions as
365# a filter to have gitweb.js minified.
Junio C Hamano8678bc02009-12-01 11:28:15 -0800366#
Mark Rada0e6ce212010-04-02 20:35:05 -0400367# Define CSSMIN to point to a CSS minifier in order to generate a minified
368# version of gitweb.css
369#
Junio C Hamanoa3d023d2009-10-30 20:45:34 -0500370# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
371# you want to use something different. The value will be interpreted by the
372# shell at runtime when it is used.
373#
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500374# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
375# want to use something different. The value will be interpreted by the shell
376# if necessary when it is used. Examples:
377#
378# DEFAULT_EDITOR='~/bin/vi',
379# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
380# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
Jonathan Niederdfea5752010-01-26 09:52:49 -0600381#
Jonathan Nieder024c8432011-11-18 03:58:21 -0600382# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
383# header files to be automatically computed, to avoid rebuilding objects when
384# an unrelated header file changes. Define it to "no" to use the hard-coded
385# dependency rules. The default is "auto", which means to use computed header
386# dependencies if your compiler is detected to support it.
387#
Eyvind Bernhardsen942e7742010-06-04 21:29:08 +0200388# Define NATIVE_CRLF if your platform uses CRLF for line endings.
Thomas Rast6942efc2012-04-06 23:01:23 +0200389#
Jeff King42dcbb72012-06-02 15:01:12 -0400390# Define GIT_USER_AGENT if you want to change how git identifies itself during
391# network interactions. The default is "git/$(GIT_VERSION)".
Junio C Hamanoa88d7aa2012-06-21 14:42:38 -0700392#
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +0000393# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
394# (defaults to "man") if you want to have a different default when
395# "git help" is called without a parameter specifying the format.
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100396#
Ben Peart1f357b02018-09-18 23:29:36 +0000397# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100398# with a different indexfile format version. If it isn't set the index
399# file format used is index-v[23].
Junio C Hamanobdb830c2014-04-08 11:59:05 -0700400#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400401# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -0800402#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400403# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
404#
405# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
406# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
Reuben Hawkins88e01182015-01-08 12:00:57 -0800407#
Kyle J. McKay290c8e72015-01-11 12:09:22 -0800408# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
409# compiles the following initialization:
410#
411# static const char s[] = ("FOO");
412#
413# and define it to "no" if you need to remove the parentheses () around the
414# constant. The default is "auto", which means to use parentheses if your
415# compiler is detected to support it.
Junio C Hamano551fc7a2015-03-20 13:11:49 -0700416#
Kyle J. McKay95290802015-03-07 23:14:36 -0800417# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
Jeff King0cc30e02015-04-16 05:01:38 -0400418#
419# Define HAVE_GETDELIM if your system has the getdelim() function.
Eric Wong995bc222016-08-04 11:40:25 +0000420#
Duy Nguyen18a4f6b2019-02-12 21:14:41 +0700421# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
422#
Clément Chigot400caaf2019-04-25 07:01:56 +0000423# Define NEED_ACCESS_ROOT_HANDLER if access() under root may success for X_OK
424# even if execution permission isn't granted for any user.
425#
Eric Wong995bc222016-08-04 11:40:25 +0000426# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
427# default environment variables to be passed when a pager is spawned, e.g.
428#
429# PAGER_ENV = LESS=FRX LV=-c
430#
431# to say "export LESS=FRX (and LV=-c) if the environment variable
432# LESS (and LV) is not set, respectively".
Eric Sunshineb2289402017-12-15 00:34:34 +0100433#
Jeff King3f824e92017-12-08 05:47:22 -0500434# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
435# running the test scripts (e.g., bash has better support for "set -x"
436# tracing).
Junio C Hamano07b747d2018-01-05 13:28:09 -0800437#
Eric Sunshineb2289402017-12-15 00:34:34 +0100438# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
439# which the built Git will run (for instance "x86_64").
Dan Jacques07d90ea2018-04-10 11:05:43 -0400440#
441# Define RUNTIME_PREFIX to configure Git to resolve its ancillary tooling and
442# support files relative to the location of the runtime binary, rather than
443# hard-coding them into the binary. Git installations built with RUNTIME_PREFIX
444# can be moved to arbitrary filesystem locations. RUNTIME_PREFIX also causes
445# Perl scripts to use a modified entry point header allowing them to resolve
446# support files at runtime.
Dan Jacques226c0dd2018-04-10 11:05:44 -0400447#
448# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
449# supports the KERN_PROC BSD sysctl function.
450#
451# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform
452# mounts a "procfs" filesystem capable of resolving the path of the current
453# executable. If defined, this must be the canonical path for the "procfs"
454# current executable path.
455#
456# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform
457# supports calling _NSGetExecutablePath to retrieve the path of the running
458# executable.
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -0400459#
460# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
461# the global variable _wpgmptr containing the absolute path of the current
462# executable (this is the case on Windows).
Junio C Hamanoe998e7a2018-05-08 15:59:21 +0900463#
Philippe Blain3821c382020-09-03 22:13:38 +0000464# Define GENERATE_COMPILATION_DATABASE to "yes" to generate JSON compilation
465# database entries during compilation if your compiler supports it, using the
466# `-MJ` flag. The JSON entries will be placed in the `compile_commands/`
467# directory, and the JSON compilation database 'compile_commands.json' will be
468# created at the root of the repository.
469#
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +0000470# Define DEVELOPER to enable more compiler warnings. Compiler version
471# and family are auto detected, but could be overridden by defining
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +0100472# COMPILER_FEATURES (see config.mak.dev). You can still set
473# CFLAGS="..." in combination with DEVELOPER enables, whether that's
474# for tweaking something unrelated (e.g. optimization level), or for
475# selectively overriding something DEVELOPER or one of the DEVOPTS
476# (see just below) brings in.
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000477#
478# When DEVELOPER is set, DEVOPTS can be used to control compiler
479# options. This variable contains keywords separated by
ryenus571fb962019-12-15 15:12:24 +0000480# whitespace. The following keywords are recognized:
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000481#
482# no-error:
483#
484# suppresses the -Werror that implicitly comes with
485# DEVELOPER=1. Useful for getting the full set of errors
486# without immediately dying, or for logging them.
Ævar Arnfjörð Bjarmason26d2e4f2018-04-14 19:19:46 +0000487#
488# extra-all:
489#
490# The DEVELOPER mode enables -Wextra with a few exceptions. By
491# setting this flag the exceptions are removed, and all of
492# -Wextra is used.
Beat Bolli729b3922018-07-24 21:26:43 +0200493#
494# pedantic:
495#
496# Enable -pedantic compilation. This also disables
497# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200498
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600499GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100500 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800501-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200502
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100503# Set our default configuration.
504#
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200505# Among the variables below, these:
506# gitexecdir
507# template_dir
Johannes Sixt9fb1e692011-05-09 10:24:55 +0200508# sysconfdir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100509# can be specified as a relative path some/where/else;
510# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200511# runtime figures out where they are based on the path to the executable.
John Keeping971f8532013-02-24 19:55:01 +0000512# Additionally, the following will be treated as relative by "git" if they
513# begin with "$(prefix)/":
514# mandir
515# infodir
516# htmldir
Dan Jacques07d90ea2018-04-10 11:05:43 -0400517# localedir
518# perllibdir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200519# This can help installing the suite in a relocatable way.
520
Pavel Roskinb05701c2005-08-06 01:36:15 -0400521prefix = $(HOME)
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000522bindir = $(prefix)/bin
John Keeping971f8532013-02-24 19:55:01 +0000523mandir = $(prefix)/share/man
524infodir = $(prefix)/share/info
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100525gitexecdir = libexec/git-core
David Aguilarbc7a96a2011-08-18 00:23:46 -0700526mergetoolsdir = $(gitexecdir)/mergetools
Johannes Sixt93547682007-06-11 10:02:17 +0200527sharedir = $(prefix)/share
Pavan Kumar Sunkarabc951962010-05-28 11:55:50 +0530528gitwebdir = $(sharedir)/gitweb
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000529perllibdir = $(sharedir)/perl5
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100530localedir = $(sharedir)/locale
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100531template_dir = share/git-core/templates
John Keeping971f8532013-02-24 19:55:01 +0000532htmldir = $(prefix)/share/doc/git-doc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100533ETC_GITCONFIG = $(sysconfdir)/gitconfig
Petr Onderka6df42ab2010-09-01 00:42:43 +0200534ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
Robert Schiele10861be2007-08-01 06:30:35 +0200535lib = lib
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100536# DESTDIR =
Johannes Schindelin352c8112009-05-23 10:04:48 +0200537pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700538
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000539bindir_relative = $(patsubst $(prefix)/%,%,$(bindir))
John Keeping971f8532013-02-24 19:55:01 +0000540mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
541infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +0000542gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400543localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
John Keeping971f8532013-02-24 19:55:01 +0000544htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400545perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
John Keeping971f8532013-02-24 19:55:01 +0000546
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000547export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200548
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100549# Set our default programs
Ævar Arnfjörð Bjarmason6d62c982011-12-20 23:40:47 +0000550CC = cc
Pavel Roskinb05701c2005-08-06 01:36:15 -0400551AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500552RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000553DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700554TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700555FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400556INSTALL = install
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400557TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700558TCLTK_PATH = wish
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +0000559XGETTEXT = xgettext
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100560MSGFMT = msgfmt
Remi Pommarelf8915872015-10-21 19:10:46 +0200561CURL_CONFIG = curl-config
Thomas Raste146d172010-07-26 09:43:41 +0200562GCOV = gcov
Ævar Arnfjörð Bjarmason9559f8f2019-02-22 15:41:23 +0100563STRIP = strip
René Scharfe63f0a752016-09-15 20:30:56 +0200564SPATCH = spatch
Linus Torvaldse83c5162005-04-07 15:13:13 -0700565
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400566export TCL_PATH TCLTK_PATH
567
Ævar Arnfjörð Bjarmason8fb2a232019-02-22 15:41:25 +0100568# Set our default LIBS variables
569PTHREAD_LIBS = -lpthread
Petr Baudis8d7f5862006-06-25 03:47:03 +0200570
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100571# Guard against environment variables
572BUILTIN_OBJS =
573BUILT_INS =
574COMPAT_CFLAGS =
575COMPAT_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500576XDIFF_OBJS =
Jeff Kingb8ba6292012-06-20 14:30:56 -0400577GENERATED_H =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500578EXTRA_CPPFLAGS =
Josh Steadmon5e472152018-10-12 17:58:40 -0700579FUZZ_OBJS =
580FUZZ_PROGRAMS =
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +0100581GIT_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100582LIB_OBJS =
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +0100583OBJECTS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600584PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100585PROGRAMS =
Johannes Schindelin724d6352019-04-18 06:16:40 -0700586EXCLUDED_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100587SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100588SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100589SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800590SCRIPT_LIB =
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100591TEST_BUILTINS_OBJS =
Ævar Arnfjörð Bjarmasonbed34192021-02-23 12:41:27 +0100592TEST_OBJS =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600593TEST_PROGRAMS_NEED_X =
Denton Liu5dedf7d2019-09-16 12:23:11 -0700594THIRD_PARTY_SOURCES =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100595
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500596# Having this variable in your environment would break pipelines because
597# you cause "cd" to echo its destination to stdout. It can also take
598# scripts to unexpected places. If you like CDPATH, define it for your
599# interactive shell sessions without exporting it.
600unexport CDPATH
601
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700602SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700603SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700604SCRIPT_SH += git-filter-branch.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700605SCRIPT_SH += git-merge-octopus.sh
606SCRIPT_SH += git-merge-one-file.sh
607SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700608SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700609SCRIPT_SH += git-quiltimport.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700610SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700611SCRIPT_SH += git-submodule.sh
612SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200613
Jonathan Nieder46bac902010-01-31 11:46:53 -0800614SCRIPT_LIB += git-mergetool--lib
Alban Gruinc42abfe2018-05-28 14:34:19 +0200615SCRIPT_LIB += git-rebase--preserve-merges
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000616SCRIPT_LIB += git-sh-i18n
Denton Liu805d9ea2020-03-21 05:21:20 -0400617SCRIPT_LIB += git-sh-setup
Jonathan Nieder46bac902010-01-31 11:46:53 -0800618
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700619SCRIPT_PERL += git-add--interactive.perl
620SCRIPT_PERL += git-archimport.perl
621SCRIPT_PERL += git-cvsexportcommit.perl
622SCRIPT_PERL += git-cvsimport.perl
623SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700624SCRIPT_PERL += git-send-email.perl
625SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700626
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400627SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500628
Matthieu Moy4c06b412013-02-08 18:31:16 +0100629# Generated files for scripts
630SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
631SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
632SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
633
634# Individual rules to allow e.g.
635# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
636# from subdirectories like contrib/*/
637.PHONY: build-perl-script build-sh-script build-python-script
638build-perl-script: $(SCRIPT_PERL_GEN)
639build-sh-script: $(SCRIPT_SH_GEN)
640build-python-script: $(SCRIPT_PYTHON_GEN)
641
642.PHONY: install-perl-script install-sh-script install-python-script
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700643install-sh-script: $(SCRIPT_SH_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500644 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700645install-perl-script: $(SCRIPT_PERL_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500646 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700647install-python-script: $(SCRIPT_PYTHON_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500648 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100649
650.PHONY: clean-perl-script clean-sh-script clean-python-script
651clean-sh-script:
652 $(RM) $(SCRIPT_SH_GEN)
653clean-perl-script:
654 $(RM) $(SCRIPT_PERL_GEN)
655clean-python-script:
656 $(RM) $(SCRIPT_PYTHON_GEN)
657
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700658SCRIPTS = $(SCRIPT_SH_GEN) \
659 $(SCRIPT_PERL_GEN) \
660 $(SCRIPT_PYTHON_GEN) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500661 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100662
Junio C Hamano2f769192010-09-28 16:08:38 -0500663ETAGS_TARGET = TAGS
664
Josh Steadmonaa658572019-01-15 14:25:50 -0800665FUZZ_OBJS += fuzz-commit-graph.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700666FUZZ_OBJS += fuzz-pack-headers.o
Josh Steadmon1127a982018-10-12 17:58:41 -0700667FUZZ_OBJS += fuzz-pack-idx.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100668.PHONY: fuzz-objs
669fuzz-objs: $(FUZZ_OBJS)
Josh Steadmon5e472152018-10-12 17:58:40 -0700670
671# Always build fuzz objects even if not testing, to prevent bit-rot.
672all:: $(FUZZ_OBJS)
673
674FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
675
Junio C Hamano42f77402006-08-15 21:38:07 -0700676# Empty...
677EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100678
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700679# ... and all the rest that could be moved out of bindir to gitexecdir
680PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600681
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100682PROGRAM_OBJS += daemon.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700683PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600684PROGRAM_OBJS += imap-send.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700685PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600686PROGRAM_OBJS += shell.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100687.PHONY: program-objs
688program-objs: $(PROGRAM_OBJS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600689
Michael Palimakaace5e972012-02-08 21:59:04 +1100690# Binary suffix, set to .exe for Windows builds
691X =
692
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600693PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700694
Heba Walyb3b18d12020-03-02 20:01:59 +0000695TEST_BUILTINS_OBJS += test-advise.o
Taylor Blau483fa7f2021-03-31 21:32:11 -0400696TEST_BUILTINS_OBJS += test-bitmap.o
Garima Singhf52207a2020-03-30 00:31:24 +0000697TEST_BUILTINS_OBJS += test-bloom.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100698TEST_BUILTINS_OBJS += test-chmtime.o
Nguyễn Thái Ngọc Duy0e2678a2018-03-24 08:44:34 +0100699TEST_BUILTINS_OBJS += test-config.o
Derrick Stolee2fec6042020-09-11 17:49:18 +0000700TEST_BUILTINS_OBJS += test-crontab.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
Elijah Newrenfe1a21d2020-10-29 20:32:13 +0000711TEST_BUILTINS_OBJS += test-fast-rebase.o
Nguyễn Thái Ngọc Duyc6806682018-03-24 08:44:42 +0100712TEST_BUILTINS_OBJS += test-genrandom.o
Johannes Schindelind5cfd142019-02-14 13:33:12 -0800713TEST_BUILTINS_OBJS += test-genzeros.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400714TEST_BUILTINS_OBJS += test-hash-speed.o
brian m. carlson50c817e2018-11-14 04:09:32 +0000715TEST_BUILTINS_OBJS += test-hash.o
Nguyễn Thái Ngọc Duy7c18cbd2018-03-24 08:44:43 +0100716TEST_BUILTINS_OBJS += test-hashmap.o
Nguyễn Thái Ngọc Duycc6f6632018-03-24 08:44:44 +0100717TEST_BUILTINS_OBJS += test-index-version.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000718TEST_BUILTINS_OBJS += test-json-writer.o
Nguyễn Thái Ngọc Duy64eb82f2018-03-24 08:44:33 +0100719TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
Nguyễn Thái Ngọc Duy9080e752018-03-24 08:44:45 +0100720TEST_BUILTINS_OBJS += test-match-trees.o
Nguyễn Thái Ngọc Duy34889d32018-03-24 08:44:46 +0100721TEST_BUILTINS_OBJS += test-mergesort.o
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +0100722TEST_BUILTINS_OBJS += test-mktemp.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700723TEST_BUILTINS_OBJS += test-oid-array.o
Christian Couder11510de2019-06-15 12:06:59 +0200724TEST_BUILTINS_OBJS += test-oidmap.o
Nguyễn Thái Ngọc Duyc033cc12018-03-24 08:44:48 +0100725TEST_BUILTINS_OBJS += test-online-cpus.o
Nguyễn Thái Ngọc Duy2f17c782018-09-09 19:36:29 +0200726TEST_BUILTINS_OBJS += test-parse-options.o
Alexandr Miloslavskiyd0d0a352019-12-31 10:15:12 +0000727TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
Nguyễn Thái Ngọc Duyb8d5cf42018-03-24 08:44:49 +0100728TEST_BUILTINS_OBJS += test-path-utils.o
Ævar Arnfjörð Bjarmason95ca1f92021-01-24 18:28:13 +0100729TEST_BUILTINS_OBJS += test-pcre2-config.o
Nguyễn Thái Ngọc Duy8ea40cc2018-09-09 19:36:28 +0200730TEST_BUILTINS_OBJS += test-pkt-line.o
Nguyễn Thái Ngọc Duy15b75812018-03-24 08:44:50 +0100731TEST_BUILTINS_OBJS += test-prio-queue.o
Jiang Xin15d3af52020-08-27 11:45:44 -0400732TEST_BUILTINS_OBJS += test-proc-receive.o
SZEDER Gábor2bb74b52019-09-16 22:54:12 +0200733TEST_BUILTINS_OBJS += test-progress.o
Derrick Stoleeab176ac2018-07-20 16:33:15 +0000734TEST_BUILTINS_OBJS += test-reach.o
Nguyễn Thái Ngọc Duy5fbe6002018-03-24 08:44:51 +0100735TEST_BUILTINS_OBJS += test-read-cache.o
Derrick Stolee4bd05932019-11-12 16:58:20 +0000736TEST_BUILTINS_OBJS += test-read-graph.o
Derrick Stolee4d805602018-07-12 15:39:23 -0400737TEST_BUILTINS_OBJS += test-read-midx.o
Nguyễn Thái Ngọc Duy65370d82018-03-24 08:44:52 +0100738TEST_BUILTINS_OBJS += test-ref-store.o
Nguyễn Thái Ngọc Duy90385312018-03-24 08:44:53 +0100739TEST_BUILTINS_OBJS += test-regex.o
Jonathan Tandade47c2018-07-11 15:42:42 -0700740TEST_BUILTINS_OBJS += test-repository.o
Nguyễn Thái Ngọc Duy77d4b8c2018-03-24 08:44:54 +0100741TEST_BUILTINS_OBJS += test-revision-walking.o
Nguyễn Thái Ngọc Duyae6a51f2018-03-24 08:44:55 +0100742TEST_BUILTINS_OBJS += test-run-command.o
Nguyễn Thái Ngọc Duyff5fb8b2018-03-24 08:44:56 +0100743TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
Johannes Schindelinb7ce24d2019-04-18 06:16:51 -0700744TEST_BUILTINS_OBJS += test-serve-v2.o
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +0100745TEST_BUILTINS_OBJS += test-sha1.o
brian m. carlson13eeedb2018-11-14 04:09:36 +0000746TEST_BUILTINS_OBJS += test-sha256.o
Nguyễn Thái Ngọc Duye154a6f2018-03-24 08:44:58 +0100747TEST_BUILTINS_OBJS += test-sigchain.o
Jeff Hostetler36a7eb62021-03-22 10:29:48 +0000748TEST_BUILTINS_OBJS += test-simple-ipc.o
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +0100749TEST_BUILTINS_OBJS += test-strcmp-offset.o
Nguyễn Thái Ngọc Duyc932a5f2018-03-24 08:45:00 +0100750TEST_BUILTINS_OBJS += test-string-list.o
Nguyễn Thái Ngọc Duyb6188212018-03-24 08:45:01 +0100751TEST_BUILTINS_OBJS += test-submodule-config.o
Antonio Ospite2b1257e2018-10-25 18:18:13 +0200752TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
Nguyễn Thái Ngọc Duy112edd62018-03-24 08:45:02 +0100753TEST_BUILTINS_OBJS += test-subprocess.o
Jeff Hostetlera15860d2019-02-22 14:25:10 -0800754TEST_BUILTINS_OBJS += test-trace2.o
Nguyễn Thái Ngọc Duy599fbd82018-03-24 08:45:03 +0100755TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
Nguyễn Thái Ngọc Duy04892892018-03-24 08:45:04 +0100756TEST_BUILTINS_OBJS += test-wildmatch.o
Jeff Hostetler06ba9d02018-09-11 13:06:01 -0700757TEST_BUILTINS_OBJS += test-windows-named-pipe.o
Nguyễn Thái Ngọc Duyc81f8432018-03-24 08:45:05 +0100758TEST_BUILTINS_OBJS += test-write-cache.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400759TEST_BUILTINS_OBJS += test-xml-encode.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100760
Nguyễn Thái Ngọc Duyc9a1f412018-09-09 19:36:31 +0200761# Do not add more tests here unless they have extra dependencies. Add
762# them in TEST_BUILTINS_OBJS above.
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100763TEST_PROGRAMS_NEED_X += test-fake-ssh
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100764TEST_PROGRAMS_NEED_X += test-tool
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600765
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700766TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100767
Junio C Hamano17368552008-02-23 11:08:25 -0800768# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800769# builtin/$C.o but is linked in as part of some other command.
770BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700771
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700772BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100773BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700774BUILT_INS += git-format-patch$X
775BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700776BUILT_INS += git-init$X
Jeff King0a21d0e2020-12-01 21:34:11 -0500777BUILT_INS += git-maintenance$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700778BUILT_INS += git-merge-subtree$X
Nguyễn Thái Ngọc Duy46e91b62019-04-25 16:45:45 +0700779BUILT_INS += git-restore$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700780BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800781BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700782BUILT_INS += git-status$X
Nguyễn Thái Ngọc Duyd787d312019-03-29 17:39:05 +0700783BUILT_INS += git-switch$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700784BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700785
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700786# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400787OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700788
Matthew Ogilvieea925192009-12-02 22:14:05 -0700789# what test wrappers are needed and 'install' will install, in bindir
790BINDIR_PROGRAMS_NEED_X += git
Matthew Ogilvieea925192009-12-02 22:14:05 -0700791BINDIR_PROGRAMS_NEED_X += git-receive-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700792BINDIR_PROGRAMS_NEED_X += git-shell
Denton Liu805d9ea2020-03-21 05:21:20 -0400793BINDIR_PROGRAMS_NEED_X += git-upload-archive
794BINDIR_PROGRAMS_NEED_X += git-upload-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700795
796BINDIR_PROGRAMS_NO_X += git-cvsserver
797
Ryan Anderson3d320512005-11-21 00:11:22 -0500798# Set paths to tools early so that they can be used for version tests.
799ifndef SHELL_PATH
800 SHELL_PATH = /bin/sh
801endif
802ifndef PERL_PATH
803 PERL_PATH = /usr/bin/perl
804endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100805ifndef PYTHON_PATH
806 PYTHON_PATH = /usr/bin/python
807endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700808
Luben Tuikov3a793472006-12-14 23:03:03 -0800809export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100810export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800811
Jeff King3f824e92017-12-08 05:47:22 -0500812TEST_SHELL_PATH = $(SHELL_PATH)
813
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100814LIB_FILE = libgit.a
815XDIFF_LIB = xdiff/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700816
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +0200817GENERATED_H += command-list.h
Denton Liu8474f262020-10-08 00:39:26 -0700818GENERATED_H += config-list.h
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700819
Denton Liucf6a2d22019-09-16 12:23:08 -0700820LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
Johannes Schindelin92b88eb2019-03-04 05:47:06 -0800821 $(FIND) . \
Jeff Kingd85b0df2014-08-25 16:00:42 -0400822 -name .git -prune -o \
823 -name t -prune -o \
824 -name Documentation -prune -o \
Denton Liucf6a2d22019-09-16 12:23:08 -0700825 -name '*.h' -print)))
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700826
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400827LIB_OBJS += abspath.o
Johannes Schindelinf83dff62019-11-13 12:40:57 +0000828LIB_OBJS += add-interactive.o
Johannes Schindelinf6aa7ec2019-12-13 08:07:48 +0000829LIB_OBJS += add-patch.o
Jeff King75194432009-09-09 07:38:58 -0400830LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700831LIB_OBJS += alias.o
832LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200833LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700834LIB_OBJS += archive-tar.o
835LIB_OBJS += archive-zip.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400836LIB_OBJS += archive.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700837LIB_OBJS += attr.o
838LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100839LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500840LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700841LIB_OBJS += blob.o
Garima Singhf52207a2020-03-30 00:31:24 +0000842LIB_OBJS += bloom.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700843LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700844LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700845LIB_OBJS += bundle.o
846LIB_OBJS += cache-tree.o
Jeff King2b5ed372018-03-30 14:35:04 -0400847LIB_OBJS += chdir-notify.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000848LIB_OBJS += checkout.o
Derrick Stolee570df422021-02-18 14:07:24 +0000849LIB_OBJS += chunk-format.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700850LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700851LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700852LIB_OBJS += combine-diff.o
Derrick Stolee08fd81c2018-04-02 16:34:19 -0400853LIB_OBJS += commit-graph.o
Derrick Stolee5227c382018-07-20 16:33:02 +0000854LIB_OBJS += commit-reach.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400855LIB_OBJS += commit.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200856LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500857LIB_OBJS += compat/terminal.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700858LIB_OBJS += config.o
859LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700860LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700861LIB_OBJS += convert.o
862LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500863LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700864LIB_OBJS += csum-file.o
865LIB_OBJS += ctype.o
866LIB_OBJS += date.o
867LIB_OBJS += decorate.o
Jeff Kingc8d521f2018-08-16 08:13:07 +0200868LIB_OBJS += delta-islands.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400869LIB_OBJS += diff-delta.o
Sergey Organova37eec62020-12-21 18:19:33 +0300870LIB_OBJS += diff-merges.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400871LIB_OBJS += diff-lib.o
872LIB_OBJS += diff-no-index.o
873LIB_OBJS += diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700874LIB_OBJS += diffcore-break.o
875LIB_OBJS += diffcore-delta.o
876LIB_OBJS += diffcore-order.o
877LIB_OBJS += diffcore-pickaxe.o
878LIB_OBJS += diffcore-rename.o
Junio C Hamano1eb41362021-02-11 11:57:50 -0800879LIB_OBJS += diffcore-rotate.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200880LIB_OBJS += dir-iterator.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400881LIB_OBJS += dir.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200882LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700883LIB_OBJS += entry.o
884LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500885LIB_OBJS += ewah/bitmap.o
886LIB_OBJS += ewah/ewah_bitmap.o
887LIB_OBJS += ewah/ewah_io.o
888LIB_OBJS += ewah/ewah_rlw.o
Stefan Bellerd807c4a2018-04-10 14:26:18 -0700889LIB_OBJS += exec-cmd.o
Jonathan Tanec062832018-06-14 15:54:28 -0700890LIB_OBJS += fetch-negotiator.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700891LIB_OBJS += fetch-pack.o
Denton Liuce6521e2020-03-23 21:07:51 -0400892LIB_OBJS += fmt-merge-msg.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700893LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400894LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100895LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700896LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700897LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700898LIB_OBJS += grep.o
Martin Ågrenbc626922020-12-31 12:56:23 +0100899LIB_OBJS += hash-lookup.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100900LIB_OBJS += hashmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700901LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800902LIB_OBJS += hex.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700903LIB_OBJS += ident.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000904LIB_OBJS += json-writer.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200905LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200906LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100907LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100908LIB_OBJS += line-range.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400909LIB_OBJS += linear-assignment.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000910LIB_OBJS += list-objects-filter-options.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400911LIB_OBJS += list-objects-filter.o
912LIB_OBJS += list-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700913LIB_OBJS += ll-merge.o
914LIB_OBJS += lockfile.o
915LIB_OBJS += log-tree.o
Brandon Williams72d0ea02018-03-15 10:31:20 -0700916LIB_OBJS += ls-refs.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700917LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700918LIB_OBJS += mailmap.o
919LIB_OBJS += match-trees.o
Jameson Miller065feab2018-04-11 18:37:55 +0000920LIB_OBJS += mem-pool.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800921LIB_OBJS += merge-blobs.o
Elijah Newren17e55742020-10-27 02:08:07 +0000922LIB_OBJS += merge-ort.o
Elijah Newren47b1e892020-10-27 02:08:08 +0000923LIB_OBJS += merge-ort-wrappers.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200924LIB_OBJS += merge-recursive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400925LIB_OBJS += merge.o
René Scharfe0db71e02012-04-01 00:10:11 +0200926LIB_OBJS += mergesort.o
Derrick Stoleea3407732018-07-12 15:39:21 -0400927LIB_OBJS += midx.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700928LIB_OBJS += name-hash.o
Jonathan Tanec062832018-06-14 15:54:28 -0700929LIB_OBJS += negotiator/default.o
Jonathan Tancbe566a2020-08-17 21:01:31 -0700930LIB_OBJS += negotiator/noop.o
Jonathan Tan42cc7482018-07-16 11:44:01 -0700931LIB_OBJS += negotiator/skipping.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400932LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100933LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200934LIB_OBJS += notes-utils.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400935LIB_OBJS += notes.o
Martin Ågrene5afd442020-12-31 12:56:21 +0100936LIB_OBJS += object-file.o
Martin Ågren1e6771e2020-12-31 12:56:20 +0100937LIB_OBJS += object-name.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700938LIB_OBJS += object.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700939LIB_OBJS += oid-array.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700940LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500941LIB_OBJS += oidset.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500942LIB_OBJS += pack-bitmap-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400943LIB_OBJS += pack-bitmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700944LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400945LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700946LIB_OBJS += pack-revindex.o
947LIB_OBJS += pack-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400948LIB_OBJS += packfile.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700949LIB_OBJS += pager.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600950LIB_OBJS += parse-options-cb.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400951LIB_OBJS += parse-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700952LIB_OBJS += patch-delta.o
953LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700954LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000955LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700956LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100957LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700958LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700959LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700960LIB_OBJS += progress.o
Christian Couder48de3152019-06-25 15:40:27 +0200961LIB_OBJS += promisor-remote.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500962LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700963LIB_OBJS += protocol.o
Bruno Albuquerquea2ba1622021-04-20 16:38:31 -0700964LIB_OBJS += protocol-caps.o
Denton Liu9460fd42020-03-23 21:07:52 -0400965LIB_OBJS += prune-packed.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700966LIB_OBJS += quote.o
Johannes Schindelind9c66f02018-08-13 04:33:04 -0700967LIB_OBJS += range-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700968LIB_OBJS += reachable.o
969LIB_OBJS += read-cache.o
Alban Gruin145e05a2018-08-10 18:51:29 +0200970LIB_OBJS += rebase-interactive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400971LIB_OBJS += rebase.o
972LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700973LIB_OBJS += reflog-walk.o
974LIB_OBJS += refs.o
Han-Wen Nienhuys4441f422020-09-09 10:15:08 +0000975LIB_OBJS += refs/debug.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100976LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200977LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200978LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200979LIB_OBJS += refs/ref-cache.o
Brandon Williamsec0cb492018-05-16 15:57:48 -0700980LIB_OBJS += refspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700981LIB_OBJS += remote.o
Stefan Beller11bc0582018-04-10 14:26:21 -0700982LIB_OBJS += replace-object.o
Derrick Stolee7211b9e2019-08-13 11:37:43 -0700983LIB_OBJS += repo-settings.o
Brandon Williams359efef2017-06-22 11:43:32 -0700984LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200985LIB_OBJS += rerere.o
Denton Liub309a972020-04-07 10:28:00 -0400986LIB_OBJS += reset.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800987LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700988LIB_OBJS += revision.o
989LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +0700990LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700991LIB_OBJS += sequencer.o
Brandon Williamsed10cb92018-03-15 10:31:19 -0700992LIB_OBJS += serve.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700993LIB_OBJS += server-info.o
994LIB_OBJS += setup.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700995LIB_OBJS += shallow.o
996LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -0500997LIB_OBJS += sigchain.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +0700998LIB_OBJS += split-index.o
Johannes Schindelin97fff612019-09-30 10:21:54 -0700999LIB_OBJS += stable-qsort.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001000LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -07001001LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001002LIB_OBJS += string-list.o
Elijah Newrenae20bf12020-11-02 18:55:06 +00001003LIB_OBJS += strmap.o
Denton Liu8474f262020-10-08 00:39:26 -07001004LIB_OBJS += strvec.o
Ben Peart99605d62017-05-05 11:28:01 -04001005LIB_OBJS += sub-process.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001006LIB_OBJS += submodule-config.o
1007LIB_OBJS += submodule.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001008LIB_OBJS += symlinks.o
1009LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +02001010LIB_OBJS += tempfile.o
Nguyễn Thái Ngọc Duy0ec79352018-10-27 19:29:59 +02001011LIB_OBJS += thread-utils.o
Jeff King2564d992016-10-03 16:49:11 -04001012LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001013LIB_OBJS += trace.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001014LIB_OBJS += trace2.o
1015LIB_OBJS += trace2/tr2_cfg.o
1016LIB_OBJS += trace2/tr2_cmd_name.o
1017LIB_OBJS += trace2/tr2_dst.o
1018LIB_OBJS += trace2/tr2_sid.o
Jeff Hostetlerbce9db62019-04-15 13:39:47 -07001019LIB_OBJS += trace2/tr2_sysenv.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001020LIB_OBJS += trace2/tr2_tbuf.o
1021LIB_OBJS += trace2/tr2_tgt_event.o
1022LIB_OBJS += trace2/tr2_tgt_normal.o
1023LIB_OBJS += trace2/tr2_tgt_perf.o
1024LIB_OBJS += trace2/tr2_tls.o
Christian Couder9385b5d2014-10-13 20:16:23 +02001025LIB_OBJS += trailer.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -04001026LIB_OBJS += transport-helper.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001027LIB_OBJS += transport.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001028LIB_OBJS += tree-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001029LIB_OBJS += tree-walk.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001030LIB_OBJS += tree.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001031LIB_OBJS += unpack-trees.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001032LIB_OBJS += upload-pack.o
Jeff King638794c2010-05-23 05:17:55 -04001033LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -07001034LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001035LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001036LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001037LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -07001038LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -04001039LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +07001040LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001041LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +07001042LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -04001043LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -07001044LIB_OBJS += wrapper.o
Stefan Bellerfa2656f2018-04-10 14:26:16 -07001045LIB_OBJS += write-or-die.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001046LIB_OBJS += ws.o
1047LIB_OBJS += wt-status.o
1048LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -05001049LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +02001050
Linus Torvalds81b50f32010-02-22 08:42:18 -08001051BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +08001052BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001053BUILTIN_OBJS += builtin/annotate.o
1054BUILTIN_OBJS += builtin/apply.o
1055BUILTIN_OBJS += builtin/archive.o
1056BUILTIN_OBJS += builtin/bisect--helper.o
1057BUILTIN_OBJS += builtin/blame.o
1058BUILTIN_OBJS += builtin/branch.o
Jeff Kingd7a56492020-08-13 10:59:36 -04001059BUILTIN_OBJS += builtin/bugreport.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001060BUILTIN_OBJS += builtin/bundle.o
1061BUILTIN_OBJS += builtin/cat-file.o
1062BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +00001063BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -04001064BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001065BUILTIN_OBJS += builtin/check-ref-format.o
1066BUILTIN_OBJS += builtin/checkout-index.o
1067BUILTIN_OBJS += builtin/checkout.o
1068BUILTIN_OBJS += builtin/clean.o
1069BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +07001070BUILTIN_OBJS += builtin/column.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001071BUILTIN_OBJS += builtin/commit-graph.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001072BUILTIN_OBJS += builtin/commit-tree.o
1073BUILTIN_OBJS += builtin/commit.o
1074BUILTIN_OBJS += builtin/config.o
1075BUILTIN_OBJS += builtin/count-objects.o
Denton Liu8474f262020-10-08 00:39:26 -07001076BUILTIN_OBJS += builtin/credential-cache--daemon.o
1077BUILTIN_OBJS += builtin/credential-cache.o
1078BUILTIN_OBJS += builtin/credential-store.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +02001079BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001080BUILTIN_OBJS += builtin/describe.o
1081BUILTIN_OBJS += builtin/diff-files.o
1082BUILTIN_OBJS += builtin/diff-index.o
1083BUILTIN_OBJS += builtin/diff-tree.o
1084BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +01001085BUILTIN_OBJS += builtin/difftool.o
Ævar Arnfjörð Bjarmasonb4f207f2019-06-21 12:18:06 +02001086BUILTIN_OBJS += builtin/env--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001087BUILTIN_OBJS += builtin/fast-export.o
Jeff Kinga006f872020-08-13 10:59:45 -04001088BUILTIN_OBJS += builtin/fast-import.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001089BUILTIN_OBJS += builtin/fetch-pack.o
1090BUILTIN_OBJS += builtin/fetch.o
1091BUILTIN_OBJS += builtin/fmt-merge-msg.o
1092BUILTIN_OBJS += builtin/for-each-ref.o
Derrick Stolee4950b2a2020-09-11 17:49:16 +00001093BUILTIN_OBJS += builtin/for-each-repo.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001094BUILTIN_OBJS += builtin/fsck.o
1095BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -08001096BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001097BUILTIN_OBJS += builtin/grep.o
1098BUILTIN_OBJS += builtin/hash-object.o
1099BUILTIN_OBJS += builtin/help.o
1100BUILTIN_OBJS += builtin/index-pack.o
1101BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +02001102BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001103BUILTIN_OBJS += builtin/log.o
1104BUILTIN_OBJS += builtin/ls-files.o
1105BUILTIN_OBJS += builtin/ls-remote.o
1106BUILTIN_OBJS += builtin/ls-tree.o
1107BUILTIN_OBJS += builtin/mailinfo.o
1108BUILTIN_OBJS += builtin/mailsplit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001109BUILTIN_OBJS += builtin/merge-base.o
1110BUILTIN_OBJS += builtin/merge-file.o
1111BUILTIN_OBJS += builtin/merge-index.o
1112BUILTIN_OBJS += builtin/merge-ours.o
1113BUILTIN_OBJS += builtin/merge-recursive.o
1114BUILTIN_OBJS += builtin/merge-tree.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001115BUILTIN_OBJS += builtin/merge.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001116BUILTIN_OBJS += builtin/mktag.o
1117BUILTIN_OBJS += builtin/mktree.o
Derrick Stolee6a257f02018-07-12 15:39:20 -04001118BUILTIN_OBJS += builtin/multi-pack-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001119BUILTIN_OBJS += builtin/mv.o
1120BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -07001121BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001122BUILTIN_OBJS += builtin/pack-objects.o
1123BUILTIN_OBJS += builtin/pack-redundant.o
1124BUILTIN_OBJS += builtin/pack-refs.o
1125BUILTIN_OBJS += builtin/patch-id.o
1126BUILTIN_OBJS += builtin/prune-packed.o
1127BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001128BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001129BUILTIN_OBJS += builtin/push.o
Johannes Schindelin348ae562018-08-13 04:33:02 -07001130BUILTIN_OBJS += builtin/range-diff.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001131BUILTIN_OBJS += builtin/read-tree.o
Pratik Karki55071ea2018-08-07 01:16:09 +05451132BUILTIN_OBJS += builtin/rebase.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001133BUILTIN_OBJS += builtin/receive-pack.o
1134BUILTIN_OBJS += builtin/reflog.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001135BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001136BUILTIN_OBJS += builtin/remote-fd.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001137BUILTIN_OBJS += builtin/remote.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001138BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001139BUILTIN_OBJS += builtin/replace.o
1140BUILTIN_OBJS += builtin/rerere.o
1141BUILTIN_OBJS += builtin/reset.o
1142BUILTIN_OBJS += builtin/rev-list.o
1143BUILTIN_OBJS += builtin/rev-parse.o
1144BUILTIN_OBJS += builtin/revert.o
1145BUILTIN_OBJS += builtin/rm.o
1146BUILTIN_OBJS += builtin/send-pack.o
1147BUILTIN_OBJS += builtin/shortlog.o
1148BUILTIN_OBJS += builtin/show-branch.o
Jeff Kingff417262018-05-28 05:38:53 -04001149BUILTIN_OBJS += builtin/show-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001150BUILTIN_OBJS += builtin/show-ref.o
Derrick Stolee94c09562019-11-21 22:04:33 +00001151BUILTIN_OBJS += builtin/sparse-checkout.o
Paul-Sebastian Ungureanu40af1462019-02-25 23:16:28 +00001152BUILTIN_OBJS += builtin/stash.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001153BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001154BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001155BUILTIN_OBJS += builtin/symbolic-ref.o
1156BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001157BUILTIN_OBJS += builtin/unpack-file.o
1158BUILTIN_OBJS += builtin/unpack-objects.o
1159BUILTIN_OBJS += builtin/update-index.o
1160BUILTIN_OBJS += builtin/update-ref.o
1161BUILTIN_OBJS += builtin/update-server-info.o
1162BUILTIN_OBJS += builtin/upload-archive.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001163BUILTIN_OBJS += builtin/upload-pack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001164BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001165BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001166BUILTIN_OBJS += builtin/verify-pack.o
1167BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001168BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001169BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001170
Denton Liu5dedf7d2019-09-16 12:23:11 -07001171# THIRD_PARTY_SOURCES is a list of patterns compatible with the
1172# $(filter) and $(filter-out) family of functions. They specify source
1173# files which are taken from some third-party source where we want to be
1174# less strict about issues such as coding style so we don't diverge from
1175# upstream unnecessarily (making merging in future changes easier).
1176THIRD_PARTY_SOURCES += compat/inet_ntop.c
1177THIRD_PARTY_SOURCES += compat/inet_pton.c
1178THIRD_PARTY_SOURCES += compat/nedmalloc/%
1179THIRD_PARTY_SOURCES += compat/obstack.%
1180THIRD_PARTY_SOURCES += compat/poll/%
1181THIRD_PARTY_SOURCES += compat/regex/%
1182THIRD_PARTY_SOURCES += sha1collisiondetection/%
1183THIRD_PARTY_SOURCES += sha1dc/%
1184
Jeff King3f2e2292016-07-01 01:58:58 -04001185GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +02001186EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001187
Jeff King42dcbb72012-06-02 15:01:12 -04001188GIT_USER_AGENT = git/$(GIT_VERSION)
1189
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001190ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1191DC_SHA1_SUBMODULE = auto
1192endif
1193
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001194# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1195# tweaked by config.* below as well as the command-line, both of
1196# which'll override these defaults.
1197CFLAGS = -g -O2 -Wall
1198LDFLAGS =
Ævar Arnfjörð Bjarmason0f50c8e2019-05-17 23:58:47 +02001199CC_LD_DYNPATH = -Wl,-rpath,
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001200BASIC_CFLAGS = -I.
1201BASIC_LDFLAGS =
1202
1203# library flags
1204ARFLAGS = rcs
1205PTHREAD_CFLAGS =
1206
1207# For the 'sparse' target
1208SPARSE_FLAGS ?=
Luc Van Oostenryck1c9664232020-05-22 02:25:02 +02001209SP_EXTRA_FLAGS = -Wno-universal-initializer
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001210
Jeff King960154b2019-05-06 19:43:34 -04001211# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
1212# usually result in less CPU usage at the cost of higher peak memory.
Jeff Kingbcb4edf2019-05-08 03:07:54 -04001213# Setting it to 0 will feed all files in a single spatch invocation.
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001214SPATCH_FLAGS = --all-includes --patch .
Jeff King960154b2019-05-06 19:43:34 -04001215SPATCH_BATCH_SIZE = 1
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001216
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001217include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001218-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001219-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001220
Matthieu Moyd6156282016-05-31 15:24:43 +02001221ifdef DEVELOPER
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +00001222include config.mak.dev
Matthieu Moyd6156282016-05-31 15:24:43 +02001223endif
1224
Johannes Schindelin4a5ec7d2021-01-21 13:09:45 +00001225# what 'all' will build and 'install' will install in gitexecdir,
1226# excluding programs for built-in commands
1227ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
1228ALL_COMMANDS_TO_INSTALL = $(ALL_PROGRAMS)
1229ifeq (,$(SKIP_DASHED_BUILT_INS))
1230ALL_COMMANDS_TO_INSTALL += $(BUILT_INS)
1231else
1232# git-upload-pack, git-receive-pack and git-upload-archive are special: they
1233# are _expected_ to be present in the `bin/` directory in their dashed form.
1234ALL_COMMANDS_TO_INSTALL += git-receive-pack$(X)
1235ALL_COMMANDS_TO_INSTALL += git-upload-archive$(X)
1236ALL_COMMANDS_TO_INSTALL += git-upload-pack$(X)
1237endif
1238
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +01001239ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001240ALL_LDFLAGS = $(LDFLAGS)
1241
René Scharfe425ca672017-07-15 19:18:56 +02001242comma := ,
1243empty :=
1244space := $(empty) $(empty)
1245
Jeff King56b5db32017-07-10 09:24:42 -04001246ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001247SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001248BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001249BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001250ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King07a20f52019-03-12 17:06:26 -04001251BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
Jeff King566cf0b2017-07-10 09:24:50 -04001252endif
Jeff King0e5bba52017-09-08 02:38:41 -04001253ifneq ($(filter leak,$(SANITIZERS)),)
1254BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
1255endif
Jeff Kingf65d07f2020-01-16 12:51:38 -05001256ifneq ($(filter address,$(SANITIZERS)),)
1257NO_REGEX = NeededForASAN
1258endif
Jeff King56b5db32017-07-10 09:24:42 -04001259endif
1260
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001261ifndef sysconfdir
1262ifeq ($(prefix),/usr)
1263sysconfdir = /etc
1264else
1265sysconfdir = etc
1266endif
1267endif
1268
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001269ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001270COMPUTE_HEADER_DEPENDENCIES = auto
1271endif
1272
1273ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001274dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Jonathan Nieder69789342011-11-18 17:23:24 -06001275 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1276 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001277 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001278ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001279override COMPUTE_HEADER_DEPENDENCIES = yes
1280else
1281override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001282endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001283endif
1284
Jonathan Nieder024c8432011-11-18 03:58:21 -06001285ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001286USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001287else
1288ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1289$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1290(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1291endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001292endif
1293
Philippe Blain3821c382020-09-03 22:13:38 +00001294ifndef GENERATE_COMPILATION_DATABASE
1295GENERATE_COMPILATION_DATABASE = no
1296endif
1297
1298ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
1299compdb_check = $(shell $(CC) $(ALL_CFLAGS) \
1300 -c -MJ /dev/null \
1301 -x c /dev/null -o /dev/null 2>&1; \
1302 echo $$?)
1303ifneq ($(compdb_check),0)
1304override GENERATE_COMPILATION_DATABASE = no
1305$(warning GENERATE_COMPILATION_DATABASE is set to "yes", but your compiler does not \
1306support generating compilation database entries)
1307endif
1308else
1309ifneq ($(GENERATE_COMPILATION_DATABASE),no)
1310$(error please set GENERATE_COMPILATION_DATABASE to "yes" or "no" \
1311(not "$(GENERATE_COMPILATION_DATABASE)"))
1312endif
1313endif
1314
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001315ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001316SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
Jeff Hostetlerc444bf82019-06-19 14:06:06 -07001317BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001318PATH := $(SANE_TOOL_PATH):${PATH}
1319else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001320BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001321endif
1322
Eric Sunshineb2289402017-12-15 00:34:34 +01001323ifeq (,$(HOST_CPU))
1324 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1325else
1326 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1327endif
1328
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001329ifneq (,$(INLINE))
1330 BASIC_CFLAGS += -Dinline=$(INLINE)
1331endif
1332
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001333ifneq (,$(SOCKLEN_T))
1334 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1335endif
1336
Kyle J. McKay290c8e72015-01-11 12:09:22 -08001337ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
1338 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
1339else
1340ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
1341 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
1342endif
1343endif
1344
Brian Gernhardt59f86742006-12-12 12:01:47 -05001345ifeq ($(uname_S),Darwin)
1346 ifndef NO_FINK
1347 ifeq ($(shell test -d /sw/lib && echo y),y)
1348 BASIC_CFLAGS += -I/sw/include
1349 BASIC_LDFLAGS += -L/sw/lib
1350 endif
1351 endif
1352 ifndef NO_DARWIN_PORTS
1353 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1354 BASIC_CFLAGS += -I/opt/local/include
1355 BASIC_LDFLAGS += -L/opt/local/lib
1356 endif
1357 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001358 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001359 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001360 APPLE_COMMON_CRYPTO = YesPlease
1361 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1362 endif
David Aguilar29de2052013-05-11 01:22:26 -07001363 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001364 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001365endif
1366
David Aguilare1c06882009-05-31 01:35:51 -07001367ifdef NO_LIBGEN_H
1368 COMPAT_CFLAGS += -DNO_LIBGEN_H
1369 COMPAT_OBJS += compat/basename.o
1370endif
1371
Ævar Arnfjörð Bjarmason75997302021-01-24 02:58:33 +01001372ifdef USE_LIBPCRE1
1373$(error The USE_LIBPCRE1 build option has been removed, use version 2 with USE_LIBPCRE)
1374endif
1375
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001376USE_LIBPCRE2 ?= $(USE_LIBPCRE)
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001377
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001378ifneq (,$(USE_LIBPCRE2))
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001379 BASIC_CFLAGS += -DUSE_LIBPCRE2
1380 EXTLIBS += -lpcre2-8
1381endif
1382
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001383ifdef LIBPCREDIR
1384 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1385 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001386endif
1387
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001388ifdef HAVE_ALLOCA_H
1389 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1390endif
1391
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001392IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001393IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001394
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001395ifdef NO_CURL
1396 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001397 REMOTE_CURL_PRIMARY =
1398 REMOTE_CURL_ALIASES =
1399 REMOTE_CURL_NAMES =
Johannes Schindelin724d6352019-04-18 06:16:40 -07001400 EXCLUDED_PROGRAMS += git-http-fetch git-http-push
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001401else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001402 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001403 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
Jeff King897d68e2020-03-26 04:08:55 -04001404 CURL_CFLAGS = -I$(CURLDIR)/include
James Knight23c4bbe2018-11-03 05:12:11 +00001405 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001406 else
Jeff King897d68e2020-03-26 04:08:55 -04001407 CURL_CFLAGS =
James Knight23c4bbe2018-11-03 05:12:11 +00001408 CURL_LIBCURL =
Junio C Hamanob2feb642014-04-30 10:58:10 -07001409 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001410
Jeff King94a88e22020-03-26 04:06:45 -04001411 ifndef CURL_LDFLAGS
Jeff King05738312020-04-04 10:58:29 -04001412 CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
Jeff King94a88e22020-03-26 04:06:45 -04001413 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001414 CURL_LIBCURL += $(CURL_LDFLAGS)
Thomas Cortbc5f8132011-07-19 18:55:47 -04001415
Jeff King897d68e2020-03-26 04:08:55 -04001416 ifndef CURL_CFLAGS
Jeff King05738312020-04-04 10:58:29 -04001417 CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
Jeff King897d68e2020-03-26 04:08:55 -04001418 endif
1419 BASIC_CFLAGS += $(CURL_CFLAGS)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001420
Johannes Sixt4256f362010-01-19 16:39:12 +01001421 REMOTE_CURL_PRIMARY = git-remote-http$X
1422 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1423 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001424 PROGRAM_OBJS += http-fetch.o
1425 PROGRAMS += $(REMOTE_CURL_NAMES)
Remi Pommarelf8915872015-10-21 19:10:46 +02001426 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 -08001427 ifeq "$(curl_check)" "070908"
1428 ifndef NO_EXPAT
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001429 PROGRAM_OBJS += http-push.o
Johannes Schindelin724d6352019-04-18 06:16:40 -07001430 else
1431 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld08900982005-11-18 17:08:36 -08001432 endif
Johannes Schindelin724d6352019-04-18 06:16:40 -07001433 else
1434 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001435 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001436 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 +01001437 ifeq "$(curl_check)" "072200"
1438 USE_CURL_FOR_IMAP_SEND = YesPlease
1439 endif
1440 ifdef USE_CURL_FOR_IMAP_SEND
1441 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1442 IMAP_SEND_BUILDDEPS = http.o
1443 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1444 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001445 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001446 ifdef EXPATDIR
1447 BASIC_CFLAGS += -I$(EXPATDIR)/include
1448 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1449 else
1450 EXPAT_LIBEXPAT = -lexpat
1451 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001452 ifdef EXPAT_NEEDS_XMLPARSE_H
1453 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1454 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001455 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001456endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001457IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001458
Robert Schielebef19da2007-07-29 20:35:45 +02001459ifdef ZLIB_PATH
1460 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001461 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001462endif
1463EXTLIBS += -lz
1464
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001465ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001466 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001467 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001468 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001469 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001470 else
1471 OPENSSL_LINK =
1472 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001473 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001474 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001475 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001476else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001477 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001478 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001479endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001480ifdef NO_OPENSSL
1481 LIB_4_CRYPTO =
1482else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001483ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001484 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001485else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001486 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001487endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001488ifdef APPLE_COMMON_CRYPTO
1489 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1490endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001491endif
Eric Sunshinefdb1fbb2018-06-14 22:25:03 -04001492ifndef NO_ICONV
1493 ifdef NEEDS_LIBICONV
1494 ifdef ICONVDIR
1495 BASIC_CFLAGS += -I$(ICONVDIR)/include
1496 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1497 else
1498 ICONV_LINK =
1499 endif
1500 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1501 ICONV_LINK += -lintl
1502 endif
1503 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano455a7f32005-09-30 13:31:16 -07001504 endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001505endif
brian m. carlson79444c92019-02-12 00:52:06 +00001506ifdef ICONV_OMITS_BOM
1507 BASIC_CFLAGS += -DICONV_OMITS_BOM
1508endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001509ifdef NEEDS_LIBGEN
1510 EXTLIBS += -lgen
1511endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001512ifndef NO_GETTEXT
1513ifndef LIBC_CONTAINS_LIBINTL
1514 EXTLIBS += -lintl
1515endif
1516endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001517ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001518 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001519endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001520ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001521 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001522endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001523ifdef NEEDS_RESOLV
1524 EXTLIBS += -lresolv
1525endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001526ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001527 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001528endif
David Michael110d6982012-12-14 14:56:59 -05001529ifdef NO_GECOS_IN_PWENT
1530 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1531endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001532ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1533 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1534endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001535ifdef USE_NSEC
1536 BASIC_CFLAGS += -DUSE_NSEC
1537endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001538ifdef USE_ST_TIMESPEC
1539 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1540endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001541ifdef NO_NORETURN
1542 BASIC_CFLAGS += -DNO_NORETURN
1543endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001544ifdef NO_NSEC
1545 BASIC_CFLAGS += -DNO_NSEC
1546endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001547ifdef SNPRINTF_RETURNS_BOGUS
1548 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1549 COMPAT_OBJS += compat/snprintf.o
1550endif
Brandon Caseycba22522008-02-08 20:32:47 -06001551ifdef FREAD_READS_DIRECTORIES
1552 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1553 COMPAT_OBJS += compat/fopen.o
1554endif
Jeff King2b081012021-02-26 01:14:35 -05001555ifdef OPEN_RETURNS_EINTR
1556 COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR
1557 COMPAT_OBJS += compat/open.o
1558endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001559ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001560 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001561endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001562ifdef NO_GETTEXT
1563 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001564 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001565endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001566ifdef NO_POLL
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001567 NO_POLL_H = YesPlease
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001568 NO_SYS_POLL_H = YesPlease
1569 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1570 COMPAT_OBJS += compat/poll/poll.o
1571endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001572ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001573 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001574 COMPAT_OBJS += compat/strcasestr.o
1575endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001576ifdef NO_STRLCPY
1577 COMPAT_CFLAGS += -DNO_STRLCPY
1578 COMPAT_OBJS += compat/strlcpy.o
1579endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001580ifdef NO_STRTOUMAX
1581 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001582 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001583endif
1584ifdef NO_STRTOULL
1585 COMPAT_CFLAGS += -DNO_STRTOULL
1586endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001587ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001588 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001589 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001590endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001591ifdef NO_MKDTEMP
1592 COMPAT_CFLAGS += -DNO_MKDTEMP
1593 COMPAT_OBJS += compat/mkdtemp.o
1594endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001595ifdef MKDIR_WO_TRAILING_SLASH
1596 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1597 COMPAT_OBJS += compat/mkdir.o
1598endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001599ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001600 COMPAT_CFLAGS += -DNO_UNSETENV
1601 COMPAT_OBJS += compat/unsetenv.o
1602endif
Robert Schiele26009732008-01-24 19:34:46 +01001603ifdef NO_SYS_SELECT_H
1604 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1605endif
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001606ifdef NO_POLL_H
1607 BASIC_CFLAGS += -DNO_POLL_H
1608endif
Markus Duft28449232010-10-27 10:39:52 +02001609ifdef NO_SYS_POLL_H
1610 BASIC_CFLAGS += -DNO_SYS_POLL_H
1611endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001612ifdef NEEDS_SYS_PARAM_H
1613 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001614endif
Markus Duft28449232010-10-27 10:39:52 +02001615ifdef NO_INTTYPES_H
1616 BASIC_CFLAGS += -DNO_INTTYPES_H
1617endif
1618ifdef NO_INITGROUPS
1619 BASIC_CFLAGS += -DNO_INITGROUPS
1620endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001621ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001622 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001623 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001624else
1625 ifdef USE_WIN32_MMAP
1626 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1627 COMPAT_OBJS += compat/win32mmap.o
1628 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001629endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001630ifdef MMAP_PREVENTS_DELETE
1631 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1632endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001633ifdef OBJECT_CREATION_USES_RENAMES
1634 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001635endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001636ifdef NO_STRUCT_ITIMERVAL
1637 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001638 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001639endif
1640ifdef NO_SETITIMER
1641 COMPAT_CFLAGS += -DNO_SETITIMER
1642endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001643ifdef NO_PREAD
1644 COMPAT_CFLAGS += -DNO_PREAD
1645 COMPAT_OBJS += compat/pread.o
1646endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001647ifdef NO_FAST_WORKING_DIRECTORY
1648 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1649endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001650ifdef NO_TRUSTABLE_FILEMODE
1651 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1652endif
David Michaeld543d9c2014-12-03 21:24:17 -05001653ifdef NEEDS_MODE_TRANSLATION
1654 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1655 COMPAT_OBJS += compat/stat.o
1656endif
hpa49744d62005-09-28 16:52:21 -07001657ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001658 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001659endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001660ifdef NO_INTPTR_T
1661 COMPAT_CFLAGS += -DNO_INTPTR_T
1662endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001663ifdef NO_UINTMAX_T
1664 BASIC_CFLAGS += -Duintmax_t=uint32_t
1665endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001666ifdef NO_SOCKADDR_STORAGE
1667ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001668 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001669else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001670 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001671endif
hpa49744d62005-09-28 16:52:21 -07001672endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001673ifdef NO_INET_NTOP
1674 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001675 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001676endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001677ifdef NO_INET_PTON
1678 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001679 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001680endif
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001681ifdef NO_UNIX_SOCKETS
1682 BASIC_CFLAGS += -DNO_UNIX_SOCKETS
1683else
Johannes Sixt63203582011-12-12 22:12:56 +01001684 LIB_OBJS += unix-socket.o
Jeff Hostetler9fd19022021-03-15 21:08:27 +00001685 LIB_OBJS += unix-stream-server.o
Jeff Hostetler7cd5dbc2021-03-22 10:29:47 +00001686 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1687 LIB_OBJS += compat/simple-ipc/ipc-unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001688endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001689
Jeff Hostetler59c7b882021-03-15 21:08:23 +00001690ifdef USE_WIN32_IPC
1691 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1692 LIB_OBJS += compat/simple-ipc/ipc-win32.o
Johannes Sixt63203582011-12-12 22:12:56 +01001693endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001694
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001695ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001696 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001697endif
1698
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001699ifdef OLD_ICONV
1700 BASIC_CFLAGS += -DOLD_ICONV
1701endif
1702
David Symonds609a2282007-11-07 14:24:28 +11001703ifdef NO_DEFLATE_BOUND
1704 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1705endif
1706
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001707ifdef NO_POSIX_GOODIES
1708 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1709endif
1710
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001711ifdef APPLE_COMMON_CRYPTO
1712 # Apple CommonCrypto requires chunking
1713 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1714endif
1715
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001716ifdef OPENSSL_SHA1
1717 EXTLIBS += $(LIB_4_CRYPTO)
1718 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001719else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001720ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001721 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001722 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001723else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001724ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001725 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001726 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001727else
David Aguilar61067952013-05-19 06:23:35 -04001728ifdef APPLE_COMMON_CRYPTO
1729 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001730 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001731else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001732 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001733 BASIC_CFLAGS += -DSHA1_DC
1734 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001735ifdef DC_SHA1_EXTERNAL
1736 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001737 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001738$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001739 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001740 endif
1741 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1742 EXTLIBS += -lsha1detectcoll
1743else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001744ifdef DC_SHA1_SUBMODULE
1745 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1746 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1747 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1748else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001749 LIB_OBJS += sha1dc/sha1.o
1750 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001751endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001752 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001753 -DSHA1DC_NO_STANDARD_INCLUDES \
1754 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1755 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001756 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001757endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001758endif
1759endif
David Aguilar61067952013-05-19 06:23:35 -04001760endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001761endif
David Aguilar61067952013-05-19 06:23:35 -04001762
brian m. carlson4b4e2912018-11-14 04:09:38 +00001763ifdef OPENSSL_SHA256
1764 EXTLIBS += $(LIB_4_CRYPTO)
1765 BASIC_CFLAGS += -DSHA256_OPENSSL
1766else
brian m. carlson27dc04c2018-11-14 04:09:37 +00001767ifdef GCRYPT_SHA256
1768 BASIC_CFLAGS += -DSHA256_GCRYPT
1769 EXTLIBS += -lgcrypt
1770else
1771 LIB_OBJS += sha256/block/sha256.o
1772 BASIC_CFLAGS += -DSHA256_BLK
1773endif
brian m. carlson4b4e2912018-11-14 04:09:38 +00001774endif
brian m. carlson13eeedb2018-11-14 04:09:36 +00001775
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001776ifdef SHA1_MAX_BLOCK_SIZE
1777 LIB_OBJS += compat/sha1-chunked.o
1778 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1779endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001780ifdef NO_HSTRERROR
1781 COMPAT_CFLAGS += -DNO_HSTRERROR
1782 COMPAT_OBJS += compat/hstrerror.o
1783endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001784ifdef NO_MEMMEM
1785 COMPAT_CFLAGS += -DNO_MEMMEM
1786 COMPAT_OBJS += compat/memmem.o
1787endif
Matt Kraai40036be2012-12-18 14:03:55 -08001788ifdef NO_GETPAGESIZE
1789 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1790endif
Brian Downing43fe9012008-02-05 15:10:44 -06001791ifdef INTERNAL_QSORT
1792 COMPAT_CFLAGS += -DINTERNAL_QSORT
Brian Downing43fe9012008-02-05 15:10:44 -06001793endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001794ifdef HAVE_ISO_QSORT_S
1795 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1796else
1797 COMPAT_OBJS += compat/qsort_s.o
1798endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001799ifdef RUNTIME_PREFIX
1800 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1801endif
Alex Riesenb7774342007-03-07 00:44:49 +01001802
Junio C Hamano46059cc2008-11-15 04:08:14 -08001803ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001804 BASIC_CFLAGS += -DNO_PTHREADS
1805else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001806 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001807 EXTLIBS += $(PTHREAD_LIBS)
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001808endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001809
Chris Webbcb6a22c2010-04-13 10:07:13 +01001810ifdef HAVE_PATHS_H
1811 BASIC_CFLAGS += -DHAVE_PATHS_H
1812endif
1813
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001814ifdef HAVE_LIBCHARSET_H
1815 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001816 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001817endif
1818
David Michaelb3e103d2012-12-14 14:57:01 -05001819ifdef HAVE_STRINGS_H
1820 BASIC_CFLAGS += -DHAVE_STRINGS_H
1821endif
1822
Jeff King21aeafc2011-12-10 05:41:01 -05001823ifdef HAVE_DEV_TTY
1824 BASIC_CFLAGS += -DHAVE_DEV_TTY
1825endif
1826
Alex Riesen81a24b52008-03-05 00:15:39 +01001827ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1828 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1829endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001830ifdef UNRELIABLE_FSTAT
1831 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1832endif
Jeff King02232ad2009-06-16 15:07:40 -04001833ifdef NO_REGEX
1834 COMPAT_CFLAGS += -Icompat/regex
1835 COMPAT_OBJS += compat/regex/regex.o
1836endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001837ifdef NATIVE_CRLF
1838 BASIC_CFLAGS += -DNATIVE_CRLF
1839endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001840
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001841ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001842 COMPAT_CFLAGS += -Icompat/nedmalloc
1843 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1844 OVERRIDE_STRDUP = YesPlease
1845endif
1846
1847ifdef OVERRIDE_STRDUP
1848 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1849 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001850endif
1851
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001852ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1853 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1854endif
1855
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001856ifndef NO_MSGFMT_EXTENDED_OPTIONS
1857 MSGFMT += --check --statistics
1858endif
1859
Karsten Blees148d6772014-07-12 02:05:42 +02001860ifdef HAVE_CLOCK_GETTIME
1861 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001862endif
1863
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001864ifdef HAVE_CLOCK_MONOTONIC
1865 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1866endif
1867
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001868ifdef NEEDS_LIBRT
1869 EXTLIBS += -lrt
1870endif
1871
Kyle J. McKay95290802015-03-07 23:14:36 -08001872ifdef HAVE_BSD_SYSCTL
1873 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1874endif
1875
Dan Jacques226c0dd2018-04-10 11:05:44 -04001876ifdef HAVE_BSD_KERN_PROC_SYSCTL
1877 BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
1878endif
1879
Jeff King0cc30e02015-04-16 05:01:38 -04001880ifdef HAVE_GETDELIM
1881 BASIC_CFLAGS += -DHAVE_GETDELIM
1882endif
1883
Dan Jacques226c0dd2018-04-10 11:05:44 -04001884ifneq ($(PROCFS_EXECUTABLE_PATH),)
1885 procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
1886 BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
1887endif
1888
1889ifdef HAVE_NS_GET_EXECUTABLE_PATH
1890 BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
1891endif
1892
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -04001893ifdef HAVE_WPGMPTR
1894 BASIC_CFLAGS += -DHAVE_WPGMPTR
1895endif
1896
Duy Nguyen18a4f6b2019-02-12 21:14:41 +07001897ifdef FILENO_IS_A_MACRO
1898 COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
1899 COMPAT_OBJS += compat/fileno.o
1900endif
1901
Clément Chigot400caaf2019-04-25 07:01:56 +00001902ifdef NEED_ACCESS_ROOT_HANDLER
1903 COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
1904 COMPAT_OBJS += compat/access.o
1905endif
1906
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001907ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001908NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001909endif
1910
Jeff King499c2932009-04-03 15:32:20 -04001911ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001912NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001913endif
1914
Johan Herlandd4e1b472009-11-18 02:42:31 +01001915ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001916NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001917endif
1918
Eric Wong995bc222016-08-04 11:40:25 +00001919ifndef PAGER_ENV
1920PAGER_ENV = LESS=FRX LV=-c
1921endif
1922
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001923QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001924QUIET_SUBDIR1 =
1925
John Keepingef49e052015-09-05 13:22:10 +01001926ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001927PRINT_DIR = --no-print-directory
1928else # "make -w"
1929NO_SUBDIR = :
1930endif
1931
John Keepingef49e052015-09-05 13:22:10 +01001932ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001933ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001934 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001935 QUIET_AR = @echo ' ' AR $@;
1936 QUIET_LINK = @echo ' ' LINK $@;
1937 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1938 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001939 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00001940 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001941 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00001942 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001943 QUIET_SP = @echo ' ' SP $<;
Denton Liub503a2d2019-09-25 01:21:01 -07001944 QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001945 QUIET_RC = @echo ' ' RC $@;
Denton Liu4f3c1dc2019-10-09 13:43:46 -07001946 QUIET_SPATCH = @echo ' ' SPATCH $<;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001947 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001948 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1949 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001950 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001951 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001952 export QUIET_BUILT_IN
1953endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001954endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001955
Junio C Hamano70de5e62012-05-02 15:12:10 -07001956ifdef NO_INSTALL_HARDLINKS
1957 export NO_INSTALL_HARDLINKS
1958endif
1959
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001960### profile feedback build
1961#
1962
1963# Can adjust this to be a global directory if you want to do extended
1964# data gathering
1965PROFILE_DIR := $(CURDIR)
1966
Johannes Sixte60ec752012-02-09 09:22:26 +01001967ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07001968 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001969 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001970 export CCACHE_DISABLE = t
1971 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01001972else
1973ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07001974 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001975 export CCACHE_DISABLE = t
1976 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001977endif
Johannes Sixte60ec752012-02-09 09:22:26 +01001978endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001979
Pavel Roskinaddf88e2006-07-09 03:44:30 -04001980# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001981
Johannes Schindelin32043c92007-02-14 12:48:14 +01001982ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02001983ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001984
1985DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1986bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001987bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001988mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00001989mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
1990infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001991perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001992localedir_SQ = $(subst ','\'',$(localedir))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001993localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001994gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +00001995gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001996template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00001997htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001998prefix_SQ = $(subst ','\'',$(prefix))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001999perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05302000gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002001
2002SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05002003TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002004PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01002005PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07002006TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002007DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08002008PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002009
Dan Jacques07d90ea2018-04-10 11:05:43 -04002010# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
2011# relative to each other and share an installation path.
2012#
2013# This is a dependency in:
2014# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
2015# - The runtime prefix Perl header (see
2016# "perl/header_templates/runtime_prefix.template.pl").
2017ifdef RUNTIME_PREFIX
2018
2019ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
2020$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
2021endif
2022
2023ifneq ($(filter /%,$(firstword $(localedir_relative))),)
2024$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
2025endif
2026
2027ifndef NO_PERL
2028ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
2029$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
2030endif
2031endif
2032
2033endif
2034
Jeff King3f2e2292016-07-01 01:58:58 -04002035# We must filter out any object files from $(GITLIBS),
2036# as it is typically used like:
2037#
2038# foo: foo.o $(GITLIBS)
2039# $(CC) $(filter %.o,$^) $(LIBS)
2040#
2041# where we use it as a dependency. Since we also pull object files
2042# from the dependency list, that would make each entry appear twice.
2043LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07002044
brian m. carlsonf18f8162017-03-11 22:28:18 +00002045BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08002046LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02002047
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05002048# Quote for C
2049
2050ifdef DEFAULT_EDITOR
2051DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
2052DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
2053
2054BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
2055endif
2056
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05002057ifdef DEFAULT_PAGER
2058DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
2059DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
2060
2061BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
2062endif
2063
Ben Waltonb3e34dd2012-03-30 21:33:21 -04002064ifdef SHELL_PATH
2065SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
2066SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
2067
2068BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
2069endif
2070
Jeff King42dcbb72012-06-02 15:01:12 -04002071GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
2072GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
2073GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04002074GIT-USER-AGENT: FORCE
2075 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04002076 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
2077 fi
Jeff King42dcbb72012-06-02 15:01:12 -04002078
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00002079ifdef DEFAULT_HELP_FORMAT
2080BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
2081endif
2082
Eric Wong995bc222016-08-04 11:40:25 +00002083PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
2084PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
2085PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
2086BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
2087
Petr Baudis8d7f5862006-06-25 03:47:03 +02002088ALL_CFLAGS += $(BASIC_CFLAGS)
2089ALL_LDFLAGS += $(BASIC_LDFLAGS)
2090
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00002091export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07002092
2093
Petr Baudis28818ff2005-07-29 17:50:24 +02002094### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07002095
Brandon Caseyc94c8e52008-08-07 14:03:42 -05002096SHELL = $(SHELL_PATH)
2097
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002098all:: shell_compatibility_test
2099
2100ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07002101all:: profile
2102endif
2103
2104profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002105 $(MAKE) PROFILE=GEN all
2106 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04002107 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
2108 $(MAKE) PROFILE=GEN -j1 perf; \
2109 else \
2110 echo "Skipping profile of perf tests..."; \
2111 fi
Andi Kleen066dd262014-07-07 23:35:11 -07002112 $(MAKE) PROFILE=USE all
2113
2114profile-fast: profile-clean
2115 $(MAKE) PROFILE=GEN all
2116 $(MAKE) PROFILE=GEN -j1 perf
2117 $(MAKE) PROFILE=USE all
2118
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002119
Johannes Schindelin179227d2020-09-21 22:28:16 +00002120all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002121ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00002122 $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002123endif
Petr Baudis28818ff2005-07-29 17:50:24 +02002124
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002125all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002126ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07002127 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08002128 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002129endif
Ben Walton502be952010-03-20 10:48:08 -04002130 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04002131
Brandon Casey6dc46272008-08-07 14:06:26 -05002132please_set_SHELL_PATH_to_a_more_modern_shell:
2133 @$$(:)
2134
2135shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
2136
Junio C Hamano4dc00022006-01-12 21:42:25 -08002137strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05002138 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08002139
Jonathan Nieder7b63c772012-07-06 23:19:09 -05002140### Target-specific flags and dependencies
2141
2142# The generic compilation pattern rule and automatically
2143# computed header dependencies (falling back to a dependency on
2144# LIB_H) are enough to describe how most targets should be built,
2145# but some targets are special enough to need something a little
2146# different.
2147#
2148# - When a source file "foo.c" #includes a generated header file,
2149# we need to list that dependency for the "foo.o" target.
2150#
2151# We also list it from other targets that are built from foo.c
2152# like "foo.sp" and "foo.s", even though that is easy to forget
2153# to do because the generated header is already present around
2154# after a regular build attempt.
2155#
2156# - Some code depends on configuration kept in makefile
2157# variables. The target-specific variable EXTRA_CPPFLAGS can
2158# be used to convey that information to the C preprocessor
2159# using -D options.
2160#
2161# The "foo.o" target should have a corresponding dependency on
2162# a file that changes when the value of the makefile variable
2163# changes. For example, targets making use of the
2164# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
2165#
2166# Technically the ".sp" and ".s" targets do not need this
2167# dependency because they are force-built, but they get the
2168# same dependency for consistency. This way, you do not have to
2169# know how each target is implemented. And it means the
2170# dependencies here will not need to change if the force-build
2171# details change some day.
2172
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002173git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04002174git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002175 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2176 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2177 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07002178
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002179git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04002180 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2181 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07002182
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002183help.sp help.s help.o: command-list.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01002184
Emily Shaffer709df952020-04-16 14:18:03 -07002185builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002186builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002187 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2188 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2189 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07002190
Jeff King520a6cd2012-06-20 14:32:22 -04002191version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04002192version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04002193 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01002194 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
Johannes Schindelin5cf8e062018-06-27 21:35:23 +02002195 '-DGIT_BUILT_FROM_COMMIT="$(shell \
2196 GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2197 git rev-parse -q --verify HEAD 2>/dev/null)"'
Jeff King816fb462012-06-02 14:51:42 -04002198
Junio C Hamano91730802006-04-10 17:37:58 -07002199$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02002200 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002201 ln $< $@ 2>/dev/null || \
2202 ln -s $< $@ 2>/dev/null || \
2203 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07002204
Emily Shaffer709df952020-04-16 14:18:03 -07002205config-list.h: generate-configlist.sh
2206
2207config-list.h:
2208 $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
2209 >$@+ && mv $@+ $@
2210
Nguyễn Thái Ngọc Duyf318d732018-05-10 10:46:41 +02002211command-list.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07002212
Nguyễn Thái Ngọc Duy76b993a2018-10-27 08:22:34 +02002213command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
Johannes Schindelin724d6352019-04-18 06:16:40 -07002214 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2215 $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
2216 command-list.txt >$@+ && mv $@+ $@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002217
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002218SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
Jeff Kingb5295f32012-06-20 14:32:19 -04002219 $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002220 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
2221 $(perllibdir_SQ)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002222define cmd_munge_script
2223$(RM) $@ $@+ && \
2224sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2225 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002226 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002227 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002228 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08002229 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002230 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04002231 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
2232 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Junio C Hamano71b40102016-03-08 15:47:57 -08002233 -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00002234 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002235 $@.sh >$@+
2236endef
2237
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002238GIT-SCRIPT-DEFINES: FORCE
2239 @FLAGS='$(SCRIPT_DEFINES)'; \
2240 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002241 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002242 echo "$$FLAGS" >$@; \
2243 fi
2244
2245
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002246$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002247 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002248 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002249 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002250
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002251$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002252 $(QUIET_GEN)$(cmd_munge_script) && \
2253 mv $@+ $@
2254
Johannes Schindelinadb59de2018-11-06 06:55:50 -08002255git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002256 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01002257 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
2258 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06002259 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002260
Jeff Kinge204b002014-11-18 12:43:09 -05002261# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002262$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05002263
Dan Jacques07d90ea2018-04-10 11:05:43 -04002264# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
2265# since the locale directory is injected.
2266perl_localedir_SQ = $(localedir_SQ)
Alex Riesenf8487182006-12-04 10:50:04 +01002267
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002268ifndef NO_PERL
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002269PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002270PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002271
Dan Jacques07d90ea2018-04-10 11:05:43 -04002272PERL_DEFINES := $(PERL_PATH_SQ) $(PERLLIB_EXTRA_SQ) $(perllibdir_SQ)
2273PERL_DEFINES += $(RUNTIME_PREFIX)
2274
2275# Support Perl runtime prefix. In this mode, a different header is installed
2276# into Perl scripts.
2277ifdef RUNTIME_PREFIX
2278
2279PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
2280
2281# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
2282# at runtime.
2283perl_localedir_SQ =
2284
2285endif
2286
2287PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
2288
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002289$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
Emil Medve4cb08df2007-07-14 12:51:44 -05002290 $(QUIET_GEN)$(RM) $@ $@+ && \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002291 sed -e '1{' \
2292 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Alejandro R. Sedeño66000542018-06-25 15:13:25 -04002293 -e ' r GIT-PERL-HEADER' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002294 -e ' G' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002295 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07002296 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002297 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002298 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002299 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002300
Dan Jacques07d90ea2018-04-10 11:05:43 -04002301PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002302GIT-PERL-DEFINES: FORCE
2303 @FLAGS='$(PERL_DEFINES)'; \
2304 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2305 echo >&2 " * new perl-specific parameters"; \
2306 echo "$$FLAGS" >$@; \
2307 fi
2308
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002309GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
2310 $(QUIET_GEN)$(RM) $@ && \
2311 INSTLIBDIR='$(perllibdir_SQ)' && \
2312 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
2313 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
2314 sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
Jonathan Nieder64f982b2018-04-23 16:25:35 -07002315 -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002316 -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
2317 -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
2318 -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002319 $< >$@+ && \
2320 mv $@+ $@
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002321
Christian Hessed8698982018-04-19 06:44:40 +09002322.PHONY: perllibdir
Christian Hessecfb3a472018-04-10 15:36:41 +02002323perllibdir:
2324 @echo '$(perllibdir_SQ)'
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002325
2326.PHONY: gitweb
2327gitweb:
2328 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2329
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002330git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002331 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002332 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002333 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002334else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002335$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Jeff King499c2932009-04-03 15:32:20 -04002336 $(QUIET_GEN)$(RM) $@ $@+ && \
2337 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2338 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2339 unimplemented.sh >$@+ && \
2340 chmod +x $@+ && \
2341 mv $@+ $@
2342endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002343
Jonathan Niederca2051d2014-11-18 10:43:47 -08002344# This makes sure we depend on the NO_PYTHON setting itself.
2345$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2346
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002347ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002348$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2349$(SCRIPT_PYTHON_GEN): % : %.py
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002350 $(QUIET_GEN)$(RM) $@ $@+ && \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002351 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002352 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002353 chmod +x $@+ && \
2354 mv $@+ $@
2355else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002356$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002357 $(QUIET_GEN)$(RM) $@ $@+ && \
2358 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2359 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2360 unimplemented.sh >$@+ && \
2361 chmod +x $@+ && \
2362 mv $@+ $@
2363endif # NO_PYTHON
2364
Jeff King7f1b6972013-02-21 01:26:14 -05002365CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
2366 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
2367 configure.ac >configure.ac+ && \
2368 autoconf -o configure configure.ac+ && \
2369 $(RM) configure.ac+
2370
Jeff King520a6cd2012-06-20 14:32:22 -04002371configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002372 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002373
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002374ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002375# We avoid depending on 'configure' here, because it gets rebuilt
2376# every time GIT-VERSION-FILE is modified, only to update the embedded
2377# version number string, which config.status does not care about. We
2378# do want to recheck when the platform/environment detection logic
2379# changes, hence this depends on configure.ac.
2380config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002381 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002382 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002383 ./config.status --recheck; \
2384 else \
2385 ./configure; \
2386 fi
2387reconfigure config.mak.autogen: config.status
2388 $(QUIET_GEN)./config.status
2389.PHONY: reconfigure # This is a convenience target.
2390endif
2391
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002392XDIFF_OBJS += xdiff/xdiffi.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002393XDIFF_OBJS += xdiff/xemit.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002394XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002395XDIFF_OBJS += xdiff/xmerge.o
2396XDIFF_OBJS += xdiff/xpatience.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002397XDIFF_OBJS += xdiff/xprepare.o
2398XDIFF_OBJS += xdiff/xutils.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002399.PHONY: xdiff-objs
2400xdiff-objs: $(XDIFF_OBJS)
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002401
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002402TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002403.PHONY: test-objs
2404test-objs: $(TEST_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002405
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002406GIT_OBJS += $(LIB_OBJS)
2407GIT_OBJS += $(BUILTIN_OBJS)
2408GIT_OBJS += common-main.o
2409GIT_OBJS += git.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002410.PHONY: git-objs
2411git-objs: $(GIT_OBJS)
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002412
2413OBJECTS += $(GIT_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002414OBJECTS += $(PROGRAM_OBJS)
2415OBJECTS += $(TEST_OBJS)
2416OBJECTS += $(XDIFF_OBJS)
2417OBJECTS += $(FUZZ_OBJS)
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002418ifndef NO_CURL
2419 OBJECTS += http.o http-walker.o remote-curl.o
2420endif
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002421.PHONY: objects
2422objects: $(OBJECTS)
Jonathan Niederc3739912010-01-26 09:52:11 -06002423
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002424dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002425dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002426
Jonathan Nieder024c8432011-11-18 03:58:21 -06002427ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002428$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002429 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002430
2431missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002432dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002433dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002434endif
2435
Jonathan Nieder024c8432011-11-18 03:58:21 -06002436ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002437dep_dirs =
2438missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002439dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002440endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002441
Philippe Blain3821c382020-09-03 22:13:38 +00002442compdb_dir = compile_commands
2443
2444ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2445missing_compdb_dir = $(compdb_dir)
2446$(missing_compdb_dir):
2447 @mkdir -p $@
2448
2449compdb_file = $(compdb_dir)/$(subst /,-,$@.json)
2450compdb_args = -MJ $(compdb_file)
2451else
2452missing_compdb_dir =
2453compdb_args =
2454endif
2455
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002456ASM_SRC := $(wildcard $(OBJECTS:o=S))
2457ASM_OBJ := $(ASM_SRC:S=o)
2458C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002459
Jonathan Nieder30248882010-01-26 09:51:24 -06002460.SUFFIXES:
2461
Philippe Blain3821c382020-09-03 22:13:38 +00002462$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2463 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
2464$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2465 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002466
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002467%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002468 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002469
2470ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2471# Take advantage of gcc's on-the-fly dependency generation
2472# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2473dep_files_present := $(wildcard $(dep_files))
2474ifneq ($(dep_files_present),)
2475include $(dep_files_present)
2476endif
2477else
Jonathan Niederdfea5752010-01-26 09:52:49 -06002478# Dependencies on header files, for platforms that do not support
2479# the gcc -MMD option.
2480#
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002481# Dependencies on automatically generated headers such as command-list.h
Jonathan Niederdfea5752010-01-26 09:52:49 -06002482# should _not_ be included here, since they are necessary even when
2483# building an object for the first time.
Pavel Roskinb05701c2005-08-06 01:36:15 -04002484
Johannes Schindelin92b88eb2019-03-04 05:47:06 -08002485$(OBJECTS): $(LIB_H) $(GENERATED_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002486endif
Junio C Hamano7a590132005-08-06 13:10:43 -07002487
Philippe Blain3821c382020-09-03 22:13:38 +00002488ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2489all:: compile_commands.json
2490compile_commands.json:
2491 @$(RM) $@
2492 $(QUIET_GEN)sed -e '1s/^/[/' -e '$$s/,$$/]/' $(compdb_dir)/*.o.json > $@+
2493 @if test -s $@+; then mv $@+ $@; else $(RM) $@+; fi
2494endif
2495
Stefan Bellerd807c4a2018-04-10 14:26:18 -07002496exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
2497exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002498 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002499 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002500 '-DBINDIR="$(bindir_relative_SQ)"' \
Philip Oakley4d5b4c22018-04-21 13:18:42 +02002501 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002502
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002503builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002504builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002505 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002506
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002507config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002508config.sp config.s config.o: EXTRA_CPPFLAGS = \
2509 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002510
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002511attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002512attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2513 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002514
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002515gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002516gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002517 -DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002518
Ramsay Jones15caca22019-02-05 02:27:48 +00002519http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002520 -DCURL_DISABLE_TYPECHECK
2521
Ramsay Jones15caca22019-02-05 02:27:48 +00002522pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
Ramsay Jones54360a12018-02-12 00:21:02 +00002523
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002524ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002525http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002526endif
2527
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002528ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002529compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2530 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002531endif
2532
René Scharfed555ff52010-09-11 11:59:18 +02002533ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002534compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002535 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones15caca22019-02-05 02:27:48 +00002536compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002537endif
2538
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002539git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002540 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002541
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002542git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002543 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002544 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002545
John Keepingfd78ced2014-01-25 13:11:44 +00002546git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002547 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002548 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002549git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002550 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002551 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002552
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002553$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2554 $(QUIET_LNCP)$(RM) $@ && \
2555 ln $< $@ 2>/dev/null || \
2556 ln -s $< $@ 2>/dev/null || \
2557 cp $< $@
2558
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002559$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002560 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002561 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002562
Petr Baudis28818ff2005-07-29 17:50:24 +02002563$(LIB_FILE): $(LIB_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002564 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002565
Linus Torvalds34435462006-03-24 20:13:22 -08002566$(XDIFF_LIB): $(XDIFF_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002567 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002568
Jonathan Nieder5b586192012-03-31 03:44:53 -05002569export DEFAULT_EDITOR DEFAULT_PAGER
2570
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07002571Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
2572 @EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
2573 if test x"$$EXCLUDED" != \
2574 x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
2575 echo >&2 " * new documentation flags"; \
2576 echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
2577 fi
2578
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002579.PHONY: doc man man-perl html info pdf
2580doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002581 $(MAKE) -C Documentation all
2582
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002583man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002584 $(MAKE) -C Documentation man
2585
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002586man-perl: perl/build/man/man3/Git.3pm
2587
Michael J Gruber414851a2008-09-10 10:19:34 +02002588html:
2589 $(MAKE) -C Documentation html
2590
David Kastrup47398092007-08-06 12:22:57 +02002591info:
2592 $(MAKE) -C Documentation info
2593
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002594pdf:
2595 $(MAKE) -C Documentation pdf
2596
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002597XGETTEXT_FLAGS = \
2598 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002599 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002600 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2601 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002602XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2603 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002604XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2605 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002606XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002607 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002608LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002609LOCALIZED_SH = $(SCRIPT_SH)
Alban Gruinc42abfe2018-05-28 14:34:19 +02002610LOCALIZED_SH += git-rebase--preserve-merges.sh
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002611LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002612LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002613
2614ifdef XGETTEXT_INCLUDE_TESTS
2615LOCALIZED_C += t/t0200/test.c
2616LOCALIZED_SH += t/t0200/test.sh
2617LOCALIZED_PERL += t/t0200/test.perl
2618endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002619
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002620## Note that this is meant to be run only by the localization coordinator
2621## under a very controlled condition, i.e. (1) it is to be run in a
2622## Git repository (not a tarball extract), (2) any local modifications
2623## will be lost.
2624## Gettext tools cannot work with our own custom PRItime type, so
2625## we replace PRItime with PRIuMAX. We need to update this to
2626## PRIdMAX if we switch to a signed type later.
2627
Jonathan Nieder1f319632014-08-22 00:32:08 -04002628po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002629 # All modifications will be reverted at the end, so we do not
2630 # want to have any local change.
2631 git diff --quiet HEAD && git diff --quiet --cached
2632
2633 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2634 do \
2635 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2636 cat "$$s+" >"$$s" && rm "$$s+"; \
2637 done
2638
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002639 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2640 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2641 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002642 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2643 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002644
2645 # Reverting the munged source, leaving only the updated $@
2646 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002647 mv $@+ $@
2648
Elia Pintoe6be2652015-12-15 15:21:00 +00002649.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002650pot: po/git.pot
2651
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002652POFILES := $(wildcard po/*.po)
2653MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2654
2655ifndef NO_GETTEXT
2656all:: $(MOFILES)
2657endif
2658
2659po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2660 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2661
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002662LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2663LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002664LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2665LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002666
2667ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002668all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002669ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002670all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002671endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002672NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002673endif
2674
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002675perl/build/lib/%.pm: perl/%.pm
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002676 $(QUIET_GEN)mkdir -p $(dir $@) && \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002677 sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002678 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2679 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002680
2681perl/build/man/man3/Git.3pm: perl/Git.pm
2682 $(QUIET_GEN)mkdir -p $(dir $@) && \
2683 pod2man $< $@
2684
Jeff Kinge951ebc2016-12-14 09:26:55 -05002685FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002686 git ls-files \
2687 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002688 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002689 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002690 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002691 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002692 $(FIND) . \
2693 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002694 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002695 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002696 -o \( -name build -type d -prune \) \
2697 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002698 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002699 -o \( -name '*.sh' -type f -print \) \
Denton Liu43f8c892019-09-16 12:23:14 -07002700 | sed -e 's|^\./||' \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002701 )
Junio C Hamano33533972011-10-18 00:26:18 -07002702
Junio C Hamano2f769192010-09-28 16:08:38 -05002703$(ETAGS_TARGET): FORCE
Ævar Arnfjörð Bjarmason3c80fcb2021-03-28 04:18:34 +02002704 $(QUIET_GEN)$(RM) "$(ETAGS_TARGET)+" && \
2705 $(FIND_SOURCE_FILES) | xargs etags -a -o "$(ETAGS_TARGET)+" && \
2706 mv "$(ETAGS_TARGET)+" "$(ETAGS_TARGET)"
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002707
Junio C Hamano2f769192010-09-28 16:08:38 -05002708tags: FORCE
Ævar Arnfjörð Bjarmason3c80fcb2021-03-28 04:18:34 +02002709 $(QUIET_GEN)$(RM) tags+ && \
2710 $(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \
2711 mv tags+ tags
Petr Baudis28818ff2005-07-29 17:50:24 +02002712
Kristof Provosta2a91502007-10-06 16:24:42 +02002713cscope:
2714 $(RM) cscope*
Junio C Hamano33533972011-10-18 00:26:18 -07002715 $(FIND_SOURCE_FILES) | xargs cscope -b
Kristof Provosta2a91502007-10-06 16:24:42 +02002716
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002717### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002718TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2719 $(localedir_SQ)
2720
2721GIT-PREFIX: FORCE
2722 @FLAGS='$(TRACK_PREFIX)'; \
2723 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002724 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002725 echo "$$FLAGS" >GIT-PREFIX; \
2726 fi
2727
2728TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002729
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002730GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002731 @FLAGS='$(TRACK_CFLAGS)'; \
2732 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002733 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002734 echo "$$FLAGS" >GIT-CFLAGS; \
2735 fi
2736
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002737TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2738
2739GIT-LDFLAGS: FORCE
2740 @FLAGS='$(TRACK_LDFLAGS)'; \
2741 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002742 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002743 echo "$$FLAGS" >GIT-LDFLAGS; \
2744 fi
2745
Junio C Hamanobfce5082008-07-25 12:35:10 -07002746# We need to apply sq twice, once to protect from the shell
2747# that runs GIT-BUILD-OPTIONS, and then again to protect it
2748# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002749GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002750 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002751 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002752 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2753 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2754 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2755 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2756 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002757 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002758 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002759 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002760 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002761 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2762 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002763 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002764 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
Johannes Schindelin8abfdf42018-11-14 08:32:11 -08002765 @echo X=\'$(X)\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002766ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002767 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002768endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002769ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002770 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002771endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002772ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002773 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002774endif
2775ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002776 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002777endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002778 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002779ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002780 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002781endif
2782ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002783 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002784endif
2785ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002786 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002787endif
2788ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002789 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002790endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002791ifdef GIT_PERF_MAKE_COMMAND
2792 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2793endif
Jeff King3d893612017-02-25 04:37:07 -05002794ifdef GIT_INTEROP_MAKE_OPTS
2795 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2796endif
Ben Peart1f357b02018-09-18 23:29:36 +00002797ifdef GIT_TEST_INDEX_VERSION
2798 @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002799endif
Jeff King5338ed22020-10-21 23:24:00 -04002800ifdef GIT_TEST_PERL_FATAL_WARNINGS
2801 @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
2802endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002803 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002804
Christian Couder96a46472012-12-18 16:26:38 +01002805### Detect Python interpreter path changes
2806ifndef NO_PYTHON
2807TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002808
Christian Couder96a46472012-12-18 16:26:38 +01002809GIT-PYTHON-VARS: FORCE
2810 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002811 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002812 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002813 echo "$$VARS" >$@; \
2814 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002815endif
2816
Matthew Ogilvieea925192009-12-02 22:14:05 -07002817test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2818
2819all:: $(TEST_PROGRAMS) $(test_bindir_programs)
2820
2821bin-wrappers/%: wrap-for-bin.sh
2822 @mkdir -p bin-wrappers
2823 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2824 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Johannes Schindelin3a94cb32019-07-29 13:08:16 -07002825 -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 -07002826 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002827
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002828# GNU make supports exporting all variables by "export" without parameters.
2829# However, the environment gets quite big, and some programs have problems
2830# with that.
2831
Johannes Schindelin140245b2006-07-07 13:26:31 +02002832export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002833export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002834
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002835### Testing rules
2836
Junio C Hamano96651ef2007-04-28 15:32:49 -07002837test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002838 $(MAKE) -C t/ all
2839
Thomas Rast342e9ef2012-02-17 11:25:09 +01002840perf: all
2841 $(MAKE) -C t/perf/ all
2842
2843.PHONY: test perf
2844
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002845.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002846
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002847t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2848
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002849t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
David Barr1d73b522010-08-09 17:34:42 -05002850 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002851
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +01002852check-sha1:: t/helper/test-tool$X
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002853 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002854
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002855SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2856
2857$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
2858 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
Ramsay Jones15caca22019-02-05 02:27:48 +00002859 $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $<
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002860
2861.PHONY: sparse $(SP_OBJ)
2862sparse: $(SP_OBJ)
2863
Emily Shaffer709df952020-04-16 14:18:03 -07002864EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/%
Ramsay Jonesf23aa182019-03-06 00:11:13 +00002865ifndef GCRYPT_SHA256
2866 EXCEPT_HDRS += sha256/gcrypt.h
2867endif
Denton Liucf6a2d22019-09-16 12:23:08 -07002868CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002869HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
Denton Liub503a2d2019-09-25 01:21:01 -07002870HCC = $(HCO:hco=hcc)
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002871
Denton Liub503a2d2019-09-25 01:21:01 -07002872%.hcc: %.h
2873 @echo '#include "git-compat-util.h"' >$@
2874 @echo '#include "$<"' >>$@
2875
2876$(HCO): %.hco: %.hcc FORCE
2877 $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002878
2879.PHONY: hdr-check $(HCO)
2880hdr-check: $(HCO)
2881
Brandon Williams21188052017-08-14 14:30:46 -07002882.PHONY: style
2883style:
2884 git clang-format --style file --diff --extensions c,h
2885
Emily Shaffer709df952020-04-16 14:18:03 -07002886check: config-list.h command-list.h
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01002887 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002888 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07002889 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002890 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002891 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07002892 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002893 exit 1; \
2894 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02002895
Denton Liu9027af52019-09-16 12:23:16 -07002896FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
2897COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02002898
2899%.cocci.patch: %.cocci $(COCCI_SOURCES)
Denton Liu4f3c1dc2019-10-09 13:43:46 -07002900 $(QUIET_SPATCH) \
Jeff Kingbcb4edf2019-05-08 03:07:54 -04002901 if test $(SPATCH_BATCH_SIZE) = 0; then \
2902 limit=; \
2903 else \
2904 limit='-n $(SPATCH_BATCH_SIZE)'; \
2905 fi; \
2906 if ! echo $(COCCI_SOURCES) | xargs $$limit \
Jeff King960154b2019-05-06 19:43:34 -04002907 $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
2908 >$@+ 2>$@.log; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002909 then \
2910 cat $@.log; \
2911 exit 1; \
2912 fi; \
2913 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02002914 if test -s $@; \
2915 then \
2916 echo ' ' SPATCH result: $@; \
2917 fi
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002918coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
René Scharfe63f0a752016-09-15 20:30:56 +02002919
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002920# See contrib/coccinelle/README
2921coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
2922
2923.PHONY: coccicheck coccicheck-pending
Petr Baudis28818ff2005-07-29 17:50:24 +02002924
Petr Baudis28818ff2005-07-29 17:50:24 +02002925### Installation rules
2926
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002927ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002928template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002929else
2930template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002931endif
2932export template_instdir
2933
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002934ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002935gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002936else
2937gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002938endif
2939gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
2940export gitexec_instdir
2941
David Aguilarbc7a96a2011-08-18 00:23:46 -07002942ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2943mergetools_instdir = $(mergetoolsdir)
2944else
2945mergetools_instdir = $(prefix)/$(mergetoolsdir)
2946endif
2947mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2948
Matthew Ogilvieea925192009-12-02 22:14:05 -07002949install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
2950
Elia Pintoe6be2652015-12-15 15:21:00 +00002951.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07002952profile-install: profile
2953 $(MAKE) install
2954
2955profile-fast-install: profile-fast
2956 $(MAKE) install
2957
Andreas Ericssond6ebd252005-11-22 00:44:15 +01002958install: all
Robert Schiele41650762007-12-01 18:05:40 +01002959 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002960 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2961 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08002962 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthew Ogilvieea925192009-12-02 22:14:05 -07002963 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07002964ifdef MSVC
2965 # We DO NOT install the individual foo.o.pdb files because they
2966 # have already been rolled up into the exe's pdb file.
2967 # We DO NOT have pdb files for the builtin commands (like git-status.exe)
2968 # because it is just a copy/hardlink of git.exe, rather than a unique binary.
Johannes Schindelina8b53552020-09-21 22:28:15 +00002969 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS),$(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)))) '$(DESTDIR_SQ)$(bindir_SQ)'
2970 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS) $(REMOTE_CURL_ALIASES),$(PROGRAMS))) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07002971ifndef DEBUG
2972 $(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2973 $(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2974else
2975 $(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2976 $(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2977endif
2978endif
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01002979 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07002980 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05002981 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002982ifndef NO_GETTEXT
2983 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
2984 (cd po/build/locale && $(TAR) cf - .) | \
2985 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
2986endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07002987ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002988 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
2989 (cd perl/build/lib && $(TAR) cf - .) | \
2990 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07002991 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07002992endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002993ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002994 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002995 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002996endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002997ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00002998 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) 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 -08002999endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003000
Johannes Sixt46beb552008-07-21 21:19:51 +02003001 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003002 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003003 destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07003004 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05003005 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
3006 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003007 test -n "$(INSTALL_SYMLINKS)" && \
3008 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
3009 { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
3010 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
3011 cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
Brandon Casey76d079a2010-07-23 12:50:45 -05003012 done; \
3013 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05003014 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
3015 $(RM) "$$bindir/$$p" && \
Johannes Schindelin907e6372020-10-21 15:13:31 +00003016 test -n "$(INSTALL_SYMLINKS)" && \
3017 ln -s "git$X" "$$bindir/$$p" || \
3018 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3019 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
3020 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
3021 cp "$$bindir/git$X" "$$bindir/$$p" || exit; }; \
Brandon Casey40919c42010-07-23 12:50:44 -05003022 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003023 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06003024 $(RM) "$$execdir/$$p" && \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003025 if test -z "$(SKIP_DASHED_BUILT_INS)"; \
3026 then \
3027 test -n "$(INSTALL_SYMLINKS)" && \
3028 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
3029 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3030 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
3031 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
3032 cp "$$execdir/git$X" "$$execdir/$$p" || exit; }; \
3033 fi \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003034 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07003035 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
3036 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003037 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003038 test -n "$(INSTALL_SYMLINKS)" && \
3039 ln -s "git-remote-http$X" "$$execdir/$$p" || \
3040 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3041 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3042 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3043 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
Brandon Casey49a43f52010-07-06 14:56:51 -07003044 done && \
Johannes Sixt7b4b59a2008-07-21 21:19:58 +02003045 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
Petr Baudis28818ff2005-07-29 17:50:24 +02003046
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003047.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00003048.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02003049install-gitweb:
3050 $(MAKE) -C gitweb install
3051
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003052install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02003053 $(MAKE) -C Documentation install
3054
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003055install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003056 $(MAKE) -C Documentation install-man
3057
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003058install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003059 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
3060 (cd perl/build/man/man3 && $(TAR) cf - .) | \
3061 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
3062
Teemu Likonenae081f32008-06-10 11:34:25 +03003063install-html:
3064 $(MAKE) -C Documentation install-html
3065
David Kastrup47398092007-08-06 12:22:57 +02003066install-info:
3067 $(MAKE) -C Documentation install-info
3068
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01003069install-pdf:
3070 $(MAKE) -C Documentation install-pdf
3071
Eric Wong6538d1e2006-12-23 08:26:09 -08003072quick-install-doc:
3073 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02003074
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003075quick-install-man:
3076 $(MAKE) -C Documentation quick-install-man
3077
Michael J Gruber6fe570d2008-09-09 22:44:17 +02003078quick-install-html:
3079 $(MAKE) -C Documentation quick-install-html
3080
Petr Baudis28818ff2005-07-29 17:50:24 +02003081
3082
3083### Maintainer's dist rules
3084
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01003085GIT_TARNAME = git-$(GIT_VERSION)
René Scharfedf368fa2020-09-19 23:23:50 +02003086GIT_ARCHIVE_EXTRA_FILES = \
3087 --prefix=$(GIT_TARNAME)/ \
3088 --add-file=configure \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003089 --add-file=.dist-tmp-dir/version \
René Scharfedf368fa2020-09-19 23:23:50 +02003090 --prefix=$(GIT_TARNAME)/git-gui/ \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003091 --add-file=.dist-tmp-dir/git-gui/version
René Scharfedf368fa2020-09-19 23:23:50 +02003092ifdef DC_SHA1_SUBMODULE
3093GIT_ARCHIVE_EXTRA_FILES += \
3094 --prefix=$(GIT_TARNAME)/sha1collisiondetection/ \
3095 --add-file=sha1collisiondetection/LICENSE.txt \
3096 --prefix=$(GIT_TARNAME)/sha1collisiondetection/lib/ \
3097 --add-file=sha1collisiondetection/lib/sha1.c \
3098 --add-file=sha1collisiondetection/lib/sha1.h \
3099 --add-file=sha1collisiondetection/lib/ubc_check.c \
3100 --add-file=sha1collisiondetection/lib/ubc_check.h
3101endif
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02003102dist: git-archive$(X) configure
Ramsay Jonesc5312032020-12-08 22:36:33 +00003103 @$(RM) -r .dist-tmp-dir
3104 @mkdir .dist-tmp-dir
3105 @echo $(GIT_VERSION) > .dist-tmp-dir/version
3106 @$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
René Scharfedf368fa2020-09-19 23:23:50 +02003107 ./git-archive --format=tar \
3108 $(GIT_ARCHIVE_EXTRA_FILES) \
3109 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Ramsay Jonesc5312032020-12-08 22:36:33 +00003110 @$(RM) -r .dist-tmp-dir
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06003111 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003112
Junio C Hamanoab214332016-04-04 23:42:41 -07003113rpm::
3114 @echo >&2 "Use distro packaged sources to run rpmbuild"
3115 @false
3116.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07003117
Johannes Schindelin46689312019-10-04 08:09:36 -07003118ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
3119OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
3120endif
3121
Johannes Schindelin179227d2020-09-21 22:28:16 +00003122artifacts-tar:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) \
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003123 GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003124 $(MOFILES)
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003125 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
3126 SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
3127 test -n "$(ARTIFACTS_DIRECTORY)"
3128 mkdir -p "$(ARTIFACTS_DIRECTORY)"
3129 $(TAR) czf "$(ARTIFACTS_DIRECTORY)/artifacts.tar.gz" $^ templates/blt/
3130.PHONY: artifacts-tar
3131
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003132htmldocs = git-htmldocs-$(GIT_VERSION)
3133manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00003134.PHONY: dist-doc distclean
René Scharfe93e70312020-10-10 18:45:18 +02003135dist-doc: git$X
Emil Medve4cb08df2007-07-14 12:51:44 -05003136 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003137 mkdir .doc-tmp-dir
3138 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
René Scharfe93e70312020-10-10 18:45:18 +02003139 ./git -C .doc-tmp-dir init
3140 ./git -C .doc-tmp-dir add .
3141 ./git -C .doc-tmp-dir commit -m htmldocs
3142 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3143 > $(htmldocs).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003144 gzip -n -9 -f $(htmldocs).tar
3145 :
Emil Medve4cb08df2007-07-14 12:51:44 -05003146 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07003147 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02003148 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003149 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07003150 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003151 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003152 install
René Scharfe93e70312020-10-10 18:45:18 +02003153 ./git -C .doc-tmp-dir init
3154 ./git -C .doc-tmp-dir add .
3155 ./git -C .doc-tmp-dir commit -m manpages
3156 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3157 > $(manpages).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003158 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05003159 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003160
Petr Baudis28818ff2005-07-29 17:50:24 +02003161### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06003162
Mathias Megyei922aa802007-10-04 23:49:19 +02003163distclean: clean
3164 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02003165 $(RM) config.log config.status config.cache
3166 $(RM) config.mak.autogen config.mak.append
3167 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02003168
Theodore Ts'of2d713f2012-02-06 01:00:17 -05003169profile-clean:
3170 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3171 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3172
SZEDER Gábor1a966382018-07-23 15:51:00 +02003173cocciclean:
3174 $(RM) contrib/coccinelle/*.cocci.patch*
3175
3176clean: profile-clean coverage-clean cocciclean
Junio C Hamano7897d842016-04-15 10:06:52 -07003177 $(RM) *.res
3178 $(RM) $(OBJECTS)
Jeff Kingfc473912020-08-13 11:00:17 -04003179 $(RM) $(LIB_FILE) $(XDIFF_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08003180 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003181 $(RM) $(TEST_PROGRAMS)
Josh Steadmon5e472152018-10-12 17:58:40 -07003182 $(RM) $(FUZZ_PROGRAMS)
Denton Liub503a2d2019-09-25 01:21:01 -07003183 $(RM) $(HCC)
Philippe Blain3821c382020-09-03 22:13:38 +00003184 $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003185 $(RM) -r po/build/
Junio C Hamanof3719842019-12-13 15:15:34 -08003186 $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
Ramsay Jonesc5312032020-12-08 22:36:33 +00003187 $(RM) -r .dist-tmp-dir .doc-tmp-dir
Ramsay Jones98836a82020-12-08 22:35:27 +00003188 $(RM) $(GIT_TARNAME).tar.gz
Emil Medve4cb08df2007-07-14 12:51:44 -05003189 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02003190 $(MAKE) -C Documentation/ clean
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07003191 $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
Jeff King499c2932009-04-03 15:32:20 -04003192ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01003193 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003194 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04003195endif
Petr Baudisb1edc532006-06-24 04:34:29 +02003196 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07003197 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003198ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003199 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003200 $(MAKE) -C git-gui clean
3201endif
Christian Couder8f26aa42012-12-18 16:26:37 +01003202 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08003203 $(RM) GIT-USER-AGENT GIT-PREFIX
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04003204 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003205ifdef MSVC
3206 $(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3207 $(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3208 $(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3209 $(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3210 $(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3211 $(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3212 $(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3213 $(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3214 $(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3215 $(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3216 $(RM) compat/vcbuild/MSVC-DEFS-GEN
3217endif
Junio C Hamano9b88fce2005-12-27 14:40:17 -08003218
SZEDER Gábor1a966382018-07-23 15:51:00 +02003219.PHONY: all install profile-clean cocciclean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05003220.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Junio C Hamano2f769192010-09-28 16:08:38 -05003221.PHONY: FORCE cscope
Junio C Hamanod89056c2005-12-19 17:59:58 -08003222
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003223### Check documentation
3224#
Johannes Schindelin179227d2020-09-21 22:28:16 +00003225ALL_COMMANDS = $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB)
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003226ALL_COMMANDS += git
Denton Liu805d9ea2020-03-21 05:21:20 -04003227ALL_COMMANDS += git-citool
3228ALL_COMMANDS += git-gui
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003229ALL_COMMANDS += gitk
3230ALL_COMMANDS += gitweb
Elia Pintoe6be2652015-12-15 15:21:00 +00003231
3232.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003233check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07003234 $(MAKE) -C Documentation lint-docs
Johannes Schindelin5ee42462019-03-25 14:41:39 -07003235 @(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003236 do \
3237 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003238 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02003239 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08003240 git-fsck-objects | git-init-db | \
Johannes Schindelin31cf4a62019-04-18 06:16:46 -07003241 git-remote-* | git-stage | git-legacy-* | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08003242 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003243 esac ; \
3244 test -f "Documentation/$$v.txt" || \
3245 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02003246 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08003247 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003248 case "$$v" in \
3249 git) ;; \
3250 *) echo "no link: $$v";; \
3251 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003252 done; \
3253 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02003254 sed -e '1,/^### command list/d' \
3255 -e '/^#/d' \
Johannes Schindelin8e6d6952019-03-25 14:41:38 -07003256 -e '/guide$$/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003257 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08003258 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04003259 $(MAKE) -C Documentation print-man1 | \
3260 grep '\.txt$$' | \
Johannes Schindelin057ccba2019-03-25 14:41:37 -07003261 sed -e 's|^|documented |' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003262 -e 's/\.txt//'; \
3263 ) | while read how cmd; \
3264 do \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003265 case " $(patsubst %$X,%,$(ALL_COMMANDS) $(BUILT_INS) $(EXCLUDED_PROGRAMS)) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003266 *" $$cmd "*) ;; \
3267 *) echo "removed but $$how: $$cmd" ;; \
3268 esac; \
3269 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08003270
3271### Make sure built-ins do not have dups and listed in git.c
3272#
3273check-builtins::
3274 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08003275
Thomas Rast901c3692009-02-19 12:13:35 +01003276### Test suite coverage testing
3277#
Thomas Rast0c38a952013-05-13 23:27:25 +02003278.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00003279.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003280.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01003281
3282coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02003283 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02003284 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01003285
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003286object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003287coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003288 $(RM) $(addsuffix *.gcov,$(object_dirs))
3289 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003290 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003291 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003292 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01003293
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003294coverage-clean: coverage-clean-results
3295 $(RM) $(addsuffix *.gcno,$(object_dirs))
3296
Thomas Rast901c3692009-02-19 12:13:35 +01003297COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
3298COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003299GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01003300
Thomas Rast0c38a952013-05-13 23:27:25 +02003301coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01003302 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02003303
3304coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01003305 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02003306 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01003307
Derrick Stolee22991202019-01-29 09:05:18 -08003308coverage-prove: coverage-clean-results coverage-compile
3309 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
3310 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
3311 -j1 test
3312
Thomas Rast901c3692009-02-19 12:13:35 +01003313coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003314 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02003315 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003316 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00003317
3318coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01003319 grep '^function.*called 0 ' *.c.gcov \
3320 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003321 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003322
3323cover_db: coverage-report
3324 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003325
3326cover_db_html: cover_db
3327 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07003328
Josh Steadmon5e472152018-10-12 17:58:40 -07003329
3330### Fuzz testing
3331#
3332# Building fuzz targets generally requires a special set of compiler flags that
3333# are not necessarily appropriate for general builds, and that vary greatly
3334# depending on the compiler version used.
3335#
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003336# An example command to build against libFuzzer from LLVM 11.0.0:
Josh Steadmon5e472152018-10-12 17:58:40 -07003337#
3338# make CC=clang CXX=clang++ \
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003339# CFLAGS="-fsanitize=fuzzer-no-link,address" \
3340# LIB_FUZZING_ENGINE="-fsanitize=fuzzer" \
Josh Steadmon5e472152018-10-12 17:58:40 -07003341# fuzz-all
3342#
Josh Steadmon927c77e2018-11-14 11:41:47 -08003343FUZZ_CXXFLAGS ?= $(CFLAGS)
3344
Josh Steadmon5e472152018-10-12 17:58:40 -07003345.PHONY: fuzz-all
3346
3347$(FUZZ_PROGRAMS): all
Josh Steadmon927c77e2018-11-14 11:41:47 -08003348 $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07003349 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3350
3351fuzz-all: $(FUZZ_PROGRAMS)