blob: 12be39ac49789898227d025c5249ce5d2842ae47 [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
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000612SCRIPT_LIB += git-sh-i18n
Denton Liu805d9ea2020-03-21 05:21:20 -0400613SCRIPT_LIB += git-sh-setup
Jonathan Nieder46bac902010-01-31 11:46:53 -0800614
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700615SCRIPT_PERL += git-add--interactive.perl
616SCRIPT_PERL += git-archimport.perl
617SCRIPT_PERL += git-cvsexportcommit.perl
618SCRIPT_PERL += git-cvsimport.perl
619SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700620SCRIPT_PERL += git-send-email.perl
621SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700622
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400623SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500624
Matthieu Moy4c06b412013-02-08 18:31:16 +0100625# Generated files for scripts
626SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
627SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
628SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
629
630# Individual rules to allow e.g.
631# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
632# from subdirectories like contrib/*/
633.PHONY: build-perl-script build-sh-script build-python-script
634build-perl-script: $(SCRIPT_PERL_GEN)
635build-sh-script: $(SCRIPT_SH_GEN)
636build-python-script: $(SCRIPT_PYTHON_GEN)
637
638.PHONY: install-perl-script install-sh-script install-python-script
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700639install-sh-script: $(SCRIPT_SH_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500640 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700641install-perl-script: $(SCRIPT_PERL_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500642 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700643install-python-script: $(SCRIPT_PYTHON_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500644 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100645
646.PHONY: clean-perl-script clean-sh-script clean-python-script
647clean-sh-script:
648 $(RM) $(SCRIPT_SH_GEN)
649clean-perl-script:
650 $(RM) $(SCRIPT_PERL_GEN)
651clean-python-script:
652 $(RM) $(SCRIPT_PYTHON_GEN)
653
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700654SCRIPTS = $(SCRIPT_SH_GEN) \
655 $(SCRIPT_PERL_GEN) \
656 $(SCRIPT_PYTHON_GEN) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500657 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100658
Junio C Hamano2f769192010-09-28 16:08:38 -0500659ETAGS_TARGET = TAGS
660
Josh Steadmonaa658572019-01-15 14:25:50 -0800661FUZZ_OBJS += fuzz-commit-graph.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700662FUZZ_OBJS += fuzz-pack-headers.o
Josh Steadmon1127a982018-10-12 17:58:41 -0700663FUZZ_OBJS += fuzz-pack-idx.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100664.PHONY: fuzz-objs
665fuzz-objs: $(FUZZ_OBJS)
Josh Steadmon5e472152018-10-12 17:58:40 -0700666
667# Always build fuzz objects even if not testing, to prevent bit-rot.
668all:: $(FUZZ_OBJS)
669
670FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
671
Junio C Hamano42f77402006-08-15 21:38:07 -0700672# Empty...
673EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100674
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700675# ... and all the rest that could be moved out of bindir to gitexecdir
676PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600677
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100678PROGRAM_OBJS += daemon.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700679PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600680PROGRAM_OBJS += imap-send.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700681PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600682PROGRAM_OBJS += shell.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100683.PHONY: program-objs
684program-objs: $(PROGRAM_OBJS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600685
Michael Palimakaace5e972012-02-08 21:59:04 +1100686# Binary suffix, set to .exe for Windows builds
687X =
688
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600689PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700690
Heba Walyb3b18d12020-03-02 20:01:59 +0000691TEST_BUILTINS_OBJS += test-advise.o
Taylor Blau483fa7f2021-03-31 21:32:11 -0400692TEST_BUILTINS_OBJS += test-bitmap.o
Garima Singhf52207a2020-03-30 00:31:24 +0000693TEST_BUILTINS_OBJS += test-bloom.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100694TEST_BUILTINS_OBJS += test-chmtime.o
Nguyễn Thái Ngọc Duy0e2678a2018-03-24 08:44:34 +0100695TEST_BUILTINS_OBJS += test-config.o
Derrick Stolee2fec6042020-09-11 17:49:18 +0000696TEST_BUILTINS_OBJS += test-crontab.o
Nguyễn Thái Ngọc Duye4998942018-03-24 08:44:35 +0100697TEST_BUILTINS_OBJS += test-ctype.o
Nguyễn Thái Ngọc Duya801a7c2018-03-24 08:44:36 +0100698TEST_BUILTINS_OBJS += test-date.o
Nguyễn Thái Ngọc Duy9153dde2018-03-24 08:44:37 +0100699TEST_BUILTINS_OBJS += test-delta.o
Daniel Ferreira150791a2019-07-10 20:58:57 -0300700TEST_BUILTINS_OBJS += test-dir-iterator.o
Nguyễn Thái Ngọc Duy1c854742018-03-24 08:44:38 +0100701TEST_BUILTINS_OBJS += test-drop-caches.o
Nguyễn Thái Ngọc Duy06ccb292018-03-24 08:44:39 +0100702TEST_BUILTINS_OBJS += test-dump-cache-tree.o
Nguyễn Thái Ngọc Duyf1ef0b02018-09-09 19:36:30 +0200703TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
Nguyễn Thái Ngọc Duy81330612018-03-24 08:44:40 +0100704TEST_BUILTINS_OBJS += test-dump-split-index.o
Nguyễn Thái Ngọc Duycd780f02018-09-09 19:36:27 +0200705TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
Nguyễn Thái Ngọc Duydbceb3e2018-03-24 08:44:41 +0100706TEST_BUILTINS_OBJS += test-example-decorate.o
Elijah Newrenfe1a21d2020-10-29 20:32:13 +0000707TEST_BUILTINS_OBJS += test-fast-rebase.o
Nguyễn Thái Ngọc Duyc6806682018-03-24 08:44:42 +0100708TEST_BUILTINS_OBJS += test-genrandom.o
Johannes Schindelind5cfd142019-02-14 13:33:12 -0800709TEST_BUILTINS_OBJS += test-genzeros.o
Ævar Arnfjörð Bjarmason482e1482021-07-30 18:18:14 +0200710TEST_BUILTINS_OBJS += test-getcwd.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400711TEST_BUILTINS_OBJS += test-hash-speed.o
brian m. carlson50c817e2018-11-14 04:09:32 +0000712TEST_BUILTINS_OBJS += test-hash.o
Nguyễn Thái Ngọc Duy7c18cbd2018-03-24 08:44:43 +0100713TEST_BUILTINS_OBJS += test-hashmap.o
Nguyễn Thái Ngọc Duycc6f6632018-03-24 08:44:44 +0100714TEST_BUILTINS_OBJS += test-index-version.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000715TEST_BUILTINS_OBJS += test-json-writer.o
Nguyễn Thái Ngọc Duy64eb82f2018-03-24 08:44:33 +0100716TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
Nguyễn Thái Ngọc Duy9080e752018-03-24 08:44:45 +0100717TEST_BUILTINS_OBJS += test-match-trees.o
Nguyễn Thái Ngọc Duy34889d32018-03-24 08:44:46 +0100718TEST_BUILTINS_OBJS += test-mergesort.o
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +0100719TEST_BUILTINS_OBJS += test-mktemp.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700720TEST_BUILTINS_OBJS += test-oid-array.o
Christian Couder11510de2019-06-15 12:06:59 +0200721TEST_BUILTINS_OBJS += test-oidmap.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000722TEST_BUILTINS_OBJS += test-oidtree.o
Nguyễn Thái Ngọc Duyc033cc12018-03-24 08:44:48 +0100723TEST_BUILTINS_OBJS += test-online-cpus.o
Nguyễn Thái Ngọc Duy2f17c782018-09-09 19:36:29 +0200724TEST_BUILTINS_OBJS += test-parse-options.o
Alexandr Miloslavskiyd0d0a352019-12-31 10:15:12 +0000725TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
Jonathan Tanef830cc2021-06-17 10:13:26 -0700726TEST_BUILTINS_OBJS += test-partial-clone.o
Nguyễn Thái Ngọc Duyb8d5cf42018-03-24 08:44:49 +0100727TEST_BUILTINS_OBJS += test-path-utils.o
Ævar Arnfjörð Bjarmason95ca1f92021-01-24 18:28:13 +0100728TEST_BUILTINS_OBJS += test-pcre2-config.o
Nguyễn Thái Ngọc Duy8ea40cc2018-09-09 19:36:28 +0200729TEST_BUILTINS_OBJS += test-pkt-line.o
Nguyễn Thái Ngọc Duy15b75812018-03-24 08:44:50 +0100730TEST_BUILTINS_OBJS += test-prio-queue.o
Jiang Xin15d3af52020-08-27 11:45:44 -0400731TEST_BUILTINS_OBJS += test-proc-receive.o
SZEDER Gábor2bb74b52019-09-16 22:54:12 +0200732TEST_BUILTINS_OBJS += test-progress.o
Derrick Stoleeab176ac2018-07-20 16:33:15 +0000733TEST_BUILTINS_OBJS += test-reach.o
Nguyễn Thái Ngọc Duy5fbe6002018-03-24 08:44:51 +0100734TEST_BUILTINS_OBJS += test-read-cache.o
Derrick Stolee4bd05932019-11-12 16:58:20 +0000735TEST_BUILTINS_OBJS += test-read-graph.o
Derrick Stolee4d805602018-07-12 15:39:23 -0400736TEST_BUILTINS_OBJS += test-read-midx.o
Nguyễn Thái Ngọc Duy65370d82018-03-24 08:44:52 +0100737TEST_BUILTINS_OBJS += test-ref-store.o
Nguyễn Thái Ngọc Duy90385312018-03-24 08:44:53 +0100738TEST_BUILTINS_OBJS += test-regex.o
Jonathan Tandade47c2018-07-11 15:42:42 -0700739TEST_BUILTINS_OBJS += test-repository.o
Nguyễn Thái Ngọc Duy77d4b8c2018-03-24 08:44:54 +0100740TEST_BUILTINS_OBJS += test-revision-walking.o
Nguyễn Thái Ngọc Duyae6a51f2018-03-24 08:44:55 +0100741TEST_BUILTINS_OBJS += test-run-command.o
Nguyễn Thái Ngọc Duyff5fb8b2018-03-24 08:44:56 +0100742TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
Johannes Schindelinb7ce24d2019-04-18 06:16:51 -0700743TEST_BUILTINS_OBJS += test-serve-v2.o
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +0100744TEST_BUILTINS_OBJS += test-sha1.o
brian m. carlson13eeedb2018-11-14 04:09:36 +0000745TEST_BUILTINS_OBJS += test-sha256.o
Nguyễn Thái Ngọc Duye154a6f2018-03-24 08:44:58 +0100746TEST_BUILTINS_OBJS += test-sigchain.o
Jeff Hostetler36a7eb62021-03-22 10:29:48 +0000747TEST_BUILTINS_OBJS += test-simple-ipc.o
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +0100748TEST_BUILTINS_OBJS += test-strcmp-offset.o
Nguyễn Thái Ngọc Duyc932a5f2018-03-24 08:45:00 +0100749TEST_BUILTINS_OBJS += test-string-list.o
Nguyễn Thái Ngọc Duyb6188212018-03-24 08:45:01 +0100750TEST_BUILTINS_OBJS += test-submodule-config.o
Antonio Ospite2b1257e2018-10-25 18:18:13 +0200751TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
Nguyễn Thái Ngọc Duy112edd62018-03-24 08:45:02 +0100752TEST_BUILTINS_OBJS += test-subprocess.o
Jeff Hostetlera15860d2019-02-22 14:25:10 -0800753TEST_BUILTINS_OBJS += test-trace2.o
Nguyễn Thái Ngọc Duy599fbd82018-03-24 08:45:03 +0100754TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
Ævar Arnfjörð Bjarmason28e8f0d2021-04-08 17:04:21 +0200755TEST_BUILTINS_OBJS += test-userdiff.o
Nguyễn Thái Ngọc Duy04892892018-03-24 08:45:04 +0100756TEST_BUILTINS_OBJS += test-wildmatch.o
Jeff Hostetler06ba9d02018-09-11 13:06:01 -0700757TEST_BUILTINS_OBJS += test-windows-named-pipe.o
Nguyễn Thái Ngọc Duyc81f8432018-03-24 08:45:05 +0100758TEST_BUILTINS_OBJS += test-write-cache.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400759TEST_BUILTINS_OBJS += test-xml-encode.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100760
Nguyễn Thái Ngọc Duyc9a1f412018-09-09 19:36:31 +0200761# Do not add more tests here unless they have extra dependencies. Add
762# them in TEST_BUILTINS_OBJS above.
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100763TEST_PROGRAMS_NEED_X += test-fake-ssh
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100764TEST_PROGRAMS_NEED_X += test-tool
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600765
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700766TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100767
Junio C Hamano17368552008-02-23 11:08:25 -0800768# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800769# builtin/$C.o but is linked in as part of some other command.
770BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700771
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700772BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100773BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700774BUILT_INS += git-format-patch$X
775BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700776BUILT_INS += git-init$X
Jeff King0a21d0e2020-12-01 21:34:11 -0500777BUILT_INS += git-maintenance$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700778BUILT_INS += git-merge-subtree$X
Nguyễn Thái Ngọc Duy46e91b62019-04-25 16:45:45 +0700779BUILT_INS += git-restore$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700780BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800781BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700782BUILT_INS += git-status$X
Nguyễn Thái Ngọc Duyd787d312019-03-29 17:39:05 +0700783BUILT_INS += git-switch$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700784BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700785
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700786# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400787OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700788
Matthew Ogilvieea925192009-12-02 22:14:05 -0700789# what test wrappers are needed and 'install' will install, in bindir
790BINDIR_PROGRAMS_NEED_X += git
Matthew Ogilvieea925192009-12-02 22:14:05 -0700791BINDIR_PROGRAMS_NEED_X += git-receive-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700792BINDIR_PROGRAMS_NEED_X += git-shell
Denton Liu805d9ea2020-03-21 05:21:20 -0400793BINDIR_PROGRAMS_NEED_X += git-upload-archive
794BINDIR_PROGRAMS_NEED_X += git-upload-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700795
796BINDIR_PROGRAMS_NO_X += git-cvsserver
797
Ryan Anderson3d320512005-11-21 00:11:22 -0500798# Set paths to tools early so that they can be used for version tests.
799ifndef SHELL_PATH
800 SHELL_PATH = /bin/sh
801endif
802ifndef PERL_PATH
803 PERL_PATH = /usr/bin/perl
804endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100805ifndef PYTHON_PATH
806 PYTHON_PATH = /usr/bin/python
807endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700808
Luben Tuikov3a793472006-12-14 23:03:03 -0800809export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100810export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800811
Jeff King3f824e92017-12-08 05:47:22 -0500812TEST_SHELL_PATH = $(SHELL_PATH)
813
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100814LIB_FILE = libgit.a
815XDIFF_LIB = xdiff/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700816
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +0200817GENERATED_H += command-list.h
Denton Liu8474f262020-10-08 00:39:26 -0700818GENERATED_H += config-list.h
Ævar Arnfjörð Bjarmasoncfe853e2021-09-26 21:03:29 +0200819GENERATED_H += hook-list.h
820
Ævar Arnfjörð Bjarmason7c3c0a92021-09-23 12:29:57 +0200821.PHONY: generated-hdrs
822generated-hdrs: $(GENERATED_H)
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700823
Denton Liucf6a2d22019-09-16 12:23:08 -0700824LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
Johannes Schindelin92b88eb2019-03-04 05:47:06 -0800825 $(FIND) . \
Jeff Kingd85b0df2014-08-25 16:00:42 -0400826 -name .git -prune -o \
827 -name t -prune -o \
828 -name Documentation -prune -o \
Denton Liucf6a2d22019-09-16 12:23:08 -0700829 -name '*.h' -print)))
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700830
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400831LIB_OBJS += abspath.o
Johannes Schindelinf83dff62019-11-13 12:40:57 +0000832LIB_OBJS += add-interactive.o
Johannes Schindelinf6aa7ec2019-12-13 08:07:48 +0000833LIB_OBJS += add-patch.o
Jeff King75194432009-09-09 07:38:58 -0400834LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700835LIB_OBJS += alias.o
836LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200837LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700838LIB_OBJS += archive-tar.o
839LIB_OBJS += archive-zip.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400840LIB_OBJS += archive.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700841LIB_OBJS += attr.o
842LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100843LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500844LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700845LIB_OBJS += blob.o
Garima Singhf52207a2020-03-30 00:31:24 +0000846LIB_OBJS += bloom.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700847LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700848LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700849LIB_OBJS += bundle.o
850LIB_OBJS += cache-tree.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000851LIB_OBJS += cbtree.o
Jeff King2b5ed372018-03-30 14:35:04 -0400852LIB_OBJS += chdir-notify.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000853LIB_OBJS += checkout.o
Derrick Stolee570df422021-02-18 14:07:24 +0000854LIB_OBJS += chunk-format.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700855LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700856LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700857LIB_OBJS += combine-diff.o
Derrick Stolee08fd81c2018-04-02 16:34:19 -0400858LIB_OBJS += commit-graph.o
Derrick Stolee5227c382018-07-20 16:33:02 +0000859LIB_OBJS += commit-reach.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400860LIB_OBJS += commit.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200861LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500862LIB_OBJS += compat/terminal.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700863LIB_OBJS += config.o
864LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700865LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700866LIB_OBJS += convert.o
867LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500868LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700869LIB_OBJS += csum-file.o
870LIB_OBJS += ctype.o
871LIB_OBJS += date.o
872LIB_OBJS += decorate.o
Jeff Kingc8d521f2018-08-16 08:13:07 +0200873LIB_OBJS += delta-islands.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400874LIB_OBJS += diff-delta.o
Sergey Organova37eec62020-12-21 18:19:33 +0300875LIB_OBJS += diff-merges.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400876LIB_OBJS += diff-lib.o
877LIB_OBJS += diff-no-index.o
878LIB_OBJS += diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700879LIB_OBJS += diffcore-break.o
880LIB_OBJS += diffcore-delta.o
881LIB_OBJS += diffcore-order.o
882LIB_OBJS += diffcore-pickaxe.o
883LIB_OBJS += diffcore-rename.o
Junio C Hamano1eb41362021-02-11 11:57:50 -0800884LIB_OBJS += diffcore-rotate.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200885LIB_OBJS += dir-iterator.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400886LIB_OBJS += dir.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200887LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700888LIB_OBJS += entry.o
889LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500890LIB_OBJS += ewah/bitmap.o
891LIB_OBJS += ewah/ewah_bitmap.o
892LIB_OBJS += ewah/ewah_io.o
893LIB_OBJS += ewah/ewah_rlw.o
Stefan Bellerd807c4a2018-04-10 14:26:18 -0700894LIB_OBJS += exec-cmd.o
Jonathan Tanec062832018-06-14 15:54:28 -0700895LIB_OBJS += fetch-negotiator.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700896LIB_OBJS += fetch-pack.o
Denton Liuce6521e2020-03-23 21:07:51 -0400897LIB_OBJS += fmt-merge-msg.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700898LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400899LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100900LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700901LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700902LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700903LIB_OBJS += grep.o
Martin Ågrenbc626922020-12-31 12:56:23 +0100904LIB_OBJS += hash-lookup.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100905LIB_OBJS += hashmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700906LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800907LIB_OBJS += hex.o
Ævar Arnfjörð Bjarmason5e3aba32021-09-26 21:03:26 +0200908LIB_OBJS += hook.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700909LIB_OBJS += ident.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000910LIB_OBJS += json-writer.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200911LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200912LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100913LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100914LIB_OBJS += line-range.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400915LIB_OBJS += linear-assignment.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000916LIB_OBJS += list-objects-filter-options.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400917LIB_OBJS += list-objects-filter.o
918LIB_OBJS += list-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700919LIB_OBJS += ll-merge.o
920LIB_OBJS += lockfile.o
921LIB_OBJS += log-tree.o
Brandon Williams72d0ea02018-03-15 10:31:20 -0700922LIB_OBJS += ls-refs.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700923LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700924LIB_OBJS += mailmap.o
925LIB_OBJS += match-trees.o
Jameson Miller065feab2018-04-11 18:37:55 +0000926LIB_OBJS += mem-pool.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800927LIB_OBJS += merge-blobs.o
Elijah Newren17e55742020-10-27 02:08:07 +0000928LIB_OBJS += merge-ort.o
Elijah Newren47b1e892020-10-27 02:08:08 +0000929LIB_OBJS += merge-ort-wrappers.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200930LIB_OBJS += merge-recursive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400931LIB_OBJS += merge.o
René Scharfe0db71e02012-04-01 00:10:11 +0200932LIB_OBJS += mergesort.o
Derrick Stoleea3407732018-07-12 15:39:21 -0400933LIB_OBJS += midx.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700934LIB_OBJS += name-hash.o
Jonathan Tanec062832018-06-14 15:54:28 -0700935LIB_OBJS += negotiator/default.o
Jonathan Tancbe566a2020-08-17 21:01:31 -0700936LIB_OBJS += negotiator/noop.o
Jonathan Tan42cc7482018-07-16 11:44:01 -0700937LIB_OBJS += negotiator/skipping.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400938LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100939LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200940LIB_OBJS += notes-utils.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400941LIB_OBJS += notes.o
Martin Ågrene5afd442020-12-31 12:56:21 +0100942LIB_OBJS += object-file.o
Martin Ågren1e6771e2020-12-31 12:56:20 +0100943LIB_OBJS += object-name.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700944LIB_OBJS += object.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700945LIB_OBJS += oid-array.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700946LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500947LIB_OBJS += oidset.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000948LIB_OBJS += oidtree.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500949LIB_OBJS += pack-bitmap-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400950LIB_OBJS += pack-bitmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700951LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400952LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700953LIB_OBJS += pack-revindex.o
954LIB_OBJS += pack-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400955LIB_OBJS += packfile.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700956LIB_OBJS += pager.o
Matheus Tavares04155bd2021-04-18 21:14:53 -0300957LIB_OBJS += parallel-checkout.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600958LIB_OBJS += parse-options-cb.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400959LIB_OBJS += parse-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700960LIB_OBJS += patch-delta.o
961LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700962LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000963LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700964LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100965LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700966LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700967LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700968LIB_OBJS += progress.o
Christian Couder48de3152019-06-25 15:40:27 +0200969LIB_OBJS += promisor-remote.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500970LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700971LIB_OBJS += protocol.o
Bruno Albuquerquea2ba1622021-04-20 16:38:31 -0700972LIB_OBJS += protocol-caps.o
Denton Liu9460fd42020-03-23 21:07:52 -0400973LIB_OBJS += prune-packed.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700974LIB_OBJS += quote.o
Johannes Schindelind9c66f02018-08-13 04:33:04 -0700975LIB_OBJS += range-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700976LIB_OBJS += reachable.o
977LIB_OBJS += read-cache.o
Alban Gruin145e05a2018-08-10 18:51:29 +0200978LIB_OBJS += rebase-interactive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400979LIB_OBJS += rebase.o
980LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700981LIB_OBJS += reflog-walk.o
982LIB_OBJS += refs.o
Han-Wen Nienhuys4441f422020-09-09 10:15:08 +0000983LIB_OBJS += refs/debug.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100984LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200985LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200986LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200987LIB_OBJS += refs/ref-cache.o
Brandon Williamsec0cb492018-05-16 15:57:48 -0700988LIB_OBJS += refspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700989LIB_OBJS += remote.o
Stefan Beller11bc0582018-04-10 14:26:21 -0700990LIB_OBJS += replace-object.o
Derrick Stolee7211b9e2019-08-13 11:37:43 -0700991LIB_OBJS += repo-settings.o
Brandon Williams359efef2017-06-22 11:43:32 -0700992LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200993LIB_OBJS += rerere.o
Denton Liub309a972020-04-07 10:28:00 -0400994LIB_OBJS += reset.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800995LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700996LIB_OBJS += revision.o
997LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +0700998LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700999LIB_OBJS += sequencer.o
Brandon Williamsed10cb92018-03-15 10:31:19 -07001000LIB_OBJS += serve.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001001LIB_OBJS += server-info.o
1002LIB_OBJS += setup.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001003LIB_OBJS += shallow.o
1004LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -05001005LIB_OBJS += sigchain.o
Derrick Stolee3964fc22021-03-30 13:10:47 +00001006LIB_OBJS += sparse-index.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +07001007LIB_OBJS += split-index.o
Johannes Schindelin97fff612019-09-30 10:21:54 -07001008LIB_OBJS += stable-qsort.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001009LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -07001010LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001011LIB_OBJS += string-list.o
Elijah Newrenae20bf12020-11-02 18:55:06 +00001012LIB_OBJS += strmap.o
Denton Liu8474f262020-10-08 00:39:26 -07001013LIB_OBJS += strvec.o
Ben Peart99605d62017-05-05 11:28:01 -04001014LIB_OBJS += sub-process.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001015LIB_OBJS += submodule-config.o
1016LIB_OBJS += submodule.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001017LIB_OBJS += symlinks.o
1018LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +02001019LIB_OBJS += tempfile.o
Nguyễn Thái Ngọc Duy0ec79352018-10-27 19:29:59 +02001020LIB_OBJS += thread-utils.o
Jeff King2564d992016-10-03 16:49:11 -04001021LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001022LIB_OBJS += trace.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001023LIB_OBJS += trace2.o
1024LIB_OBJS += trace2/tr2_cfg.o
1025LIB_OBJS += trace2/tr2_cmd_name.o
1026LIB_OBJS += trace2/tr2_dst.o
1027LIB_OBJS += trace2/tr2_sid.o
Jeff Hostetlerbce9db62019-04-15 13:39:47 -07001028LIB_OBJS += trace2/tr2_sysenv.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001029LIB_OBJS += trace2/tr2_tbuf.o
1030LIB_OBJS += trace2/tr2_tgt_event.o
1031LIB_OBJS += trace2/tr2_tgt_normal.o
1032LIB_OBJS += trace2/tr2_tgt_perf.o
1033LIB_OBJS += trace2/tr2_tls.o
Christian Couder9385b5d2014-10-13 20:16:23 +02001034LIB_OBJS += trailer.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -04001035LIB_OBJS += transport-helper.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001036LIB_OBJS += transport.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001037LIB_OBJS += tree-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001038LIB_OBJS += tree-walk.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001039LIB_OBJS += tree.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001040LIB_OBJS += unpack-trees.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001041LIB_OBJS += upload-pack.o
Jeff King638794c2010-05-23 05:17:55 -04001042LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -07001043LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001044LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001045LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001046LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -07001047LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -04001048LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +07001049LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001050LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +07001051LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -04001052LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -07001053LIB_OBJS += wrapper.o
Stefan Bellerfa2656f2018-04-10 14:26:16 -07001054LIB_OBJS += write-or-die.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001055LIB_OBJS += ws.o
1056LIB_OBJS += wt-status.o
1057LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -05001058LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +02001059
Linus Torvalds81b50f32010-02-22 08:42:18 -08001060BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +08001061BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001062BUILTIN_OBJS += builtin/annotate.o
1063BUILTIN_OBJS += builtin/apply.o
1064BUILTIN_OBJS += builtin/archive.o
1065BUILTIN_OBJS += builtin/bisect--helper.o
1066BUILTIN_OBJS += builtin/blame.o
1067BUILTIN_OBJS += builtin/branch.o
Jeff Kingd7a56492020-08-13 10:59:36 -04001068BUILTIN_OBJS += builtin/bugreport.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001069BUILTIN_OBJS += builtin/bundle.o
1070BUILTIN_OBJS += builtin/cat-file.o
1071BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +00001072BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -04001073BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001074BUILTIN_OBJS += builtin/check-ref-format.o
Matheus Tavarese9e8adf2021-04-18 21:14:54 -03001075BUILTIN_OBJS += builtin/checkout--worker.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001076BUILTIN_OBJS += builtin/checkout-index.o
1077BUILTIN_OBJS += builtin/checkout.o
1078BUILTIN_OBJS += builtin/clean.o
1079BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +07001080BUILTIN_OBJS += builtin/column.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001081BUILTIN_OBJS += builtin/commit-graph.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001082BUILTIN_OBJS += builtin/commit-tree.o
1083BUILTIN_OBJS += builtin/commit.o
1084BUILTIN_OBJS += builtin/config.o
1085BUILTIN_OBJS += builtin/count-objects.o
Denton Liu8474f262020-10-08 00:39:26 -07001086BUILTIN_OBJS += builtin/credential-cache--daemon.o
1087BUILTIN_OBJS += builtin/credential-cache.o
1088BUILTIN_OBJS += builtin/credential-store.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +02001089BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001090BUILTIN_OBJS += builtin/describe.o
1091BUILTIN_OBJS += builtin/diff-files.o
1092BUILTIN_OBJS += builtin/diff-index.o
1093BUILTIN_OBJS += builtin/diff-tree.o
1094BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +01001095BUILTIN_OBJS += builtin/difftool.o
Ævar Arnfjörð Bjarmasonb4f207f2019-06-21 12:18:06 +02001096BUILTIN_OBJS += builtin/env--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001097BUILTIN_OBJS += builtin/fast-export.o
Jeff Kinga006f872020-08-13 10:59:45 -04001098BUILTIN_OBJS += builtin/fast-import.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001099BUILTIN_OBJS += builtin/fetch-pack.o
1100BUILTIN_OBJS += builtin/fetch.o
1101BUILTIN_OBJS += builtin/fmt-merge-msg.o
1102BUILTIN_OBJS += builtin/for-each-ref.o
Derrick Stolee4950b2a2020-09-11 17:49:16 +00001103BUILTIN_OBJS += builtin/for-each-repo.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001104BUILTIN_OBJS += builtin/fsck.o
1105BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -08001106BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001107BUILTIN_OBJS += builtin/grep.o
1108BUILTIN_OBJS += builtin/hash-object.o
1109BUILTIN_OBJS += builtin/help.o
1110BUILTIN_OBJS += builtin/index-pack.o
1111BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +02001112BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001113BUILTIN_OBJS += builtin/log.o
1114BUILTIN_OBJS += builtin/ls-files.o
1115BUILTIN_OBJS += builtin/ls-remote.o
1116BUILTIN_OBJS += builtin/ls-tree.o
1117BUILTIN_OBJS += builtin/mailinfo.o
1118BUILTIN_OBJS += builtin/mailsplit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001119BUILTIN_OBJS += builtin/merge-base.o
1120BUILTIN_OBJS += builtin/merge-file.o
1121BUILTIN_OBJS += builtin/merge-index.o
1122BUILTIN_OBJS += builtin/merge-ours.o
1123BUILTIN_OBJS += builtin/merge-recursive.o
1124BUILTIN_OBJS += builtin/merge-tree.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001125BUILTIN_OBJS += builtin/merge.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001126BUILTIN_OBJS += builtin/mktag.o
1127BUILTIN_OBJS += builtin/mktree.o
Derrick Stolee6a257f02018-07-12 15:39:20 -04001128BUILTIN_OBJS += builtin/multi-pack-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001129BUILTIN_OBJS += builtin/mv.o
1130BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -07001131BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001132BUILTIN_OBJS += builtin/pack-objects.o
1133BUILTIN_OBJS += builtin/pack-redundant.o
1134BUILTIN_OBJS += builtin/pack-refs.o
1135BUILTIN_OBJS += builtin/patch-id.o
1136BUILTIN_OBJS += builtin/prune-packed.o
1137BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001138BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001139BUILTIN_OBJS += builtin/push.o
Johannes Schindelin348ae562018-08-13 04:33:02 -07001140BUILTIN_OBJS += builtin/range-diff.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001141BUILTIN_OBJS += builtin/read-tree.o
Pratik Karki55071ea2018-08-07 01:16:09 +05451142BUILTIN_OBJS += builtin/rebase.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001143BUILTIN_OBJS += builtin/receive-pack.o
1144BUILTIN_OBJS += builtin/reflog.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001145BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001146BUILTIN_OBJS += builtin/remote-fd.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001147BUILTIN_OBJS += builtin/remote.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001148BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001149BUILTIN_OBJS += builtin/replace.o
1150BUILTIN_OBJS += builtin/rerere.o
1151BUILTIN_OBJS += builtin/reset.o
1152BUILTIN_OBJS += builtin/rev-list.o
1153BUILTIN_OBJS += builtin/rev-parse.o
1154BUILTIN_OBJS += builtin/revert.o
1155BUILTIN_OBJS += builtin/rm.o
1156BUILTIN_OBJS += builtin/send-pack.o
1157BUILTIN_OBJS += builtin/shortlog.o
1158BUILTIN_OBJS += builtin/show-branch.o
Jeff Kingff417262018-05-28 05:38:53 -04001159BUILTIN_OBJS += builtin/show-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001160BUILTIN_OBJS += builtin/show-ref.o
Derrick Stolee94c09562019-11-21 22:04:33 +00001161BUILTIN_OBJS += builtin/sparse-checkout.o
Paul-Sebastian Ungureanu40af1462019-02-25 23:16:28 +00001162BUILTIN_OBJS += builtin/stash.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001163BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001164BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001165BUILTIN_OBJS += builtin/symbolic-ref.o
1166BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001167BUILTIN_OBJS += builtin/unpack-file.o
1168BUILTIN_OBJS += builtin/unpack-objects.o
1169BUILTIN_OBJS += builtin/update-index.o
1170BUILTIN_OBJS += builtin/update-ref.o
1171BUILTIN_OBJS += builtin/update-server-info.o
1172BUILTIN_OBJS += builtin/upload-archive.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001173BUILTIN_OBJS += builtin/upload-pack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001174BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001175BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001176BUILTIN_OBJS += builtin/verify-pack.o
1177BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001178BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001179BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001180
Denton Liu5dedf7d2019-09-16 12:23:11 -07001181# THIRD_PARTY_SOURCES is a list of patterns compatible with the
1182# $(filter) and $(filter-out) family of functions. They specify source
1183# files which are taken from some third-party source where we want to be
1184# less strict about issues such as coding style so we don't diverge from
1185# upstream unnecessarily (making merging in future changes easier).
1186THIRD_PARTY_SOURCES += compat/inet_ntop.c
1187THIRD_PARTY_SOURCES += compat/inet_pton.c
1188THIRD_PARTY_SOURCES += compat/nedmalloc/%
1189THIRD_PARTY_SOURCES += compat/obstack.%
1190THIRD_PARTY_SOURCES += compat/poll/%
1191THIRD_PARTY_SOURCES += compat/regex/%
1192THIRD_PARTY_SOURCES += sha1collisiondetection/%
1193THIRD_PARTY_SOURCES += sha1dc/%
1194
Jeff King3f2e2292016-07-01 01:58:58 -04001195GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +02001196EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001197
Jeff King42dcbb72012-06-02 15:01:12 -04001198GIT_USER_AGENT = git/$(GIT_VERSION)
1199
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001200ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1201DC_SHA1_SUBMODULE = auto
1202endif
1203
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001204# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1205# tweaked by config.* below as well as the command-line, both of
1206# which'll override these defaults.
1207CFLAGS = -g -O2 -Wall
1208LDFLAGS =
Ævar Arnfjörð Bjarmason0f50c8e2019-05-17 23:58:47 +02001209CC_LD_DYNPATH = -Wl,-rpath,
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001210BASIC_CFLAGS = -I.
1211BASIC_LDFLAGS =
1212
1213# library flags
1214ARFLAGS = rcs
1215PTHREAD_CFLAGS =
1216
1217# For the 'sparse' target
1218SPARSE_FLAGS ?=
Luc Van Oostenryck1c9664232020-05-22 02:25:02 +02001219SP_EXTRA_FLAGS = -Wno-universal-initializer
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001220
Ævar Arnfjörð Bjarmason2cdc2922021-09-23 11:20:45 +02001221# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak target
1222SANITIZE_LEAK =
1223
Jeff King960154b2019-05-06 19:43:34 -04001224# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
1225# usually result in less CPU usage at the cost of higher peak memory.
Jeff Kingbcb4edf2019-05-08 03:07:54 -04001226# Setting it to 0 will feed all files in a single spatch invocation.
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001227SPATCH_FLAGS = --all-includes --patch .
Jeff King960154b2019-05-06 19:43:34 -04001228SPATCH_BATCH_SIZE = 1
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001229
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001230include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001231-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001232-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001233
Matthieu Moyd6156282016-05-31 15:24:43 +02001234ifdef DEVELOPER
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +00001235include config.mak.dev
Matthieu Moyd6156282016-05-31 15:24:43 +02001236endif
1237
Johannes Schindelin4a5ec7d2021-01-21 13:09:45 +00001238# what 'all' will build and 'install' will install in gitexecdir,
1239# excluding programs for built-in commands
1240ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
1241ALL_COMMANDS_TO_INSTALL = $(ALL_PROGRAMS)
1242ifeq (,$(SKIP_DASHED_BUILT_INS))
1243ALL_COMMANDS_TO_INSTALL += $(BUILT_INS)
1244else
1245# git-upload-pack, git-receive-pack and git-upload-archive are special: they
1246# are _expected_ to be present in the `bin/` directory in their dashed form.
1247ALL_COMMANDS_TO_INSTALL += git-receive-pack$(X)
1248ALL_COMMANDS_TO_INSTALL += git-upload-archive$(X)
1249ALL_COMMANDS_TO_INSTALL += git-upload-pack$(X)
1250endif
1251
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +01001252ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001253ALL_LDFLAGS = $(LDFLAGS)
1254
René Scharfe425ca672017-07-15 19:18:56 +02001255comma := ,
1256empty :=
1257space := $(empty) $(empty)
1258
Jeff King56b5db32017-07-10 09:24:42 -04001259ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001260SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001261BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001262BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001263ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King07a20f52019-03-12 17:06:26 -04001264BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
Jeff King566cf0b2017-07-10 09:24:50 -04001265endif
Jeff King0e5bba52017-09-08 02:38:41 -04001266ifneq ($(filter leak,$(SANITIZERS)),)
1267BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
Ævar Arnfjörð Bjarmason2cdc2922021-09-23 11:20:45 +02001268SANITIZE_LEAK = YesCompiledWithIt
Jeff King0e5bba52017-09-08 02:38:41 -04001269endif
Jeff Kingf65d07f2020-01-16 12:51:38 -05001270ifneq ($(filter address,$(SANITIZERS)),)
1271NO_REGEX = NeededForASAN
1272endif
Jeff King56b5db32017-07-10 09:24:42 -04001273endif
1274
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001275ifndef sysconfdir
1276ifeq ($(prefix),/usr)
1277sysconfdir = /etc
1278else
1279sysconfdir = etc
1280endif
1281endif
1282
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001283ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001284COMPUTE_HEADER_DEPENDENCIES = auto
1285endif
1286
1287ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001288dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Ævar Arnfjörð Bjarmason731b6852021-09-23 00:08:01 +02001289 -Wno-pedantic \
Jonathan Nieder69789342011-11-18 17:23:24 -06001290 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1291 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001292 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001293ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001294override COMPUTE_HEADER_DEPENDENCIES = yes
1295else
1296override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001297endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001298endif
1299
Jonathan Nieder024c8432011-11-18 03:58:21 -06001300ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001301USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001302else
1303ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1304$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1305(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1306endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001307endif
1308
Philippe Blain3821c382020-09-03 22:13:38 +00001309ifndef GENERATE_COMPILATION_DATABASE
1310GENERATE_COMPILATION_DATABASE = no
1311endif
1312
1313ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
1314compdb_check = $(shell $(CC) $(ALL_CFLAGS) \
Ævar Arnfjörð Bjarmasondd20e4a2021-09-23 00:08:02 +02001315 -Wno-pedantic \
Philippe Blain3821c382020-09-03 22:13:38 +00001316 -c -MJ /dev/null \
1317 -x c /dev/null -o /dev/null 2>&1; \
1318 echo $$?)
1319ifneq ($(compdb_check),0)
1320override GENERATE_COMPILATION_DATABASE = no
1321$(warning GENERATE_COMPILATION_DATABASE is set to "yes", but your compiler does not \
1322support generating compilation database entries)
1323endif
1324else
1325ifneq ($(GENERATE_COMPILATION_DATABASE),no)
1326$(error please set GENERATE_COMPILATION_DATABASE to "yes" or "no" \
1327(not "$(GENERATE_COMPILATION_DATABASE)"))
1328endif
1329endif
1330
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001331ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001332SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
Jeff Hostetlerc444bf82019-06-19 14:06:06 -07001333BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001334PATH := $(SANE_TOOL_PATH):${PATH}
1335else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001336BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001337endif
1338
Eric Sunshineb2289402017-12-15 00:34:34 +01001339ifeq (,$(HOST_CPU))
1340 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1341else
1342 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1343endif
1344
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001345ifneq (,$(INLINE))
1346 BASIC_CFLAGS += -Dinline=$(INLINE)
1347endif
1348
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001349ifneq (,$(SOCKLEN_T))
1350 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1351endif
1352
Brian Gernhardt59f86742006-12-12 12:01:47 -05001353ifeq ($(uname_S),Darwin)
1354 ifndef NO_FINK
1355 ifeq ($(shell test -d /sw/lib && echo y),y)
1356 BASIC_CFLAGS += -I/sw/include
1357 BASIC_LDFLAGS += -L/sw/lib
1358 endif
1359 endif
1360 ifndef NO_DARWIN_PORTS
1361 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1362 BASIC_CFLAGS += -I/opt/local/include
1363 BASIC_LDFLAGS += -L/opt/local/lib
1364 endif
1365 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001366 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001367 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001368 APPLE_COMMON_CRYPTO = YesPlease
1369 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1370 endif
David Aguilar29de2052013-05-11 01:22:26 -07001371 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001372 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001373endif
1374
David Aguilare1c06882009-05-31 01:35:51 -07001375ifdef NO_LIBGEN_H
1376 COMPAT_CFLAGS += -DNO_LIBGEN_H
1377 COMPAT_OBJS += compat/basename.o
1378endif
1379
Ævar Arnfjörð Bjarmason75997302021-01-24 02:58:33 +01001380ifdef USE_LIBPCRE1
1381$(error The USE_LIBPCRE1 build option has been removed, use version 2 with USE_LIBPCRE)
1382endif
1383
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001384USE_LIBPCRE2 ?= $(USE_LIBPCRE)
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001385
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001386ifneq (,$(USE_LIBPCRE2))
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001387 BASIC_CFLAGS += -DUSE_LIBPCRE2
1388 EXTLIBS += -lpcre2-8
1389endif
1390
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001391ifdef LIBPCREDIR
1392 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1393 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001394endif
1395
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001396ifdef HAVE_ALLOCA_H
1397 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1398endif
1399
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001400IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001401IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001402
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001403ifdef NO_CURL
1404 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001405 REMOTE_CURL_PRIMARY =
1406 REMOTE_CURL_ALIASES =
1407 REMOTE_CURL_NAMES =
Johannes Schindelin724d6352019-04-18 06:16:40 -07001408 EXCLUDED_PROGRAMS += git-http-fetch git-http-push
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001409else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001410 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001411 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
Jeff King897d68e2020-03-26 04:08:55 -04001412 CURL_CFLAGS = -I$(CURLDIR)/include
James Knight23c4bbe2018-11-03 05:12:11 +00001413 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001414 else
Jeff King897d68e2020-03-26 04:08:55 -04001415 CURL_CFLAGS =
James Knight23c4bbe2018-11-03 05:12:11 +00001416 CURL_LIBCURL =
Junio C Hamanob2feb642014-04-30 10:58:10 -07001417 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001418
Jeff King94a88e22020-03-26 04:06:45 -04001419 ifndef CURL_LDFLAGS
Jeff King05738312020-04-04 10:58:29 -04001420 CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
Jeff King94a88e22020-03-26 04:06:45 -04001421 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001422 CURL_LIBCURL += $(CURL_LDFLAGS)
Thomas Cortbc5f8132011-07-19 18:55:47 -04001423
Jeff King897d68e2020-03-26 04:08:55 -04001424 ifndef CURL_CFLAGS
Jeff King05738312020-04-04 10:58:29 -04001425 CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
Jeff King897d68e2020-03-26 04:08:55 -04001426 endif
1427 BASIC_CFLAGS += $(CURL_CFLAGS)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001428
Johannes Sixt4256f362010-01-19 16:39:12 +01001429 REMOTE_CURL_PRIMARY = git-remote-http$X
1430 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1431 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001432 PROGRAM_OBJS += http-fetch.o
1433 PROGRAMS += $(REMOTE_CURL_NAMES)
Ævar Arnfjörð Bjarmason2d4032c2021-09-13 16:51:24 +02001434 ifndef NO_EXPAT
1435 PROGRAM_OBJS += http-push.o
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001436 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001437 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 +01001438 ifeq "$(curl_check)" "072200"
1439 USE_CURL_FOR_IMAP_SEND = YesPlease
1440 endif
1441 ifdef USE_CURL_FOR_IMAP_SEND
1442 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1443 IMAP_SEND_BUILDDEPS = http.o
1444 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1445 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001446 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001447 ifdef EXPATDIR
1448 BASIC_CFLAGS += -I$(EXPATDIR)/include
1449 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1450 else
1451 EXPAT_LIBEXPAT = -lexpat
1452 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001453 ifdef EXPAT_NEEDS_XMLPARSE_H
1454 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1455 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001456 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001457endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001458IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001459
Robert Schielebef19da2007-07-29 20:35:45 +02001460ifdef ZLIB_PATH
1461 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001462 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001463endif
1464EXTLIBS += -lz
1465
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001466ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001467 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001468 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001469 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001470 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001471 else
1472 OPENSSL_LINK =
1473 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001474 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001475 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001476 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001477else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001478 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001479 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001480endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001481ifdef NO_OPENSSL
1482 LIB_4_CRYPTO =
1483else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001484ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001485 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001486else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001487 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001488endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001489ifdef APPLE_COMMON_CRYPTO
1490 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1491endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001492endif
Eric Sunshinefdb1fbb2018-06-14 22:25:03 -04001493ifndef NO_ICONV
1494 ifdef NEEDS_LIBICONV
1495 ifdef ICONVDIR
1496 BASIC_CFLAGS += -I$(ICONVDIR)/include
1497 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1498 else
1499 ICONV_LINK =
1500 endif
1501 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1502 ICONV_LINK += -lintl
1503 endif
1504 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano455a7f32005-09-30 13:31:16 -07001505 endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001506endif
brian m. carlson79444c92019-02-12 00:52:06 +00001507ifdef ICONV_OMITS_BOM
1508 BASIC_CFLAGS += -DICONV_OMITS_BOM
1509endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001510ifdef NEEDS_LIBGEN
1511 EXTLIBS += -lgen
1512endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001513ifndef NO_GETTEXT
1514ifndef LIBC_CONTAINS_LIBINTL
1515 EXTLIBS += -lintl
1516endif
1517endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001518ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001519 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001520endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001521ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001522 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001523endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001524ifdef NEEDS_RESOLV
1525 EXTLIBS += -lresolv
1526endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001527ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001528 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001529endif
David Michael110d6982012-12-14 14:56:59 -05001530ifdef NO_GECOS_IN_PWENT
1531 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1532endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001533ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1534 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1535endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001536ifdef USE_NSEC
1537 BASIC_CFLAGS += -DUSE_NSEC
1538endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001539ifdef USE_ST_TIMESPEC
1540 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1541endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001542ifdef NO_NORETURN
1543 BASIC_CFLAGS += -DNO_NORETURN
1544endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001545ifdef NO_NSEC
1546 BASIC_CFLAGS += -DNO_NSEC
1547endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001548ifdef SNPRINTF_RETURNS_BOGUS
1549 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1550 COMPAT_OBJS += compat/snprintf.o
1551endif
Brandon Caseycba22522008-02-08 20:32:47 -06001552ifdef FREAD_READS_DIRECTORIES
1553 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1554 COMPAT_OBJS += compat/fopen.o
1555endif
Jeff King2b081012021-02-26 01:14:35 -05001556ifdef OPEN_RETURNS_EINTR
1557 COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR
1558 COMPAT_OBJS += compat/open.o
1559endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001560ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001561 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001562endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001563ifdef NO_GETTEXT
1564 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001565 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001566endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001567ifdef NO_POLL
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001568 NO_POLL_H = YesPlease
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001569 NO_SYS_POLL_H = YesPlease
1570 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1571 COMPAT_OBJS += compat/poll/poll.o
1572endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001573ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001574 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001575 COMPAT_OBJS += compat/strcasestr.o
1576endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001577ifdef NO_STRLCPY
1578 COMPAT_CFLAGS += -DNO_STRLCPY
1579 COMPAT_OBJS += compat/strlcpy.o
1580endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001581ifdef NO_STRTOUMAX
1582 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001583 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001584endif
1585ifdef NO_STRTOULL
1586 COMPAT_CFLAGS += -DNO_STRTOULL
1587endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001588ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001589 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001590 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001591endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001592ifdef NO_MKDTEMP
1593 COMPAT_CFLAGS += -DNO_MKDTEMP
1594 COMPAT_OBJS += compat/mkdtemp.o
1595endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001596ifdef MKDIR_WO_TRAILING_SLASH
1597 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1598 COMPAT_OBJS += compat/mkdir.o
1599endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001600ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001601 COMPAT_CFLAGS += -DNO_UNSETENV
1602 COMPAT_OBJS += compat/unsetenv.o
1603endif
Robert Schiele26009732008-01-24 19:34:46 +01001604ifdef NO_SYS_SELECT_H
1605 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1606endif
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001607ifdef NO_POLL_H
1608 BASIC_CFLAGS += -DNO_POLL_H
1609endif
Markus Duft28449232010-10-27 10:39:52 +02001610ifdef NO_SYS_POLL_H
1611 BASIC_CFLAGS += -DNO_SYS_POLL_H
1612endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001613ifdef NEEDS_SYS_PARAM_H
1614 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001615endif
Markus Duft28449232010-10-27 10:39:52 +02001616ifdef NO_INTTYPES_H
1617 BASIC_CFLAGS += -DNO_INTTYPES_H
1618endif
1619ifdef NO_INITGROUPS
1620 BASIC_CFLAGS += -DNO_INITGROUPS
1621endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001622ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001623 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001624 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001625else
1626 ifdef USE_WIN32_MMAP
1627 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1628 COMPAT_OBJS += compat/win32mmap.o
1629 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001630endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001631ifdef MMAP_PREVENTS_DELETE
1632 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1633endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001634ifdef OBJECT_CREATION_USES_RENAMES
1635 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001636endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001637ifdef NO_STRUCT_ITIMERVAL
1638 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001639 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001640endif
1641ifdef NO_SETITIMER
1642 COMPAT_CFLAGS += -DNO_SETITIMER
1643endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001644ifdef NO_PREAD
1645 COMPAT_CFLAGS += -DNO_PREAD
1646 COMPAT_OBJS += compat/pread.o
1647endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001648ifdef NO_FAST_WORKING_DIRECTORY
1649 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1650endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001651ifdef NO_TRUSTABLE_FILEMODE
1652 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1653endif
David Michaeld543d9c2014-12-03 21:24:17 -05001654ifdef NEEDS_MODE_TRANSLATION
1655 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1656 COMPAT_OBJS += compat/stat.o
1657endif
hpa49744d62005-09-28 16:52:21 -07001658ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001659 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001660endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001661ifdef NO_INTPTR_T
1662 COMPAT_CFLAGS += -DNO_INTPTR_T
1663endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001664ifdef NO_UINTMAX_T
1665 BASIC_CFLAGS += -Duintmax_t=uint32_t
1666endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001667ifdef NO_SOCKADDR_STORAGE
1668ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001669 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001670else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001671 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001672endif
hpa49744d62005-09-28 16:52:21 -07001673endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001674ifdef NO_INET_NTOP
1675 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001676 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001677endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001678ifdef NO_INET_PTON
1679 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001680 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001681endif
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001682ifdef NO_UNIX_SOCKETS
1683 BASIC_CFLAGS += -DNO_UNIX_SOCKETS
1684else
Johannes Sixt63203582011-12-12 22:12:56 +01001685 LIB_OBJS += unix-socket.o
Jeff Hostetler9fd19022021-03-15 21:08:27 +00001686 LIB_OBJS += unix-stream-server.o
Jeff Hostetler6aac70a2021-05-20 18:28:10 +00001687endif
1688
1689# Simple IPC requires threads and platform-specific IPC support.
1690# Only platforms that have both should include these source files
1691# in the build.
1692#
1693# On Windows-based systems, Simple IPC requires threads and Windows
1694# Named Pipes. These are always available, so Simple IPC support
1695# is optional.
1696#
1697# On Unix-based systems, Simple IPC requires pthreads and Unix
1698# domain sockets. So support is only enabled when both are present.
1699#
1700ifdef USE_WIN32_IPC
1701 BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
1702 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1703 LIB_OBJS += compat/simple-ipc/ipc-win32.o
1704else
1705ifndef NO_PTHREADS
1706ifndef NO_UNIX_SOCKETS
1707 BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
Jeff Hostetler7cd5dbc2021-03-22 10:29:47 +00001708 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1709 LIB_OBJS += compat/simple-ipc/ipc-unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001710endif
Jeff Hostetler6aac70a2021-05-20 18:28:10 +00001711endif
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001712endif
1713
1714ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001715 BASIC_CFLAGS += -DNO_ICONV
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001716endif
1717
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001718ifdef OLD_ICONV
1719 BASIC_CFLAGS += -DOLD_ICONV
1720endif
1721
David Symonds609a2282007-11-07 14:24:28 +11001722ifdef NO_DEFLATE_BOUND
1723 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1724endif
1725
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001726ifdef NO_POSIX_GOODIES
1727 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1728endif
1729
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001730ifdef APPLE_COMMON_CRYPTO
1731 # Apple CommonCrypto requires chunking
1732 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1733endif
1734
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001735ifdef OPENSSL_SHA1
1736 EXTLIBS += $(LIB_4_CRYPTO)
1737 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001738else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001739ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001740 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001741 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001742else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001743ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001744 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001745 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001746else
David Aguilar61067952013-05-19 06:23:35 -04001747ifdef APPLE_COMMON_CRYPTO
1748 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001749 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001750else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001751 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001752 BASIC_CFLAGS += -DSHA1_DC
1753 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001754ifdef DC_SHA1_EXTERNAL
1755 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001756 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001757$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001758 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001759 endif
1760 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1761 EXTLIBS += -lsha1detectcoll
1762else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001763ifdef DC_SHA1_SUBMODULE
1764 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1765 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1766 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1767else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001768 LIB_OBJS += sha1dc/sha1.o
1769 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001770endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001771 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001772 -DSHA1DC_NO_STANDARD_INCLUDES \
1773 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1774 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001775 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001776endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001777endif
1778endif
David Aguilar61067952013-05-19 06:23:35 -04001779endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001780endif
David Aguilar61067952013-05-19 06:23:35 -04001781
brian m. carlson4b4e2912018-11-14 04:09:38 +00001782ifdef OPENSSL_SHA256
1783 EXTLIBS += $(LIB_4_CRYPTO)
1784 BASIC_CFLAGS += -DSHA256_OPENSSL
1785else
brian m. carlson27dc04c2018-11-14 04:09:37 +00001786ifdef GCRYPT_SHA256
1787 BASIC_CFLAGS += -DSHA256_GCRYPT
1788 EXTLIBS += -lgcrypt
1789else
1790 LIB_OBJS += sha256/block/sha256.o
1791 BASIC_CFLAGS += -DSHA256_BLK
1792endif
brian m. carlson4b4e2912018-11-14 04:09:38 +00001793endif
brian m. carlson13eeedb2018-11-14 04:09:36 +00001794
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001795ifdef SHA1_MAX_BLOCK_SIZE
1796 LIB_OBJS += compat/sha1-chunked.o
1797 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1798endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001799ifdef NO_HSTRERROR
1800 COMPAT_CFLAGS += -DNO_HSTRERROR
1801 COMPAT_OBJS += compat/hstrerror.o
1802endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001803ifdef NO_MEMMEM
1804 COMPAT_CFLAGS += -DNO_MEMMEM
1805 COMPAT_OBJS += compat/memmem.o
1806endif
Matt Kraai40036be2012-12-18 14:03:55 -08001807ifdef NO_GETPAGESIZE
1808 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1809endif
Brian Downing43fe9012008-02-05 15:10:44 -06001810ifdef INTERNAL_QSORT
1811 COMPAT_CFLAGS += -DINTERNAL_QSORT
Brian Downing43fe9012008-02-05 15:10:44 -06001812endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001813ifdef HAVE_ISO_QSORT_S
1814 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1815else
1816 COMPAT_OBJS += compat/qsort_s.o
1817endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001818ifdef RUNTIME_PREFIX
1819 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1820endif
Alex Riesenb7774342007-03-07 00:44:49 +01001821
Junio C Hamano46059cc2008-11-15 04:08:14 -08001822ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001823 BASIC_CFLAGS += -DNO_PTHREADS
1824else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001825 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001826 EXTLIBS += $(PTHREAD_LIBS)
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001827endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001828
Chris Webbcb6a22c2010-04-13 10:07:13 +01001829ifdef HAVE_PATHS_H
1830 BASIC_CFLAGS += -DHAVE_PATHS_H
1831endif
1832
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001833ifdef HAVE_LIBCHARSET_H
1834 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001835 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001836endif
1837
David Michaelb3e103d2012-12-14 14:57:01 -05001838ifdef HAVE_STRINGS_H
1839 BASIC_CFLAGS += -DHAVE_STRINGS_H
1840endif
1841
Jeff King21aeafc2011-12-10 05:41:01 -05001842ifdef HAVE_DEV_TTY
1843 BASIC_CFLAGS += -DHAVE_DEV_TTY
1844endif
1845
Alex Riesen81a24b52008-03-05 00:15:39 +01001846ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1847 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1848endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001849ifdef UNRELIABLE_FSTAT
1850 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1851endif
Jeff King02232ad2009-06-16 15:07:40 -04001852ifdef NO_REGEX
1853 COMPAT_CFLAGS += -Icompat/regex
1854 COMPAT_OBJS += compat/regex/regex.o
1855endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001856ifdef NATIVE_CRLF
1857 BASIC_CFLAGS += -DNATIVE_CRLF
1858endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001859
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001860ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001861 COMPAT_CFLAGS += -Icompat/nedmalloc
1862 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1863 OVERRIDE_STRDUP = YesPlease
1864endif
1865
1866ifdef OVERRIDE_STRDUP
1867 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1868 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001869endif
1870
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001871ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1872 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1873endif
1874
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001875ifndef NO_MSGFMT_EXTENDED_OPTIONS
1876 MSGFMT += --check --statistics
1877endif
1878
Karsten Blees148d6772014-07-12 02:05:42 +02001879ifdef HAVE_CLOCK_GETTIME
1880 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001881endif
1882
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001883ifdef HAVE_CLOCK_MONOTONIC
1884 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1885endif
1886
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001887ifdef NEEDS_LIBRT
1888 EXTLIBS += -lrt
1889endif
1890
Kyle J. McKay95290802015-03-07 23:14:36 -08001891ifdef HAVE_BSD_SYSCTL
1892 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1893endif
1894
Dan Jacques226c0dd2018-04-10 11:05:44 -04001895ifdef HAVE_BSD_KERN_PROC_SYSCTL
1896 BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
1897endif
1898
Jeff King0cc30e02015-04-16 05:01:38 -04001899ifdef HAVE_GETDELIM
1900 BASIC_CFLAGS += -DHAVE_GETDELIM
1901endif
1902
Dan Jacques226c0dd2018-04-10 11:05:44 -04001903ifneq ($(PROCFS_EXECUTABLE_PATH),)
1904 procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
1905 BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
1906endif
1907
Emily Shafferb7e6a412021-07-21 18:27:06 -07001908ifndef HAVE_PLATFORM_PROCINFO
1909 COMPAT_OBJS += compat/stub/procinfo.o
1910endif
1911
Dan Jacques226c0dd2018-04-10 11:05:44 -04001912ifdef HAVE_NS_GET_EXECUTABLE_PATH
1913 BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
1914endif
1915
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -04001916ifdef HAVE_WPGMPTR
1917 BASIC_CFLAGS += -DHAVE_WPGMPTR
1918endif
1919
Duy Nguyen18a4f6b2019-02-12 21:14:41 +07001920ifdef FILENO_IS_A_MACRO
1921 COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
1922 COMPAT_OBJS += compat/fileno.o
1923endif
1924
Clément Chigot400caaf2019-04-25 07:01:56 +00001925ifdef NEED_ACCESS_ROOT_HANDLER
1926 COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
1927 COMPAT_OBJS += compat/access.o
1928endif
1929
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001930ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001931NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001932endif
1933
Jeff King499c2932009-04-03 15:32:20 -04001934ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001935NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001936endif
1937
Johan Herlandd4e1b472009-11-18 02:42:31 +01001938ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001939NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001940endif
1941
Eric Wong995bc222016-08-04 11:40:25 +00001942ifndef PAGER_ENV
1943PAGER_ENV = LESS=FRX LV=-c
1944endif
1945
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001946QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001947QUIET_SUBDIR1 =
1948
John Keepingef49e052015-09-05 13:22:10 +01001949ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001950PRINT_DIR = --no-print-directory
1951else # "make -w"
1952NO_SUBDIR = :
1953endif
1954
John Keepingef49e052015-09-05 13:22:10 +01001955ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001956ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001957 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001958 QUIET_AR = @echo ' ' AR $@;
1959 QUIET_LINK = @echo ' ' LINK $@;
1960 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1961 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001962 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00001963 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001964 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00001965 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001966 QUIET_SP = @echo ' ' SP $<;
Denton Liub503a2d2019-09-25 01:21:01 -07001967 QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001968 QUIET_RC = @echo ' ' RC $@;
Denton Liu4f3c1dc2019-10-09 13:43:46 -07001969 QUIET_SPATCH = @echo ' ' SPATCH $<;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001970 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001971 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1972 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001973 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001974 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001975 export QUIET_BUILT_IN
1976endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001977endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001978
Junio C Hamano70de5e62012-05-02 15:12:10 -07001979ifdef NO_INSTALL_HARDLINKS
1980 export NO_INSTALL_HARDLINKS
1981endif
1982
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001983### profile feedback build
1984#
1985
1986# Can adjust this to be a global directory if you want to do extended
1987# data gathering
1988PROFILE_DIR := $(CURDIR)
1989
Johannes Sixte60ec752012-02-09 09:22:26 +01001990ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07001991 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001992 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001993 export CCACHE_DISABLE = t
1994 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01001995else
1996ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07001997 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001998 export CCACHE_DISABLE = t
1999 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002000endif
Johannes Sixte60ec752012-02-09 09:22:26 +01002001endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002002
Pavel Roskinaddf88e2006-07-09 03:44:30 -04002003# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002004
Johannes Schindelin32043c92007-02-14 12:48:14 +01002005ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02002006ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002007
2008DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002009NO_GETTEXT_SQ = $(subst ','\'',$(NO_GETTEXT))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002010bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002011bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002012mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00002013mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
2014infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002015perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002016localedir_SQ = $(subst ','\'',$(localedir))
Dan Jacques07d90ea2018-04-10 11:05:43 -04002017localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002018gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +00002019gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002020template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00002021htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002022prefix_SQ = $(subst ','\'',$(prefix))
Dan Jacques07d90ea2018-04-10 11:05:43 -04002023perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05302024gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002025
2026SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05002027TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002028PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01002029PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07002030TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002031DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08002032PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002033
Dan Jacques07d90ea2018-04-10 11:05:43 -04002034# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
2035# relative to each other and share an installation path.
2036#
2037# This is a dependency in:
2038# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
2039# - The runtime prefix Perl header (see
2040# "perl/header_templates/runtime_prefix.template.pl").
2041ifdef RUNTIME_PREFIX
2042
2043ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
2044$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
2045endif
2046
2047ifneq ($(filter /%,$(firstword $(localedir_relative))),)
2048$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
2049endif
2050
2051ifndef NO_PERL
2052ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
2053$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
2054endif
2055endif
2056
2057endif
2058
Jeff King3f2e2292016-07-01 01:58:58 -04002059# We must filter out any object files from $(GITLIBS),
2060# as it is typically used like:
2061#
2062# foo: foo.o $(GITLIBS)
2063# $(CC) $(filter %.o,$^) $(LIBS)
2064#
2065# where we use it as a dependency. Since we also pull object files
2066# from the dependency list, that would make each entry appear twice.
2067LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07002068
brian m. carlsonf18f8162017-03-11 22:28:18 +00002069BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08002070LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02002071
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05002072# Quote for C
2073
2074ifdef DEFAULT_EDITOR
2075DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
2076DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
2077
2078BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
2079endif
2080
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05002081ifdef DEFAULT_PAGER
2082DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
2083DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
2084
2085BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
2086endif
2087
Ben Waltonb3e34dd2012-03-30 21:33:21 -04002088ifdef SHELL_PATH
2089SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
2090SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
2091
2092BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
2093endif
2094
Jeff King42dcbb72012-06-02 15:01:12 -04002095GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
2096GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
2097GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04002098GIT-USER-AGENT: FORCE
2099 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04002100 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
2101 fi
Jeff King42dcbb72012-06-02 15:01:12 -04002102
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00002103ifdef DEFAULT_HELP_FORMAT
2104BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
2105endif
2106
Eric Wong995bc222016-08-04 11:40:25 +00002107PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
2108PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
2109PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
2110BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
2111
Petr Baudis8d7f5862006-06-25 03:47:03 +02002112ALL_CFLAGS += $(BASIC_CFLAGS)
2113ALL_LDFLAGS += $(BASIC_LDFLAGS)
2114
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00002115export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07002116
2117
Petr Baudis28818ff2005-07-29 17:50:24 +02002118### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07002119
Brandon Caseyc94c8e52008-08-07 14:03:42 -05002120SHELL = $(SHELL_PATH)
2121
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002122all:: shell_compatibility_test
2123
2124ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07002125all:: profile
2126endif
2127
2128profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002129 $(MAKE) PROFILE=GEN all
2130 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04002131 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
2132 $(MAKE) PROFILE=GEN -j1 perf; \
2133 else \
2134 echo "Skipping profile of perf tests..."; \
2135 fi
Andi Kleen066dd262014-07-07 23:35:11 -07002136 $(MAKE) PROFILE=USE all
2137
2138profile-fast: profile-clean
2139 $(MAKE) PROFILE=GEN all
2140 $(MAKE) PROFILE=GEN -j1 perf
2141 $(MAKE) PROFILE=USE all
2142
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002143
Johannes Schindelin179227d2020-09-21 22:28:16 +00002144all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002145ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00002146 $(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 -08002147endif
Petr Baudis28818ff2005-07-29 17:50:24 +02002148
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002149all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002150ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07002151 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08002152 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002153endif
Ben Walton502be952010-03-20 10:48:08 -04002154 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04002155
Brandon Casey6dc46272008-08-07 14:06:26 -05002156please_set_SHELL_PATH_to_a_more_modern_shell:
2157 @$$(:)
2158
2159shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
2160
Junio C Hamano4dc00022006-01-12 21:42:25 -08002161strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05002162 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08002163
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002164### Flags affecting all rules
2165
2166# A GNU make extension since gmake 3.72 (released in late 1994) to
2167# remove the target of rules if commands in those rules fail. The
2168# default is to only do that if make itself receives a signal. Affects
2169# all targets, see:
2170#
2171# info make --index-search=.DELETE_ON_ERROR
2172.DELETE_ON_ERROR:
2173
Jonathan Nieder7b63c772012-07-06 23:19:09 -05002174### Target-specific flags and dependencies
2175
2176# The generic compilation pattern rule and automatically
2177# computed header dependencies (falling back to a dependency on
2178# LIB_H) are enough to describe how most targets should be built,
2179# but some targets are special enough to need something a little
2180# different.
2181#
2182# - When a source file "foo.c" #includes a generated header file,
2183# we need to list that dependency for the "foo.o" target.
2184#
2185# We also list it from other targets that are built from foo.c
2186# like "foo.sp" and "foo.s", even though that is easy to forget
2187# to do because the generated header is already present around
2188# after a regular build attempt.
2189#
2190# - Some code depends on configuration kept in makefile
2191# variables. The target-specific variable EXTRA_CPPFLAGS can
2192# be used to convey that information to the C preprocessor
2193# using -D options.
2194#
2195# The "foo.o" target should have a corresponding dependency on
2196# a file that changes when the value of the makefile variable
2197# changes. For example, targets making use of the
2198# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
2199#
2200# Technically the ".sp" and ".s" targets do not need this
2201# dependency because they are force-built, but they get the
2202# same dependency for consistency. This way, you do not have to
2203# know how each target is implemented. And it means the
2204# dependencies here will not need to change if the force-build
2205# details change some day.
2206
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002207git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04002208git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002209 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2210 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2211 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07002212
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002213git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04002214 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2215 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07002216
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002217help.sp help.s help.o: command-list.h
Ævar Arnfjörð Bjarmasoncfe853e2021-09-26 21:03:29 +02002218hook.sp hook.s hook.o: hook-list.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01002219
Ævar Arnfjörð Bjarmasoncfe853e2021-09-26 21:03:29 +02002220builtin/help.sp builtin/help.s builtin/help.o: config-list.h hook-list.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002221builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002222 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2223 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2224 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07002225
Jeff King520a6cd2012-06-20 14:32:22 -04002226version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04002227version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04002228 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01002229 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
Johannes Schindelin5cf8e062018-06-27 21:35:23 +02002230 '-DGIT_BUILT_FROM_COMMIT="$(shell \
2231 GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2232 git rev-parse -q --verify HEAD 2>/dev/null)"'
Jeff King816fb462012-06-02 14:51:42 -04002233
Junio C Hamano91730802006-04-10 17:37:58 -07002234$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02002235 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002236 ln $< $@ 2>/dev/null || \
2237 ln -s $< $@ 2>/dev/null || \
2238 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07002239
Emily Shaffer709df952020-04-16 14:18:03 -07002240config-list.h: generate-configlist.sh
2241
SZEDER Gábor56550ea2021-04-08 23:29:15 +02002242config-list.h: Documentation/*config.txt Documentation/config/*.txt
Ævar Arnfjörð Bjarmason7c812952021-09-23 12:29:58 +02002243 $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
Emily Shaffer709df952020-04-16 14:18:03 -07002244
Nguyễn Thái Ngọc Duyf318d732018-05-10 10:46:41 +02002245command-list.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07002246
SZEDER Gábor56550ea2021-04-08 23:29:15 +02002247command-list.h: $(wildcard Documentation/git*.txt)
Johannes Schindelin724d6352019-04-18 06:16:40 -07002248 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2249 $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
Ævar Arnfjörð Bjarmason7c812952021-09-23 12:29:58 +02002250 command-list.txt >$@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002251
Ævar Arnfjörð Bjarmasoncfe853e2021-09-26 21:03:29 +02002252hook-list.h: generate-hooklist.sh Documentation/githooks.txt
2253 $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002254
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002255SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
Jeff Kingb5295f32012-06-20 14:32:19 -04002256 $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002257 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
2258 $(perllibdir_SQ)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002259define cmd_munge_script
Jonathan Nieder46bac902010-01-31 11:46:53 -08002260sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2261 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002262 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002263 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002264 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08002265 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002266 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04002267 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
2268 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Junio C Hamano71b40102016-03-08 15:47:57 -08002269 -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00002270 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002271 $@.sh >$@+
2272endef
2273
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002274GIT-SCRIPT-DEFINES: FORCE
2275 @FLAGS='$(SCRIPT_DEFINES)'; \
2276 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002277 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002278 echo "$$FLAGS" >$@; \
2279 fi
2280
2281
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002282$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002283 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002284 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002285 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002286
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002287$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002288 $(QUIET_GEN)$(cmd_munge_script) && \
2289 mv $@+ $@
2290
Johannes Schindelinadb59de2018-11-06 06:55:50 -08002291git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002292 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01002293 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
2294 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06002295 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002296
Jeff Kinge204b002014-11-18 12:43:09 -05002297# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002298$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05002299
Dan Jacques07d90ea2018-04-10 11:05:43 -04002300# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
2301# since the locale directory is injected.
2302perl_localedir_SQ = $(localedir_SQ)
Alex Riesenf8487182006-12-04 10:50:04 +01002303
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002304ifndef NO_PERL
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002305PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
Ævar Arnfjörð Bjarmason8c557532021-05-12 11:49:44 +02002306PERL_DEFINES =
Ævar Arnfjörð Bjarmason4070c9e2021-05-05 14:21:38 +02002307PERL_DEFINES += $(PERL_PATH_SQ)
2308PERL_DEFINES += $(PERLLIB_EXTRA_SQ)
2309PERL_DEFINES += $(perllibdir_SQ)
Dan Jacques07d90ea2018-04-10 11:05:43 -04002310PERL_DEFINES += $(RUNTIME_PREFIX)
Ævar Arnfjörð Bjarmason368a50d2021-05-05 14:21:40 +02002311PERL_DEFINES += $(NO_PERL_CPAN_FALLBACKS)
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002312PERL_DEFINES += $(NO_GETTEXT)
Dan Jacques07d90ea2018-04-10 11:05:43 -04002313
2314# Support Perl runtime prefix. In this mode, a different header is installed
2315# into Perl scripts.
2316ifdef RUNTIME_PREFIX
2317
2318PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
2319
2320# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
2321# at runtime.
2322perl_localedir_SQ =
2323
2324endif
2325
2326PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
2327
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002328$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002329 $(QUIET_GEN) \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002330 sed -e '1{' \
2331 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Alejandro R. Sedeño66000542018-06-25 15:13:25 -04002332 -e ' r GIT-PERL-HEADER' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002333 -e ' G' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002334 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07002335 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002336 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002337 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002338 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002339
Dan Jacques07d90ea2018-04-10 11:05:43 -04002340PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002341GIT-PERL-DEFINES: FORCE
2342 @FLAGS='$(PERL_DEFINES)'; \
2343 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2344 echo >&2 " * new perl-specific parameters"; \
2345 echo "$$FLAGS" >$@; \
2346 fi
2347
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002348GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002349 $(QUIET_GEN) \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002350 INSTLIBDIR='$(perllibdir_SQ)' && \
2351 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
2352 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
2353 sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
Jonathan Nieder64f982b2018-04-23 16:25:35 -07002354 -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002355 -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
2356 -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
2357 -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002358 $< >$@+ && \
2359 mv $@+ $@
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002360
Christian Hessed8698982018-04-19 06:44:40 +09002361.PHONY: perllibdir
Christian Hessecfb3a472018-04-10 15:36:41 +02002362perllibdir:
2363 @echo '$(perllibdir_SQ)'
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002364
2365.PHONY: gitweb
2366gitweb:
2367 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2368
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002369git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002370 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002371 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002372 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002373else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002374$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002375 $(QUIET_GEN) \
Jeff King499c2932009-04-03 15:32:20 -04002376 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2377 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2378 unimplemented.sh >$@+ && \
2379 chmod +x $@+ && \
2380 mv $@+ $@
2381endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002382
Jonathan Niederca2051d2014-11-18 10:43:47 -08002383# This makes sure we depend on the NO_PYTHON setting itself.
2384$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2385
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002386ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002387$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2388$(SCRIPT_PYTHON_GEN): % : %.py
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002389 $(QUIET_GEN) \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002390 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002391 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002392 chmod +x $@+ && \
2393 mv $@+ $@
2394else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002395$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002396 $(QUIET_GEN) \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002397 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2398 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2399 unimplemented.sh >$@+ && \
2400 chmod +x $@+ && \
2401 mv $@+ $@
2402endif # NO_PYTHON
2403
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002404CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Jeff King7f1b6972013-02-21 01:26:14 -05002405 configure.ac >configure.ac+ && \
2406 autoconf -o configure configure.ac+ && \
2407 $(RM) configure.ac+
2408
Jeff King520a6cd2012-06-20 14:32:22 -04002409configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002410 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002411
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002412ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002413# We avoid depending on 'configure' here, because it gets rebuilt
2414# every time GIT-VERSION-FILE is modified, only to update the embedded
2415# version number string, which config.status does not care about. We
2416# do want to recheck when the platform/environment detection logic
2417# changes, hence this depends on configure.ac.
2418config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002419 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002420 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002421 ./config.status --recheck; \
2422 else \
2423 ./configure; \
2424 fi
2425reconfigure config.mak.autogen: config.status
2426 $(QUIET_GEN)./config.status
2427.PHONY: reconfigure # This is a convenience target.
2428endif
2429
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002430XDIFF_OBJS += xdiff/xdiffi.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002431XDIFF_OBJS += xdiff/xemit.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002432XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002433XDIFF_OBJS += xdiff/xmerge.o
2434XDIFF_OBJS += xdiff/xpatience.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002435XDIFF_OBJS += xdiff/xprepare.o
2436XDIFF_OBJS += xdiff/xutils.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002437.PHONY: xdiff-objs
2438xdiff-objs: $(XDIFF_OBJS)
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002439
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002440TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002441.PHONY: test-objs
2442test-objs: $(TEST_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002443
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002444GIT_OBJS += $(LIB_OBJS)
2445GIT_OBJS += $(BUILTIN_OBJS)
2446GIT_OBJS += common-main.o
2447GIT_OBJS += git.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002448.PHONY: git-objs
2449git-objs: $(GIT_OBJS)
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002450
2451OBJECTS += $(GIT_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002452OBJECTS += $(PROGRAM_OBJS)
2453OBJECTS += $(TEST_OBJS)
2454OBJECTS += $(XDIFF_OBJS)
2455OBJECTS += $(FUZZ_OBJS)
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002456ifndef NO_CURL
2457 OBJECTS += http.o http-walker.o remote-curl.o
2458endif
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002459.PHONY: objects
2460objects: $(OBJECTS)
Jonathan Niederc3739912010-01-26 09:52:11 -06002461
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002462dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002463dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002464
Jonathan Nieder024c8432011-11-18 03:58:21 -06002465ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002466$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002467 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002468
2469missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002470dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002471dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002472endif
2473
Jonathan Nieder024c8432011-11-18 03:58:21 -06002474ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002475missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002476dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002477endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002478
Philippe Blain3821c382020-09-03 22:13:38 +00002479compdb_dir = compile_commands
2480
2481ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2482missing_compdb_dir = $(compdb_dir)
2483$(missing_compdb_dir):
2484 @mkdir -p $@
2485
2486compdb_file = $(compdb_dir)/$(subst /,-,$@.json)
2487compdb_args = -MJ $(compdb_file)
2488else
2489missing_compdb_dir =
2490compdb_args =
2491endif
2492
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002493ASM_SRC := $(wildcard $(OBJECTS:o=S))
2494ASM_OBJ := $(ASM_SRC:S=o)
2495C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002496
Jonathan Nieder30248882010-01-26 09:51:24 -06002497.SUFFIXES:
2498
Philippe Blain3821c382020-09-03 22:13:38 +00002499$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2500 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
2501$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2502 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002503
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002504%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002505 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002506
2507ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2508# Take advantage of gcc's on-the-fly dependency generation
2509# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2510dep_files_present := $(wildcard $(dep_files))
2511ifneq ($(dep_files_present),)
2512include $(dep_files_present)
2513endif
2514else
Johannes Schindelin92b88eb2019-03-04 05:47:06 -08002515$(OBJECTS): $(LIB_H) $(GENERATED_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002516endif
Pavel Roskinb05701c2005-08-06 01:36:15 -04002517
Philippe Blain3821c382020-09-03 22:13:38 +00002518ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2519all:: compile_commands.json
2520compile_commands.json:
Philippe Blain3821c382020-09-03 22:13:38 +00002521 $(QUIET_GEN)sed -e '1s/^/[/' -e '$$s/,$$/]/' $(compdb_dir)/*.o.json > $@+
2522 @if test -s $@+; then mv $@+ $@; else $(RM) $@+; fi
2523endif
2524
Stefan Bellerd807c4a2018-04-10 14:26:18 -07002525exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
2526exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002527 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002528 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002529 '-DBINDIR="$(bindir_relative_SQ)"' \
Philip Oakley4d5b4c22018-04-21 13:18:42 +02002530 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002531
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002532builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002533builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002534 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002535
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002536config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002537config.sp config.s config.o: EXTRA_CPPFLAGS = \
2538 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002539
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002540attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002541attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2542 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002543
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002544gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002545gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002546 -DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002547
Ramsay Jones15caca22019-02-05 02:27:48 +00002548http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002549 -DCURL_DISABLE_TYPECHECK
2550
Ramsay Jones15caca22019-02-05 02:27:48 +00002551pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
Ramsay Jones54360a12018-02-12 00:21:02 +00002552
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002553ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002554http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002555endif
2556
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002557ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002558compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2559 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002560endif
2561
René Scharfed555ff52010-09-11 11:59:18 +02002562ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002563compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002564 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones15caca22019-02-05 02:27:48 +00002565compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002566endif
2567
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002568git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002569 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002570
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002571git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002572 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002573 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002574
John Keepingfd78ced2014-01-25 13:11:44 +00002575git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002576 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002577 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002578git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002579 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002580 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002581
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002582$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2583 $(QUIET_LNCP)$(RM) $@ && \
2584 ln $< $@ 2>/dev/null || \
2585 ln -s $< $@ 2>/dev/null || \
2586 cp $< $@
2587
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002588$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002589 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002590 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002591
Petr Baudis28818ff2005-07-29 17:50:24 +02002592$(LIB_FILE): $(LIB_OBJS)
SZEDER Gábor325b06d2021-08-18 23:36:11 +02002593 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002594
Linus Torvalds34435462006-03-24 20:13:22 -08002595$(XDIFF_LIB): $(XDIFF_OBJS)
SZEDER Gábor325b06d2021-08-18 23:36:11 +02002596 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002597
Jonathan Nieder5b586192012-03-31 03:44:53 -05002598export DEFAULT_EDITOR DEFAULT_PAGER
2599
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07002600Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
2601 @EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
2602 if test x"$$EXCLUDED" != \
2603 x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
2604 echo >&2 " * new documentation flags"; \
2605 echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
2606 fi
2607
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002608.PHONY: doc man man-perl html info pdf
2609doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002610 $(MAKE) -C Documentation all
2611
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002612man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002613 $(MAKE) -C Documentation man
2614
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002615man-perl: perl/build/man/man3/Git.3pm
2616
Michael J Gruber414851a2008-09-10 10:19:34 +02002617html:
2618 $(MAKE) -C Documentation html
2619
David Kastrup47398092007-08-06 12:22:57 +02002620info:
2621 $(MAKE) -C Documentation info
2622
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002623pdf:
2624 $(MAKE) -C Documentation pdf
2625
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002626XGETTEXT_FLAGS = \
2627 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002628 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002629 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2630 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002631XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2632 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002633XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2634 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002635XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002636 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002637LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002638LOCALIZED_SH = $(SCRIPT_SH)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002639LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002640LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002641
2642ifdef XGETTEXT_INCLUDE_TESTS
2643LOCALIZED_C += t/t0200/test.c
2644LOCALIZED_SH += t/t0200/test.sh
2645LOCALIZED_PERL += t/t0200/test.perl
2646endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002647
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002648## Note that this is meant to be run only by the localization coordinator
2649## under a very controlled condition, i.e. (1) it is to be run in a
2650## Git repository (not a tarball extract), (2) any local modifications
2651## will be lost.
2652## Gettext tools cannot work with our own custom PRItime type, so
2653## we replace PRItime with PRIuMAX. We need to update this to
2654## PRIdMAX if we switch to a signed type later.
2655
Jonathan Nieder1f319632014-08-22 00:32:08 -04002656po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002657 # All modifications will be reverted at the end, so we do not
2658 # want to have any local change.
2659 git diff --quiet HEAD && git diff --quiet --cached
2660
2661 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2662 do \
2663 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2664 cat "$$s+" >"$$s" && rm "$$s+"; \
2665 done
2666
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002667 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2668 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2669 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002670 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2671 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002672
2673 # Reverting the munged source, leaving only the updated $@
2674 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002675 mv $@+ $@
2676
Elia Pintoe6be2652015-12-15 15:21:00 +00002677.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002678pot: po/git.pot
2679
Johannes Schindelin43488242021-07-04 22:55:12 +00002680ifdef NO_GETTEXT
2681POFILES :=
2682MOFILES :=
2683else
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002684POFILES := $(wildcard po/*.po)
2685MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2686
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002687all:: $(MOFILES)
2688endif
2689
2690po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2691 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2692
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002693LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2694LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002695LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2696LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002697
2698ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002699all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002700ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002701all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002702endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002703NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002704endif
2705
Ævar Arnfjörð Bjarmason3d49f722021-05-05 14:21:39 +02002706perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002707 $(QUIET_GEN)mkdir -p $(dir $@) && \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002708 sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002709 -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002710 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2711 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002712
2713perl/build/man/man3/Git.3pm: perl/Git.pm
2714 $(QUIET_GEN)mkdir -p $(dir $@) && \
2715 pod2man $< $@
2716
Jeff Kinge951ebc2016-12-14 09:26:55 -05002717FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002718 git ls-files \
2719 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002720 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002721 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002722 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002723 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002724 $(FIND) . \
2725 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002726 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002727 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002728 -o \( -name build -type d -prune \) \
2729 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002730 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002731 -o \( -name '*.sh' -type f -print \) \
Denton Liu43f8c892019-09-16 12:23:14 -07002732 | sed -e 's|^\./||' \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002733 )
Junio C Hamano33533972011-10-18 00:26:18 -07002734
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002735FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002736
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002737$(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002738 $(QUIET_GEN)$(RM) $@+ && \
2739 echo $(FOUND_SOURCE_FILES) | xargs etags -a -o $@+ && \
2740 mv $@+ $@
Petr Baudis28818ff2005-07-29 17:50:24 +02002741
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002742tags: $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002743 $(QUIET_GEN)$(RM) $@+ && \
2744 echo $(FOUND_SOURCE_FILES) | xargs ctags -a -o $@+ && \
2745 mv $@+ $@
Petr Baudis28818ff2005-07-29 17:50:24 +02002746
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002747cscope.out: $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002748 $(QUIET_GEN)$(RM) $@+ && \
2749 echo $(FOUND_SOURCE_FILES) | xargs cscope -f$@+ -b && \
2750 mv $@+ $@
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002751
2752.PHONY: cscope
2753cscope: cscope.out
Kristof Provosta2a91502007-10-06 16:24:42 +02002754
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002755### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002756TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2757 $(localedir_SQ)
2758
2759GIT-PREFIX: FORCE
2760 @FLAGS='$(TRACK_PREFIX)'; \
2761 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002762 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002763 echo "$$FLAGS" >GIT-PREFIX; \
2764 fi
2765
2766TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002767
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002768GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002769 @FLAGS='$(TRACK_CFLAGS)'; \
2770 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002771 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002772 echo "$$FLAGS" >GIT-CFLAGS; \
2773 fi
2774
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002775TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2776
2777GIT-LDFLAGS: FORCE
2778 @FLAGS='$(TRACK_LDFLAGS)'; \
2779 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002780 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002781 echo "$$FLAGS" >GIT-LDFLAGS; \
2782 fi
2783
Junio C Hamanobfce5082008-07-25 12:35:10 -07002784# We need to apply sq twice, once to protect from the shell
2785# that runs GIT-BUILD-OPTIONS, and then again to protect it
2786# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002787GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002788 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002789 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002790 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2791 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2792 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2793 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2794 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002795 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002796 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002797 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002798 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002799 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2800 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002801 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002802 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
Ævar Arnfjörð Bjarmason2cdc2922021-09-23 11:20:45 +02002803 @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
Johannes Schindelin8abfdf42018-11-14 08:32:11 -08002804 @echo X=\'$(X)\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002805ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002806 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002807endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002808ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002809 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002810endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002811ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002812 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002813endif
2814ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002815 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002816endif
Đoàn Trần Công Danh482c9622021-06-08 13:56:28 +07002817ifdef GIT_TEST_UTF8_LOCALE
2818 @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
2819endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002820 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002821ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002822 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002823endif
2824ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002825 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002826endif
2827ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002828 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002829endif
2830ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002831 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002832endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002833ifdef GIT_PERF_MAKE_COMMAND
2834 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2835endif
Jeff King3d893612017-02-25 04:37:07 -05002836ifdef GIT_INTEROP_MAKE_OPTS
2837 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2838endif
Ben Peart1f357b02018-09-18 23:29:36 +00002839ifdef GIT_TEST_INDEX_VERSION
2840 @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002841endif
Jeff King5338ed22020-10-21 23:24:00 -04002842ifdef GIT_TEST_PERL_FATAL_WARNINGS
2843 @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
2844endif
Johannes Schindelinb7d11a02021-07-24 22:06:49 +00002845ifdef RUNTIME_PREFIX
2846 @echo RUNTIME_PREFIX=\'true\' >>$@+
2847else
2848 @echo RUNTIME_PREFIX=\'false\' >>$@+
2849endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002850 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002851
Christian Couder96a46472012-12-18 16:26:38 +01002852### Detect Python interpreter path changes
2853ifndef NO_PYTHON
2854TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002855
Christian Couder96a46472012-12-18 16:26:38 +01002856GIT-PYTHON-VARS: FORCE
2857 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002858 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002859 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002860 echo "$$VARS" >$@; \
2861 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002862endif
2863
Matthew Ogilvieea925192009-12-02 22:14:05 -07002864test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2865
2866all:: $(TEST_PROGRAMS) $(test_bindir_programs)
2867
2868bin-wrappers/%: wrap-for-bin.sh
2869 @mkdir -p bin-wrappers
2870 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2871 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Johannes Schindelin3a94cb32019-07-29 13:08:16 -07002872 -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 -07002873 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002874
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002875# GNU make supports exporting all variables by "export" without parameters.
2876# However, the environment gets quite big, and some programs have problems
2877# with that.
2878
Johannes Schindelin140245b2006-07-07 13:26:31 +02002879export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002880export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002881
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002882### Testing rules
2883
Junio C Hamano96651ef2007-04-28 15:32:49 -07002884test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002885 $(MAKE) -C t/ all
2886
Thomas Rast342e9ef2012-02-17 11:25:09 +01002887perf: all
2888 $(MAKE) -C t/perf/ all
2889
2890.PHONY: test perf
2891
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002892.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002893
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002894t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2895
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002896t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
David Barr1d73b522010-08-09 17:34:42 -05002897 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002898
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +01002899check-sha1:: t/helper/test-tool$X
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002900 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002901
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002902SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2903
Ævar Arnfjörð Bjarmason8a7a90b2021-10-21 22:00:14 +02002904$(SP_OBJ): %.sp: %.c %.o
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002905 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02002906 -Wsparse-error \
2907 $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $< && \
2908 >$@
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002909
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02002910.PHONY: sparse
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002911sparse: $(SP_OBJ)
2912
Ævar Arnfjörð Bjarmason7c3c0a92021-09-23 12:29:57 +02002913EXCEPT_HDRS := $(GENERATED_H) unicode-width.h compat/% xdiff/%
Ramsay Jonesf23aa182019-03-06 00:11:13 +00002914ifndef GCRYPT_SHA256
2915 EXCEPT_HDRS += sha256/gcrypt.h
2916endif
Denton Liucf6a2d22019-09-16 12:23:08 -07002917CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002918HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
Denton Liub503a2d2019-09-25 01:21:01 -07002919HCC = $(HCO:hco=hcc)
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002920
Denton Liub503a2d2019-09-25 01:21:01 -07002921%.hcc: %.h
2922 @echo '#include "git-compat-util.h"' >$@
2923 @echo '#include "$<"' >>$@
2924
2925$(HCO): %.hco: %.hcc FORCE
2926 $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002927
2928.PHONY: hdr-check $(HCO)
2929hdr-check: $(HCO)
2930
Brandon Williams21188052017-08-14 14:30:46 -07002931.PHONY: style
2932style:
2933 git clang-format --style file --diff --extensions c,h
2934
Ævar Arnfjörð Bjarmasonea47e592021-09-23 12:29:56 +02002935.PHONY: check
Ævar Arnfjörð Bjarmason7c3c0a92021-09-23 12:29:57 +02002936check: $(GENERATED_H)
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01002937 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002938 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07002939 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002940 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002941 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07002942 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002943 exit 1; \
2944 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02002945
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002946FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
Denton Liu9027af52019-09-16 12:23:16 -07002947COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02002948
2949%.cocci.patch: %.cocci $(COCCI_SOURCES)
Denton Liu4f3c1dc2019-10-09 13:43:46 -07002950 $(QUIET_SPATCH) \
Jeff Kingbcb4edf2019-05-08 03:07:54 -04002951 if test $(SPATCH_BATCH_SIZE) = 0; then \
2952 limit=; \
2953 else \
2954 limit='-n $(SPATCH_BATCH_SIZE)'; \
2955 fi; \
2956 if ! echo $(COCCI_SOURCES) | xargs $$limit \
Jeff King960154b2019-05-06 19:43:34 -04002957 $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
2958 >$@+ 2>$@.log; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002959 then \
2960 cat $@.log; \
2961 exit 1; \
2962 fi; \
2963 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02002964 if test -s $@; \
2965 then \
2966 echo ' ' SPATCH result: $@; \
2967 fi
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002968coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
René Scharfe63f0a752016-09-15 20:30:56 +02002969
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002970# See contrib/coccinelle/README
2971coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
2972
2973.PHONY: coccicheck coccicheck-pending
Petr Baudis28818ff2005-07-29 17:50:24 +02002974
Petr Baudis28818ff2005-07-29 17:50:24 +02002975### Installation rules
2976
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002977ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002978template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002979else
2980template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002981endif
2982export template_instdir
2983
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002984ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002985gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002986else
2987gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002988endif
2989gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
2990export gitexec_instdir
2991
David Aguilarbc7a96a2011-08-18 00:23:46 -07002992ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2993mergetools_instdir = $(mergetoolsdir)
2994else
2995mergetools_instdir = $(prefix)/$(mergetoolsdir)
2996endif
2997mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2998
Bagas Sanjaya3231f412021-09-05 12:17:56 -07002999install_bindir_xprograms := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X))
3000install_bindir_programs := $(install_bindir_xprograms) $(BINDIR_PROGRAMS_NO_X)
Matthew Ogilvieea925192009-12-02 22:14:05 -07003001
Elia Pintoe6be2652015-12-15 15:21:00 +00003002.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07003003profile-install: profile
3004 $(MAKE) install
3005
3006profile-fast-install: profile-fast
3007 $(MAKE) install
3008
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003009INSTALL_STRIP =
3010
Andreas Ericssond6ebd252005-11-22 00:44:15 +01003011install: all
Robert Schiele41650762007-12-01 18:05:40 +01003012 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003013 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003014 $(INSTALL) $(INSTALL_STRIP) $(PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3015 $(INSTALL) $(SCRIPTS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08003016 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003017 $(INSTALL) $(INSTALL_STRIP) $(install_bindir_xprograms) '$(DESTDIR_SQ)$(bindir_SQ)'
3018 $(INSTALL) $(BINDIR_PROGRAMS_NO_X) '$(DESTDIR_SQ)$(bindir_SQ)'
3019
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003020ifdef MSVC
3021 # We DO NOT install the individual foo.o.pdb files because they
3022 # have already been rolled up into the exe's pdb file.
3023 # We DO NOT have pdb files for the builtin commands (like git-status.exe)
3024 # because it is just a copy/hardlink of git.exe, rather than a unique binary.
Johannes Schindelina8b53552020-09-21 22:28:15 +00003025 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS),$(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)))) '$(DESTDIR_SQ)$(bindir_SQ)'
3026 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS) $(REMOTE_CURL_ALIASES),$(PROGRAMS))) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003027ifndef DEBUG
3028 $(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
3029 $(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
3030else
3031 $(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
3032 $(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
3033endif
3034endif
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01003035 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07003036 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05003037 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003038ifndef NO_GETTEXT
3039 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
3040 (cd po/build/locale && $(TAR) cf - .) | \
3041 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
3042endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07003043ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003044 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
3045 (cd perl/build/lib && $(TAR) cf - .) | \
3046 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07003047 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07003048endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003049ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003050 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003051 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003052endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08003053ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00003054 $(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 -08003055endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003056
Johannes Sixt46beb552008-07-21 21:19:51 +02003057 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003058 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003059 destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07003060 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05003061 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
3062 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003063 test -n "$(INSTALL_SYMLINKS)" && \
3064 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
3065 { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
3066 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
3067 cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
Brandon Casey76d079a2010-07-23 12:50:45 -05003068 done; \
3069 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05003070 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
3071 $(RM) "$$bindir/$$p" && \
Johannes Schindelin907e6372020-10-21 15:13:31 +00003072 test -n "$(INSTALL_SYMLINKS)" && \
3073 ln -s "git$X" "$$bindir/$$p" || \
3074 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3075 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
3076 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
3077 cp "$$bindir/git$X" "$$bindir/$$p" || exit; }; \
Brandon Casey40919c42010-07-23 12:50:44 -05003078 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003079 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06003080 $(RM) "$$execdir/$$p" && \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003081 if test -z "$(SKIP_DASHED_BUILT_INS)"; \
3082 then \
3083 test -n "$(INSTALL_SYMLINKS)" && \
3084 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
3085 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3086 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
3087 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
3088 cp "$$execdir/git$X" "$$execdir/$$p" || exit; }; \
3089 fi \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003090 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07003091 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
3092 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003093 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003094 test -n "$(INSTALL_SYMLINKS)" && \
3095 ln -s "git-remote-http$X" "$$execdir/$$p" || \
3096 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3097 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3098 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3099 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
Ævar Arnfjörð Bjarmason72b113e2021-09-06 09:55:33 +02003100 done
Petr Baudis28818ff2005-07-29 17:50:24 +02003101
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003102.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00003103.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02003104install-gitweb:
3105 $(MAKE) -C gitweb install
3106
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003107install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02003108 $(MAKE) -C Documentation install
3109
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003110install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003111 $(MAKE) -C Documentation install-man
3112
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003113install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003114 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
3115 (cd perl/build/man/man3 && $(TAR) cf - .) | \
3116 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
3117
Teemu Likonenae081f32008-06-10 11:34:25 +03003118install-html:
3119 $(MAKE) -C Documentation install-html
3120
David Kastrup47398092007-08-06 12:22:57 +02003121install-info:
3122 $(MAKE) -C Documentation install-info
3123
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01003124install-pdf:
3125 $(MAKE) -C Documentation install-pdf
3126
Eric Wong6538d1e2006-12-23 08:26:09 -08003127quick-install-doc:
3128 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02003129
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003130quick-install-man:
3131 $(MAKE) -C Documentation quick-install-man
3132
Michael J Gruber6fe570d2008-09-09 22:44:17 +02003133quick-install-html:
3134 $(MAKE) -C Documentation quick-install-html
3135
Petr Baudis28818ff2005-07-29 17:50:24 +02003136
3137
3138### Maintainer's dist rules
3139
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01003140GIT_TARNAME = git-$(GIT_VERSION)
René Scharfedf368fa2020-09-19 23:23:50 +02003141GIT_ARCHIVE_EXTRA_FILES = \
3142 --prefix=$(GIT_TARNAME)/ \
3143 --add-file=configure \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003144 --add-file=.dist-tmp-dir/version \
René Scharfedf368fa2020-09-19 23:23:50 +02003145 --prefix=$(GIT_TARNAME)/git-gui/ \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003146 --add-file=.dist-tmp-dir/git-gui/version
René Scharfedf368fa2020-09-19 23:23:50 +02003147ifdef DC_SHA1_SUBMODULE
3148GIT_ARCHIVE_EXTRA_FILES += \
3149 --prefix=$(GIT_TARNAME)/sha1collisiondetection/ \
3150 --add-file=sha1collisiondetection/LICENSE.txt \
3151 --prefix=$(GIT_TARNAME)/sha1collisiondetection/lib/ \
3152 --add-file=sha1collisiondetection/lib/sha1.c \
3153 --add-file=sha1collisiondetection/lib/sha1.h \
3154 --add-file=sha1collisiondetection/lib/ubc_check.c \
3155 --add-file=sha1collisiondetection/lib/ubc_check.h
3156endif
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02003157dist: git-archive$(X) configure
Ramsay Jonesc5312032020-12-08 22:36:33 +00003158 @$(RM) -r .dist-tmp-dir
3159 @mkdir .dist-tmp-dir
3160 @echo $(GIT_VERSION) > .dist-tmp-dir/version
3161 @$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
René Scharfedf368fa2020-09-19 23:23:50 +02003162 ./git-archive --format=tar \
3163 $(GIT_ARCHIVE_EXTRA_FILES) \
3164 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Ramsay Jonesc5312032020-12-08 22:36:33 +00003165 @$(RM) -r .dist-tmp-dir
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06003166 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003167
Junio C Hamanoab214332016-04-04 23:42:41 -07003168rpm::
3169 @echo >&2 "Use distro packaged sources to run rpmbuild"
3170 @false
3171.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07003172
Johannes Schindelin46689312019-10-04 08:09:36 -07003173ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
3174OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
3175endif
3176
Johannes Schindelin179227d2020-09-21 22:28:16 +00003177artifacts-tar:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) \
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003178 GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003179 $(MOFILES)
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003180 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
3181 SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
3182 test -n "$(ARTIFACTS_DIRECTORY)"
3183 mkdir -p "$(ARTIFACTS_DIRECTORY)"
3184 $(TAR) czf "$(ARTIFACTS_DIRECTORY)/artifacts.tar.gz" $^ templates/blt/
3185.PHONY: artifacts-tar
3186
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003187htmldocs = git-htmldocs-$(GIT_VERSION)
3188manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00003189.PHONY: dist-doc distclean
René Scharfe93e70312020-10-10 18:45:18 +02003190dist-doc: git$X
Emil Medve4cb08df2007-07-14 12:51:44 -05003191 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003192 mkdir .doc-tmp-dir
3193 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
René Scharfe93e70312020-10-10 18:45:18 +02003194 ./git -C .doc-tmp-dir init
3195 ./git -C .doc-tmp-dir add .
3196 ./git -C .doc-tmp-dir commit -m htmldocs
3197 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3198 > $(htmldocs).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003199 gzip -n -9 -f $(htmldocs).tar
3200 :
Emil Medve4cb08df2007-07-14 12:51:44 -05003201 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07003202 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02003203 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003204 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07003205 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003206 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003207 install
René Scharfe93e70312020-10-10 18:45:18 +02003208 ./git -C .doc-tmp-dir init
3209 ./git -C .doc-tmp-dir add .
3210 ./git -C .doc-tmp-dir commit -m manpages
3211 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3212 > $(manpages).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003213 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05003214 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003215
Petr Baudis28818ff2005-07-29 17:50:24 +02003216### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06003217
Mathias Megyei922aa802007-10-04 23:49:19 +02003218distclean: clean
3219 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02003220 $(RM) config.log config.status config.cache
3221 $(RM) config.mak.autogen config.mak.append
3222 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02003223
Theodore Ts'of2d713f2012-02-06 01:00:17 -05003224profile-clean:
3225 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3226 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3227
SZEDER Gábor1a966382018-07-23 15:51:00 +02003228cocciclean:
3229 $(RM) contrib/coccinelle/*.cocci.patch*
3230
3231clean: profile-clean coverage-clean cocciclean
Junio C Hamano7897d842016-04-15 10:06:52 -07003232 $(RM) *.res
3233 $(RM) $(OBJECTS)
Jeff Kingfc473912020-08-13 11:00:17 -04003234 $(RM) $(LIB_FILE) $(XDIFF_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08003235 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003236 $(RM) $(TEST_PROGRAMS)
Josh Steadmon5e472152018-10-12 17:58:40 -07003237 $(RM) $(FUZZ_PROGRAMS)
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02003238 $(RM) $(SP_OBJ)
Denton Liub503a2d2019-09-25 01:21:01 -07003239 $(RM) $(HCC)
Philippe Blain3821c382020-09-03 22:13:38 +00003240 $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003241 $(RM) -r po/build/
Junio C Hamanof3719842019-12-13 15:15:34 -08003242 $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
Ramsay Jonesc5312032020-12-08 22:36:33 +00003243 $(RM) -r .dist-tmp-dir .doc-tmp-dir
Ramsay Jones98836a82020-12-08 22:35:27 +00003244 $(RM) $(GIT_TARNAME).tar.gz
Emil Medve4cb08df2007-07-14 12:51:44 -05003245 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02003246 $(MAKE) -C Documentation/ clean
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07003247 $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
Jeff King499c2932009-04-03 15:32:20 -04003248ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01003249 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003250 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04003251endif
Petr Baudisb1edc532006-06-24 04:34:29 +02003252 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07003253 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003254ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003255 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003256 $(MAKE) -C git-gui clean
3257endif
Christian Couder8f26aa42012-12-18 16:26:37 +01003258 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08003259 $(RM) GIT-USER-AGENT GIT-PREFIX
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04003260 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003261ifdef MSVC
3262 $(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3263 $(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3264 $(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3265 $(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3266 $(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3267 $(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3268 $(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3269 $(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3270 $(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3271 $(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3272 $(RM) compat/vcbuild/MSVC-DEFS-GEN
3273endif
Junio C Hamano9b88fce2005-12-27 14:40:17 -08003274
SZEDER Gábor1a966382018-07-23 15:51:00 +02003275.PHONY: all install profile-clean cocciclean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05003276.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Ævar Arnfjörð Bjarmason922f8bb2021-06-29 13:12:55 +02003277.PHONY: FORCE
Junio C Hamanod89056c2005-12-19 17:59:58 -08003278
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003279### Check documentation
3280#
Johannes Schindelin179227d2020-09-21 22:28:16 +00003281ALL_COMMANDS = $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB)
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003282ALL_COMMANDS += git
Denton Liu805d9ea2020-03-21 05:21:20 -04003283ALL_COMMANDS += git-citool
3284ALL_COMMANDS += git-gui
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003285ALL_COMMANDS += gitk
3286ALL_COMMANDS += gitweb
Elia Pintoe6be2652015-12-15 15:21:00 +00003287
3288.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003289check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07003290 $(MAKE) -C Documentation lint-docs
Johannes Schindelin5ee42462019-03-25 14:41:39 -07003291 @(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003292 do \
3293 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003294 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02003295 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08003296 git-fsck-objects | git-init-db | \
Johannes Schindelin31cf4a62019-04-18 06:16:46 -07003297 git-remote-* | git-stage | git-legacy-* | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08003298 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003299 esac ; \
3300 test -f "Documentation/$$v.txt" || \
3301 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02003302 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08003303 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003304 case "$$v" in \
3305 git) ;; \
3306 *) echo "no link: $$v";; \
3307 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003308 done; \
3309 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02003310 sed -e '1,/^### command list/d' \
3311 -e '/^#/d' \
Johannes Schindelin8e6d6952019-03-25 14:41:38 -07003312 -e '/guide$$/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003313 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08003314 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04003315 $(MAKE) -C Documentation print-man1 | \
3316 grep '\.txt$$' | \
Johannes Schindelin057ccba2019-03-25 14:41:37 -07003317 sed -e 's|^|documented |' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003318 -e 's/\.txt//'; \
3319 ) | while read how cmd; \
3320 do \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003321 case " $(patsubst %$X,%,$(ALL_COMMANDS) $(BUILT_INS) $(EXCLUDED_PROGRAMS)) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003322 *" $$cmd "*) ;; \
3323 *) echo "removed but $$how: $$cmd" ;; \
3324 esac; \
3325 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08003326
3327### Make sure built-ins do not have dups and listed in git.c
3328#
3329check-builtins::
3330 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08003331
Thomas Rast901c3692009-02-19 12:13:35 +01003332### Test suite coverage testing
3333#
Thomas Rast0c38a952013-05-13 23:27:25 +02003334.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00003335.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003336.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01003337
3338coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02003339 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02003340 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01003341
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003342object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003343coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003344 $(RM) $(addsuffix *.gcov,$(object_dirs))
3345 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003346 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003347 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003348 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01003349
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003350coverage-clean: coverage-clean-results
3351 $(RM) $(addsuffix *.gcno,$(object_dirs))
3352
Thomas Rast901c3692009-02-19 12:13:35 +01003353COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
3354COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003355GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01003356
Thomas Rast0c38a952013-05-13 23:27:25 +02003357coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01003358 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02003359
3360coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01003361 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02003362 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01003363
Derrick Stolee22991202019-01-29 09:05:18 -08003364coverage-prove: coverage-clean-results coverage-compile
3365 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
3366 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
3367 -j1 test
3368
Thomas Rast901c3692009-02-19 12:13:35 +01003369coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003370 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02003371 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003372 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00003373
3374coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01003375 grep '^function.*called 0 ' *.c.gcov \
3376 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003377 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003378
3379cover_db: coverage-report
3380 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003381
3382cover_db_html: cover_db
3383 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07003384
Josh Steadmon5e472152018-10-12 17:58:40 -07003385
3386### Fuzz testing
3387#
3388# Building fuzz targets generally requires a special set of compiler flags that
3389# are not necessarily appropriate for general builds, and that vary greatly
3390# depending on the compiler version used.
3391#
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003392# An example command to build against libFuzzer from LLVM 11.0.0:
Josh Steadmon5e472152018-10-12 17:58:40 -07003393#
3394# make CC=clang CXX=clang++ \
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003395# CFLAGS="-fsanitize=fuzzer-no-link,address" \
3396# LIB_FUZZING_ENGINE="-fsanitize=fuzzer" \
Josh Steadmon5e472152018-10-12 17:58:40 -07003397# fuzz-all
3398#
Josh Steadmon927c77e2018-11-14 11:41:47 -08003399FUZZ_CXXFLAGS ?= $(CFLAGS)
3400
Josh Steadmon5e472152018-10-12 17:58:40 -07003401.PHONY: fuzz-all
3402
3403$(FUZZ_PROGRAMS): all
Josh Steadmon927c77e2018-11-14 11:41:47 -08003404 $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07003405 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3406
3407fuzz-all: $(FUZZ_PROGRAMS)