blob: 8d085ab72a1363aadd1713141a440db6f8defa91 [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#
Đoàn Trần Công Danh482c9622021-06-08 13:56:28 +0700401# Define GIT_TEST_UTF8_LOCALE to preferred utf-8 locale for testing.
402# If it isn't set, fallback to $LC_ALL, $LANG or use the first utf-8
403# locale returned by "locale -a".
404#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400405# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -0800406#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400407# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
408#
409# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
410# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
Reuben Hawkins88e01182015-01-08 12:00:57 -0800411#
Kyle J. McKay95290802015-03-07 23:14:36 -0800412# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
Jeff King0cc30e02015-04-16 05:01:38 -0400413#
414# Define HAVE_GETDELIM if your system has the getdelim() function.
Eric Wong995bc222016-08-04 11:40:25 +0000415#
Duy Nguyen18a4f6b2019-02-12 21:14:41 +0700416# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
417#
Clément Chigot400caaf2019-04-25 07:01:56 +0000418# Define NEED_ACCESS_ROOT_HANDLER if access() under root may success for X_OK
419# even if execution permission isn't granted for any user.
420#
Eric Wong995bc222016-08-04 11:40:25 +0000421# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
422# default environment variables to be passed when a pager is spawned, e.g.
423#
424# PAGER_ENV = LESS=FRX LV=-c
425#
426# to say "export LESS=FRX (and LV=-c) if the environment variable
427# LESS (and LV) is not set, respectively".
Eric Sunshineb2289402017-12-15 00:34:34 +0100428#
Jeff King3f824e92017-12-08 05:47:22 -0500429# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
430# running the test scripts (e.g., bash has better support for "set -x"
431# tracing).
Junio C Hamano07b747d2018-01-05 13:28:09 -0800432#
Eric Sunshineb2289402017-12-15 00:34:34 +0100433# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
434# which the built Git will run (for instance "x86_64").
Dan Jacques07d90ea2018-04-10 11:05:43 -0400435#
436# Define RUNTIME_PREFIX to configure Git to resolve its ancillary tooling and
437# support files relative to the location of the runtime binary, rather than
438# hard-coding them into the binary. Git installations built with RUNTIME_PREFIX
439# can be moved to arbitrary filesystem locations. RUNTIME_PREFIX also causes
440# Perl scripts to use a modified entry point header allowing them to resolve
441# support files at runtime.
Dan Jacques226c0dd2018-04-10 11:05:44 -0400442#
443# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
444# supports the KERN_PROC BSD sysctl function.
445#
446# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform
447# mounts a "procfs" filesystem capable of resolving the path of the current
448# executable. If defined, this must be the canonical path for the "procfs"
449# current executable path.
450#
451# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform
452# supports calling _NSGetExecutablePath to retrieve the path of the running
453# executable.
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -0400454#
455# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
456# the global variable _wpgmptr containing the absolute path of the current
457# executable (this is the case on Windows).
Junio C Hamanoe998e7a2018-05-08 15:59:21 +0900458#
Bagas Sanjaya3231f412021-09-05 12:17:56 -0700459# INSTALL_STRIP can be set to "-s" to strip binaries during installation,
460# if your $(INSTALL) command supports the option.
461#
Philippe Blain3821c382020-09-03 22:13:38 +0000462# Define GENERATE_COMPILATION_DATABASE to "yes" to generate JSON compilation
463# database entries during compilation if your compiler supports it, using the
464# `-MJ` flag. The JSON entries will be placed in the `compile_commands/`
465# directory, and the JSON compilation database 'compile_commands.json' will be
466# created at the root of the repository.
467#
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +0000468# Define DEVELOPER to enable more compiler warnings. Compiler version
469# and family are auto detected, but could be overridden by defining
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +0100470# COMPILER_FEATURES (see config.mak.dev). You can still set
471# CFLAGS="..." in combination with DEVELOPER enables, whether that's
472# for tweaking something unrelated (e.g. optimization level), or for
473# selectively overriding something DEVELOPER or one of the DEVOPTS
474# (see just below) brings in.
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000475#
476# When DEVELOPER is set, DEVOPTS can be used to control compiler
477# options. This variable contains keywords separated by
ryenus571fb962019-12-15 15:12:24 +0000478# whitespace. The following keywords are recognized:
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000479#
480# no-error:
481#
482# suppresses the -Werror that implicitly comes with
483# DEVELOPER=1. Useful for getting the full set of errors
484# without immediately dying, or for logging them.
Ævar Arnfjörð Bjarmason26d2e4f2018-04-14 19:19:46 +0000485#
486# extra-all:
487#
488# The DEVELOPER mode enables -Wextra with a few exceptions. By
489# setting this flag the exceptions are removed, and all of
490# -Wextra is used.
Beat Bolli729b3922018-07-24 21:26:43 +0200491#
Carlo Marcelo Arenas Belón6a8cbc42021-09-03 10:02:32 -0700492# no-pedantic:
Beat Bolli729b3922018-07-24 21:26:43 +0200493#
Carlo Marcelo Arenas Belón6a8cbc42021-09-03 10:02:32 -0700494# Disable -pedantic compilation.
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200495
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600496GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100497 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800498-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200499
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100500# Set our default configuration.
501#
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200502# Among the variables below, these:
503# gitexecdir
504# template_dir
Johannes Sixt9fb1e692011-05-09 10:24:55 +0200505# sysconfdir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100506# can be specified as a relative path some/where/else;
507# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200508# runtime figures out where they are based on the path to the executable.
John Keeping971f8532013-02-24 19:55:01 +0000509# Additionally, the following will be treated as relative by "git" if they
510# begin with "$(prefix)/":
511# mandir
512# infodir
513# htmldir
Dan Jacques07d90ea2018-04-10 11:05:43 -0400514# localedir
515# perllibdir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200516# This can help installing the suite in a relocatable way.
517
Pavel Roskinb05701c2005-08-06 01:36:15 -0400518prefix = $(HOME)
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000519bindir = $(prefix)/bin
John Keeping971f8532013-02-24 19:55:01 +0000520mandir = $(prefix)/share/man
521infodir = $(prefix)/share/info
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100522gitexecdir = libexec/git-core
David Aguilarbc7a96a2011-08-18 00:23:46 -0700523mergetoolsdir = $(gitexecdir)/mergetools
Johannes Sixt93547682007-06-11 10:02:17 +0200524sharedir = $(prefix)/share
Pavan Kumar Sunkarabc951962010-05-28 11:55:50 +0530525gitwebdir = $(sharedir)/gitweb
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000526perllibdir = $(sharedir)/perl5
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100527localedir = $(sharedir)/locale
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100528template_dir = share/git-core/templates
John Keeping971f8532013-02-24 19:55:01 +0000529htmldir = $(prefix)/share/doc/git-doc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100530ETC_GITCONFIG = $(sysconfdir)/gitconfig
Petr Onderka6df42ab2010-09-01 00:42:43 +0200531ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
Robert Schiele10861be2007-08-01 06:30:35 +0200532lib = lib
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100533# DESTDIR =
Johannes Schindelin352c8112009-05-23 10:04:48 +0200534pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700535
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000536bindir_relative = $(patsubst $(prefix)/%,%,$(bindir))
John Keeping971f8532013-02-24 19:55:01 +0000537mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
538infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +0000539gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400540localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
John Keeping971f8532013-02-24 19:55:01 +0000541htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400542perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
John Keeping971f8532013-02-24 19:55:01 +0000543
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000544export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200545
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100546# Set our default programs
Ævar Arnfjörð Bjarmason6d62c982011-12-20 23:40:47 +0000547CC = cc
Pavel Roskinb05701c2005-08-06 01:36:15 -0400548AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500549RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000550DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700551TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700552FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400553INSTALL = install
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400554TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700555TCLTK_PATH = wish
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +0000556XGETTEXT = xgettext
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100557MSGFMT = msgfmt
Remi Pommarelf8915872015-10-21 19:10:46 +0200558CURL_CONFIG = curl-config
Thomas Raste146d172010-07-26 09:43:41 +0200559GCOV = gcov
Ævar Arnfjörð Bjarmason9559f8f2019-02-22 15:41:23 +0100560STRIP = strip
René Scharfe63f0a752016-09-15 20:30:56 +0200561SPATCH = spatch
Linus Torvaldse83c5162005-04-07 15:13:13 -0700562
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400563export TCL_PATH TCLTK_PATH
564
Ævar Arnfjörð Bjarmason8fb2a232019-02-22 15:41:25 +0100565# Set our default LIBS variables
566PTHREAD_LIBS = -lpthread
Petr Baudis8d7f5862006-06-25 03:47:03 +0200567
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100568# Guard against environment variables
569BUILTIN_OBJS =
570BUILT_INS =
571COMPAT_CFLAGS =
572COMPAT_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500573XDIFF_OBJS =
Jeff Kingb8ba6292012-06-20 14:30:56 -0400574GENERATED_H =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500575EXTRA_CPPFLAGS =
Josh Steadmon5e472152018-10-12 17:58:40 -0700576FUZZ_OBJS =
577FUZZ_PROGRAMS =
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +0100578GIT_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100579LIB_OBJS =
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +0100580OBJECTS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600581PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100582PROGRAMS =
Johannes Schindelin724d6352019-04-18 06:16:40 -0700583EXCLUDED_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100584SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100585SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100586SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800587SCRIPT_LIB =
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100588TEST_BUILTINS_OBJS =
Ævar Arnfjörð Bjarmasonbed34192021-02-23 12:41:27 +0100589TEST_OBJS =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600590TEST_PROGRAMS_NEED_X =
Denton Liu5dedf7d2019-09-16 12:23:11 -0700591THIRD_PARTY_SOURCES =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100592
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500593# Having this variable in your environment would break pipelines because
594# you cause "cd" to echo its destination to stdout. It can also take
595# scripts to unexpected places. If you like CDPATH, define it for your
596# interactive shell sessions without exporting it.
597unexport CDPATH
598
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700599SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700600SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700601SCRIPT_SH += git-filter-branch.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700602SCRIPT_SH += git-merge-octopus.sh
603SCRIPT_SH += git-merge-one-file.sh
604SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700605SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700606SCRIPT_SH += git-quiltimport.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700607SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700608SCRIPT_SH += git-submodule.sh
609SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200610
Jonathan Nieder46bac902010-01-31 11:46:53 -0800611SCRIPT_LIB += git-mergetool--lib
Alban Gruinc42abfe2018-05-28 14:34:19 +0200612SCRIPT_LIB += git-rebase--preserve-merges
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000613SCRIPT_LIB += git-sh-i18n
Denton Liu805d9ea2020-03-21 05:21:20 -0400614SCRIPT_LIB += git-sh-setup
Jonathan Nieder46bac902010-01-31 11:46:53 -0800615
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700616SCRIPT_PERL += git-add--interactive.perl
617SCRIPT_PERL += git-archimport.perl
618SCRIPT_PERL += git-cvsexportcommit.perl
619SCRIPT_PERL += git-cvsimport.perl
620SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700621SCRIPT_PERL += git-send-email.perl
622SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700623
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400624SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500625
Matthieu Moy4c06b412013-02-08 18:31:16 +0100626# Generated files for scripts
627SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
628SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
629SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
630
631# Individual rules to allow e.g.
632# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
633# from subdirectories like contrib/*/
634.PHONY: build-perl-script build-sh-script build-python-script
635build-perl-script: $(SCRIPT_PERL_GEN)
636build-sh-script: $(SCRIPT_SH_GEN)
637build-python-script: $(SCRIPT_PYTHON_GEN)
638
639.PHONY: install-perl-script install-sh-script install-python-script
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700640install-sh-script: $(SCRIPT_SH_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500641 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700642install-perl-script: $(SCRIPT_PERL_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500643 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700644install-python-script: $(SCRIPT_PYTHON_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500645 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100646
647.PHONY: clean-perl-script clean-sh-script clean-python-script
648clean-sh-script:
649 $(RM) $(SCRIPT_SH_GEN)
650clean-perl-script:
651 $(RM) $(SCRIPT_PERL_GEN)
652clean-python-script:
653 $(RM) $(SCRIPT_PYTHON_GEN)
654
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700655SCRIPTS = $(SCRIPT_SH_GEN) \
656 $(SCRIPT_PERL_GEN) \
657 $(SCRIPT_PYTHON_GEN) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500658 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100659
Junio C Hamano2f769192010-09-28 16:08:38 -0500660ETAGS_TARGET = TAGS
661
Josh Steadmonaa658572019-01-15 14:25:50 -0800662FUZZ_OBJS += fuzz-commit-graph.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700663FUZZ_OBJS += fuzz-pack-headers.o
Josh Steadmon1127a982018-10-12 17:58:41 -0700664FUZZ_OBJS += fuzz-pack-idx.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100665.PHONY: fuzz-objs
666fuzz-objs: $(FUZZ_OBJS)
Josh Steadmon5e472152018-10-12 17:58:40 -0700667
668# Always build fuzz objects even if not testing, to prevent bit-rot.
669all:: $(FUZZ_OBJS)
670
671FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
672
Junio C Hamano42f77402006-08-15 21:38:07 -0700673# Empty...
674EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100675
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700676# ... and all the rest that could be moved out of bindir to gitexecdir
677PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600678
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100679PROGRAM_OBJS += daemon.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700680PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600681PROGRAM_OBJS += imap-send.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700682PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600683PROGRAM_OBJS += shell.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100684.PHONY: program-objs
685program-objs: $(PROGRAM_OBJS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600686
Michael Palimakaace5e972012-02-08 21:59:04 +1100687# Binary suffix, set to .exe for Windows builds
688X =
689
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600690PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700691
Heba Walyb3b18d12020-03-02 20:01:59 +0000692TEST_BUILTINS_OBJS += test-advise.o
Taylor Blau483fa7f2021-03-31 21:32:11 -0400693TEST_BUILTINS_OBJS += test-bitmap.o
Garima Singhf52207a2020-03-30 00:31:24 +0000694TEST_BUILTINS_OBJS += test-bloom.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100695TEST_BUILTINS_OBJS += test-chmtime.o
Nguyễn Thái Ngọc Duy0e2678a2018-03-24 08:44:34 +0100696TEST_BUILTINS_OBJS += test-config.o
Derrick Stolee2fec6042020-09-11 17:49:18 +0000697TEST_BUILTINS_OBJS += test-crontab.o
Nguyễn Thái Ngọc Duye4998942018-03-24 08:44:35 +0100698TEST_BUILTINS_OBJS += test-ctype.o
Nguyễn Thái Ngọc Duya801a7c2018-03-24 08:44:36 +0100699TEST_BUILTINS_OBJS += test-date.o
Nguyễn Thái Ngọc Duy9153dde2018-03-24 08:44:37 +0100700TEST_BUILTINS_OBJS += test-delta.o
Daniel Ferreira150791a2019-07-10 20:58:57 -0300701TEST_BUILTINS_OBJS += test-dir-iterator.o
Nguyễn Thái Ngọc Duy1c854742018-03-24 08:44:38 +0100702TEST_BUILTINS_OBJS += test-drop-caches.o
Nguyễn Thái Ngọc Duy06ccb292018-03-24 08:44:39 +0100703TEST_BUILTINS_OBJS += test-dump-cache-tree.o
Nguyễn Thái Ngọc Duyf1ef0b02018-09-09 19:36:30 +0200704TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
Nguyễn Thái Ngọc Duy81330612018-03-24 08:44:40 +0100705TEST_BUILTINS_OBJS += test-dump-split-index.o
Nguyễn Thái Ngọc Duycd780f02018-09-09 19:36:27 +0200706TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
Nguyễn Thái Ngọc Duydbceb3e2018-03-24 08:44:41 +0100707TEST_BUILTINS_OBJS += test-example-decorate.o
Elijah Newrenfe1a21d2020-10-29 20:32:13 +0000708TEST_BUILTINS_OBJS += test-fast-rebase.o
Nguyễn Thái Ngọc Duyc6806682018-03-24 08:44:42 +0100709TEST_BUILTINS_OBJS += test-genrandom.o
Johannes Schindelind5cfd142019-02-14 13:33:12 -0800710TEST_BUILTINS_OBJS += test-genzeros.o
Ævar Arnfjörð Bjarmason482e1482021-07-30 18:18:14 +0200711TEST_BUILTINS_OBJS += test-getcwd.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400712TEST_BUILTINS_OBJS += test-hash-speed.o
brian m. carlson50c817e2018-11-14 04:09:32 +0000713TEST_BUILTINS_OBJS += test-hash.o
Nguyễn Thái Ngọc Duy7c18cbd2018-03-24 08:44:43 +0100714TEST_BUILTINS_OBJS += test-hashmap.o
Nguyễn Thái Ngọc Duycc6f6632018-03-24 08:44:44 +0100715TEST_BUILTINS_OBJS += test-index-version.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000716TEST_BUILTINS_OBJS += test-json-writer.o
Nguyễn Thái Ngọc Duy64eb82f2018-03-24 08:44:33 +0100717TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
Nguyễn Thái Ngọc Duy9080e752018-03-24 08:44:45 +0100718TEST_BUILTINS_OBJS += test-match-trees.o
Nguyễn Thái Ngọc Duy34889d32018-03-24 08:44:46 +0100719TEST_BUILTINS_OBJS += test-mergesort.o
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +0100720TEST_BUILTINS_OBJS += test-mktemp.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700721TEST_BUILTINS_OBJS += test-oid-array.o
Christian Couder11510de2019-06-15 12:06:59 +0200722TEST_BUILTINS_OBJS += test-oidmap.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000723TEST_BUILTINS_OBJS += test-oidtree.o
Nguyễn Thái Ngọc Duyc033cc12018-03-24 08:44:48 +0100724TEST_BUILTINS_OBJS += test-online-cpus.o
Nguyễn Thái Ngọc Duy2f17c782018-09-09 19:36:29 +0200725TEST_BUILTINS_OBJS += test-parse-options.o
Alexandr Miloslavskiyd0d0a352019-12-31 10:15:12 +0000726TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
Jonathan Tanef830cc2021-06-17 10:13:26 -0700727TEST_BUILTINS_OBJS += test-partial-clone.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
Ævar Arnfjörð Bjarmason28e8f0d2021-04-08 17:04:21 +0200756TEST_BUILTINS_OBJS += test-userdiff.o
Nguyễn Thái Ngọc Duy04892892018-03-24 08:45:04 +0100757TEST_BUILTINS_OBJS += test-wildmatch.o
Jeff Hostetler06ba9d02018-09-11 13:06:01 -0700758TEST_BUILTINS_OBJS += test-windows-named-pipe.o
Nguyễn Thái Ngọc Duyc81f8432018-03-24 08:45:05 +0100759TEST_BUILTINS_OBJS += test-write-cache.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400760TEST_BUILTINS_OBJS += test-xml-encode.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100761
Nguyễn Thái Ngọc Duyc9a1f412018-09-09 19:36:31 +0200762# Do not add more tests here unless they have extra dependencies. Add
763# them in TEST_BUILTINS_OBJS above.
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100764TEST_PROGRAMS_NEED_X += test-fake-ssh
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100765TEST_PROGRAMS_NEED_X += test-tool
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600766
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700767TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100768
Junio C Hamano17368552008-02-23 11:08:25 -0800769# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800770# builtin/$C.o but is linked in as part of some other command.
771BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700772
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700773BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100774BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700775BUILT_INS += git-format-patch$X
776BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700777BUILT_INS += git-init$X
Jeff King0a21d0e2020-12-01 21:34:11 -0500778BUILT_INS += git-maintenance$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700779BUILT_INS += git-merge-subtree$X
Nguyễn Thái Ngọc Duy46e91b62019-04-25 16:45:45 +0700780BUILT_INS += git-restore$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700781BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800782BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700783BUILT_INS += git-status$X
Nguyễn Thái Ngọc Duyd787d312019-03-29 17:39:05 +0700784BUILT_INS += git-switch$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700785BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700786
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700787# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400788OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700789
Matthew Ogilvieea925192009-12-02 22:14:05 -0700790# what test wrappers are needed and 'install' will install, in bindir
791BINDIR_PROGRAMS_NEED_X += git
Matthew Ogilvieea925192009-12-02 22:14:05 -0700792BINDIR_PROGRAMS_NEED_X += git-receive-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700793BINDIR_PROGRAMS_NEED_X += git-shell
Denton Liu805d9ea2020-03-21 05:21:20 -0400794BINDIR_PROGRAMS_NEED_X += git-upload-archive
795BINDIR_PROGRAMS_NEED_X += git-upload-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700796
797BINDIR_PROGRAMS_NO_X += git-cvsserver
798
Ryan Anderson3d320512005-11-21 00:11:22 -0500799# Set paths to tools early so that they can be used for version tests.
800ifndef SHELL_PATH
801 SHELL_PATH = /bin/sh
802endif
803ifndef PERL_PATH
804 PERL_PATH = /usr/bin/perl
805endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100806ifndef PYTHON_PATH
807 PYTHON_PATH = /usr/bin/python
808endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700809
Luben Tuikov3a793472006-12-14 23:03:03 -0800810export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100811export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800812
Jeff King3f824e92017-12-08 05:47:22 -0500813TEST_SHELL_PATH = $(SHELL_PATH)
814
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100815LIB_FILE = libgit.a
816XDIFF_LIB = xdiff/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700817
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +0200818GENERATED_H += command-list.h
Denton Liu8474f262020-10-08 00:39:26 -0700819GENERATED_H += config-list.h
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700820
Denton Liucf6a2d22019-09-16 12:23:08 -0700821LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
Johannes Schindelin92b88eb2019-03-04 05:47:06 -0800822 $(FIND) . \
Jeff Kingd85b0df2014-08-25 16:00:42 -0400823 -name .git -prune -o \
824 -name t -prune -o \
825 -name Documentation -prune -o \
Denton Liucf6a2d22019-09-16 12:23:08 -0700826 -name '*.h' -print)))
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700827
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400828LIB_OBJS += abspath.o
Johannes Schindelinf83dff62019-11-13 12:40:57 +0000829LIB_OBJS += add-interactive.o
Johannes Schindelinf6aa7ec2019-12-13 08:07:48 +0000830LIB_OBJS += add-patch.o
Jeff King75194432009-09-09 07:38:58 -0400831LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700832LIB_OBJS += alias.o
833LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200834LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700835LIB_OBJS += archive-tar.o
836LIB_OBJS += archive-zip.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400837LIB_OBJS += archive.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700838LIB_OBJS += attr.o
839LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100840LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500841LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700842LIB_OBJS += blob.o
Garima Singhf52207a2020-03-30 00:31:24 +0000843LIB_OBJS += bloom.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700844LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700845LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700846LIB_OBJS += bundle.o
847LIB_OBJS += cache-tree.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000848LIB_OBJS += cbtree.o
Jeff King2b5ed372018-03-30 14:35:04 -0400849LIB_OBJS += chdir-notify.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000850LIB_OBJS += checkout.o
Derrick Stolee570df422021-02-18 14:07:24 +0000851LIB_OBJS += chunk-format.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700852LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700853LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700854LIB_OBJS += combine-diff.o
Derrick Stolee08fd81c2018-04-02 16:34:19 -0400855LIB_OBJS += commit-graph.o
Derrick Stolee5227c382018-07-20 16:33:02 +0000856LIB_OBJS += commit-reach.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400857LIB_OBJS += commit.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200858LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500859LIB_OBJS += compat/terminal.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700860LIB_OBJS += config.o
861LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700862LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700863LIB_OBJS += convert.o
864LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500865LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700866LIB_OBJS += csum-file.o
867LIB_OBJS += ctype.o
868LIB_OBJS += date.o
869LIB_OBJS += decorate.o
Jeff Kingc8d521f2018-08-16 08:13:07 +0200870LIB_OBJS += delta-islands.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400871LIB_OBJS += diff-delta.o
Sergey Organova37eec62020-12-21 18:19:33 +0300872LIB_OBJS += diff-merges.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400873LIB_OBJS += diff-lib.o
874LIB_OBJS += diff-no-index.o
875LIB_OBJS += diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700876LIB_OBJS += diffcore-break.o
877LIB_OBJS += diffcore-delta.o
878LIB_OBJS += diffcore-order.o
879LIB_OBJS += diffcore-pickaxe.o
880LIB_OBJS += diffcore-rename.o
Junio C Hamano1eb41362021-02-11 11:57:50 -0800881LIB_OBJS += diffcore-rotate.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200882LIB_OBJS += dir-iterator.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400883LIB_OBJS += dir.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200884LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700885LIB_OBJS += entry.o
886LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500887LIB_OBJS += ewah/bitmap.o
888LIB_OBJS += ewah/ewah_bitmap.o
889LIB_OBJS += ewah/ewah_io.o
890LIB_OBJS += ewah/ewah_rlw.o
Stefan Bellerd807c4a2018-04-10 14:26:18 -0700891LIB_OBJS += exec-cmd.o
Jonathan Tanec062832018-06-14 15:54:28 -0700892LIB_OBJS += fetch-negotiator.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700893LIB_OBJS += fetch-pack.o
Denton Liuce6521e2020-03-23 21:07:51 -0400894LIB_OBJS += fmt-merge-msg.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700895LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400896LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100897LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700898LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700899LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700900LIB_OBJS += grep.o
Martin Ågrenbc626922020-12-31 12:56:23 +0100901LIB_OBJS += hash-lookup.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100902LIB_OBJS += hashmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700903LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800904LIB_OBJS += hex.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700905LIB_OBJS += ident.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000906LIB_OBJS += json-writer.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200907LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200908LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100909LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100910LIB_OBJS += line-range.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400911LIB_OBJS += linear-assignment.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000912LIB_OBJS += list-objects-filter-options.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400913LIB_OBJS += list-objects-filter.o
914LIB_OBJS += list-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700915LIB_OBJS += ll-merge.o
916LIB_OBJS += lockfile.o
917LIB_OBJS += log-tree.o
Brandon Williams72d0ea02018-03-15 10:31:20 -0700918LIB_OBJS += ls-refs.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700919LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700920LIB_OBJS += mailmap.o
921LIB_OBJS += match-trees.o
Jameson Miller065feab2018-04-11 18:37:55 +0000922LIB_OBJS += mem-pool.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800923LIB_OBJS += merge-blobs.o
Elijah Newren17e55742020-10-27 02:08:07 +0000924LIB_OBJS += merge-ort.o
Elijah Newren47b1e892020-10-27 02:08:08 +0000925LIB_OBJS += merge-ort-wrappers.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200926LIB_OBJS += merge-recursive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400927LIB_OBJS += merge.o
René Scharfe0db71e02012-04-01 00:10:11 +0200928LIB_OBJS += mergesort.o
Derrick Stoleea3407732018-07-12 15:39:21 -0400929LIB_OBJS += midx.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700930LIB_OBJS += name-hash.o
Jonathan Tanec062832018-06-14 15:54:28 -0700931LIB_OBJS += negotiator/default.o
Jonathan Tancbe566a2020-08-17 21:01:31 -0700932LIB_OBJS += negotiator/noop.o
Jonathan Tan42cc7482018-07-16 11:44:01 -0700933LIB_OBJS += negotiator/skipping.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400934LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100935LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200936LIB_OBJS += notes-utils.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400937LIB_OBJS += notes.o
Martin Ågrene5afd442020-12-31 12:56:21 +0100938LIB_OBJS += object-file.o
Martin Ågren1e6771e2020-12-31 12:56:20 +0100939LIB_OBJS += object-name.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700940LIB_OBJS += object.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700941LIB_OBJS += oid-array.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700942LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500943LIB_OBJS += oidset.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000944LIB_OBJS += oidtree.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500945LIB_OBJS += pack-bitmap-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400946LIB_OBJS += pack-bitmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700947LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400948LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700949LIB_OBJS += pack-revindex.o
950LIB_OBJS += pack-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400951LIB_OBJS += packfile.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700952LIB_OBJS += pager.o
Matheus Tavares04155bd2021-04-18 21:14:53 -0300953LIB_OBJS += parallel-checkout.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600954LIB_OBJS += parse-options-cb.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400955LIB_OBJS += parse-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700956LIB_OBJS += patch-delta.o
957LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700958LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000959LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700960LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100961LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700962LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700963LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700964LIB_OBJS += progress.o
Christian Couder48de3152019-06-25 15:40:27 +0200965LIB_OBJS += promisor-remote.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500966LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700967LIB_OBJS += protocol.o
Bruno Albuquerquea2ba1622021-04-20 16:38:31 -0700968LIB_OBJS += protocol-caps.o
Denton Liu9460fd42020-03-23 21:07:52 -0400969LIB_OBJS += prune-packed.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700970LIB_OBJS += quote.o
Johannes Schindelind9c66f02018-08-13 04:33:04 -0700971LIB_OBJS += range-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700972LIB_OBJS += reachable.o
973LIB_OBJS += read-cache.o
Alban Gruin145e05a2018-08-10 18:51:29 +0200974LIB_OBJS += rebase-interactive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400975LIB_OBJS += rebase.o
976LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700977LIB_OBJS += reflog-walk.o
978LIB_OBJS += refs.o
Han-Wen Nienhuys4441f422020-09-09 10:15:08 +0000979LIB_OBJS += refs/debug.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100980LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200981LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200982LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200983LIB_OBJS += refs/ref-cache.o
Brandon Williamsec0cb492018-05-16 15:57:48 -0700984LIB_OBJS += refspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700985LIB_OBJS += remote.o
Stefan Beller11bc0582018-04-10 14:26:21 -0700986LIB_OBJS += replace-object.o
Derrick Stolee7211b9e2019-08-13 11:37:43 -0700987LIB_OBJS += repo-settings.o
Brandon Williams359efef2017-06-22 11:43:32 -0700988LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200989LIB_OBJS += rerere.o
Denton Liub309a972020-04-07 10:28:00 -0400990LIB_OBJS += reset.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800991LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700992LIB_OBJS += revision.o
993LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +0700994LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700995LIB_OBJS += sequencer.o
Brandon Williamsed10cb92018-03-15 10:31:19 -0700996LIB_OBJS += serve.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700997LIB_OBJS += server-info.o
998LIB_OBJS += setup.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700999LIB_OBJS += shallow.o
1000LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -05001001LIB_OBJS += sigchain.o
Derrick Stolee3964fc22021-03-30 13:10:47 +00001002LIB_OBJS += sparse-index.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +07001003LIB_OBJS += split-index.o
Johannes Schindelin97fff612019-09-30 10:21:54 -07001004LIB_OBJS += stable-qsort.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001005LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -07001006LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001007LIB_OBJS += string-list.o
Elijah Newrenae20bf12020-11-02 18:55:06 +00001008LIB_OBJS += strmap.o
Denton Liu8474f262020-10-08 00:39:26 -07001009LIB_OBJS += strvec.o
Ben Peart99605d62017-05-05 11:28:01 -04001010LIB_OBJS += sub-process.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001011LIB_OBJS += submodule-config.o
1012LIB_OBJS += submodule.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001013LIB_OBJS += symlinks.o
1014LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +02001015LIB_OBJS += tempfile.o
Nguyễn Thái Ngọc Duy0ec79352018-10-27 19:29:59 +02001016LIB_OBJS += thread-utils.o
Jeff King2564d992016-10-03 16:49:11 -04001017LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001018LIB_OBJS += trace.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001019LIB_OBJS += trace2.o
1020LIB_OBJS += trace2/tr2_cfg.o
1021LIB_OBJS += trace2/tr2_cmd_name.o
1022LIB_OBJS += trace2/tr2_dst.o
1023LIB_OBJS += trace2/tr2_sid.o
Jeff Hostetlerbce9db62019-04-15 13:39:47 -07001024LIB_OBJS += trace2/tr2_sysenv.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001025LIB_OBJS += trace2/tr2_tbuf.o
1026LIB_OBJS += trace2/tr2_tgt_event.o
1027LIB_OBJS += trace2/tr2_tgt_normal.o
1028LIB_OBJS += trace2/tr2_tgt_perf.o
1029LIB_OBJS += trace2/tr2_tls.o
Christian Couder9385b5d2014-10-13 20:16:23 +02001030LIB_OBJS += trailer.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -04001031LIB_OBJS += transport-helper.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001032LIB_OBJS += transport.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001033LIB_OBJS += tree-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001034LIB_OBJS += tree-walk.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001035LIB_OBJS += tree.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001036LIB_OBJS += unpack-trees.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001037LIB_OBJS += upload-pack.o
Jeff King638794c2010-05-23 05:17:55 -04001038LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -07001039LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001040LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001041LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001042LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -07001043LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -04001044LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +07001045LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001046LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +07001047LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -04001048LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -07001049LIB_OBJS += wrapper.o
Stefan Bellerfa2656f2018-04-10 14:26:16 -07001050LIB_OBJS += write-or-die.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001051LIB_OBJS += ws.o
1052LIB_OBJS += wt-status.o
1053LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -05001054LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +02001055
Linus Torvalds81b50f32010-02-22 08:42:18 -08001056BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +08001057BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001058BUILTIN_OBJS += builtin/annotate.o
1059BUILTIN_OBJS += builtin/apply.o
1060BUILTIN_OBJS += builtin/archive.o
1061BUILTIN_OBJS += builtin/bisect--helper.o
1062BUILTIN_OBJS += builtin/blame.o
1063BUILTIN_OBJS += builtin/branch.o
Jeff Kingd7a56492020-08-13 10:59:36 -04001064BUILTIN_OBJS += builtin/bugreport.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001065BUILTIN_OBJS += builtin/bundle.o
1066BUILTIN_OBJS += builtin/cat-file.o
1067BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +00001068BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -04001069BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001070BUILTIN_OBJS += builtin/check-ref-format.o
Matheus Tavarese9e8adf2021-04-18 21:14:54 -03001071BUILTIN_OBJS += builtin/checkout--worker.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001072BUILTIN_OBJS += builtin/checkout-index.o
1073BUILTIN_OBJS += builtin/checkout.o
1074BUILTIN_OBJS += builtin/clean.o
1075BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +07001076BUILTIN_OBJS += builtin/column.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001077BUILTIN_OBJS += builtin/commit-graph.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001078BUILTIN_OBJS += builtin/commit-tree.o
1079BUILTIN_OBJS += builtin/commit.o
1080BUILTIN_OBJS += builtin/config.o
1081BUILTIN_OBJS += builtin/count-objects.o
Denton Liu8474f262020-10-08 00:39:26 -07001082BUILTIN_OBJS += builtin/credential-cache--daemon.o
1083BUILTIN_OBJS += builtin/credential-cache.o
1084BUILTIN_OBJS += builtin/credential-store.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +02001085BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001086BUILTIN_OBJS += builtin/describe.o
1087BUILTIN_OBJS += builtin/diff-files.o
1088BUILTIN_OBJS += builtin/diff-index.o
1089BUILTIN_OBJS += builtin/diff-tree.o
1090BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +01001091BUILTIN_OBJS += builtin/difftool.o
Ævar Arnfjörð Bjarmasonb4f207f2019-06-21 12:18:06 +02001092BUILTIN_OBJS += builtin/env--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001093BUILTIN_OBJS += builtin/fast-export.o
Jeff Kinga006f872020-08-13 10:59:45 -04001094BUILTIN_OBJS += builtin/fast-import.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001095BUILTIN_OBJS += builtin/fetch-pack.o
1096BUILTIN_OBJS += builtin/fetch.o
1097BUILTIN_OBJS += builtin/fmt-merge-msg.o
1098BUILTIN_OBJS += builtin/for-each-ref.o
Derrick Stolee4950b2a2020-09-11 17:49:16 +00001099BUILTIN_OBJS += builtin/for-each-repo.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001100BUILTIN_OBJS += builtin/fsck.o
1101BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -08001102BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001103BUILTIN_OBJS += builtin/grep.o
1104BUILTIN_OBJS += builtin/hash-object.o
1105BUILTIN_OBJS += builtin/help.o
1106BUILTIN_OBJS += builtin/index-pack.o
1107BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +02001108BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001109BUILTIN_OBJS += builtin/log.o
1110BUILTIN_OBJS += builtin/ls-files.o
1111BUILTIN_OBJS += builtin/ls-remote.o
1112BUILTIN_OBJS += builtin/ls-tree.o
1113BUILTIN_OBJS += builtin/mailinfo.o
1114BUILTIN_OBJS += builtin/mailsplit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001115BUILTIN_OBJS += builtin/merge-base.o
1116BUILTIN_OBJS += builtin/merge-file.o
1117BUILTIN_OBJS += builtin/merge-index.o
1118BUILTIN_OBJS += builtin/merge-ours.o
1119BUILTIN_OBJS += builtin/merge-recursive.o
1120BUILTIN_OBJS += builtin/merge-tree.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001121BUILTIN_OBJS += builtin/merge.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001122BUILTIN_OBJS += builtin/mktag.o
1123BUILTIN_OBJS += builtin/mktree.o
Derrick Stolee6a257f02018-07-12 15:39:20 -04001124BUILTIN_OBJS += builtin/multi-pack-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001125BUILTIN_OBJS += builtin/mv.o
1126BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -07001127BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001128BUILTIN_OBJS += builtin/pack-objects.o
1129BUILTIN_OBJS += builtin/pack-redundant.o
1130BUILTIN_OBJS += builtin/pack-refs.o
1131BUILTIN_OBJS += builtin/patch-id.o
1132BUILTIN_OBJS += builtin/prune-packed.o
1133BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001134BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001135BUILTIN_OBJS += builtin/push.o
Johannes Schindelin348ae562018-08-13 04:33:02 -07001136BUILTIN_OBJS += builtin/range-diff.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001137BUILTIN_OBJS += builtin/read-tree.o
Pratik Karki55071ea2018-08-07 01:16:09 +05451138BUILTIN_OBJS += builtin/rebase.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001139BUILTIN_OBJS += builtin/receive-pack.o
1140BUILTIN_OBJS += builtin/reflog.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001141BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001142BUILTIN_OBJS += builtin/remote-fd.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001143BUILTIN_OBJS += builtin/remote.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001144BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001145BUILTIN_OBJS += builtin/replace.o
1146BUILTIN_OBJS += builtin/rerere.o
1147BUILTIN_OBJS += builtin/reset.o
1148BUILTIN_OBJS += builtin/rev-list.o
1149BUILTIN_OBJS += builtin/rev-parse.o
1150BUILTIN_OBJS += builtin/revert.o
1151BUILTIN_OBJS += builtin/rm.o
1152BUILTIN_OBJS += builtin/send-pack.o
1153BUILTIN_OBJS += builtin/shortlog.o
1154BUILTIN_OBJS += builtin/show-branch.o
Jeff Kingff417262018-05-28 05:38:53 -04001155BUILTIN_OBJS += builtin/show-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001156BUILTIN_OBJS += builtin/show-ref.o
Derrick Stolee94c09562019-11-21 22:04:33 +00001157BUILTIN_OBJS += builtin/sparse-checkout.o
Paul-Sebastian Ungureanu40af1462019-02-25 23:16:28 +00001158BUILTIN_OBJS += builtin/stash.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001159BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001160BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001161BUILTIN_OBJS += builtin/symbolic-ref.o
1162BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001163BUILTIN_OBJS += builtin/unpack-file.o
1164BUILTIN_OBJS += builtin/unpack-objects.o
1165BUILTIN_OBJS += builtin/update-index.o
1166BUILTIN_OBJS += builtin/update-ref.o
1167BUILTIN_OBJS += builtin/update-server-info.o
1168BUILTIN_OBJS += builtin/upload-archive.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001169BUILTIN_OBJS += builtin/upload-pack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001170BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001171BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001172BUILTIN_OBJS += builtin/verify-pack.o
1173BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001174BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001175BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001176
Denton Liu5dedf7d2019-09-16 12:23:11 -07001177# THIRD_PARTY_SOURCES is a list of patterns compatible with the
1178# $(filter) and $(filter-out) family of functions. They specify source
1179# files which are taken from some third-party source where we want to be
1180# less strict about issues such as coding style so we don't diverge from
1181# upstream unnecessarily (making merging in future changes easier).
1182THIRD_PARTY_SOURCES += compat/inet_ntop.c
1183THIRD_PARTY_SOURCES += compat/inet_pton.c
1184THIRD_PARTY_SOURCES += compat/nedmalloc/%
1185THIRD_PARTY_SOURCES += compat/obstack.%
1186THIRD_PARTY_SOURCES += compat/poll/%
1187THIRD_PARTY_SOURCES += compat/regex/%
1188THIRD_PARTY_SOURCES += sha1collisiondetection/%
1189THIRD_PARTY_SOURCES += sha1dc/%
1190
Jeff King3f2e2292016-07-01 01:58:58 -04001191GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +02001192EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001193
Jeff King42dcbb72012-06-02 15:01:12 -04001194GIT_USER_AGENT = git/$(GIT_VERSION)
1195
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001196ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1197DC_SHA1_SUBMODULE = auto
1198endif
1199
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001200# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1201# tweaked by config.* below as well as the command-line, both of
1202# which'll override these defaults.
1203CFLAGS = -g -O2 -Wall
1204LDFLAGS =
Ævar Arnfjörð Bjarmason0f50c8e2019-05-17 23:58:47 +02001205CC_LD_DYNPATH = -Wl,-rpath,
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001206BASIC_CFLAGS = -I.
1207BASIC_LDFLAGS =
1208
1209# library flags
1210ARFLAGS = rcs
1211PTHREAD_CFLAGS =
1212
1213# For the 'sparse' target
1214SPARSE_FLAGS ?=
Luc Van Oostenryck1c9664232020-05-22 02:25:02 +02001215SP_EXTRA_FLAGS = -Wno-universal-initializer
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001216
Jeff King960154b2019-05-06 19:43:34 -04001217# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
1218# usually result in less CPU usage at the cost of higher peak memory.
Jeff Kingbcb4edf2019-05-08 03:07:54 -04001219# Setting it to 0 will feed all files in a single spatch invocation.
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001220SPATCH_FLAGS = --all-includes --patch .
Jeff King960154b2019-05-06 19:43:34 -04001221SPATCH_BATCH_SIZE = 1
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001222
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001223include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001224-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001225-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001226
Matthieu Moyd6156282016-05-31 15:24:43 +02001227ifdef DEVELOPER
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +00001228include config.mak.dev
Matthieu Moyd6156282016-05-31 15:24:43 +02001229endif
1230
Johannes Schindelin4a5ec7d2021-01-21 13:09:45 +00001231# what 'all' will build and 'install' will install in gitexecdir,
1232# excluding programs for built-in commands
1233ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
1234ALL_COMMANDS_TO_INSTALL = $(ALL_PROGRAMS)
1235ifeq (,$(SKIP_DASHED_BUILT_INS))
1236ALL_COMMANDS_TO_INSTALL += $(BUILT_INS)
1237else
1238# git-upload-pack, git-receive-pack and git-upload-archive are special: they
1239# are _expected_ to be present in the `bin/` directory in their dashed form.
1240ALL_COMMANDS_TO_INSTALL += git-receive-pack$(X)
1241ALL_COMMANDS_TO_INSTALL += git-upload-archive$(X)
1242ALL_COMMANDS_TO_INSTALL += git-upload-pack$(X)
1243endif
1244
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +01001245ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001246ALL_LDFLAGS = $(LDFLAGS)
1247
René Scharfe425ca672017-07-15 19:18:56 +02001248comma := ,
1249empty :=
1250space := $(empty) $(empty)
1251
Jeff King56b5db32017-07-10 09:24:42 -04001252ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001253SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001254BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001255BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001256ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King07a20f52019-03-12 17:06:26 -04001257BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
Jeff King566cf0b2017-07-10 09:24:50 -04001258endif
Jeff King0e5bba52017-09-08 02:38:41 -04001259ifneq ($(filter leak,$(SANITIZERS)),)
1260BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
1261endif
Jeff Kingf65d07f2020-01-16 12:51:38 -05001262ifneq ($(filter address,$(SANITIZERS)),)
1263NO_REGEX = NeededForASAN
1264endif
Jeff King56b5db32017-07-10 09:24:42 -04001265endif
1266
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001267ifndef sysconfdir
1268ifeq ($(prefix),/usr)
1269sysconfdir = /etc
1270else
1271sysconfdir = etc
1272endif
1273endif
1274
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001275ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001276COMPUTE_HEADER_DEPENDENCIES = auto
1277endif
1278
1279ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001280dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Jonathan Nieder69789342011-11-18 17:23:24 -06001281 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1282 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001283 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001284ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001285override COMPUTE_HEADER_DEPENDENCIES = yes
1286else
1287override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001288endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001289endif
1290
Jonathan Nieder024c8432011-11-18 03:58:21 -06001291ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001292USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001293else
1294ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1295$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1296(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1297endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001298endif
1299
Philippe Blain3821c382020-09-03 22:13:38 +00001300ifndef GENERATE_COMPILATION_DATABASE
1301GENERATE_COMPILATION_DATABASE = no
1302endif
1303
1304ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
1305compdb_check = $(shell $(CC) $(ALL_CFLAGS) \
1306 -c -MJ /dev/null \
1307 -x c /dev/null -o /dev/null 2>&1; \
1308 echo $$?)
1309ifneq ($(compdb_check),0)
1310override GENERATE_COMPILATION_DATABASE = no
1311$(warning GENERATE_COMPILATION_DATABASE is set to "yes", but your compiler does not \
1312support generating compilation database entries)
1313endif
1314else
1315ifneq ($(GENERATE_COMPILATION_DATABASE),no)
1316$(error please set GENERATE_COMPILATION_DATABASE to "yes" or "no" \
1317(not "$(GENERATE_COMPILATION_DATABASE)"))
1318endif
1319endif
1320
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001321ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001322SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
Jeff Hostetlerc444bf82019-06-19 14:06:06 -07001323BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001324PATH := $(SANE_TOOL_PATH):${PATH}
1325else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001326BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001327endif
1328
Eric Sunshineb2289402017-12-15 00:34:34 +01001329ifeq (,$(HOST_CPU))
1330 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1331else
1332 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1333endif
1334
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001335ifneq (,$(INLINE))
1336 BASIC_CFLAGS += -Dinline=$(INLINE)
1337endif
1338
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001339ifneq (,$(SOCKLEN_T))
1340 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1341endif
1342
Brian Gernhardt59f86742006-12-12 12:01:47 -05001343ifeq ($(uname_S),Darwin)
1344 ifndef NO_FINK
1345 ifeq ($(shell test -d /sw/lib && echo y),y)
1346 BASIC_CFLAGS += -I/sw/include
1347 BASIC_LDFLAGS += -L/sw/lib
1348 endif
1349 endif
1350 ifndef NO_DARWIN_PORTS
1351 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1352 BASIC_CFLAGS += -I/opt/local/include
1353 BASIC_LDFLAGS += -L/opt/local/lib
1354 endif
1355 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001356 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001357 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001358 APPLE_COMMON_CRYPTO = YesPlease
1359 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1360 endif
David Aguilar29de2052013-05-11 01:22:26 -07001361 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001362 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001363endif
1364
David Aguilare1c06882009-05-31 01:35:51 -07001365ifdef NO_LIBGEN_H
1366 COMPAT_CFLAGS += -DNO_LIBGEN_H
1367 COMPAT_OBJS += compat/basename.o
1368endif
1369
Ævar Arnfjörð Bjarmason75997302021-01-24 02:58:33 +01001370ifdef USE_LIBPCRE1
1371$(error The USE_LIBPCRE1 build option has been removed, use version 2 with USE_LIBPCRE)
1372endif
1373
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001374USE_LIBPCRE2 ?= $(USE_LIBPCRE)
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001375
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001376ifneq (,$(USE_LIBPCRE2))
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001377 BASIC_CFLAGS += -DUSE_LIBPCRE2
1378 EXTLIBS += -lpcre2-8
1379endif
1380
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001381ifdef LIBPCREDIR
1382 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1383 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001384endif
1385
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001386ifdef HAVE_ALLOCA_H
1387 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1388endif
1389
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001390IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001391IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001392
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001393ifdef NO_CURL
1394 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001395 REMOTE_CURL_PRIMARY =
1396 REMOTE_CURL_ALIASES =
1397 REMOTE_CURL_NAMES =
Johannes Schindelin724d6352019-04-18 06:16:40 -07001398 EXCLUDED_PROGRAMS += git-http-fetch git-http-push
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001399else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001400 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001401 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
Jeff King897d68e2020-03-26 04:08:55 -04001402 CURL_CFLAGS = -I$(CURLDIR)/include
James Knight23c4bbe2018-11-03 05:12:11 +00001403 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001404 else
Jeff King897d68e2020-03-26 04:08:55 -04001405 CURL_CFLAGS =
James Knight23c4bbe2018-11-03 05:12:11 +00001406 CURL_LIBCURL =
Junio C Hamanob2feb642014-04-30 10:58:10 -07001407 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001408
Jeff King94a88e22020-03-26 04:06:45 -04001409 ifndef CURL_LDFLAGS
Jeff King05738312020-04-04 10:58:29 -04001410 CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
Jeff King94a88e22020-03-26 04:06:45 -04001411 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001412 CURL_LIBCURL += $(CURL_LDFLAGS)
Thomas Cortbc5f8132011-07-19 18:55:47 -04001413
Jeff King897d68e2020-03-26 04:08:55 -04001414 ifndef CURL_CFLAGS
Jeff King05738312020-04-04 10:58:29 -04001415 CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
Jeff King897d68e2020-03-26 04:08:55 -04001416 endif
1417 BASIC_CFLAGS += $(CURL_CFLAGS)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001418
Johannes Sixt4256f362010-01-19 16:39:12 +01001419 REMOTE_CURL_PRIMARY = git-remote-http$X
1420 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1421 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001422 PROGRAM_OBJS += http-fetch.o
1423 PROGRAMS += $(REMOTE_CURL_NAMES)
Remi Pommarelf8915872015-10-21 19:10:46 +02001424 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 -08001425 ifeq "$(curl_check)" "070908"
1426 ifndef NO_EXPAT
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001427 PROGRAM_OBJS += http-push.o
Johannes Schindelin724d6352019-04-18 06:16:40 -07001428 else
1429 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld08900982005-11-18 17:08:36 -08001430 endif
Johannes Schindelin724d6352019-04-18 06:16:40 -07001431 else
1432 EXCLUDED_PROGRAMS += git-http-push
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001433 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001434 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 +01001435 ifeq "$(curl_check)" "072200"
1436 USE_CURL_FOR_IMAP_SEND = YesPlease
1437 endif
1438 ifdef USE_CURL_FOR_IMAP_SEND
1439 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1440 IMAP_SEND_BUILDDEPS = http.o
1441 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1442 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001443 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001444 ifdef EXPATDIR
1445 BASIC_CFLAGS += -I$(EXPATDIR)/include
1446 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1447 else
1448 EXPAT_LIBEXPAT = -lexpat
1449 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001450 ifdef EXPAT_NEEDS_XMLPARSE_H
1451 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1452 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001453 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001454endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001455IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001456
Robert Schielebef19da2007-07-29 20:35:45 +02001457ifdef ZLIB_PATH
1458 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001459 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001460endif
1461EXTLIBS += -lz
1462
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001463ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001464 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001465 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001466 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001467 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001468 else
1469 OPENSSL_LINK =
1470 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001471 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001472 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001473 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001474else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001475 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001476 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001477endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001478ifdef NO_OPENSSL
1479 LIB_4_CRYPTO =
1480else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001481ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001482 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001483else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001484 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001485endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001486ifdef APPLE_COMMON_CRYPTO
1487 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1488endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001489endif
Eric Sunshinefdb1fbb2018-06-14 22:25:03 -04001490ifndef NO_ICONV
1491 ifdef NEEDS_LIBICONV
1492 ifdef ICONVDIR
1493 BASIC_CFLAGS += -I$(ICONVDIR)/include
1494 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1495 else
1496 ICONV_LINK =
1497 endif
1498 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1499 ICONV_LINK += -lintl
1500 endif
1501 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano455a7f32005-09-30 13:31:16 -07001502 endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001503endif
brian m. carlson79444c92019-02-12 00:52:06 +00001504ifdef ICONV_OMITS_BOM
1505 BASIC_CFLAGS += -DICONV_OMITS_BOM
1506endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001507ifdef NEEDS_LIBGEN
1508 EXTLIBS += -lgen
1509endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001510ifndef NO_GETTEXT
1511ifndef LIBC_CONTAINS_LIBINTL
1512 EXTLIBS += -lintl
1513endif
1514endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001515ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001516 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001517endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001518ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001519 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001520endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001521ifdef NEEDS_RESOLV
1522 EXTLIBS += -lresolv
1523endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001524ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001525 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001526endif
David Michael110d6982012-12-14 14:56:59 -05001527ifdef NO_GECOS_IN_PWENT
1528 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1529endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001530ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1531 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1532endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001533ifdef USE_NSEC
1534 BASIC_CFLAGS += -DUSE_NSEC
1535endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001536ifdef USE_ST_TIMESPEC
1537 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1538endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001539ifdef NO_NORETURN
1540 BASIC_CFLAGS += -DNO_NORETURN
1541endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001542ifdef NO_NSEC
1543 BASIC_CFLAGS += -DNO_NSEC
1544endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001545ifdef SNPRINTF_RETURNS_BOGUS
1546 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1547 COMPAT_OBJS += compat/snprintf.o
1548endif
Brandon Caseycba22522008-02-08 20:32:47 -06001549ifdef FREAD_READS_DIRECTORIES
1550 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1551 COMPAT_OBJS += compat/fopen.o
1552endif
Jeff King2b081012021-02-26 01:14:35 -05001553ifdef OPEN_RETURNS_EINTR
1554 COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR
1555 COMPAT_OBJS += compat/open.o
1556endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001557ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001558 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001559endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001560ifdef NO_GETTEXT
1561 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001562 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001563endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001564ifdef NO_POLL
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001565 NO_POLL_H = YesPlease
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001566 NO_SYS_POLL_H = YesPlease
1567 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1568 COMPAT_OBJS += compat/poll/poll.o
1569endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001570ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001571 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001572 COMPAT_OBJS += compat/strcasestr.o
1573endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001574ifdef NO_STRLCPY
1575 COMPAT_CFLAGS += -DNO_STRLCPY
1576 COMPAT_OBJS += compat/strlcpy.o
1577endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001578ifdef NO_STRTOUMAX
1579 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001580 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001581endif
1582ifdef NO_STRTOULL
1583 COMPAT_CFLAGS += -DNO_STRTOULL
1584endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001585ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001586 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001587 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001588endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001589ifdef NO_MKDTEMP
1590 COMPAT_CFLAGS += -DNO_MKDTEMP
1591 COMPAT_OBJS += compat/mkdtemp.o
1592endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001593ifdef MKDIR_WO_TRAILING_SLASH
1594 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1595 COMPAT_OBJS += compat/mkdir.o
1596endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001597ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001598 COMPAT_CFLAGS += -DNO_UNSETENV
1599 COMPAT_OBJS += compat/unsetenv.o
1600endif
Robert Schiele26009732008-01-24 19:34:46 +01001601ifdef NO_SYS_SELECT_H
1602 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1603endif
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001604ifdef NO_POLL_H
1605 BASIC_CFLAGS += -DNO_POLL_H
1606endif
Markus Duft28449232010-10-27 10:39:52 +02001607ifdef NO_SYS_POLL_H
1608 BASIC_CFLAGS += -DNO_SYS_POLL_H
1609endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001610ifdef NEEDS_SYS_PARAM_H
1611 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001612endif
Markus Duft28449232010-10-27 10:39:52 +02001613ifdef NO_INTTYPES_H
1614 BASIC_CFLAGS += -DNO_INTTYPES_H
1615endif
1616ifdef NO_INITGROUPS
1617 BASIC_CFLAGS += -DNO_INITGROUPS
1618endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001619ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001620 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001621 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001622else
1623 ifdef USE_WIN32_MMAP
1624 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1625 COMPAT_OBJS += compat/win32mmap.o
1626 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001627endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001628ifdef MMAP_PREVENTS_DELETE
1629 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1630endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001631ifdef OBJECT_CREATION_USES_RENAMES
1632 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001633endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001634ifdef NO_STRUCT_ITIMERVAL
1635 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001636 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001637endif
1638ifdef NO_SETITIMER
1639 COMPAT_CFLAGS += -DNO_SETITIMER
1640endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001641ifdef NO_PREAD
1642 COMPAT_CFLAGS += -DNO_PREAD
1643 COMPAT_OBJS += compat/pread.o
1644endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001645ifdef NO_FAST_WORKING_DIRECTORY
1646 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1647endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001648ifdef NO_TRUSTABLE_FILEMODE
1649 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1650endif
David Michaeld543d9c2014-12-03 21:24:17 -05001651ifdef NEEDS_MODE_TRANSLATION
1652 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1653 COMPAT_OBJS += compat/stat.o
1654endif
hpa49744d62005-09-28 16:52:21 -07001655ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001656 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001657endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001658ifdef NO_INTPTR_T
1659 COMPAT_CFLAGS += -DNO_INTPTR_T
1660endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001661ifdef NO_UINTMAX_T
1662 BASIC_CFLAGS += -Duintmax_t=uint32_t
1663endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001664ifdef NO_SOCKADDR_STORAGE
1665ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001666 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001667else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001668 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001669endif
hpa49744d62005-09-28 16:52:21 -07001670endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001671ifdef NO_INET_NTOP
1672 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001673 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001674endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001675ifdef NO_INET_PTON
1676 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001677 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001678endif
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001679ifdef NO_UNIX_SOCKETS
1680 BASIC_CFLAGS += -DNO_UNIX_SOCKETS
1681else
Johannes Sixt63203582011-12-12 22:12:56 +01001682 LIB_OBJS += unix-socket.o
Jeff Hostetler9fd19022021-03-15 21:08:27 +00001683 LIB_OBJS += unix-stream-server.o
Jeff Hostetler6aac70a2021-05-20 18:28:10 +00001684endif
1685
1686# Simple IPC requires threads and platform-specific IPC support.
1687# Only platforms that have both should include these source files
1688# in the build.
1689#
1690# On Windows-based systems, Simple IPC requires threads and Windows
1691# Named Pipes. These are always available, so Simple IPC support
1692# is optional.
1693#
1694# On Unix-based systems, Simple IPC requires pthreads and Unix
1695# domain sockets. So support is only enabled when both are present.
1696#
1697ifdef USE_WIN32_IPC
1698 BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
1699 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1700 LIB_OBJS += compat/simple-ipc/ipc-win32.o
1701else
1702ifndef NO_PTHREADS
1703ifndef NO_UNIX_SOCKETS
1704 BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
Jeff Hostetler7cd5dbc2021-03-22 10:29:47 +00001705 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1706 LIB_OBJS += compat/simple-ipc/ipc-unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001707endif
Jeff Hostetler6aac70a2021-05-20 18:28:10 +00001708endif
Johannes Sixt63203582011-12-12 22:12:56 +01001709endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001710
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001711ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001712 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001713endif
1714
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001715ifdef OLD_ICONV
1716 BASIC_CFLAGS += -DOLD_ICONV
1717endif
1718
David Symonds609a2282007-11-07 14:24:28 +11001719ifdef NO_DEFLATE_BOUND
1720 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1721endif
1722
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001723ifdef NO_POSIX_GOODIES
1724 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1725endif
1726
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001727ifdef APPLE_COMMON_CRYPTO
1728 # Apple CommonCrypto requires chunking
1729 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1730endif
1731
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001732ifdef OPENSSL_SHA1
1733 EXTLIBS += $(LIB_4_CRYPTO)
1734 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001735else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001736ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001737 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001738 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001739else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001740ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001741 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001742 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001743else
David Aguilar61067952013-05-19 06:23:35 -04001744ifdef APPLE_COMMON_CRYPTO
1745 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001746 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001747else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001748 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001749 BASIC_CFLAGS += -DSHA1_DC
1750 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001751ifdef DC_SHA1_EXTERNAL
1752 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001753 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001754$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001755 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001756 endif
1757 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1758 EXTLIBS += -lsha1detectcoll
1759else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001760ifdef DC_SHA1_SUBMODULE
1761 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1762 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1763 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1764else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001765 LIB_OBJS += sha1dc/sha1.o
1766 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001767endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001768 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001769 -DSHA1DC_NO_STANDARD_INCLUDES \
1770 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1771 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001772 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001773endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001774endif
1775endif
David Aguilar61067952013-05-19 06:23:35 -04001776endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001777endif
David Aguilar61067952013-05-19 06:23:35 -04001778
brian m. carlson4b4e2912018-11-14 04:09:38 +00001779ifdef OPENSSL_SHA256
1780 EXTLIBS += $(LIB_4_CRYPTO)
1781 BASIC_CFLAGS += -DSHA256_OPENSSL
1782else
brian m. carlson27dc04c2018-11-14 04:09:37 +00001783ifdef GCRYPT_SHA256
1784 BASIC_CFLAGS += -DSHA256_GCRYPT
1785 EXTLIBS += -lgcrypt
1786else
1787 LIB_OBJS += sha256/block/sha256.o
1788 BASIC_CFLAGS += -DSHA256_BLK
1789endif
brian m. carlson4b4e2912018-11-14 04:09:38 +00001790endif
brian m. carlson13eeedb2018-11-14 04:09:36 +00001791
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001792ifdef SHA1_MAX_BLOCK_SIZE
1793 LIB_OBJS += compat/sha1-chunked.o
1794 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1795endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001796ifdef NO_HSTRERROR
1797 COMPAT_CFLAGS += -DNO_HSTRERROR
1798 COMPAT_OBJS += compat/hstrerror.o
1799endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001800ifdef NO_MEMMEM
1801 COMPAT_CFLAGS += -DNO_MEMMEM
1802 COMPAT_OBJS += compat/memmem.o
1803endif
Matt Kraai40036be2012-12-18 14:03:55 -08001804ifdef NO_GETPAGESIZE
1805 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1806endif
Brian Downing43fe9012008-02-05 15:10:44 -06001807ifdef INTERNAL_QSORT
1808 COMPAT_CFLAGS += -DINTERNAL_QSORT
Brian Downing43fe9012008-02-05 15:10:44 -06001809endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001810ifdef HAVE_ISO_QSORT_S
1811 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1812else
1813 COMPAT_OBJS += compat/qsort_s.o
1814endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001815ifdef RUNTIME_PREFIX
1816 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1817endif
Alex Riesenb7774342007-03-07 00:44:49 +01001818
Junio C Hamano46059cc2008-11-15 04:08:14 -08001819ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001820 BASIC_CFLAGS += -DNO_PTHREADS
1821else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001822 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001823 EXTLIBS += $(PTHREAD_LIBS)
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001824endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001825
Chris Webbcb6a22c2010-04-13 10:07:13 +01001826ifdef HAVE_PATHS_H
1827 BASIC_CFLAGS += -DHAVE_PATHS_H
1828endif
1829
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001830ifdef HAVE_LIBCHARSET_H
1831 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001832 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001833endif
1834
David Michaelb3e103d2012-12-14 14:57:01 -05001835ifdef HAVE_STRINGS_H
1836 BASIC_CFLAGS += -DHAVE_STRINGS_H
1837endif
1838
Jeff King21aeafc2011-12-10 05:41:01 -05001839ifdef HAVE_DEV_TTY
1840 BASIC_CFLAGS += -DHAVE_DEV_TTY
1841endif
1842
Alex Riesen81a24b52008-03-05 00:15:39 +01001843ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1844 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1845endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001846ifdef UNRELIABLE_FSTAT
1847 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1848endif
Jeff King02232ad2009-06-16 15:07:40 -04001849ifdef NO_REGEX
1850 COMPAT_CFLAGS += -Icompat/regex
1851 COMPAT_OBJS += compat/regex/regex.o
1852endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001853ifdef NATIVE_CRLF
1854 BASIC_CFLAGS += -DNATIVE_CRLF
1855endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001856
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001857ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001858 COMPAT_CFLAGS += -Icompat/nedmalloc
1859 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1860 OVERRIDE_STRDUP = YesPlease
1861endif
1862
1863ifdef OVERRIDE_STRDUP
1864 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1865 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001866endif
1867
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001868ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1869 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1870endif
1871
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001872ifndef NO_MSGFMT_EXTENDED_OPTIONS
1873 MSGFMT += --check --statistics
1874endif
1875
Karsten Blees148d6772014-07-12 02:05:42 +02001876ifdef HAVE_CLOCK_GETTIME
1877 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001878endif
1879
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001880ifdef HAVE_CLOCK_MONOTONIC
1881 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1882endif
1883
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001884ifdef NEEDS_LIBRT
1885 EXTLIBS += -lrt
1886endif
1887
Kyle J. McKay95290802015-03-07 23:14:36 -08001888ifdef HAVE_BSD_SYSCTL
1889 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1890endif
1891
Dan Jacques226c0dd2018-04-10 11:05:44 -04001892ifdef HAVE_BSD_KERN_PROC_SYSCTL
1893 BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
1894endif
1895
Jeff King0cc30e02015-04-16 05:01:38 -04001896ifdef HAVE_GETDELIM
1897 BASIC_CFLAGS += -DHAVE_GETDELIM
1898endif
1899
Dan Jacques226c0dd2018-04-10 11:05:44 -04001900ifneq ($(PROCFS_EXECUTABLE_PATH),)
1901 procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
1902 BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
1903endif
1904
Emily Shafferb7e6a412021-07-21 18:27:06 -07001905ifndef HAVE_PLATFORM_PROCINFO
1906 COMPAT_OBJS += compat/stub/procinfo.o
1907endif
1908
Dan Jacques226c0dd2018-04-10 11:05:44 -04001909ifdef HAVE_NS_GET_EXECUTABLE_PATH
1910 BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
1911endif
1912
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -04001913ifdef HAVE_WPGMPTR
1914 BASIC_CFLAGS += -DHAVE_WPGMPTR
1915endif
1916
Duy Nguyen18a4f6b2019-02-12 21:14:41 +07001917ifdef FILENO_IS_A_MACRO
1918 COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
1919 COMPAT_OBJS += compat/fileno.o
1920endif
1921
Clément Chigot400caaf2019-04-25 07:01:56 +00001922ifdef NEED_ACCESS_ROOT_HANDLER
1923 COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
1924 COMPAT_OBJS += compat/access.o
1925endif
1926
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001927ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001928NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001929endif
1930
Jeff King499c2932009-04-03 15:32:20 -04001931ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001932NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001933endif
1934
Johan Herlandd4e1b472009-11-18 02:42:31 +01001935ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001936NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001937endif
1938
Eric Wong995bc222016-08-04 11:40:25 +00001939ifndef PAGER_ENV
1940PAGER_ENV = LESS=FRX LV=-c
1941endif
1942
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001943QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001944QUIET_SUBDIR1 =
1945
John Keepingef49e052015-09-05 13:22:10 +01001946ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001947PRINT_DIR = --no-print-directory
1948else # "make -w"
1949NO_SUBDIR = :
1950endif
1951
John Keepingef49e052015-09-05 13:22:10 +01001952ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001953ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001954 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001955 QUIET_AR = @echo ' ' AR $@;
1956 QUIET_LINK = @echo ' ' LINK $@;
1957 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1958 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001959 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00001960 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001961 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00001962 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001963 QUIET_SP = @echo ' ' SP $<;
Denton Liub503a2d2019-09-25 01:21:01 -07001964 QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001965 QUIET_RC = @echo ' ' RC $@;
Denton Liu4f3c1dc2019-10-09 13:43:46 -07001966 QUIET_SPATCH = @echo ' ' SPATCH $<;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001967 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001968 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1969 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001970 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001971 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001972 export QUIET_BUILT_IN
1973endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001974endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001975
Junio C Hamano70de5e62012-05-02 15:12:10 -07001976ifdef NO_INSTALL_HARDLINKS
1977 export NO_INSTALL_HARDLINKS
1978endif
1979
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001980### profile feedback build
1981#
1982
1983# Can adjust this to be a global directory if you want to do extended
1984# data gathering
1985PROFILE_DIR := $(CURDIR)
1986
Johannes Sixte60ec752012-02-09 09:22:26 +01001987ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07001988 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001989 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001990 export CCACHE_DISABLE = t
1991 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01001992else
1993ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07001994 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001995 export CCACHE_DISABLE = t
1996 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001997endif
Johannes Sixte60ec752012-02-09 09:22:26 +01001998endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001999
Pavel Roskinaddf88e2006-07-09 03:44:30 -04002000# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002001
Johannes Schindelin32043c92007-02-14 12:48:14 +01002002ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02002003ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002004
2005DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002006NO_GETTEXT_SQ = $(subst ','\'',$(NO_GETTEXT))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002007bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002008bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002009mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00002010mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
2011infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002012perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002013localedir_SQ = $(subst ','\'',$(localedir))
Dan Jacques07d90ea2018-04-10 11:05:43 -04002014localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002015gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +00002016gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002017template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00002018htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002019prefix_SQ = $(subst ','\'',$(prefix))
Dan Jacques07d90ea2018-04-10 11:05:43 -04002020perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05302021gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002022
2023SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05002024TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002025PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01002026PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07002027TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002028DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08002029PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002030
Dan Jacques07d90ea2018-04-10 11:05:43 -04002031# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
2032# relative to each other and share an installation path.
2033#
2034# This is a dependency in:
2035# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
2036# - The runtime prefix Perl header (see
2037# "perl/header_templates/runtime_prefix.template.pl").
2038ifdef RUNTIME_PREFIX
2039
2040ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
2041$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
2042endif
2043
2044ifneq ($(filter /%,$(firstword $(localedir_relative))),)
2045$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
2046endif
2047
2048ifndef NO_PERL
2049ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
2050$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
2051endif
2052endif
2053
2054endif
2055
Jeff King3f2e2292016-07-01 01:58:58 -04002056# We must filter out any object files from $(GITLIBS),
2057# as it is typically used like:
2058#
2059# foo: foo.o $(GITLIBS)
2060# $(CC) $(filter %.o,$^) $(LIBS)
2061#
2062# where we use it as a dependency. Since we also pull object files
2063# from the dependency list, that would make each entry appear twice.
2064LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07002065
brian m. carlsonf18f8162017-03-11 22:28:18 +00002066BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08002067LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02002068
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05002069# Quote for C
2070
2071ifdef DEFAULT_EDITOR
2072DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
2073DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
2074
2075BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
2076endif
2077
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05002078ifdef DEFAULT_PAGER
2079DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
2080DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
2081
2082BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
2083endif
2084
Ben Waltonb3e34dd2012-03-30 21:33:21 -04002085ifdef SHELL_PATH
2086SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
2087SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
2088
2089BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
2090endif
2091
Jeff King42dcbb72012-06-02 15:01:12 -04002092GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
2093GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
2094GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04002095GIT-USER-AGENT: FORCE
2096 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04002097 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
2098 fi
Jeff King42dcbb72012-06-02 15:01:12 -04002099
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00002100ifdef DEFAULT_HELP_FORMAT
2101BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
2102endif
2103
Eric Wong995bc222016-08-04 11:40:25 +00002104PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
2105PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
2106PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
2107BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
2108
Petr Baudis8d7f5862006-06-25 03:47:03 +02002109ALL_CFLAGS += $(BASIC_CFLAGS)
2110ALL_LDFLAGS += $(BASIC_LDFLAGS)
2111
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00002112export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07002113
2114
Petr Baudis28818ff2005-07-29 17:50:24 +02002115### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07002116
Brandon Caseyc94c8e52008-08-07 14:03:42 -05002117SHELL = $(SHELL_PATH)
2118
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002119all:: shell_compatibility_test
2120
2121ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07002122all:: profile
2123endif
2124
2125profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002126 $(MAKE) PROFILE=GEN all
2127 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04002128 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
2129 $(MAKE) PROFILE=GEN -j1 perf; \
2130 else \
2131 echo "Skipping profile of perf tests..."; \
2132 fi
Andi Kleen066dd262014-07-07 23:35:11 -07002133 $(MAKE) PROFILE=USE all
2134
2135profile-fast: profile-clean
2136 $(MAKE) PROFILE=GEN all
2137 $(MAKE) PROFILE=GEN -j1 perf
2138 $(MAKE) PROFILE=USE all
2139
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002140
Johannes Schindelin179227d2020-09-21 22:28:16 +00002141all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002142ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00002143 $(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 -08002144endif
Petr Baudis28818ff2005-07-29 17:50:24 +02002145
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002146all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002147ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07002148 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08002149 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002150endif
Ben Walton502be952010-03-20 10:48:08 -04002151 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04002152
Brandon Casey6dc46272008-08-07 14:06:26 -05002153please_set_SHELL_PATH_to_a_more_modern_shell:
2154 @$$(:)
2155
2156shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
2157
Junio C Hamano4dc00022006-01-12 21:42:25 -08002158strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05002159 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08002160
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002161### Flags affecting all rules
2162
2163# A GNU make extension since gmake 3.72 (released in late 1994) to
2164# remove the target of rules if commands in those rules fail. The
2165# default is to only do that if make itself receives a signal. Affects
2166# all targets, see:
2167#
2168# info make --index-search=.DELETE_ON_ERROR
2169.DELETE_ON_ERROR:
2170
Jonathan Nieder7b63c772012-07-06 23:19:09 -05002171### Target-specific flags and dependencies
2172
2173# The generic compilation pattern rule and automatically
2174# computed header dependencies (falling back to a dependency on
2175# LIB_H) are enough to describe how most targets should be built,
2176# but some targets are special enough to need something a little
2177# different.
2178#
2179# - When a source file "foo.c" #includes a generated header file,
2180# we need to list that dependency for the "foo.o" target.
2181#
2182# We also list it from other targets that are built from foo.c
2183# like "foo.sp" and "foo.s", even though that is easy to forget
2184# to do because the generated header is already present around
2185# after a regular build attempt.
2186#
2187# - Some code depends on configuration kept in makefile
2188# variables. The target-specific variable EXTRA_CPPFLAGS can
2189# be used to convey that information to the C preprocessor
2190# using -D options.
2191#
2192# The "foo.o" target should have a corresponding dependency on
2193# a file that changes when the value of the makefile variable
2194# changes. For example, targets making use of the
2195# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
2196#
2197# Technically the ".sp" and ".s" targets do not need this
2198# dependency because they are force-built, but they get the
2199# same dependency for consistency. This way, you do not have to
2200# know how each target is implemented. And it means the
2201# dependencies here will not need to change if the force-build
2202# details change some day.
2203
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002204git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04002205git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002206 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2207 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2208 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07002209
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002210git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04002211 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2212 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07002213
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002214help.sp help.s help.o: command-list.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01002215
Emily Shaffer709df952020-04-16 14:18:03 -07002216builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002217builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002218 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2219 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2220 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07002221
Jeff King520a6cd2012-06-20 14:32:22 -04002222version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04002223version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04002224 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01002225 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
Johannes Schindelin5cf8e062018-06-27 21:35:23 +02002226 '-DGIT_BUILT_FROM_COMMIT="$(shell \
2227 GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2228 git rev-parse -q --verify HEAD 2>/dev/null)"'
Jeff King816fb462012-06-02 14:51:42 -04002229
Junio C Hamano91730802006-04-10 17:37:58 -07002230$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02002231 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002232 ln $< $@ 2>/dev/null || \
2233 ln -s $< $@ 2>/dev/null || \
2234 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07002235
Emily Shaffer709df952020-04-16 14:18:03 -07002236config-list.h: generate-configlist.sh
2237
SZEDER Gábor56550ea2021-04-08 23:29:15 +02002238config-list.h: Documentation/*config.txt Documentation/config/*.txt
Emily Shaffer709df952020-04-16 14:18:03 -07002239 $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
2240 >$@+ && mv $@+ $@
2241
Nguyễn Thái Ngọc Duyf318d732018-05-10 10:46:41 +02002242command-list.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07002243
SZEDER Gábor56550ea2021-04-08 23:29:15 +02002244command-list.h: $(wildcard Documentation/git*.txt)
Johannes Schindelin724d6352019-04-18 06:16:40 -07002245 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2246 $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
2247 command-list.txt >$@+ && mv $@+ $@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002248
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002249SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
Jeff Kingb5295f32012-06-20 14:32:19 -04002250 $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002251 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
2252 $(perllibdir_SQ)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002253define cmd_munge_script
Jonathan Nieder46bac902010-01-31 11:46:53 -08002254sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2255 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002256 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002257 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002258 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08002259 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002260 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04002261 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
2262 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Junio C Hamano71b40102016-03-08 15:47:57 -08002263 -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00002264 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002265 $@.sh >$@+
2266endef
2267
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002268GIT-SCRIPT-DEFINES: FORCE
2269 @FLAGS='$(SCRIPT_DEFINES)'; \
2270 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002271 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002272 echo "$$FLAGS" >$@; \
2273 fi
2274
2275
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002276$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002277 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002278 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002279 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002280
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002281$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002282 $(QUIET_GEN)$(cmd_munge_script) && \
2283 mv $@+ $@
2284
Johannes Schindelinadb59de2018-11-06 06:55:50 -08002285git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002286 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01002287 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
2288 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06002289 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002290
Jeff Kinge204b002014-11-18 12:43:09 -05002291# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002292$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05002293
Dan Jacques07d90ea2018-04-10 11:05:43 -04002294# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
2295# since the locale directory is injected.
2296perl_localedir_SQ = $(localedir_SQ)
Alex Riesenf8487182006-12-04 10:50:04 +01002297
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002298ifndef NO_PERL
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002299PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
Ævar Arnfjörð Bjarmason8c557532021-05-12 11:49:44 +02002300PERL_DEFINES =
Ævar Arnfjörð Bjarmason4070c9e2021-05-05 14:21:38 +02002301PERL_DEFINES += $(PERL_PATH_SQ)
2302PERL_DEFINES += $(PERLLIB_EXTRA_SQ)
2303PERL_DEFINES += $(perllibdir_SQ)
Dan Jacques07d90ea2018-04-10 11:05:43 -04002304PERL_DEFINES += $(RUNTIME_PREFIX)
Ævar Arnfjörð Bjarmason368a50d2021-05-05 14:21:40 +02002305PERL_DEFINES += $(NO_PERL_CPAN_FALLBACKS)
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002306PERL_DEFINES += $(NO_GETTEXT)
Dan Jacques07d90ea2018-04-10 11:05:43 -04002307
2308# Support Perl runtime prefix. In this mode, a different header is installed
2309# into Perl scripts.
2310ifdef RUNTIME_PREFIX
2311
2312PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
2313
2314# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
2315# at runtime.
2316perl_localedir_SQ =
2317
2318endif
2319
2320PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
2321
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002322$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002323 $(QUIET_GEN) \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002324 sed -e '1{' \
2325 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Alejandro R. Sedeño66000542018-06-25 15:13:25 -04002326 -e ' r GIT-PERL-HEADER' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002327 -e ' G' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002328 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07002329 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002330 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002331 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002332 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002333
Dan Jacques07d90ea2018-04-10 11:05:43 -04002334PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002335GIT-PERL-DEFINES: FORCE
2336 @FLAGS='$(PERL_DEFINES)'; \
2337 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2338 echo >&2 " * new perl-specific parameters"; \
2339 echo "$$FLAGS" >$@; \
2340 fi
2341
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002342GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002343 $(QUIET_GEN) \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002344 INSTLIBDIR='$(perllibdir_SQ)' && \
2345 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
2346 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
2347 sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
Jonathan Nieder64f982b2018-04-23 16:25:35 -07002348 -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002349 -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
2350 -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
2351 -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002352 $< >$@+ && \
2353 mv $@+ $@
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002354
Christian Hessed8698982018-04-19 06:44:40 +09002355.PHONY: perllibdir
Christian Hessecfb3a472018-04-10 15:36:41 +02002356perllibdir:
2357 @echo '$(perllibdir_SQ)'
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002358
2359.PHONY: gitweb
2360gitweb:
2361 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2362
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002363git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002364 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002365 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002366 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002367else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002368$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002369 $(QUIET_GEN) \
Jeff King499c2932009-04-03 15:32:20 -04002370 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2371 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2372 unimplemented.sh >$@+ && \
2373 chmod +x $@+ && \
2374 mv $@+ $@
2375endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002376
Jonathan Niederca2051d2014-11-18 10:43:47 -08002377# This makes sure we depend on the NO_PYTHON setting itself.
2378$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2379
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002380ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002381$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2382$(SCRIPT_PYTHON_GEN): % : %.py
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002383 $(QUIET_GEN) \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002384 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002385 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002386 chmod +x $@+ && \
2387 mv $@+ $@
2388else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002389$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002390 $(QUIET_GEN) \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002391 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2392 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2393 unimplemented.sh >$@+ && \
2394 chmod +x $@+ && \
2395 mv $@+ $@
2396endif # NO_PYTHON
2397
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002398CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Jeff King7f1b6972013-02-21 01:26:14 -05002399 configure.ac >configure.ac+ && \
2400 autoconf -o configure configure.ac+ && \
2401 $(RM) configure.ac+
2402
Jeff King520a6cd2012-06-20 14:32:22 -04002403configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002404 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002405
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002406ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002407# We avoid depending on 'configure' here, because it gets rebuilt
2408# every time GIT-VERSION-FILE is modified, only to update the embedded
2409# version number string, which config.status does not care about. We
2410# do want to recheck when the platform/environment detection logic
2411# changes, hence this depends on configure.ac.
2412config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002413 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002414 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002415 ./config.status --recheck; \
2416 else \
2417 ./configure; \
2418 fi
2419reconfigure config.mak.autogen: config.status
2420 $(QUIET_GEN)./config.status
2421.PHONY: reconfigure # This is a convenience target.
2422endif
2423
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002424XDIFF_OBJS += xdiff/xdiffi.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002425XDIFF_OBJS += xdiff/xemit.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002426XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002427XDIFF_OBJS += xdiff/xmerge.o
2428XDIFF_OBJS += xdiff/xpatience.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002429XDIFF_OBJS += xdiff/xprepare.o
2430XDIFF_OBJS += xdiff/xutils.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002431.PHONY: xdiff-objs
2432xdiff-objs: $(XDIFF_OBJS)
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002433
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002434TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002435.PHONY: test-objs
2436test-objs: $(TEST_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002437
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002438GIT_OBJS += $(LIB_OBJS)
2439GIT_OBJS += $(BUILTIN_OBJS)
2440GIT_OBJS += common-main.o
2441GIT_OBJS += git.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002442.PHONY: git-objs
2443git-objs: $(GIT_OBJS)
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002444
2445OBJECTS += $(GIT_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002446OBJECTS += $(PROGRAM_OBJS)
2447OBJECTS += $(TEST_OBJS)
2448OBJECTS += $(XDIFF_OBJS)
2449OBJECTS += $(FUZZ_OBJS)
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002450ifndef NO_CURL
2451 OBJECTS += http.o http-walker.o remote-curl.o
2452endif
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002453.PHONY: objects
2454objects: $(OBJECTS)
Jonathan Niederc3739912010-01-26 09:52:11 -06002455
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002456dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002457dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002458
Jonathan Nieder024c8432011-11-18 03:58:21 -06002459ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002460$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002461 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002462
2463missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002464dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002465dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002466endif
2467
Jonathan Nieder024c8432011-11-18 03:58:21 -06002468ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002469dep_dirs =
2470missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002471dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002472endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002473
Philippe Blain3821c382020-09-03 22:13:38 +00002474compdb_dir = compile_commands
2475
2476ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2477missing_compdb_dir = $(compdb_dir)
2478$(missing_compdb_dir):
2479 @mkdir -p $@
2480
2481compdb_file = $(compdb_dir)/$(subst /,-,$@.json)
2482compdb_args = -MJ $(compdb_file)
2483else
2484missing_compdb_dir =
2485compdb_args =
2486endif
2487
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002488ASM_SRC := $(wildcard $(OBJECTS:o=S))
2489ASM_OBJ := $(ASM_SRC:S=o)
2490C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002491
Jonathan Nieder30248882010-01-26 09:51:24 -06002492.SUFFIXES:
2493
Philippe Blain3821c382020-09-03 22:13:38 +00002494$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2495 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
2496$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2497 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002498
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002499%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002500 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002501
2502ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2503# Take advantage of gcc's on-the-fly dependency generation
2504# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2505dep_files_present := $(wildcard $(dep_files))
2506ifneq ($(dep_files_present),)
2507include $(dep_files_present)
2508endif
2509else
Jonathan Niederdfea5752010-01-26 09:52:49 -06002510# Dependencies on header files, for platforms that do not support
2511# the gcc -MMD option.
2512#
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002513# Dependencies on automatically generated headers such as command-list.h
Jonathan Niederdfea5752010-01-26 09:52:49 -06002514# should _not_ be included here, since they are necessary even when
2515# building an object for the first time.
Pavel Roskinb05701c2005-08-06 01:36:15 -04002516
Johannes Schindelin92b88eb2019-03-04 05:47:06 -08002517$(OBJECTS): $(LIB_H) $(GENERATED_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002518endif
Junio C Hamano7a590132005-08-06 13:10:43 -07002519
Philippe Blain3821c382020-09-03 22:13:38 +00002520ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2521all:: compile_commands.json
2522compile_commands.json:
Philippe Blain3821c382020-09-03 22:13:38 +00002523 $(QUIET_GEN)sed -e '1s/^/[/' -e '$$s/,$$/]/' $(compdb_dir)/*.o.json > $@+
2524 @if test -s $@+; then mv $@+ $@; else $(RM) $@+; fi
2525endif
2526
Stefan Bellerd807c4a2018-04-10 14:26:18 -07002527exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
2528exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002529 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002530 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002531 '-DBINDIR="$(bindir_relative_SQ)"' \
Philip Oakley4d5b4c22018-04-21 13:18:42 +02002532 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002533
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002534builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002535builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002536 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002537
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002538config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002539config.sp config.s config.o: EXTRA_CPPFLAGS = \
2540 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002541
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002542attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002543attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2544 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002545
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002546gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002547gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002548 -DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002549
Ramsay Jones15caca22019-02-05 02:27:48 +00002550http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002551 -DCURL_DISABLE_TYPECHECK
2552
Ramsay Jones15caca22019-02-05 02:27:48 +00002553pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
Ramsay Jones54360a12018-02-12 00:21:02 +00002554
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002555ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002556http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002557endif
2558
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002559ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002560compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2561 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002562endif
2563
René Scharfed555ff52010-09-11 11:59:18 +02002564ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002565compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002566 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones15caca22019-02-05 02:27:48 +00002567compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002568endif
2569
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002570git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002571 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002572
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002573git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002574 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002575 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002576
John Keepingfd78ced2014-01-25 13:11:44 +00002577git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002578 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002579 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002580git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002581 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002582 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002583
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002584$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2585 $(QUIET_LNCP)$(RM) $@ && \
2586 ln $< $@ 2>/dev/null || \
2587 ln -s $< $@ 2>/dev/null || \
2588 cp $< $@
2589
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002590$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002591 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002592 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002593
Petr Baudis28818ff2005-07-29 17:50:24 +02002594$(LIB_FILE): $(LIB_OBJS)
SZEDER Gábor325b06d2021-08-18 23:36:11 +02002595 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002596
Linus Torvalds34435462006-03-24 20:13:22 -08002597$(XDIFF_LIB): $(XDIFF_OBJS)
SZEDER Gábor325b06d2021-08-18 23:36:11 +02002598 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002599
Jonathan Nieder5b586192012-03-31 03:44:53 -05002600export DEFAULT_EDITOR DEFAULT_PAGER
2601
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07002602Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
2603 @EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
2604 if test x"$$EXCLUDED" != \
2605 x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
2606 echo >&2 " * new documentation flags"; \
2607 echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
2608 fi
2609
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002610.PHONY: doc man man-perl html info pdf
2611doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002612 $(MAKE) -C Documentation all
2613
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002614man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002615 $(MAKE) -C Documentation man
2616
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002617man-perl: perl/build/man/man3/Git.3pm
2618
Michael J Gruber414851a2008-09-10 10:19:34 +02002619html:
2620 $(MAKE) -C Documentation html
2621
David Kastrup47398092007-08-06 12:22:57 +02002622info:
2623 $(MAKE) -C Documentation info
2624
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002625pdf:
2626 $(MAKE) -C Documentation pdf
2627
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002628XGETTEXT_FLAGS = \
2629 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002630 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002631 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2632 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002633XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2634 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002635XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2636 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002637XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002638 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002639LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002640LOCALIZED_SH = $(SCRIPT_SH)
Alban Gruinc42abfe2018-05-28 14:34:19 +02002641LOCALIZED_SH += git-rebase--preserve-merges.sh
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002642LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002643LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002644
2645ifdef XGETTEXT_INCLUDE_TESTS
2646LOCALIZED_C += t/t0200/test.c
2647LOCALIZED_SH += t/t0200/test.sh
2648LOCALIZED_PERL += t/t0200/test.perl
2649endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002650
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002651## Note that this is meant to be run only by the localization coordinator
2652## under a very controlled condition, i.e. (1) it is to be run in a
2653## Git repository (not a tarball extract), (2) any local modifications
2654## will be lost.
2655## Gettext tools cannot work with our own custom PRItime type, so
2656## we replace PRItime with PRIuMAX. We need to update this to
2657## PRIdMAX if we switch to a signed type later.
2658
Jonathan Nieder1f319632014-08-22 00:32:08 -04002659po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002660 # All modifications will be reverted at the end, so we do not
2661 # want to have any local change.
2662 git diff --quiet HEAD && git diff --quiet --cached
2663
2664 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2665 do \
2666 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2667 cat "$$s+" >"$$s" && rm "$$s+"; \
2668 done
2669
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002670 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2671 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2672 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002673 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2674 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002675
2676 # Reverting the munged source, leaving only the updated $@
2677 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002678 mv $@+ $@
2679
Elia Pintoe6be2652015-12-15 15:21:00 +00002680.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002681pot: po/git.pot
2682
Johannes Schindelin43488242021-07-04 22:55:12 +00002683ifdef NO_GETTEXT
2684POFILES :=
2685MOFILES :=
2686else
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002687POFILES := $(wildcard po/*.po)
2688MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2689
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002690all:: $(MOFILES)
2691endif
2692
2693po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2694 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2695
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002696LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2697LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002698LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2699LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002700
2701ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002702all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002703ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002704all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002705endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002706NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002707endif
2708
Ævar Arnfjörð Bjarmason3d49f722021-05-05 14:21:39 +02002709perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002710 $(QUIET_GEN)mkdir -p $(dir $@) && \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002711 sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002712 -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002713 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2714 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002715
2716perl/build/man/man3/Git.3pm: perl/Git.pm
2717 $(QUIET_GEN)mkdir -p $(dir $@) && \
2718 pod2man $< $@
2719
Jeff Kinge951ebc2016-12-14 09:26:55 -05002720FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002721 git ls-files \
2722 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002723 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002724 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002725 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002726 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002727 $(FIND) . \
2728 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002729 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002730 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002731 -o \( -name build -type d -prune \) \
2732 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002733 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002734 -o \( -name '*.sh' -type f -print \) \
Denton Liu43f8c892019-09-16 12:23:14 -07002735 | sed -e 's|^\./||' \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002736 )
Junio C Hamano33533972011-10-18 00:26:18 -07002737
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002738FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002739
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002740$(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002741 $(QUIET_GEN)$(RM) $@+ && \
2742 echo $(FOUND_SOURCE_FILES) | xargs etags -a -o $@+ && \
2743 mv $@+ $@
Petr Baudis28818ff2005-07-29 17:50:24 +02002744
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002745tags: $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002746 $(QUIET_GEN)$(RM) $@+ && \
2747 echo $(FOUND_SOURCE_FILES) | xargs ctags -a -o $@+ && \
2748 mv $@+ $@
Petr Baudis28818ff2005-07-29 17:50:24 +02002749
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002750cscope.out: $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002751 $(QUIET_GEN)$(RM) $@+ && \
2752 echo $(FOUND_SOURCE_FILES) | xargs cscope -f$@+ -b && \
2753 mv $@+ $@
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002754
2755.PHONY: cscope
2756cscope: cscope.out
Kristof Provosta2a91502007-10-06 16:24:42 +02002757
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002758### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002759TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2760 $(localedir_SQ)
2761
2762GIT-PREFIX: FORCE
2763 @FLAGS='$(TRACK_PREFIX)'; \
2764 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002765 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002766 echo "$$FLAGS" >GIT-PREFIX; \
2767 fi
2768
2769TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002770
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002771GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002772 @FLAGS='$(TRACK_CFLAGS)'; \
2773 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002774 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002775 echo "$$FLAGS" >GIT-CFLAGS; \
2776 fi
2777
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002778TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2779
2780GIT-LDFLAGS: FORCE
2781 @FLAGS='$(TRACK_LDFLAGS)'; \
2782 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002783 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002784 echo "$$FLAGS" >GIT-LDFLAGS; \
2785 fi
2786
Junio C Hamanobfce5082008-07-25 12:35:10 -07002787# We need to apply sq twice, once to protect from the shell
2788# that runs GIT-BUILD-OPTIONS, and then again to protect it
2789# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002790GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002791 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002792 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002793 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2794 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2795 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2796 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2797 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002798 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002799 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002800 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002801 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002802 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2803 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002804 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002805 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
Johannes Schindelin8abfdf42018-11-14 08:32:11 -08002806 @echo X=\'$(X)\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002807ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002808 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002809endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002810ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002811 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002812endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002813ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002814 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002815endif
2816ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002817 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002818endif
Đoàn Trần Công Danh482c9622021-06-08 13:56:28 +07002819ifdef GIT_TEST_UTF8_LOCALE
2820 @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
2821endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002822 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002823ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002824 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002825endif
2826ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002827 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002828endif
2829ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002830 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002831endif
2832ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002833 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002834endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002835ifdef GIT_PERF_MAKE_COMMAND
2836 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2837endif
Jeff King3d893612017-02-25 04:37:07 -05002838ifdef GIT_INTEROP_MAKE_OPTS
2839 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2840endif
Ben Peart1f357b02018-09-18 23:29:36 +00002841ifdef GIT_TEST_INDEX_VERSION
2842 @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002843endif
Jeff King5338ed22020-10-21 23:24:00 -04002844ifdef GIT_TEST_PERL_FATAL_WARNINGS
2845 @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
2846endif
Johannes Schindelinb7d11a02021-07-24 22:06:49 +00002847ifdef RUNTIME_PREFIX
2848 @echo RUNTIME_PREFIX=\'true\' >>$@+
2849else
2850 @echo RUNTIME_PREFIX=\'false\' >>$@+
2851endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002852 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002853
Christian Couder96a46472012-12-18 16:26:38 +01002854### Detect Python interpreter path changes
2855ifndef NO_PYTHON
2856TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002857
Christian Couder96a46472012-12-18 16:26:38 +01002858GIT-PYTHON-VARS: FORCE
2859 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002860 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002861 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002862 echo "$$VARS" >$@; \
2863 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002864endif
2865
Matthew Ogilvieea925192009-12-02 22:14:05 -07002866test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2867
2868all:: $(TEST_PROGRAMS) $(test_bindir_programs)
2869
2870bin-wrappers/%: wrap-for-bin.sh
2871 @mkdir -p bin-wrappers
2872 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2873 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Johannes Schindelin3a94cb32019-07-29 13:08:16 -07002874 -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 -07002875 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002876
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002877# GNU make supports exporting all variables by "export" without parameters.
2878# However, the environment gets quite big, and some programs have problems
2879# with that.
2880
Johannes Schindelin140245b2006-07-07 13:26:31 +02002881export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002882export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002883
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002884### Testing rules
2885
Junio C Hamano96651ef2007-04-28 15:32:49 -07002886test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002887 $(MAKE) -C t/ all
2888
Thomas Rast342e9ef2012-02-17 11:25:09 +01002889perf: all
2890 $(MAKE) -C t/perf/ all
2891
2892.PHONY: test perf
2893
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002894.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002895
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002896t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2897
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002898t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
David Barr1d73b522010-08-09 17:34:42 -05002899 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002900
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +01002901check-sha1:: t/helper/test-tool$X
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002902 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002903
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002904SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2905
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02002906$(SP_OBJ): %.sp: %.c %.o GIT-CFLAGS
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002907 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02002908 -Wsparse-error \
2909 $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $< && \
2910 >$@
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002911
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02002912.PHONY: sparse
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002913sparse: $(SP_OBJ)
2914
Emily Shaffer709df952020-04-16 14:18:03 -07002915EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/%
Ramsay Jonesf23aa182019-03-06 00:11:13 +00002916ifndef GCRYPT_SHA256
2917 EXCEPT_HDRS += sha256/gcrypt.h
2918endif
Denton Liucf6a2d22019-09-16 12:23:08 -07002919CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002920HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
Denton Liub503a2d2019-09-25 01:21:01 -07002921HCC = $(HCO:hco=hcc)
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002922
Denton Liub503a2d2019-09-25 01:21:01 -07002923%.hcc: %.h
2924 @echo '#include "git-compat-util.h"' >$@
2925 @echo '#include "$<"' >>$@
2926
2927$(HCO): %.hco: %.hcc FORCE
2928 $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002929
2930.PHONY: hdr-check $(HCO)
2931hdr-check: $(HCO)
2932
Brandon Williams21188052017-08-14 14:30:46 -07002933.PHONY: style
2934style:
2935 git clang-format --style file --diff --extensions c,h
2936
Emily Shaffer709df952020-04-16 14:18:03 -07002937check: config-list.h command-list.h
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01002938 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002939 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07002940 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002941 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002942 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07002943 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002944 exit 1; \
2945 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02002946
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002947FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
Denton Liu9027af52019-09-16 12:23:16 -07002948COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02002949
2950%.cocci.patch: %.cocci $(COCCI_SOURCES)
Denton Liu4f3c1dc2019-10-09 13:43:46 -07002951 $(QUIET_SPATCH) \
Jeff Kingbcb4edf2019-05-08 03:07:54 -04002952 if test $(SPATCH_BATCH_SIZE) = 0; then \
2953 limit=; \
2954 else \
2955 limit='-n $(SPATCH_BATCH_SIZE)'; \
2956 fi; \
2957 if ! echo $(COCCI_SOURCES) | xargs $$limit \
Jeff King960154b2019-05-06 19:43:34 -04002958 $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
2959 >$@+ 2>$@.log; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002960 then \
2961 cat $@.log; \
2962 exit 1; \
2963 fi; \
2964 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02002965 if test -s $@; \
2966 then \
2967 echo ' ' SPATCH result: $@; \
2968 fi
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002969coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
René Scharfe63f0a752016-09-15 20:30:56 +02002970
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002971# See contrib/coccinelle/README
2972coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
2973
2974.PHONY: coccicheck coccicheck-pending
Petr Baudis28818ff2005-07-29 17:50:24 +02002975
Petr Baudis28818ff2005-07-29 17:50:24 +02002976### Installation rules
2977
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002978ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002979template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002980else
2981template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002982endif
2983export template_instdir
2984
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002985ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002986gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002987else
2988gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002989endif
2990gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
2991export gitexec_instdir
2992
David Aguilarbc7a96a2011-08-18 00:23:46 -07002993ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2994mergetools_instdir = $(mergetoolsdir)
2995else
2996mergetools_instdir = $(prefix)/$(mergetoolsdir)
2997endif
2998mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2999
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003000install_bindir_xprograms := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X))
3001install_bindir_programs := $(install_bindir_xprograms) $(BINDIR_PROGRAMS_NO_X)
Matthew Ogilvieea925192009-12-02 22:14:05 -07003002
Elia Pintoe6be2652015-12-15 15:21:00 +00003003.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07003004profile-install: profile
3005 $(MAKE) install
3006
3007profile-fast-install: profile-fast
3008 $(MAKE) install
3009
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003010INSTALL_STRIP =
3011
Andreas Ericssond6ebd252005-11-22 00:44:15 +01003012install: all
Robert Schiele41650762007-12-01 18:05:40 +01003013 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003014 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003015 $(INSTALL) $(INSTALL_STRIP) $(PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3016 $(INSTALL) $(SCRIPTS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08003017 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003018 $(INSTALL) $(INSTALL_STRIP) $(install_bindir_xprograms) '$(DESTDIR_SQ)$(bindir_SQ)'
3019 $(INSTALL) $(BINDIR_PROGRAMS_NO_X) '$(DESTDIR_SQ)$(bindir_SQ)'
3020
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003021ifdef MSVC
3022 # We DO NOT install the individual foo.o.pdb files because they
3023 # have already been rolled up into the exe's pdb file.
3024 # We DO NOT have pdb files for the builtin commands (like git-status.exe)
3025 # because it is just a copy/hardlink of git.exe, rather than a unique binary.
Johannes Schindelina8b53552020-09-21 22:28:15 +00003026 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS),$(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)))) '$(DESTDIR_SQ)$(bindir_SQ)'
3027 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS) $(REMOTE_CURL_ALIASES),$(PROGRAMS))) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003028ifndef DEBUG
3029 $(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
3030 $(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
3031else
3032 $(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
3033 $(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
3034endif
3035endif
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01003036 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07003037 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05003038 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003039ifndef NO_GETTEXT
3040 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
3041 (cd po/build/locale && $(TAR) cf - .) | \
3042 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
3043endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07003044ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003045 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
3046 (cd perl/build/lib && $(TAR) cf - .) | \
3047 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07003048 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07003049endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003050ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003051 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003052 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003053endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08003054ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00003055 $(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 -08003056endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003057
Johannes Sixt46beb552008-07-21 21:19:51 +02003058 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003059 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003060 destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07003061 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05003062 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
3063 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003064 test -n "$(INSTALL_SYMLINKS)" && \
3065 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
3066 { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
3067 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
3068 cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
Brandon Casey76d079a2010-07-23 12:50:45 -05003069 done; \
3070 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05003071 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
3072 $(RM) "$$bindir/$$p" && \
Johannes Schindelin907e6372020-10-21 15:13:31 +00003073 test -n "$(INSTALL_SYMLINKS)" && \
3074 ln -s "git$X" "$$bindir/$$p" || \
3075 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3076 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
3077 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
3078 cp "$$bindir/git$X" "$$bindir/$$p" || exit; }; \
Brandon Casey40919c42010-07-23 12:50:44 -05003079 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003080 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06003081 $(RM) "$$execdir/$$p" && \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003082 if test -z "$(SKIP_DASHED_BUILT_INS)"; \
3083 then \
3084 test -n "$(INSTALL_SYMLINKS)" && \
3085 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
3086 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3087 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
3088 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
3089 cp "$$execdir/git$X" "$$execdir/$$p" || exit; }; \
3090 fi \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003091 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07003092 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
3093 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003094 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003095 test -n "$(INSTALL_SYMLINKS)" && \
3096 ln -s "git-remote-http$X" "$$execdir/$$p" || \
3097 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3098 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3099 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3100 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
Ævar Arnfjörð Bjarmason72b113e2021-09-06 09:55:33 +02003101 done
Petr Baudis28818ff2005-07-29 17:50:24 +02003102
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003103.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00003104.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02003105install-gitweb:
3106 $(MAKE) -C gitweb install
3107
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003108install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02003109 $(MAKE) -C Documentation install
3110
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003111install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003112 $(MAKE) -C Documentation install-man
3113
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003114install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003115 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
3116 (cd perl/build/man/man3 && $(TAR) cf - .) | \
3117 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
3118
Teemu Likonenae081f32008-06-10 11:34:25 +03003119install-html:
3120 $(MAKE) -C Documentation install-html
3121
David Kastrup47398092007-08-06 12:22:57 +02003122install-info:
3123 $(MAKE) -C Documentation install-info
3124
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01003125install-pdf:
3126 $(MAKE) -C Documentation install-pdf
3127
Eric Wong6538d1e2006-12-23 08:26:09 -08003128quick-install-doc:
3129 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02003130
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003131quick-install-man:
3132 $(MAKE) -C Documentation quick-install-man
3133
Michael J Gruber6fe570d2008-09-09 22:44:17 +02003134quick-install-html:
3135 $(MAKE) -C Documentation quick-install-html
3136
Petr Baudis28818ff2005-07-29 17:50:24 +02003137
3138
3139### Maintainer's dist rules
3140
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01003141GIT_TARNAME = git-$(GIT_VERSION)
René Scharfedf368fa2020-09-19 23:23:50 +02003142GIT_ARCHIVE_EXTRA_FILES = \
3143 --prefix=$(GIT_TARNAME)/ \
3144 --add-file=configure \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003145 --add-file=.dist-tmp-dir/version \
René Scharfedf368fa2020-09-19 23:23:50 +02003146 --prefix=$(GIT_TARNAME)/git-gui/ \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003147 --add-file=.dist-tmp-dir/git-gui/version
René Scharfedf368fa2020-09-19 23:23:50 +02003148ifdef DC_SHA1_SUBMODULE
3149GIT_ARCHIVE_EXTRA_FILES += \
3150 --prefix=$(GIT_TARNAME)/sha1collisiondetection/ \
3151 --add-file=sha1collisiondetection/LICENSE.txt \
3152 --prefix=$(GIT_TARNAME)/sha1collisiondetection/lib/ \
3153 --add-file=sha1collisiondetection/lib/sha1.c \
3154 --add-file=sha1collisiondetection/lib/sha1.h \
3155 --add-file=sha1collisiondetection/lib/ubc_check.c \
3156 --add-file=sha1collisiondetection/lib/ubc_check.h
3157endif
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02003158dist: git-archive$(X) configure
Ramsay Jonesc5312032020-12-08 22:36:33 +00003159 @$(RM) -r .dist-tmp-dir
3160 @mkdir .dist-tmp-dir
3161 @echo $(GIT_VERSION) > .dist-tmp-dir/version
3162 @$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
René Scharfedf368fa2020-09-19 23:23:50 +02003163 ./git-archive --format=tar \
3164 $(GIT_ARCHIVE_EXTRA_FILES) \
3165 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Ramsay Jonesc5312032020-12-08 22:36:33 +00003166 @$(RM) -r .dist-tmp-dir
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06003167 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003168
Junio C Hamanoab214332016-04-04 23:42:41 -07003169rpm::
3170 @echo >&2 "Use distro packaged sources to run rpmbuild"
3171 @false
3172.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07003173
Johannes Schindelin46689312019-10-04 08:09:36 -07003174ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
3175OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
3176endif
3177
Johannes Schindelin179227d2020-09-21 22:28:16 +00003178artifacts-tar:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) \
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003179 GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003180 $(MOFILES)
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003181 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
3182 SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
3183 test -n "$(ARTIFACTS_DIRECTORY)"
3184 mkdir -p "$(ARTIFACTS_DIRECTORY)"
3185 $(TAR) czf "$(ARTIFACTS_DIRECTORY)/artifacts.tar.gz" $^ templates/blt/
3186.PHONY: artifacts-tar
3187
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003188htmldocs = git-htmldocs-$(GIT_VERSION)
3189manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00003190.PHONY: dist-doc distclean
René Scharfe93e70312020-10-10 18:45:18 +02003191dist-doc: git$X
Emil Medve4cb08df2007-07-14 12:51:44 -05003192 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003193 mkdir .doc-tmp-dir
3194 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
René Scharfe93e70312020-10-10 18:45:18 +02003195 ./git -C .doc-tmp-dir init
3196 ./git -C .doc-tmp-dir add .
3197 ./git -C .doc-tmp-dir commit -m htmldocs
3198 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3199 > $(htmldocs).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003200 gzip -n -9 -f $(htmldocs).tar
3201 :
Emil Medve4cb08df2007-07-14 12:51:44 -05003202 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07003203 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02003204 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003205 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07003206 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003207 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003208 install
René Scharfe93e70312020-10-10 18:45:18 +02003209 ./git -C .doc-tmp-dir init
3210 ./git -C .doc-tmp-dir add .
3211 ./git -C .doc-tmp-dir commit -m manpages
3212 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3213 > $(manpages).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003214 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05003215 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003216
Petr Baudis28818ff2005-07-29 17:50:24 +02003217### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06003218
Mathias Megyei922aa802007-10-04 23:49:19 +02003219distclean: clean
3220 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02003221 $(RM) config.log config.status config.cache
3222 $(RM) config.mak.autogen config.mak.append
3223 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02003224
Theodore Ts'of2d713f2012-02-06 01:00:17 -05003225profile-clean:
3226 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3227 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3228
SZEDER Gábor1a966382018-07-23 15:51:00 +02003229cocciclean:
3230 $(RM) contrib/coccinelle/*.cocci.patch*
3231
3232clean: profile-clean coverage-clean cocciclean
Junio C Hamano7897d842016-04-15 10:06:52 -07003233 $(RM) *.res
3234 $(RM) $(OBJECTS)
Jeff Kingfc473912020-08-13 11:00:17 -04003235 $(RM) $(LIB_FILE) $(XDIFF_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08003236 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003237 $(RM) $(TEST_PROGRAMS)
Josh Steadmon5e472152018-10-12 17:58:40 -07003238 $(RM) $(FUZZ_PROGRAMS)
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02003239 $(RM) $(SP_OBJ)
Denton Liub503a2d2019-09-25 01:21:01 -07003240 $(RM) $(HCC)
Philippe Blain3821c382020-09-03 22:13:38 +00003241 $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003242 $(RM) -r po/build/
Junio C Hamanof3719842019-12-13 15:15:34 -08003243 $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
Ramsay Jonesc5312032020-12-08 22:36:33 +00003244 $(RM) -r .dist-tmp-dir .doc-tmp-dir
Ramsay Jones98836a82020-12-08 22:35:27 +00003245 $(RM) $(GIT_TARNAME).tar.gz
Emil Medve4cb08df2007-07-14 12:51:44 -05003246 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02003247 $(MAKE) -C Documentation/ clean
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07003248 $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
Jeff King499c2932009-04-03 15:32:20 -04003249ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01003250 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003251 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04003252endif
Petr Baudisb1edc532006-06-24 04:34:29 +02003253 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07003254 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003255ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003256 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003257 $(MAKE) -C git-gui clean
3258endif
Christian Couder8f26aa42012-12-18 16:26:37 +01003259 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08003260 $(RM) GIT-USER-AGENT GIT-PREFIX
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04003261 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003262ifdef MSVC
3263 $(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3264 $(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3265 $(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3266 $(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3267 $(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3268 $(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3269 $(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3270 $(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3271 $(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3272 $(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3273 $(RM) compat/vcbuild/MSVC-DEFS-GEN
3274endif
Junio C Hamano9b88fce2005-12-27 14:40:17 -08003275
SZEDER Gábor1a966382018-07-23 15:51:00 +02003276.PHONY: all install profile-clean cocciclean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05003277.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Ævar Arnfjörð Bjarmason922f8bb2021-06-29 13:12:55 +02003278.PHONY: FORCE
Junio C Hamanod89056c2005-12-19 17:59:58 -08003279
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003280### Check documentation
3281#
Johannes Schindelin179227d2020-09-21 22:28:16 +00003282ALL_COMMANDS = $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB)
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003283ALL_COMMANDS += git
Denton Liu805d9ea2020-03-21 05:21:20 -04003284ALL_COMMANDS += git-citool
3285ALL_COMMANDS += git-gui
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003286ALL_COMMANDS += gitk
3287ALL_COMMANDS += gitweb
Elia Pintoe6be2652015-12-15 15:21:00 +00003288
3289.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003290check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07003291 $(MAKE) -C Documentation lint-docs
Johannes Schindelin5ee42462019-03-25 14:41:39 -07003292 @(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003293 do \
3294 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003295 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02003296 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08003297 git-fsck-objects | git-init-db | \
Johannes Schindelin31cf4a62019-04-18 06:16:46 -07003298 git-remote-* | git-stage | git-legacy-* | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08003299 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003300 esac ; \
3301 test -f "Documentation/$$v.txt" || \
3302 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02003303 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08003304 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003305 case "$$v" in \
3306 git) ;; \
3307 *) echo "no link: $$v";; \
3308 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003309 done; \
3310 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02003311 sed -e '1,/^### command list/d' \
3312 -e '/^#/d' \
Johannes Schindelin8e6d6952019-03-25 14:41:38 -07003313 -e '/guide$$/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003314 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08003315 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04003316 $(MAKE) -C Documentation print-man1 | \
3317 grep '\.txt$$' | \
Johannes Schindelin057ccba2019-03-25 14:41:37 -07003318 sed -e 's|^|documented |' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003319 -e 's/\.txt//'; \
3320 ) | while read how cmd; \
3321 do \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003322 case " $(patsubst %$X,%,$(ALL_COMMANDS) $(BUILT_INS) $(EXCLUDED_PROGRAMS)) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003323 *" $$cmd "*) ;; \
3324 *) echo "removed but $$how: $$cmd" ;; \
3325 esac; \
3326 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08003327
3328### Make sure built-ins do not have dups and listed in git.c
3329#
3330check-builtins::
3331 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08003332
Thomas Rast901c3692009-02-19 12:13:35 +01003333### Test suite coverage testing
3334#
Thomas Rast0c38a952013-05-13 23:27:25 +02003335.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00003336.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003337.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01003338
3339coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02003340 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02003341 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01003342
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003343object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003344coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003345 $(RM) $(addsuffix *.gcov,$(object_dirs))
3346 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003347 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003348 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003349 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01003350
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003351coverage-clean: coverage-clean-results
3352 $(RM) $(addsuffix *.gcno,$(object_dirs))
3353
Thomas Rast901c3692009-02-19 12:13:35 +01003354COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
3355COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003356GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01003357
Thomas Rast0c38a952013-05-13 23:27:25 +02003358coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01003359 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02003360
3361coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01003362 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02003363 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01003364
Derrick Stolee22991202019-01-29 09:05:18 -08003365coverage-prove: coverage-clean-results coverage-compile
3366 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
3367 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
3368 -j1 test
3369
Thomas Rast901c3692009-02-19 12:13:35 +01003370coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003371 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02003372 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003373 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00003374
3375coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01003376 grep '^function.*called 0 ' *.c.gcov \
3377 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003378 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003379
3380cover_db: coverage-report
3381 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003382
3383cover_db_html: cover_db
3384 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07003385
Josh Steadmon5e472152018-10-12 17:58:40 -07003386
3387### Fuzz testing
3388#
3389# Building fuzz targets generally requires a special set of compiler flags that
3390# are not necessarily appropriate for general builds, and that vary greatly
3391# depending on the compiler version used.
3392#
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003393# An example command to build against libFuzzer from LLVM 11.0.0:
Josh Steadmon5e472152018-10-12 17:58:40 -07003394#
3395# make CC=clang CXX=clang++ \
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003396# CFLAGS="-fsanitize=fuzzer-no-link,address" \
3397# LIB_FUZZING_ENGINE="-fsanitize=fuzzer" \
Josh Steadmon5e472152018-10-12 17:58:40 -07003398# fuzz-all
3399#
Josh Steadmon927c77e2018-11-14 11:41:47 -08003400FUZZ_CXXFLAGS ?= $(CFLAGS)
3401
Josh Steadmon5e472152018-10-12 17:58:40 -07003402.PHONY: fuzz-all
3403
3404$(FUZZ_PROGRAMS): all
Josh Steadmon927c77e2018-11-14 11:41:47 -08003405 $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07003406 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3407
3408fuzz-all: $(FUZZ_PROGRAMS)