blob: 17fd9b023a48eb7fc1012ddafea709dba395970b [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#
brian m. carlson05cd9882022-01-17 21:56:16 +0000237# Define CSPRNG_METHOD to "arc4random" if your system has arc4random and
238# arc4random_buf, "libbsd" if your system has those functions from libbsd,
239# "getrandom" if your system has getrandom, "getentropy" if your system has
240# getentropy, "rtlgenrandom" for RtlGenRandom (Windows only), or "openssl" if
241# you'd want to use the OpenSSL CSPRNG. You may set multiple options with
242# spaces, in which case a suitable option will be chosen. If unset or set to
243# anything else, defaults to using "/dev/urandom".
244#
David Michaeld543d9c2014-12-03 21:24:17 -0500245# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
246# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
247# usual 0xF000).
248#
hpa49744d62005-09-28 16:52:21 -0700249# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
250#
Johannes Sixt63203582011-12-12 22:12:56 +0100251# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
252#
Junio C Hamanobdc37f52006-01-19 17:13:32 -0800253# Define NO_SOCKADDR_STORAGE if your platform does not have struct
254# sockaddr_storage.
255#
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +0100256# Define NO_ICONV if your libc does not properly support iconv.
257#
Ramsay Jonesfd547a92007-03-03 18:29:03 +0000258# Define OLD_ICONV if your library has an old iconv(), where the second
259# (input buffer pointer) parameter is declared with type (const char **).
260#
brian m. carlson79444c92019-02-12 00:52:06 +0000261# Define ICONV_OMITS_BOM if your iconv implementation does not write a
262# byte-order mark (BOM) when writing UTF-16 or UTF-32 and always writes in
263# big-endian format.
264#
David Symonds609a2282007-11-07 14:24:28 +1100265# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
266#
Junio C Hamano6520c842011-06-18 18:07:03 -0700267# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
268# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
269#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200270# Define USE_NSEC below if you want git to care about sub-second file mtimes
Karsten Bleesb1ffafa2015-07-01 21:10:52 +0200271# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
272# Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
273# on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
274# on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
275# Documentation/technical/racy-git.txt for details.
Junio C Hamanof6af75d2006-06-23 17:57:48 -0700276#
Brian Gernhardtc5673832009-03-08 16:04:28 -0400277# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
278# "st_ctim"
279#
Kjetil Barvikc06ff492009-03-04 18:47:40 +0100280# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
281# available. This automatically turns USE_NSEC off.
282#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200283# Define USE_STDEV below if you want git to care about the underlying device
Johannes Schindelin10455d22007-11-30 11:35:23 +0000284# change being considered an inode change from the update-index perspective.
Alex Riesenf8487182006-12-04 10:50:04 +0100285#
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +0200286# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
287# field that counts the on-disk footprint in 512-byte blocks.
288#
Thomas Rast204d3632009-10-22 10:19:06 +0200289# Define GNU_ROFF if your target system uses GNU groff. This forces
290# apostrophes to be ASCII so that cut&pasting examples to the shell
291# will work.
292#
brian m. carlsonec3366e2017-01-22 02:41:56 +0000293# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
294# documentation.
295#
296# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
297# Extensions Lab if you have it available.
298#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800299# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
300#
Jeff King499c2932009-04-03 15:32:20 -0400301# Define NO_PERL if you do not want Perl scripts or libraries at all.
302#
Todd Zullinger075321c2018-03-03 15:38:16 +0000303# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
304# copies of CPAN modules that serve as a fallback in case the modules
305# are not available on the system. This option is intended for
306# distributions that want to use their packaged versions of Perl
307# modules, instead of the fallbacks shipped with Git.
308#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800309# 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 +0700310# but /usr/bin/python2.7 or /usr/bin/python3 on some platforms).
Junio C Hamanocdbada72013-01-13 22:48:07 -0800311#
Johan Herlandd4e1b472009-11-18 02:42:31 +0100312# Define NO_PYTHON if you do not want Python scripts or libraries at all.
313#
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700314# Define NO_TCLTK if you do not want Tcl/Tk GUI.
315#
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400316# The TCL_PATH variable governs the location of the Tcl interpreter
317# used to optimize git-gui for your system. Only used if NO_TCLTK
318# is not set. Defaults to the bare 'tclsh'.
319#
320# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700321# If not set it defaults to the bare 'wish'. If it is set to the empty
322# string then NO_TCLTK will be forced (this is used by configure script).
323#
Brian Downing43fe9012008-02-05 15:10:44 -0600324# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
325# is a simplified version of the merge sort used in glibc. This is
326# recommended if Git triggers O(n^2) behavior in your platform's qsort().
327#
René Scharfe04ee8b82017-01-22 18:51:11 +0100328# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
329# compatible with the one described in C11 Annex K.
330#
Johannes Sixt34779c52009-04-20 10:17:00 +0200331# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
332# information on a not yet closed file that lstat would return for the same
333# file after it was closed.
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200334#
Johannes Schindelin348df162009-04-28 00:32:25 +0200335# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
336# when hardlinking a file to another name and unlinking the original file right
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200337# away (some NTFS drivers seem to zero the contents in that scenario).
Junio C Hamano2c8f8b12009-05-23 01:43:08 -0700338#
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +0000339# Define INSTALL_SYMLINKS if you prefer to have everything that can be
340# symlinked between bin/ and libexec/ to use relative symlinks between
341# the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and
342# NO_INSTALL_HARDLINKS which will also use symlinking by indirection
343# within the same directory in some cases, INSTALL_SYMLINKS will
344# always symlink to the final target directly.
345#
Johannes Schindelin3426e342009-05-11 13:02:18 +0200346# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
347# programs as a tar, where bin/ and libexec/ might be on different file systems.
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200348#
Junio C Hamano70de5e62012-05-02 15:12:10 -0700349# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
350# copies to install built-in git commands e.g. git-cat-file.
351#
Johannes Schindelin179227d2020-09-21 22:28:16 +0000352# Define SKIP_DASHED_BUILT_INS if you do not need the dashed versions of the
353# built-ins to be linked/copied at all.
354#
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200355# Define USE_NED_ALLOCATOR if you want to replace the platforms default
356# memory allocators with the nedmalloc allocator written by Niall Douglas.
Jeff King02232ad2009-06-16 15:07:40 -0400357#
René Scharfeca2baa32016-09-03 17:59:15 +0200358# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
359# This is necessary when using a custom allocator in order to avoid
360# crashes due to allocation and free working on different 'heaps'.
361# It's defined automatically if USE_NED_ALLOCATOR is set.
362#
Johannes Schindelin2f895222016-09-21 20:24:04 +0200363# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
364# feature.
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500365#
Jeff King21aeafc2011-12-10 05:41:01 -0500366# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
367# user.
368#
Jakub Narebski63267de2009-09-01 13:39:20 +0200369# Define JSMIN to point to JavaScript minifier that functions as
370# a filter to have gitweb.js minified.
Junio C Hamano8678bc02009-12-01 11:28:15 -0800371#
Mark Rada0e6ce212010-04-02 20:35:05 -0400372# Define CSSMIN to point to a CSS minifier in order to generate a minified
373# version of gitweb.css
374#
Junio C Hamanoa3d023d2009-10-30 20:45:34 -0500375# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
376# you want to use something different. The value will be interpreted by the
377# shell at runtime when it is used.
378#
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500379# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
380# want to use something different. The value will be interpreted by the shell
381# if necessary when it is used. Examples:
382#
383# DEFAULT_EDITOR='~/bin/vi',
384# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
385# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
Jonathan Niederdfea5752010-01-26 09:52:49 -0600386#
Jonathan Nieder024c8432011-11-18 03:58:21 -0600387# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
388# header files to be automatically computed, to avoid rebuilding objects when
389# an unrelated header file changes. Define it to "no" to use the hard-coded
390# dependency rules. The default is "auto", which means to use computed header
391# dependencies if your compiler is detected to support it.
392#
Eyvind Bernhardsen942e7742010-06-04 21:29:08 +0200393# Define NATIVE_CRLF if your platform uses CRLF for line endings.
Thomas Rast6942efc2012-04-06 23:01:23 +0200394#
Jeff King42dcbb72012-06-02 15:01:12 -0400395# Define GIT_USER_AGENT if you want to change how git identifies itself during
396# network interactions. The default is "git/$(GIT_VERSION)".
Junio C Hamanoa88d7aa2012-06-21 14:42:38 -0700397#
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +0000398# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
399# (defaults to "man") if you want to have a different default when
400# "git help" is called without a parameter specifying the format.
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100401#
Ben Peart1f357b02018-09-18 23:29:36 +0000402# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100403# with a different indexfile format version. If it isn't set the index
404# file format used is index-v[23].
Junio C Hamanobdb830c2014-04-08 11:59:05 -0700405#
Đoàn Trần Công Danh482c9622021-06-08 13:56:28 +0700406# Define GIT_TEST_UTF8_LOCALE to preferred utf-8 locale for testing.
407# If it isn't set, fallback to $LC_ALL, $LANG or use the first utf-8
408# locale returned by "locale -a".
409#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400410# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -0800411#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400412# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
413#
Neeraj Singhabf38ab2022-03-10 22:43:20 +0000414# Define HAVE_SYNC_FILE_RANGE if your platform has sync_file_range.
415#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400416# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
417# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
Reuben Hawkins88e01182015-01-08 12:00:57 -0800418#
Kyle J. McKay95290802015-03-07 23:14:36 -0800419# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
Jeff King0cc30e02015-04-16 05:01:38 -0400420#
421# Define HAVE_GETDELIM if your system has the getdelim() function.
Eric Wong995bc222016-08-04 11:40:25 +0000422#
Duy Nguyen18a4f6b2019-02-12 21:14:41 +0700423# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
424#
Clément Chigot400caaf2019-04-25 07:01:56 +0000425# Define NEED_ACCESS_ROOT_HANDLER if access() under root may success for X_OK
426# even if execution permission isn't granted for any user.
427#
Eric Wong995bc222016-08-04 11:40:25 +0000428# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
429# default environment variables to be passed when a pager is spawned, e.g.
430#
431# PAGER_ENV = LESS=FRX LV=-c
432#
433# to say "export LESS=FRX (and LV=-c) if the environment variable
434# LESS (and LV) is not set, respectively".
Eric Sunshineb2289402017-12-15 00:34:34 +0100435#
Jeff King3f824e92017-12-08 05:47:22 -0500436# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
437# running the test scripts (e.g., bash has better support for "set -x"
438# tracing).
Junio C Hamano07b747d2018-01-05 13:28:09 -0800439#
Eric Sunshineb2289402017-12-15 00:34:34 +0100440# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
441# which the built Git will run (for instance "x86_64").
Dan Jacques07d90ea2018-04-10 11:05:43 -0400442#
443# Define RUNTIME_PREFIX to configure Git to resolve its ancillary tooling and
444# support files relative to the location of the runtime binary, rather than
445# hard-coding them into the binary. Git installations built with RUNTIME_PREFIX
446# can be moved to arbitrary filesystem locations. RUNTIME_PREFIX also causes
447# Perl scripts to use a modified entry point header allowing them to resolve
448# support files at runtime.
Dan Jacques226c0dd2018-04-10 11:05:44 -0400449#
450# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
451# supports the KERN_PROC BSD sysctl function.
452#
453# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform
454# mounts a "procfs" filesystem capable of resolving the path of the current
455# executable. If defined, this must be the canonical path for the "procfs"
456# current executable path.
457#
458# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform
459# supports calling _NSGetExecutablePath to retrieve the path of the running
460# executable.
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -0400461#
462# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
463# the global variable _wpgmptr containing the absolute path of the current
464# executable (this is the case on Windows).
Junio C Hamanoe998e7a2018-05-08 15:59:21 +0900465#
Bagas Sanjaya3231f412021-09-05 12:17:56 -0700466# INSTALL_STRIP can be set to "-s" to strip binaries during installation,
467# if your $(INSTALL) command supports the option.
468#
Philippe Blain3821c382020-09-03 22:13:38 +0000469# Define GENERATE_COMPILATION_DATABASE to "yes" to generate JSON compilation
470# database entries during compilation if your compiler supports it, using the
471# `-MJ` flag. The JSON entries will be placed in the `compile_commands/`
472# directory, and the JSON compilation database 'compile_commands.json' will be
473# created at the root of the repository.
474#
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +0000475# Define DEVELOPER to enable more compiler warnings. Compiler version
476# and family are auto detected, but could be overridden by defining
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +0100477# COMPILER_FEATURES (see config.mak.dev). You can still set
478# CFLAGS="..." in combination with DEVELOPER enables, whether that's
479# for tweaking something unrelated (e.g. optimization level), or for
480# selectively overriding something DEVELOPER or one of the DEVOPTS
481# (see just below) brings in.
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000482#
483# When DEVELOPER is set, DEVOPTS can be used to control compiler
484# options. This variable contains keywords separated by
ryenus571fb962019-12-15 15:12:24 +0000485# whitespace. The following keywords are recognized:
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000486#
487# no-error:
488#
489# suppresses the -Werror that implicitly comes with
490# DEVELOPER=1. Useful for getting the full set of errors
491# without immediately dying, or for logging them.
Ævar Arnfjörð Bjarmason26d2e4f2018-04-14 19:19:46 +0000492#
493# extra-all:
494#
495# The DEVELOPER mode enables -Wextra with a few exceptions. By
496# setting this flag the exceptions are removed, and all of
497# -Wextra is used.
Beat Bolli729b3922018-07-24 21:26:43 +0200498#
Carlo Marcelo Arenas Belón6a8cbc42021-09-03 10:02:32 -0700499# no-pedantic:
Beat Bolli729b3922018-07-24 21:26:43 +0200500#
Carlo Marcelo Arenas Belón6a8cbc42021-09-03 10:02:32 -0700501# Disable -pedantic compilation.
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200502
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600503GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100504 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800505-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200506
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100507# Set our default configuration.
508#
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200509# Among the variables below, these:
510# gitexecdir
511# template_dir
Johannes Sixt9fb1e692011-05-09 10:24:55 +0200512# sysconfdir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100513# can be specified as a relative path some/where/else;
514# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200515# runtime figures out where they are based on the path to the executable.
John Keeping971f8532013-02-24 19:55:01 +0000516# Additionally, the following will be treated as relative by "git" if they
517# begin with "$(prefix)/":
518# mandir
519# infodir
520# htmldir
Dan Jacques07d90ea2018-04-10 11:05:43 -0400521# localedir
522# perllibdir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200523# This can help installing the suite in a relocatable way.
524
Pavel Roskinb05701c2005-08-06 01:36:15 -0400525prefix = $(HOME)
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000526bindir = $(prefix)/bin
John Keeping971f8532013-02-24 19:55:01 +0000527mandir = $(prefix)/share/man
528infodir = $(prefix)/share/info
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100529gitexecdir = libexec/git-core
David Aguilarbc7a96a2011-08-18 00:23:46 -0700530mergetoolsdir = $(gitexecdir)/mergetools
Johannes Sixt93547682007-06-11 10:02:17 +0200531sharedir = $(prefix)/share
Pavan Kumar Sunkarabc951962010-05-28 11:55:50 +0530532gitwebdir = $(sharedir)/gitweb
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000533perllibdir = $(sharedir)/perl5
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100534localedir = $(sharedir)/locale
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100535template_dir = share/git-core/templates
John Keeping971f8532013-02-24 19:55:01 +0000536htmldir = $(prefix)/share/doc/git-doc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100537ETC_GITCONFIG = $(sysconfdir)/gitconfig
Petr Onderka6df42ab2010-09-01 00:42:43 +0200538ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
Robert Schiele10861be2007-08-01 06:30:35 +0200539lib = lib
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100540# DESTDIR =
Johannes Schindelin352c8112009-05-23 10:04:48 +0200541pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700542
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000543bindir_relative = $(patsubst $(prefix)/%,%,$(bindir))
John Keeping971f8532013-02-24 19:55:01 +0000544mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
545infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +0000546gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400547localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
John Keeping971f8532013-02-24 19:55:01 +0000548htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400549perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
John Keeping971f8532013-02-24 19:55:01 +0000550
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000551export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200552
Ævar Arnfjörð Bjarmason65260a42019-02-22 15:41:24 +0100553# Set our default programs
Ævar Arnfjörð Bjarmason6d62c982011-12-20 23:40:47 +0000554CC = cc
Pavel Roskinb05701c2005-08-06 01:36:15 -0400555AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500556RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000557DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700558TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700559FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400560INSTALL = install
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400561TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700562TCLTK_PATH = wish
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +0000563XGETTEXT = xgettext
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100564MSGFMT = msgfmt
Remi Pommarelf8915872015-10-21 19:10:46 +0200565CURL_CONFIG = curl-config
Thomas Raste146d172010-07-26 09:43:41 +0200566GCOV = gcov
Ævar Arnfjörð Bjarmason9559f8f2019-02-22 15:41:23 +0100567STRIP = strip
René Scharfe63f0a752016-09-15 20:30:56 +0200568SPATCH = spatch
Linus Torvaldse83c5162005-04-07 15:13:13 -0700569
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400570export TCL_PATH TCLTK_PATH
571
Ævar Arnfjörð Bjarmason8fb2a232019-02-22 15:41:25 +0100572# Set our default LIBS variables
573PTHREAD_LIBS = -lpthread
Petr Baudis8d7f5862006-06-25 03:47:03 +0200574
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100575# Guard against environment variables
576BUILTIN_OBJS =
577BUILT_INS =
578COMPAT_CFLAGS =
579COMPAT_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500580XDIFF_OBJS =
Jeff Kingb8ba6292012-06-20 14:30:56 -0400581GENERATED_H =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500582EXTRA_CPPFLAGS =
Josh Steadmon5e472152018-10-12 17:58:40 -0700583FUZZ_OBJS =
584FUZZ_PROGRAMS =
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +0100585GIT_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100586LIB_OBJS =
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +0100587OBJECTS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600588PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100589PROGRAMS =
Johannes Schindelin724d6352019-04-18 06:16:40 -0700590EXCLUDED_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100591SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100592SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100593SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800594SCRIPT_LIB =
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100595TEST_BUILTINS_OBJS =
Ævar Arnfjörð Bjarmasonbed34192021-02-23 12:41:27 +0100596TEST_OBJS =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600597TEST_PROGRAMS_NEED_X =
Denton Liu5dedf7d2019-09-16 12:23:11 -0700598THIRD_PARTY_SOURCES =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100599
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500600# Having this variable in your environment would break pipelines because
601# you cause "cd" to echo its destination to stdout. It can also take
602# scripts to unexpected places. If you like CDPATH, define it for your
603# interactive shell sessions without exporting it.
604unexport CDPATH
605
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700606SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700607SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700608SCRIPT_SH += git-filter-branch.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700609SCRIPT_SH += git-merge-octopus.sh
610SCRIPT_SH += git-merge-one-file.sh
611SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700612SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700613SCRIPT_SH += git-quiltimport.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700614SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700615SCRIPT_SH += git-submodule.sh
616SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200617
Jonathan Nieder46bac902010-01-31 11:46:53 -0800618SCRIPT_LIB += git-mergetool--lib
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000619SCRIPT_LIB += git-sh-i18n
Denton Liu805d9ea2020-03-21 05:21:20 -0400620SCRIPT_LIB += git-sh-setup
Jonathan Nieder46bac902010-01-31 11:46:53 -0800621
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700622SCRIPT_PERL += git-add--interactive.perl
623SCRIPT_PERL += git-archimport.perl
624SCRIPT_PERL += git-cvsexportcommit.perl
625SCRIPT_PERL += git-cvsimport.perl
626SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700627SCRIPT_PERL += git-send-email.perl
628SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700629
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400630SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500631
Matthieu Moy4c06b412013-02-08 18:31:16 +0100632# Generated files for scripts
633SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
634SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
635SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
636
637# Individual rules to allow e.g.
638# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
639# from subdirectories like contrib/*/
640.PHONY: build-perl-script build-sh-script build-python-script
641build-perl-script: $(SCRIPT_PERL_GEN)
642build-sh-script: $(SCRIPT_SH_GEN)
643build-python-script: $(SCRIPT_PYTHON_GEN)
644
645.PHONY: install-perl-script install-sh-script install-python-script
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700646install-sh-script: $(SCRIPT_SH_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500647 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700648install-perl-script: $(SCRIPT_PERL_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500649 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700650install-python-script: $(SCRIPT_PYTHON_GEN)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500651 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100652
653.PHONY: clean-perl-script clean-sh-script clean-python-script
654clean-sh-script:
655 $(RM) $(SCRIPT_SH_GEN)
656clean-perl-script:
657 $(RM) $(SCRIPT_PERL_GEN)
658clean-python-script:
659 $(RM) $(SCRIPT_PYTHON_GEN)
660
Johannes Schindelin0b64e212019-04-18 06:16:39 -0700661SCRIPTS = $(SCRIPT_SH_GEN) \
662 $(SCRIPT_PERL_GEN) \
663 $(SCRIPT_PYTHON_GEN) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500664 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100665
Junio C Hamano2f769192010-09-28 16:08:38 -0500666ETAGS_TARGET = TAGS
667
Josh Steadmonaa658572019-01-15 14:25:50 -0800668FUZZ_OBJS += fuzz-commit-graph.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700669FUZZ_OBJS += fuzz-pack-headers.o
Josh Steadmon1127a982018-10-12 17:58:41 -0700670FUZZ_OBJS += fuzz-pack-idx.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100671.PHONY: fuzz-objs
672fuzz-objs: $(FUZZ_OBJS)
Josh Steadmon5e472152018-10-12 17:58:40 -0700673
674# Always build fuzz objects even if not testing, to prevent bit-rot.
675all:: $(FUZZ_OBJS)
676
677FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
678
Junio C Hamano42f77402006-08-15 21:38:07 -0700679# Empty...
680EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100681
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700682# ... and all the rest that could be moved out of bindir to gitexecdir
683PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600684
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100685PROGRAM_OBJS += daemon.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700686PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600687PROGRAM_OBJS += imap-send.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700688PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600689PROGRAM_OBJS += shell.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +0100690.PHONY: program-objs
691program-objs: $(PROGRAM_OBJS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600692
Michael Palimakaace5e972012-02-08 21:59:04 +1100693# Binary suffix, set to .exe for Windows builds
694X =
695
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600696PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700697
Heba Walyb3b18d12020-03-02 20:01:59 +0000698TEST_BUILTINS_OBJS += test-advise.o
Taylor Blau483fa7f2021-03-31 21:32:11 -0400699TEST_BUILTINS_OBJS += test-bitmap.o
Garima Singhf52207a2020-03-30 00:31:24 +0000700TEST_BUILTINS_OBJS += test-bloom.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100701TEST_BUILTINS_OBJS += test-chmtime.o
Nguyễn Thái Ngọc Duy0e2678a2018-03-24 08:44:34 +0100702TEST_BUILTINS_OBJS += test-config.o
Derrick Stolee2fec6042020-09-11 17:49:18 +0000703TEST_BUILTINS_OBJS += test-crontab.o
brian m. carlson05cd9882022-01-17 21:56:16 +0000704TEST_BUILTINS_OBJS += test-csprng.o
Nguyễn Thái Ngọc Duye4998942018-03-24 08:44:35 +0100705TEST_BUILTINS_OBJS += test-ctype.o
Nguyễn Thái Ngọc Duya801a7c2018-03-24 08:44:36 +0100706TEST_BUILTINS_OBJS += test-date.o
Nguyễn Thái Ngọc Duy9153dde2018-03-24 08:44:37 +0100707TEST_BUILTINS_OBJS += test-delta.o
Daniel Ferreira150791a2019-07-10 20:58:57 -0300708TEST_BUILTINS_OBJS += test-dir-iterator.o
Nguyễn Thái Ngọc Duy1c854742018-03-24 08:44:38 +0100709TEST_BUILTINS_OBJS += test-drop-caches.o
Nguyễn Thái Ngọc Duy06ccb292018-03-24 08:44:39 +0100710TEST_BUILTINS_OBJS += test-dump-cache-tree.o
Nguyễn Thái Ngọc Duyf1ef0b02018-09-09 19:36:30 +0200711TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
Nguyễn Thái Ngọc Duy81330612018-03-24 08:44:40 +0100712TEST_BUILTINS_OBJS += test-dump-split-index.o
Nguyễn Thái Ngọc Duycd780f02018-09-09 19:36:27 +0200713TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
Nguyễn Thái Ngọc Duydbceb3e2018-03-24 08:44:41 +0100714TEST_BUILTINS_OBJS += test-example-decorate.o
Elijah Newrenfe1a21d2020-10-29 20:32:13 +0000715TEST_BUILTINS_OBJS += test-fast-rebase.o
Nguyễn Thái Ngọc Duyc6806682018-03-24 08:44:42 +0100716TEST_BUILTINS_OBJS += test-genrandom.o
Johannes Schindelind5cfd142019-02-14 13:33:12 -0800717TEST_BUILTINS_OBJS += test-genzeros.o
Ævar Arnfjörð Bjarmason482e1482021-07-30 18:18:14 +0200718TEST_BUILTINS_OBJS += test-getcwd.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400719TEST_BUILTINS_OBJS += test-hash-speed.o
brian m. carlson50c817e2018-11-14 04:09:32 +0000720TEST_BUILTINS_OBJS += test-hash.o
Nguyễn Thái Ngọc Duy7c18cbd2018-03-24 08:44:43 +0100721TEST_BUILTINS_OBJS += test-hashmap.o
Nguyễn Thái Ngọc Duycc6f6632018-03-24 08:44:44 +0100722TEST_BUILTINS_OBJS += test-index-version.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000723TEST_BUILTINS_OBJS += test-json-writer.o
Nguyễn Thái Ngọc Duy64eb82f2018-03-24 08:44:33 +0100724TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
Nguyễn Thái Ngọc Duy9080e752018-03-24 08:44:45 +0100725TEST_BUILTINS_OBJS += test-match-trees.o
Nguyễn Thái Ngọc Duy34889d32018-03-24 08:44:46 +0100726TEST_BUILTINS_OBJS += test-mergesort.o
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +0100727TEST_BUILTINS_OBJS += test-mktemp.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700728TEST_BUILTINS_OBJS += test-oid-array.o
Christian Couder11510de2019-06-15 12:06:59 +0200729TEST_BUILTINS_OBJS += test-oidmap.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000730TEST_BUILTINS_OBJS += test-oidtree.o
Nguyễn Thái Ngọc Duyc033cc12018-03-24 08:44:48 +0100731TEST_BUILTINS_OBJS += test-online-cpus.o
Nguyễn Thái Ngọc Duy2f17c782018-09-09 19:36:29 +0200732TEST_BUILTINS_OBJS += test-parse-options.o
Alexandr Miloslavskiyd0d0a352019-12-31 10:15:12 +0000733TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
Jonathan Tanef830cc2021-06-17 10:13:26 -0700734TEST_BUILTINS_OBJS += test-partial-clone.o
Nguyễn Thái Ngọc Duyb8d5cf42018-03-24 08:44:49 +0100735TEST_BUILTINS_OBJS += test-path-utils.o
Ævar Arnfjörð Bjarmason95ca1f92021-01-24 18:28:13 +0100736TEST_BUILTINS_OBJS += test-pcre2-config.o
Nguyễn Thái Ngọc Duy8ea40cc2018-09-09 19:36:28 +0200737TEST_BUILTINS_OBJS += test-pkt-line.o
Nguyễn Thái Ngọc Duy15b75812018-03-24 08:44:50 +0100738TEST_BUILTINS_OBJS += test-prio-queue.o
Jiang Xin15d3af52020-08-27 11:45:44 -0400739TEST_BUILTINS_OBJS += test-proc-receive.o
SZEDER Gábor2bb74b52019-09-16 22:54:12 +0200740TEST_BUILTINS_OBJS += test-progress.o
Derrick Stoleeab176ac2018-07-20 16:33:15 +0000741TEST_BUILTINS_OBJS += test-reach.o
Nguyễn Thái Ngọc Duy5fbe6002018-03-24 08:44:51 +0100742TEST_BUILTINS_OBJS += test-read-cache.o
Derrick Stolee4bd05932019-11-12 16:58:20 +0000743TEST_BUILTINS_OBJS += test-read-graph.o
Derrick Stolee4d805602018-07-12 15:39:23 -0400744TEST_BUILTINS_OBJS += test-read-midx.o
Nguyễn Thái Ngọc Duy65370d82018-03-24 08:44:52 +0100745TEST_BUILTINS_OBJS += test-ref-store.o
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +0000746TEST_BUILTINS_OBJS += test-reftable.o
Nguyễn Thái Ngọc Duy90385312018-03-24 08:44:53 +0100747TEST_BUILTINS_OBJS += test-regex.o
Jonathan Tandade47c2018-07-11 15:42:42 -0700748TEST_BUILTINS_OBJS += test-repository.o
Nguyễn Thái Ngọc Duy77d4b8c2018-03-24 08:44:54 +0100749TEST_BUILTINS_OBJS += test-revision-walking.o
Nguyễn Thái Ngọc Duyae6a51f2018-03-24 08:44:55 +0100750TEST_BUILTINS_OBJS += test-run-command.o
Nguyễn Thái Ngọc Duyff5fb8b2018-03-24 08:44:56 +0100751TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
Johannes Schindelinb7ce24d2019-04-18 06:16:51 -0700752TEST_BUILTINS_OBJS += test-serve-v2.o
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +0100753TEST_BUILTINS_OBJS += test-sha1.o
brian m. carlson13eeedb2018-11-14 04:09:36 +0000754TEST_BUILTINS_OBJS += test-sha256.o
Nguyễn Thái Ngọc Duye154a6f2018-03-24 08:44:58 +0100755TEST_BUILTINS_OBJS += test-sigchain.o
Jeff Hostetler36a7eb62021-03-22 10:29:48 +0000756TEST_BUILTINS_OBJS += test-simple-ipc.o
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +0100757TEST_BUILTINS_OBJS += test-strcmp-offset.o
Nguyễn Thái Ngọc Duyc932a5f2018-03-24 08:45:00 +0100758TEST_BUILTINS_OBJS += test-string-list.o
Nguyễn Thái Ngọc Duyb6188212018-03-24 08:45:01 +0100759TEST_BUILTINS_OBJS += test-submodule-config.o
Antonio Ospite2b1257e2018-10-25 18:18:13 +0200760TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
Nguyễn Thái Ngọc Duy112edd62018-03-24 08:45:02 +0100761TEST_BUILTINS_OBJS += test-subprocess.o
Jeff Hostetlera15860d2019-02-22 14:25:10 -0800762TEST_BUILTINS_OBJS += test-trace2.o
Nguyễn Thái Ngọc Duy599fbd82018-03-24 08:45:03 +0100763TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
Ævar Arnfjörð Bjarmason28e8f0d2021-04-08 17:04:21 +0200764TEST_BUILTINS_OBJS += test-userdiff.o
Nguyễn Thái Ngọc Duy04892892018-03-24 08:45:04 +0100765TEST_BUILTINS_OBJS += test-wildmatch.o
Jeff Hostetler06ba9d02018-09-11 13:06:01 -0700766TEST_BUILTINS_OBJS += test-windows-named-pipe.o
Nguyễn Thái Ngọc Duyc81f8432018-03-24 08:45:05 +0100767TEST_BUILTINS_OBJS += test-write-cache.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400768TEST_BUILTINS_OBJS += test-xml-encode.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100769
Nguyễn Thái Ngọc Duyc9a1f412018-09-09 19:36:31 +0200770# Do not add more tests here unless they have extra dependencies. Add
771# them in TEST_BUILTINS_OBJS above.
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100772TEST_PROGRAMS_NEED_X += test-fake-ssh
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100773TEST_PROGRAMS_NEED_X += test-tool
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600774
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700775TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100776
Junio C Hamano17368552008-02-23 11:08:25 -0800777# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800778# builtin/$C.o but is linked in as part of some other command.
779BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700780
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700781BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100782BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700783BUILT_INS += git-format-patch$X
784BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700785BUILT_INS += git-init$X
Jeff King0a21d0e2020-12-01 21:34:11 -0500786BUILT_INS += git-maintenance$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700787BUILT_INS += git-merge-subtree$X
Nguyễn Thái Ngọc Duy46e91b62019-04-25 16:45:45 +0700788BUILT_INS += git-restore$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700789BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800790BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700791BUILT_INS += git-status$X
Nguyễn Thái Ngọc Duyd787d312019-03-29 17:39:05 +0700792BUILT_INS += git-switch$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700793BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700794
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700795# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400796OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700797
Matthew Ogilvieea925192009-12-02 22:14:05 -0700798# what test wrappers are needed and 'install' will install, in bindir
799BINDIR_PROGRAMS_NEED_X += git
Matthew Ogilvieea925192009-12-02 22:14:05 -0700800BINDIR_PROGRAMS_NEED_X += git-receive-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700801BINDIR_PROGRAMS_NEED_X += git-shell
Denton Liu805d9ea2020-03-21 05:21:20 -0400802BINDIR_PROGRAMS_NEED_X += git-upload-archive
803BINDIR_PROGRAMS_NEED_X += git-upload-pack
Matthew Ogilvieea925192009-12-02 22:14:05 -0700804
805BINDIR_PROGRAMS_NO_X += git-cvsserver
806
Ryan Anderson3d320512005-11-21 00:11:22 -0500807# Set paths to tools early so that they can be used for version tests.
808ifndef SHELL_PATH
809 SHELL_PATH = /bin/sh
810endif
811ifndef PERL_PATH
812 PERL_PATH = /usr/bin/perl
813endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100814ifndef PYTHON_PATH
815 PYTHON_PATH = /usr/bin/python
816endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700817
Luben Tuikov3a793472006-12-14 23:03:03 -0800818export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100819export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800820
Jeff King3f824e92017-12-08 05:47:22 -0500821TEST_SHELL_PATH = $(SHELL_PATH)
822
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100823LIB_FILE = libgit.a
824XDIFF_LIB = xdiff/lib.a
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +0000825REFTABLE_LIB = reftable/libreftable.a
826REFTABLE_TEST_LIB = reftable/libreftable_test.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700827
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +0200828GENERATED_H += command-list.h
Denton Liu8474f262020-10-08 00:39:26 -0700829GENERATED_H += config-list.h
Ævar Arnfjörð Bjarmasoncfe853e2021-09-26 21:03:29 +0200830GENERATED_H += hook-list.h
831
Ævar Arnfjörð Bjarmason7c3c0a92021-09-23 12:29:57 +0200832.PHONY: generated-hdrs
833generated-hdrs: $(GENERATED_H)
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700834
Denton Liucf6a2d22019-09-16 12:23:08 -0700835LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
Johannes Schindelin92b88eb2019-03-04 05:47:06 -0800836 $(FIND) . \
Jeff Kingd85b0df2014-08-25 16:00:42 -0400837 -name .git -prune -o \
838 -name t -prune -o \
839 -name Documentation -prune -o \
Denton Liucf6a2d22019-09-16 12:23:08 -0700840 -name '*.h' -print)))
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700841
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400842LIB_OBJS += abspath.o
Johannes Schindelinf83dff62019-11-13 12:40:57 +0000843LIB_OBJS += add-interactive.o
Johannes Schindelinf6aa7ec2019-12-13 08:07:48 +0000844LIB_OBJS += add-patch.o
Jeff King75194432009-09-09 07:38:58 -0400845LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700846LIB_OBJS += alias.o
847LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200848LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700849LIB_OBJS += archive-tar.o
850LIB_OBJS += archive-zip.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400851LIB_OBJS += archive.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700852LIB_OBJS += attr.o
853LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100854LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500855LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700856LIB_OBJS += blob.o
Garima Singhf52207a2020-03-30 00:31:24 +0000857LIB_OBJS += bloom.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700858LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700859LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700860LIB_OBJS += bundle.o
861LIB_OBJS += cache-tree.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000862LIB_OBJS += cbtree.o
Jeff King2b5ed372018-03-30 14:35:04 -0400863LIB_OBJS += chdir-notify.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000864LIB_OBJS += checkout.o
Derrick Stolee570df422021-02-18 14:07:24 +0000865LIB_OBJS += chunk-format.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700866LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700867LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700868LIB_OBJS += combine-diff.o
Derrick Stolee08fd81c2018-04-02 16:34:19 -0400869LIB_OBJS += commit-graph.o
Derrick Stolee5227c382018-07-20 16:33:02 +0000870LIB_OBJS += commit-reach.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400871LIB_OBJS += commit.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200872LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500873LIB_OBJS += compat/terminal.o
Ævar Arnfjörð Bjarmason07564772022-01-24 10:27:59 -0800874LIB_OBJS += compat/zlib-uncompress2.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700875LIB_OBJS += config.o
876LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700877LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700878LIB_OBJS += convert.o
879LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500880LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700881LIB_OBJS += csum-file.o
882LIB_OBJS += ctype.o
883LIB_OBJS += date.o
884LIB_OBJS += decorate.o
Jeff Kingc8d521f2018-08-16 08:13:07 +0200885LIB_OBJS += delta-islands.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400886LIB_OBJS += diff-delta.o
Sergey Organova37eec62020-12-21 18:19:33 +0300887LIB_OBJS += diff-merges.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400888LIB_OBJS += diff-lib.o
889LIB_OBJS += diff-no-index.o
890LIB_OBJS += diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700891LIB_OBJS += diffcore-break.o
892LIB_OBJS += diffcore-delta.o
893LIB_OBJS += diffcore-order.o
894LIB_OBJS += diffcore-pickaxe.o
895LIB_OBJS += diffcore-rename.o
Junio C Hamano1eb41362021-02-11 11:57:50 -0800896LIB_OBJS += diffcore-rotate.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200897LIB_OBJS += dir-iterator.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400898LIB_OBJS += dir.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200899LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700900LIB_OBJS += entry.o
901LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500902LIB_OBJS += ewah/bitmap.o
903LIB_OBJS += ewah/ewah_bitmap.o
904LIB_OBJS += ewah/ewah_io.o
905LIB_OBJS += ewah/ewah_rlw.o
Stefan Bellerd807c4a2018-04-10 14:26:18 -0700906LIB_OBJS += exec-cmd.o
Jonathan Tanec062832018-06-14 15:54:28 -0700907LIB_OBJS += fetch-negotiator.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700908LIB_OBJS += fetch-pack.o
Denton Liuce6521e2020-03-23 21:07:51 -0400909LIB_OBJS += fmt-merge-msg.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700910LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400911LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100912LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700913LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700914LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700915LIB_OBJS += grep.o
Martin Ågrenbc626922020-12-31 12:56:23 +0100916LIB_OBJS += hash-lookup.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100917LIB_OBJS += hashmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700918LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800919LIB_OBJS += hex.o
Ævar Arnfjörð Bjarmason5e3aba32021-09-26 21:03:26 +0200920LIB_OBJS += hook.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700921LIB_OBJS += ident.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000922LIB_OBJS += json-writer.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200923LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200924LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100925LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100926LIB_OBJS += line-range.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400927LIB_OBJS += linear-assignment.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000928LIB_OBJS += list-objects-filter-options.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400929LIB_OBJS += list-objects-filter.o
930LIB_OBJS += list-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700931LIB_OBJS += ll-merge.o
932LIB_OBJS += lockfile.o
933LIB_OBJS += log-tree.o
Brandon Williams72d0ea02018-03-15 10:31:20 -0700934LIB_OBJS += ls-refs.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700935LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700936LIB_OBJS += mailmap.o
937LIB_OBJS += match-trees.o
Jameson Miller065feab2018-04-11 18:37:55 +0000938LIB_OBJS += mem-pool.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800939LIB_OBJS += merge-blobs.o
Elijah Newren17e55742020-10-27 02:08:07 +0000940LIB_OBJS += merge-ort.o
Elijah Newren47b1e892020-10-27 02:08:08 +0000941LIB_OBJS += merge-ort-wrappers.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200942LIB_OBJS += merge-recursive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400943LIB_OBJS += merge.o
René Scharfe0db71e02012-04-01 00:10:11 +0200944LIB_OBJS += mergesort.o
Derrick Stoleea3407732018-07-12 15:39:21 -0400945LIB_OBJS += midx.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700946LIB_OBJS += name-hash.o
Jonathan Tanec062832018-06-14 15:54:28 -0700947LIB_OBJS += negotiator/default.o
Jonathan Tancbe566a2020-08-17 21:01:31 -0700948LIB_OBJS += negotiator/noop.o
Jonathan Tan42cc7482018-07-16 11:44:01 -0700949LIB_OBJS += negotiator/skipping.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400950LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100951LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200952LIB_OBJS += notes-utils.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400953LIB_OBJS += notes.o
Martin Ågrene5afd442020-12-31 12:56:21 +0100954LIB_OBJS += object-file.o
Martin Ågren1e6771e2020-12-31 12:56:20 +0100955LIB_OBJS += object-name.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700956LIB_OBJS += object.o
Junio C Hamanobf102002020-04-29 16:15:27 -0700957LIB_OBJS += oid-array.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700958LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500959LIB_OBJS += oidset.o
Eric Wong92d8ed82021-07-07 23:10:19 +0000960LIB_OBJS += oidtree.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500961LIB_OBJS += pack-bitmap-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400962LIB_OBJS += pack-bitmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700963LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400964LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700965LIB_OBJS += pack-revindex.o
966LIB_OBJS += pack-write.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400967LIB_OBJS += packfile.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700968LIB_OBJS += pager.o
Matheus Tavares04155bd2021-04-18 21:14:53 -0300969LIB_OBJS += parallel-checkout.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600970LIB_OBJS += parse-options-cb.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400971LIB_OBJS += parse-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700972LIB_OBJS += patch-delta.o
973LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700974LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000975LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700976LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100977LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700978LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700979LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700980LIB_OBJS += progress.o
Christian Couder48de3152019-06-25 15:40:27 +0200981LIB_OBJS += promisor-remote.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500982LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700983LIB_OBJS += protocol.o
Bruno Albuquerquea2ba1622021-04-20 16:38:31 -0700984LIB_OBJS += protocol-caps.o
Denton Liu9460fd42020-03-23 21:07:52 -0400985LIB_OBJS += prune-packed.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700986LIB_OBJS += quote.o
Johannes Schindelind9c66f02018-08-13 04:33:04 -0700987LIB_OBJS += range-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700988LIB_OBJS += reachable.o
989LIB_OBJS += read-cache.o
Alban Gruin145e05a2018-08-10 18:51:29 +0200990LIB_OBJS += rebase-interactive.o
Denton Liu805d9ea2020-03-21 05:21:20 -0400991LIB_OBJS += rebase.o
992LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700993LIB_OBJS += reflog-walk.o
994LIB_OBJS += refs.o
Han-Wen Nienhuys4441f422020-09-09 10:15:08 +0000995LIB_OBJS += refs/debug.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100996LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200997LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200998LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200999LIB_OBJS += refs/ref-cache.o
Brandon Williamsec0cb492018-05-16 15:57:48 -07001000LIB_OBJS += refspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001001LIB_OBJS += remote.o
Stefan Beller11bc0582018-04-10 14:26:21 -07001002LIB_OBJS += replace-object.o
Derrick Stolee7211b9e2019-08-13 11:37:43 -07001003LIB_OBJS += repo-settings.o
Brandon Williams359efef2017-06-22 11:43:32 -07001004LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +02001005LIB_OBJS += rerere.o
Denton Liub309a972020-04-07 10:28:00 -04001006LIB_OBJS += reset.o
Junio C Hamanocfc57892009-12-25 00:30:51 -08001007LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001008LIB_OBJS += revision.o
1009LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +07001010LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +07001011LIB_OBJS += sequencer.o
Brandon Williamsed10cb92018-03-15 10:31:19 -07001012LIB_OBJS += serve.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001013LIB_OBJS += server-info.o
1014LIB_OBJS += setup.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001015LIB_OBJS += shallow.o
1016LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -05001017LIB_OBJS += sigchain.o
Derrick Stolee3964fc22021-03-30 13:10:47 +00001018LIB_OBJS += sparse-index.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +07001019LIB_OBJS += split-index.o
Johannes Schindelin97fff612019-09-30 10:21:54 -07001020LIB_OBJS += stable-qsort.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001021LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -07001022LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001023LIB_OBJS += string-list.o
Elijah Newrenae20bf12020-11-02 18:55:06 +00001024LIB_OBJS += strmap.o
Denton Liu8474f262020-10-08 00:39:26 -07001025LIB_OBJS += strvec.o
Ben Peart99605d62017-05-05 11:28:01 -04001026LIB_OBJS += sub-process.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001027LIB_OBJS += submodule-config.o
1028LIB_OBJS += submodule.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001029LIB_OBJS += symlinks.o
1030LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +02001031LIB_OBJS += tempfile.o
Nguyễn Thái Ngọc Duy0ec79352018-10-27 19:29:59 +02001032LIB_OBJS += thread-utils.o
Jeff King2564d992016-10-03 16:49:11 -04001033LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001034LIB_OBJS += trace.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001035LIB_OBJS += trace2.o
1036LIB_OBJS += trace2/tr2_cfg.o
1037LIB_OBJS += trace2/tr2_cmd_name.o
1038LIB_OBJS += trace2/tr2_dst.o
1039LIB_OBJS += trace2/tr2_sid.o
Jeff Hostetlerbce9db62019-04-15 13:39:47 -07001040LIB_OBJS += trace2/tr2_sysenv.o
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001041LIB_OBJS += trace2/tr2_tbuf.o
1042LIB_OBJS += trace2/tr2_tgt_event.o
1043LIB_OBJS += trace2/tr2_tgt_normal.o
1044LIB_OBJS += trace2/tr2_tgt_perf.o
1045LIB_OBJS += trace2/tr2_tls.o
Christian Couder9385b5d2014-10-13 20:16:23 +02001046LIB_OBJS += trailer.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -04001047LIB_OBJS += transport-helper.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001048LIB_OBJS += transport.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001049LIB_OBJS += tree-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001050LIB_OBJS += tree-walk.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001051LIB_OBJS += tree.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001052LIB_OBJS += unpack-trees.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001053LIB_OBJS += upload-pack.o
Jeff King638794c2010-05-23 05:17:55 -04001054LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -07001055LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001056LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001057LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001058LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -07001059LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -04001060LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +07001061LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001062LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +07001063LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -04001064LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -07001065LIB_OBJS += wrapper.o
Stefan Bellerfa2656f2018-04-10 14:26:16 -07001066LIB_OBJS += write-or-die.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001067LIB_OBJS += ws.o
1068LIB_OBJS += wt-status.o
1069LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -05001070LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +02001071
Linus Torvalds81b50f32010-02-22 08:42:18 -08001072BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +08001073BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001074BUILTIN_OBJS += builtin/annotate.o
1075BUILTIN_OBJS += builtin/apply.o
1076BUILTIN_OBJS += builtin/archive.o
1077BUILTIN_OBJS += builtin/bisect--helper.o
1078BUILTIN_OBJS += builtin/blame.o
1079BUILTIN_OBJS += builtin/branch.o
Jeff Kingd7a56492020-08-13 10:59:36 -04001080BUILTIN_OBJS += builtin/bugreport.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001081BUILTIN_OBJS += builtin/bundle.o
1082BUILTIN_OBJS += builtin/cat-file.o
1083BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +00001084BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -04001085BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001086BUILTIN_OBJS += builtin/check-ref-format.o
Matheus Tavarese9e8adf2021-04-18 21:14:54 -03001087BUILTIN_OBJS += builtin/checkout--worker.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001088BUILTIN_OBJS += builtin/checkout-index.o
1089BUILTIN_OBJS += builtin/checkout.o
1090BUILTIN_OBJS += builtin/clean.o
1091BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +07001092BUILTIN_OBJS += builtin/column.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001093BUILTIN_OBJS += builtin/commit-graph.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001094BUILTIN_OBJS += builtin/commit-tree.o
1095BUILTIN_OBJS += builtin/commit.o
1096BUILTIN_OBJS += builtin/config.o
1097BUILTIN_OBJS += builtin/count-objects.o
Denton Liu8474f262020-10-08 00:39:26 -07001098BUILTIN_OBJS += builtin/credential-cache--daemon.o
1099BUILTIN_OBJS += builtin/credential-cache.o
1100BUILTIN_OBJS += builtin/credential-store.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +02001101BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001102BUILTIN_OBJS += builtin/describe.o
1103BUILTIN_OBJS += builtin/diff-files.o
1104BUILTIN_OBJS += builtin/diff-index.o
1105BUILTIN_OBJS += builtin/diff-tree.o
1106BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +01001107BUILTIN_OBJS += builtin/difftool.o
Ævar Arnfjörð Bjarmasonb4f207f2019-06-21 12:18:06 +02001108BUILTIN_OBJS += builtin/env--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001109BUILTIN_OBJS += builtin/fast-export.o
Jeff Kinga006f872020-08-13 10:59:45 -04001110BUILTIN_OBJS += builtin/fast-import.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001111BUILTIN_OBJS += builtin/fetch-pack.o
1112BUILTIN_OBJS += builtin/fetch.o
1113BUILTIN_OBJS += builtin/fmt-merge-msg.o
1114BUILTIN_OBJS += builtin/for-each-ref.o
Derrick Stolee4950b2a2020-09-11 17:49:16 +00001115BUILTIN_OBJS += builtin/for-each-repo.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001116BUILTIN_OBJS += builtin/fsck.o
1117BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -08001118BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001119BUILTIN_OBJS += builtin/grep.o
1120BUILTIN_OBJS += builtin/hash-object.o
1121BUILTIN_OBJS += builtin/help.o
Emily Shaffer96e72252021-12-22 04:59:27 +01001122BUILTIN_OBJS += builtin/hook.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001123BUILTIN_OBJS += builtin/index-pack.o
1124BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +02001125BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001126BUILTIN_OBJS += builtin/log.o
1127BUILTIN_OBJS += builtin/ls-files.o
1128BUILTIN_OBJS += builtin/ls-remote.o
1129BUILTIN_OBJS += builtin/ls-tree.o
1130BUILTIN_OBJS += builtin/mailinfo.o
1131BUILTIN_OBJS += builtin/mailsplit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001132BUILTIN_OBJS += builtin/merge-base.o
1133BUILTIN_OBJS += builtin/merge-file.o
1134BUILTIN_OBJS += builtin/merge-index.o
1135BUILTIN_OBJS += builtin/merge-ours.o
1136BUILTIN_OBJS += builtin/merge-recursive.o
1137BUILTIN_OBJS += builtin/merge-tree.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001138BUILTIN_OBJS += builtin/merge.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001139BUILTIN_OBJS += builtin/mktag.o
1140BUILTIN_OBJS += builtin/mktree.o
Derrick Stolee6a257f02018-07-12 15:39:20 -04001141BUILTIN_OBJS += builtin/multi-pack-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001142BUILTIN_OBJS += builtin/mv.o
1143BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -07001144BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001145BUILTIN_OBJS += builtin/pack-objects.o
1146BUILTIN_OBJS += builtin/pack-redundant.o
1147BUILTIN_OBJS += builtin/pack-refs.o
1148BUILTIN_OBJS += builtin/patch-id.o
1149BUILTIN_OBJS += builtin/prune-packed.o
1150BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001151BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001152BUILTIN_OBJS += builtin/push.o
Johannes Schindelin348ae562018-08-13 04:33:02 -07001153BUILTIN_OBJS += builtin/range-diff.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001154BUILTIN_OBJS += builtin/read-tree.o
Pratik Karki55071ea2018-08-07 01:16:09 +05451155BUILTIN_OBJS += builtin/rebase.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001156BUILTIN_OBJS += builtin/receive-pack.o
1157BUILTIN_OBJS += builtin/reflog.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001158BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001159BUILTIN_OBJS += builtin/remote-fd.o
Denton Liu805d9ea2020-03-21 05:21:20 -04001160BUILTIN_OBJS += builtin/remote.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001161BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001162BUILTIN_OBJS += builtin/replace.o
1163BUILTIN_OBJS += builtin/rerere.o
1164BUILTIN_OBJS += builtin/reset.o
1165BUILTIN_OBJS += builtin/rev-list.o
1166BUILTIN_OBJS += builtin/rev-parse.o
1167BUILTIN_OBJS += builtin/revert.o
1168BUILTIN_OBJS += builtin/rm.o
1169BUILTIN_OBJS += builtin/send-pack.o
1170BUILTIN_OBJS += builtin/shortlog.o
1171BUILTIN_OBJS += builtin/show-branch.o
Jeff Kingff417262018-05-28 05:38:53 -04001172BUILTIN_OBJS += builtin/show-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001173BUILTIN_OBJS += builtin/show-ref.o
Derrick Stolee94c09562019-11-21 22:04:33 +00001174BUILTIN_OBJS += builtin/sparse-checkout.o
Paul-Sebastian Ungureanu40af1462019-02-25 23:16:28 +00001175BUILTIN_OBJS += builtin/stash.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001176BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001177BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001178BUILTIN_OBJS += builtin/symbolic-ref.o
1179BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001180BUILTIN_OBJS += builtin/unpack-file.o
1181BUILTIN_OBJS += builtin/unpack-objects.o
1182BUILTIN_OBJS += builtin/update-index.o
1183BUILTIN_OBJS += builtin/update-ref.o
1184BUILTIN_OBJS += builtin/update-server-info.o
1185BUILTIN_OBJS += builtin/upload-archive.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001186BUILTIN_OBJS += builtin/upload-pack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001187BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001188BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001189BUILTIN_OBJS += builtin/verify-pack.o
1190BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001191BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001192BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001193
Denton Liu5dedf7d2019-09-16 12:23:11 -07001194# THIRD_PARTY_SOURCES is a list of patterns compatible with the
1195# $(filter) and $(filter-out) family of functions. They specify source
1196# files which are taken from some third-party source where we want to be
1197# less strict about issues such as coding style so we don't diverge from
1198# upstream unnecessarily (making merging in future changes easier).
1199THIRD_PARTY_SOURCES += compat/inet_ntop.c
1200THIRD_PARTY_SOURCES += compat/inet_pton.c
1201THIRD_PARTY_SOURCES += compat/nedmalloc/%
1202THIRD_PARTY_SOURCES += compat/obstack.%
1203THIRD_PARTY_SOURCES += compat/poll/%
1204THIRD_PARTY_SOURCES += compat/regex/%
1205THIRD_PARTY_SOURCES += sha1collisiondetection/%
1206THIRD_PARTY_SOURCES += sha1dc/%
1207
Ævar Arnfjörð Bjarmason07564772022-01-24 10:27:59 -08001208# xdiff and reftable libs may in turn depend on what is in libgit.a
1209GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
Robert Schielebef19da2007-07-29 20:35:45 +02001210EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001211
Jeff King42dcbb72012-06-02 15:01:12 -04001212GIT_USER_AGENT = git/$(GIT_VERSION)
1213
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001214ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1215DC_SHA1_SUBMODULE = auto
1216endif
1217
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001218# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1219# tweaked by config.* below as well as the command-line, both of
1220# which'll override these defaults.
Junio C Hamano44ba10d2021-11-14 22:27:45 -08001221# Older versions of GCC may require adding "-std=gnu99" at the end.
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001222CFLAGS = -g -O2 -Wall
1223LDFLAGS =
Ævar Arnfjörð Bjarmason0f50c8e2019-05-17 23:58:47 +02001224CC_LD_DYNPATH = -Wl,-rpath,
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001225BASIC_CFLAGS = -I.
1226BASIC_LDFLAGS =
1227
1228# library flags
1229ARFLAGS = rcs
1230PTHREAD_CFLAGS =
1231
1232# For the 'sparse' target
brian m. carlson7bc341e2021-12-01 01:40:50 +00001233SPARSE_FLAGS ?= -std=gnu99
Luc Van Oostenryck1c9664232020-05-22 02:25:02 +02001234SP_EXTRA_FLAGS = -Wno-universal-initializer
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001235
Ævar Arnfjörð Bjarmason2cdc2922021-09-23 11:20:45 +02001236# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak target
1237SANITIZE_LEAK =
1238
Jeff King960154b2019-05-06 19:43:34 -04001239# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
1240# usually result in less CPU usage at the cost of higher peak memory.
Jeff Kingbcb4edf2019-05-08 03:07:54 -04001241# Setting it to 0 will feed all files in a single spatch invocation.
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001242SPATCH_FLAGS = --all-includes --patch .
Jeff King960154b2019-05-06 19:43:34 -04001243SPATCH_BATCH_SIZE = 1
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001244
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001245include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001246-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001247-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001248
Matthieu Moyd6156282016-05-31 15:24:43 +02001249ifdef DEVELOPER
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +00001250include config.mak.dev
Matthieu Moyd6156282016-05-31 15:24:43 +02001251endif
1252
Johannes Schindelin4a5ec7d2021-01-21 13:09:45 +00001253# what 'all' will build and 'install' will install in gitexecdir,
1254# excluding programs for built-in commands
1255ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
1256ALL_COMMANDS_TO_INSTALL = $(ALL_PROGRAMS)
1257ifeq (,$(SKIP_DASHED_BUILT_INS))
1258ALL_COMMANDS_TO_INSTALL += $(BUILT_INS)
1259else
1260# git-upload-pack, git-receive-pack and git-upload-archive are special: they
1261# are _expected_ to be present in the `bin/` directory in their dashed form.
1262ALL_COMMANDS_TO_INSTALL += git-receive-pack$(X)
1263ALL_COMMANDS_TO_INSTALL += git-upload-archive$(X)
1264ALL_COMMANDS_TO_INSTALL += git-upload-pack$(X)
1265endif
1266
Ævar Arnfjörð Bjarmason6d5d4b42019-02-22 15:41:27 +01001267ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
Ævar Arnfjörð Bjarmason71a78942019-02-22 15:41:26 +01001268ALL_LDFLAGS = $(LDFLAGS)
1269
René Scharfe425ca672017-07-15 19:18:56 +02001270comma := ,
1271empty :=
1272space := $(empty) $(empty)
1273
Jeff King56b5db32017-07-10 09:24:42 -04001274ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001275SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001276BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001277BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001278ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King07a20f52019-03-12 17:06:26 -04001279BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
Jeff King566cf0b2017-07-10 09:24:50 -04001280endif
Jeff King0e5bba52017-09-08 02:38:41 -04001281ifneq ($(filter leak,$(SANITIZERS)),)
1282BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
Ævar Arnfjörð Bjarmason2cdc2922021-09-23 11:20:45 +02001283SANITIZE_LEAK = YesCompiledWithIt
Jeff King0e5bba52017-09-08 02:38:41 -04001284endif
Jeff Kingf65d07f2020-01-16 12:51:38 -05001285ifneq ($(filter address,$(SANITIZERS)),)
1286NO_REGEX = NeededForASAN
1287endif
Jeff King56b5db32017-07-10 09:24:42 -04001288endif
1289
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001290ifndef sysconfdir
1291ifeq ($(prefix),/usr)
1292sysconfdir = /etc
1293else
1294sysconfdir = etc
1295endif
1296endif
1297
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001298ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001299COMPUTE_HEADER_DEPENDENCIES = auto
1300endif
1301
1302ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001303dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Ævar Arnfjörð Bjarmason731b6852021-09-23 00:08:01 +02001304 -Wno-pedantic \
Jonathan Nieder69789342011-11-18 17:23:24 -06001305 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1306 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001307 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001308ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001309override COMPUTE_HEADER_DEPENDENCIES = yes
1310else
1311override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001312endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001313endif
1314
Jonathan Nieder024c8432011-11-18 03:58:21 -06001315ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001316USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001317else
1318ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1319$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1320(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1321endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001322endif
1323
Philippe Blain3821c382020-09-03 22:13:38 +00001324ifndef GENERATE_COMPILATION_DATABASE
1325GENERATE_COMPILATION_DATABASE = no
1326endif
1327
1328ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
1329compdb_check = $(shell $(CC) $(ALL_CFLAGS) \
Ævar Arnfjörð Bjarmasondd20e4a2021-09-23 00:08:02 +02001330 -Wno-pedantic \
Philippe Blain3821c382020-09-03 22:13:38 +00001331 -c -MJ /dev/null \
1332 -x c /dev/null -o /dev/null 2>&1; \
1333 echo $$?)
1334ifneq ($(compdb_check),0)
1335override GENERATE_COMPILATION_DATABASE = no
1336$(warning GENERATE_COMPILATION_DATABASE is set to "yes", but your compiler does not \
1337support generating compilation database entries)
1338endif
1339else
1340ifneq ($(GENERATE_COMPILATION_DATABASE),no)
1341$(error please set GENERATE_COMPILATION_DATABASE to "yes" or "no" \
1342(not "$(GENERATE_COMPILATION_DATABASE)"))
1343endif
1344endif
1345
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001346ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001347SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
Jeff Hostetlerc444bf82019-06-19 14:06:06 -07001348BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001349PATH := $(SANE_TOOL_PATH):${PATH}
1350else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001351BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001352endif
1353
Eric Sunshineb2289402017-12-15 00:34:34 +01001354ifeq (,$(HOST_CPU))
1355 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1356else
1357 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1358endif
1359
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001360ifneq (,$(INLINE))
1361 BASIC_CFLAGS += -Dinline=$(INLINE)
1362endif
1363
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001364ifneq (,$(SOCKLEN_T))
1365 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1366endif
1367
Brian Gernhardt59f86742006-12-12 12:01:47 -05001368ifeq ($(uname_S),Darwin)
1369 ifndef NO_FINK
1370 ifeq ($(shell test -d /sw/lib && echo y),y)
1371 BASIC_CFLAGS += -I/sw/include
1372 BASIC_LDFLAGS += -L/sw/lib
1373 endif
1374 endif
1375 ifndef NO_DARWIN_PORTS
1376 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1377 BASIC_CFLAGS += -I/opt/local/include
1378 BASIC_LDFLAGS += -L/opt/local/lib
1379 endif
1380 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001381 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001382 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001383 APPLE_COMMON_CRYPTO = YesPlease
1384 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1385 endif
David Aguilar29de2052013-05-11 01:22:26 -07001386 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001387 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001388endif
1389
David Aguilare1c06882009-05-31 01:35:51 -07001390ifdef NO_LIBGEN_H
1391 COMPAT_CFLAGS += -DNO_LIBGEN_H
1392 COMPAT_OBJS += compat/basename.o
1393endif
1394
Ævar Arnfjörð Bjarmason75997302021-01-24 02:58:33 +01001395ifdef USE_LIBPCRE1
1396$(error The USE_LIBPCRE1 build option has been removed, use version 2 with USE_LIBPCRE)
1397endif
1398
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001399USE_LIBPCRE2 ?= $(USE_LIBPCRE)
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001400
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001401ifneq (,$(USE_LIBPCRE2))
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001402 BASIC_CFLAGS += -DUSE_LIBPCRE2
1403 EXTLIBS += -lpcre2-8
1404endif
1405
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001406ifdef LIBPCREDIR
1407 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1408 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001409endif
1410
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001411ifdef HAVE_ALLOCA_H
1412 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1413endif
1414
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001415IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001416IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001417
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001418ifdef NO_CURL
1419 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001420 REMOTE_CURL_PRIMARY =
1421 REMOTE_CURL_ALIASES =
1422 REMOTE_CURL_NAMES =
Johannes Schindelin724d6352019-04-18 06:16:40 -07001423 EXCLUDED_PROGRAMS += git-http-fetch git-http-push
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001424else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001425 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001426 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
Jeff King897d68e2020-03-26 04:08:55 -04001427 CURL_CFLAGS = -I$(CURLDIR)/include
James Knight23c4bbe2018-11-03 05:12:11 +00001428 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001429 else
Jeff King897d68e2020-03-26 04:08:55 -04001430 CURL_CFLAGS =
James Knight23c4bbe2018-11-03 05:12:11 +00001431 CURL_LIBCURL =
Junio C Hamanob2feb642014-04-30 10:58:10 -07001432 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001433
Jeff King94a88e22020-03-26 04:06:45 -04001434 ifndef CURL_LDFLAGS
Jeff King05738312020-04-04 10:58:29 -04001435 CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
Jeff King94a88e22020-03-26 04:06:45 -04001436 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001437 CURL_LIBCURL += $(CURL_LDFLAGS)
Thomas Cortbc5f8132011-07-19 18:55:47 -04001438
Jeff King897d68e2020-03-26 04:08:55 -04001439 ifndef CURL_CFLAGS
Jeff King05738312020-04-04 10:58:29 -04001440 CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
Jeff King897d68e2020-03-26 04:08:55 -04001441 endif
1442 BASIC_CFLAGS += $(CURL_CFLAGS)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001443
Johannes Sixt4256f362010-01-19 16:39:12 +01001444 REMOTE_CURL_PRIMARY = git-remote-http$X
1445 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1446 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001447 PROGRAM_OBJS += http-fetch.o
1448 PROGRAMS += $(REMOTE_CURL_NAMES)
Ævar Arnfjörð Bjarmason2d4032c2021-09-13 16:51:24 +02001449 ifndef NO_EXPAT
1450 PROGRAM_OBJS += http-push.o
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001451 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001452 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 +01001453 ifeq "$(curl_check)" "072200"
1454 USE_CURL_FOR_IMAP_SEND = YesPlease
1455 endif
1456 ifdef USE_CURL_FOR_IMAP_SEND
1457 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1458 IMAP_SEND_BUILDDEPS = http.o
1459 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1460 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001461 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001462 ifdef EXPATDIR
1463 BASIC_CFLAGS += -I$(EXPATDIR)/include
1464 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1465 else
1466 EXPAT_LIBEXPAT = -lexpat
1467 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001468 ifdef EXPAT_NEEDS_XMLPARSE_H
1469 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1470 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001471 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001472endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001473IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001474
Robert Schielebef19da2007-07-29 20:35:45 +02001475ifdef ZLIB_PATH
1476 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001477 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001478endif
1479EXTLIBS += -lz
1480
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001481ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001482 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001483 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001484 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001485 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001486 else
1487 OPENSSL_LINK =
1488 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001489 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001490 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001491 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001492else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001493 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001494 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001495endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001496ifdef NO_OPENSSL
1497 LIB_4_CRYPTO =
1498else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001499ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001500 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001501else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001502 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001503endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001504ifdef APPLE_COMMON_CRYPTO
1505 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1506endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001507endif
Eric Sunshinefdb1fbb2018-06-14 22:25:03 -04001508ifndef NO_ICONV
1509 ifdef NEEDS_LIBICONV
1510 ifdef ICONVDIR
1511 BASIC_CFLAGS += -I$(ICONVDIR)/include
1512 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1513 else
1514 ICONV_LINK =
1515 endif
1516 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1517 ICONV_LINK += -lintl
1518 endif
1519 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano455a7f32005-09-30 13:31:16 -07001520 endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001521endif
brian m. carlson79444c92019-02-12 00:52:06 +00001522ifdef ICONV_OMITS_BOM
1523 BASIC_CFLAGS += -DICONV_OMITS_BOM
1524endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001525ifdef NEEDS_LIBGEN
1526 EXTLIBS += -lgen
1527endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001528ifndef NO_GETTEXT
1529ifndef LIBC_CONTAINS_LIBINTL
1530 EXTLIBS += -lintl
1531endif
1532endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001533ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001534 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001535endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001536ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001537 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001538endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001539ifdef NEEDS_RESOLV
1540 EXTLIBS += -lresolv
1541endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001542ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001543 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001544endif
David Michael110d6982012-12-14 14:56:59 -05001545ifdef NO_GECOS_IN_PWENT
1546 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1547endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001548ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1549 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1550endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001551ifdef USE_NSEC
1552 BASIC_CFLAGS += -DUSE_NSEC
1553endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001554ifdef USE_ST_TIMESPEC
1555 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1556endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001557ifdef NO_NORETURN
1558 BASIC_CFLAGS += -DNO_NORETURN
1559endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001560ifdef NO_NSEC
1561 BASIC_CFLAGS += -DNO_NSEC
1562endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001563ifdef SNPRINTF_RETURNS_BOGUS
1564 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1565 COMPAT_OBJS += compat/snprintf.o
1566endif
Brandon Caseycba22522008-02-08 20:32:47 -06001567ifdef FREAD_READS_DIRECTORIES
1568 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1569 COMPAT_OBJS += compat/fopen.o
1570endif
Jeff King2b081012021-02-26 01:14:35 -05001571ifdef OPEN_RETURNS_EINTR
1572 COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR
1573 COMPAT_OBJS += compat/open.o
1574endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001575ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001576 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001577endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001578ifdef NO_GETTEXT
1579 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001580 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001581endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001582ifdef NO_POLL
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001583 NO_POLL_H = YesPlease
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001584 NO_SYS_POLL_H = YesPlease
1585 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1586 COMPAT_OBJS += compat/poll/poll.o
1587endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001588ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001589 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001590 COMPAT_OBJS += compat/strcasestr.o
1591endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001592ifdef NO_STRLCPY
1593 COMPAT_CFLAGS += -DNO_STRLCPY
1594 COMPAT_OBJS += compat/strlcpy.o
1595endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001596ifdef NO_STRTOUMAX
1597 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001598 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001599endif
1600ifdef NO_STRTOULL
1601 COMPAT_CFLAGS += -DNO_STRTOULL
1602endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001603ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001604 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001605 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001606endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001607ifdef NO_MKDTEMP
1608 COMPAT_CFLAGS += -DNO_MKDTEMP
1609 COMPAT_OBJS += compat/mkdtemp.o
1610endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001611ifdef MKDIR_WO_TRAILING_SLASH
1612 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1613 COMPAT_OBJS += compat/mkdir.o
1614endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001615ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001616 COMPAT_CFLAGS += -DNO_UNSETENV
1617 COMPAT_OBJS += compat/unsetenv.o
1618endif
Robert Schiele26009732008-01-24 19:34:46 +01001619ifdef NO_SYS_SELECT_H
1620 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1621endif
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001622ifdef NO_POLL_H
1623 BASIC_CFLAGS += -DNO_POLL_H
1624endif
Markus Duft28449232010-10-27 10:39:52 +02001625ifdef NO_SYS_POLL_H
1626 BASIC_CFLAGS += -DNO_SYS_POLL_H
1627endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001628ifdef NEEDS_SYS_PARAM_H
1629 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001630endif
Markus Duft28449232010-10-27 10:39:52 +02001631ifdef NO_INTTYPES_H
1632 BASIC_CFLAGS += -DNO_INTTYPES_H
1633endif
1634ifdef NO_INITGROUPS
1635 BASIC_CFLAGS += -DNO_INITGROUPS
1636endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001637ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001638 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001639 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001640else
1641 ifdef USE_WIN32_MMAP
1642 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1643 COMPAT_OBJS += compat/win32mmap.o
1644 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001645endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001646ifdef MMAP_PREVENTS_DELETE
1647 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1648endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001649ifdef OBJECT_CREATION_USES_RENAMES
1650 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001651endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001652ifdef NO_STRUCT_ITIMERVAL
1653 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001654 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001655endif
1656ifdef NO_SETITIMER
1657 COMPAT_CFLAGS += -DNO_SETITIMER
1658endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001659ifdef NO_PREAD
1660 COMPAT_CFLAGS += -DNO_PREAD
1661 COMPAT_OBJS += compat/pread.o
1662endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001663ifdef NO_FAST_WORKING_DIRECTORY
1664 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1665endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001666ifdef NO_TRUSTABLE_FILEMODE
1667 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1668endif
David Michaeld543d9c2014-12-03 21:24:17 -05001669ifdef NEEDS_MODE_TRANSLATION
1670 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1671 COMPAT_OBJS += compat/stat.o
1672endif
hpa49744d62005-09-28 16:52:21 -07001673ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001674 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001675endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001676ifdef NO_INTPTR_T
1677 COMPAT_CFLAGS += -DNO_INTPTR_T
1678endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001679ifdef NO_UINTMAX_T
1680 BASIC_CFLAGS += -Duintmax_t=uint32_t
1681endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001682ifdef NO_SOCKADDR_STORAGE
1683ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001684 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001685else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001686 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001687endif
hpa49744d62005-09-28 16:52:21 -07001688endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001689ifdef NO_INET_NTOP
1690 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001691 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001692endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001693ifdef NO_INET_PTON
1694 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001695 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001696endif
Jeff Hostetleree4512e2019-02-22 14:25:01 -08001697ifdef NO_UNIX_SOCKETS
1698 BASIC_CFLAGS += -DNO_UNIX_SOCKETS
1699else
Johannes Sixt63203582011-12-12 22:12:56 +01001700 LIB_OBJS += unix-socket.o
Jeff Hostetler9fd19022021-03-15 21:08:27 +00001701 LIB_OBJS += unix-stream-server.o
Jeff Hostetler6aac70a2021-05-20 18:28:10 +00001702endif
1703
1704# Simple IPC requires threads and platform-specific IPC support.
1705# Only platforms that have both should include these source files
1706# in the build.
1707#
1708# On Windows-based systems, Simple IPC requires threads and Windows
1709# Named Pipes. These are always available, so Simple IPC support
1710# is optional.
1711#
1712# On Unix-based systems, Simple IPC requires pthreads and Unix
1713# domain sockets. So support is only enabled when both are present.
1714#
1715ifdef USE_WIN32_IPC
1716 BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
1717 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1718 LIB_OBJS += compat/simple-ipc/ipc-win32.o
1719else
1720ifndef NO_PTHREADS
1721ifndef NO_UNIX_SOCKETS
1722 BASIC_CFLAGS += -DSUPPORTS_SIMPLE_IPC
Jeff Hostetler7cd5dbc2021-03-22 10:29:47 +00001723 LIB_OBJS += compat/simple-ipc/ipc-shared.o
1724 LIB_OBJS += compat/simple-ipc/ipc-unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001725endif
Jeff Hostetler6aac70a2021-05-20 18:28:10 +00001726endif
Johannes Sixt63203582011-12-12 22:12:56 +01001727endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001728
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001729ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001730 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001731endif
1732
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001733ifdef OLD_ICONV
1734 BASIC_CFLAGS += -DOLD_ICONV
1735endif
1736
David Symonds609a2282007-11-07 14:24:28 +11001737ifdef NO_DEFLATE_BOUND
1738 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1739endif
1740
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001741ifdef NO_POSIX_GOODIES
1742 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1743endif
1744
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001745ifdef APPLE_COMMON_CRYPTO
1746 # Apple CommonCrypto requires chunking
1747 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1748endif
1749
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001750ifdef OPENSSL_SHA1
1751 EXTLIBS += $(LIB_4_CRYPTO)
1752 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001753else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001754ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001755 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001756 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001757else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001758ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001759 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001760 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001761else
David Aguilar61067952013-05-19 06:23:35 -04001762ifdef APPLE_COMMON_CRYPTO
1763 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001764 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001765else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001766 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001767 BASIC_CFLAGS += -DSHA1_DC
1768 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001769ifdef DC_SHA1_EXTERNAL
1770 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001771 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001772$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001773 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001774 endif
1775 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1776 EXTLIBS += -lsha1detectcoll
1777else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001778ifdef DC_SHA1_SUBMODULE
1779 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1780 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1781 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1782else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001783 LIB_OBJS += sha1dc/sha1.o
1784 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001785endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001786 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001787 -DSHA1DC_NO_STANDARD_INCLUDES \
1788 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1789 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001790 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001791endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001792endif
1793endif
David Aguilar61067952013-05-19 06:23:35 -04001794endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001795endif
David Aguilar61067952013-05-19 06:23:35 -04001796
brian m. carlson4b4e2912018-11-14 04:09:38 +00001797ifdef OPENSSL_SHA256
1798 EXTLIBS += $(LIB_4_CRYPTO)
1799 BASIC_CFLAGS += -DSHA256_OPENSSL
1800else
brian m. carlson27dc04c2018-11-14 04:09:37 +00001801ifdef GCRYPT_SHA256
1802 BASIC_CFLAGS += -DSHA256_GCRYPT
1803 EXTLIBS += -lgcrypt
1804else
1805 LIB_OBJS += sha256/block/sha256.o
1806 BASIC_CFLAGS += -DSHA256_BLK
1807endif
brian m. carlson4b4e2912018-11-14 04:09:38 +00001808endif
brian m. carlson13eeedb2018-11-14 04:09:36 +00001809
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001810ifdef SHA1_MAX_BLOCK_SIZE
1811 LIB_OBJS += compat/sha1-chunked.o
1812 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1813endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001814ifdef NO_HSTRERROR
1815 COMPAT_CFLAGS += -DNO_HSTRERROR
1816 COMPAT_OBJS += compat/hstrerror.o
1817endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001818ifdef NO_MEMMEM
1819 COMPAT_CFLAGS += -DNO_MEMMEM
1820 COMPAT_OBJS += compat/memmem.o
1821endif
Matt Kraai40036be2012-12-18 14:03:55 -08001822ifdef NO_GETPAGESIZE
1823 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1824endif
Brian Downing43fe9012008-02-05 15:10:44 -06001825ifdef INTERNAL_QSORT
1826 COMPAT_CFLAGS += -DINTERNAL_QSORT
Brian Downing43fe9012008-02-05 15:10:44 -06001827endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001828ifdef HAVE_ISO_QSORT_S
1829 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1830else
1831 COMPAT_OBJS += compat/qsort_s.o
1832endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001833ifdef RUNTIME_PREFIX
1834 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1835endif
Alex Riesenb7774342007-03-07 00:44:49 +01001836
Junio C Hamano46059cc2008-11-15 04:08:14 -08001837ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001838 BASIC_CFLAGS += -DNO_PTHREADS
1839else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001840 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001841 EXTLIBS += $(PTHREAD_LIBS)
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001842endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001843
Chris Webbcb6a22c2010-04-13 10:07:13 +01001844ifdef HAVE_PATHS_H
1845 BASIC_CFLAGS += -DHAVE_PATHS_H
1846endif
1847
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001848ifdef HAVE_LIBCHARSET_H
1849 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001850 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001851endif
1852
David Michaelb3e103d2012-12-14 14:57:01 -05001853ifdef HAVE_STRINGS_H
1854 BASIC_CFLAGS += -DHAVE_STRINGS_H
1855endif
1856
Jeff King21aeafc2011-12-10 05:41:01 -05001857ifdef HAVE_DEV_TTY
1858 BASIC_CFLAGS += -DHAVE_DEV_TTY
1859endif
1860
Alex Riesen81a24b52008-03-05 00:15:39 +01001861ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1862 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1863endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001864ifdef UNRELIABLE_FSTAT
1865 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1866endif
Jeff King02232ad2009-06-16 15:07:40 -04001867ifdef NO_REGEX
1868 COMPAT_CFLAGS += -Icompat/regex
1869 COMPAT_OBJS += compat/regex/regex.o
1870endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001871ifdef NATIVE_CRLF
1872 BASIC_CFLAGS += -DNATIVE_CRLF
1873endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001874
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001875ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001876 COMPAT_CFLAGS += -Icompat/nedmalloc
1877 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1878 OVERRIDE_STRDUP = YesPlease
1879endif
1880
1881ifdef OVERRIDE_STRDUP
1882 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1883 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001884endif
1885
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001886ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1887 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1888endif
1889
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001890ifndef NO_MSGFMT_EXTENDED_OPTIONS
Ævar Arnfjörð Bjarmason2f12b312021-12-17 01:10:00 +01001891 MSGFMT += --check
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001892endif
1893
Karsten Blees148d6772014-07-12 02:05:42 +02001894ifdef HAVE_CLOCK_GETTIME
1895 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001896endif
1897
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001898ifdef HAVE_CLOCK_MONOTONIC
1899 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1900endif
1901
Neeraj Singhabf38ab2022-03-10 22:43:20 +00001902ifdef HAVE_SYNC_FILE_RANGE
1903 BASIC_CFLAGS += -DHAVE_SYNC_FILE_RANGE
1904endif
1905
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001906ifdef NEEDS_LIBRT
1907 EXTLIBS += -lrt
1908endif
1909
Kyle J. McKay95290802015-03-07 23:14:36 -08001910ifdef HAVE_BSD_SYSCTL
1911 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1912endif
1913
Dan Jacques226c0dd2018-04-10 11:05:44 -04001914ifdef HAVE_BSD_KERN_PROC_SYSCTL
1915 BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
1916endif
1917
Jeff King0cc30e02015-04-16 05:01:38 -04001918ifdef HAVE_GETDELIM
1919 BASIC_CFLAGS += -DHAVE_GETDELIM
1920endif
1921
brian m. carlson05cd9882022-01-17 21:56:16 +00001922ifneq ($(findstring arc4random,$(CSPRNG_METHOD)),)
1923 BASIC_CFLAGS += -DHAVE_ARC4RANDOM
1924endif
1925
1926ifneq ($(findstring libbsd,$(CSPRNG_METHOD)),)
1927 BASIC_CFLAGS += -DHAVE_ARC4RANDOM_LIBBSD
1928 EXTLIBS += -lbsd
1929endif
1930
1931ifneq ($(findstring getrandom,$(CSPRNG_METHOD)),)
1932 BASIC_CFLAGS += -DHAVE_GETRANDOM
1933endif
1934
1935ifneq ($(findstring getentropy,$(CSPRNG_METHOD)),)
1936 BASIC_CFLAGS += -DHAVE_GETENTROPY
1937endif
1938
1939ifneq ($(findstring rtlgenrandom,$(CSPRNG_METHOD)),)
1940 BASIC_CFLAGS += -DHAVE_RTLGENRANDOM
1941endif
1942
1943ifneq ($(findstring openssl,$(CSPRNG_METHOD)),)
1944 BASIC_CFLAGS += -DHAVE_OPENSSL_CSPRNG
1945endif
1946
Dan Jacques226c0dd2018-04-10 11:05:44 -04001947ifneq ($(PROCFS_EXECUTABLE_PATH),)
1948 procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
1949 BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
1950endif
1951
Emily Shafferb7e6a412021-07-21 18:27:06 -07001952ifndef HAVE_PLATFORM_PROCINFO
1953 COMPAT_OBJS += compat/stub/procinfo.o
1954endif
1955
Dan Jacques226c0dd2018-04-10 11:05:44 -04001956ifdef HAVE_NS_GET_EXECUTABLE_PATH
1957 BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
1958endif
1959
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -04001960ifdef HAVE_WPGMPTR
1961 BASIC_CFLAGS += -DHAVE_WPGMPTR
1962endif
1963
Duy Nguyen18a4f6b2019-02-12 21:14:41 +07001964ifdef FILENO_IS_A_MACRO
1965 COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
1966 COMPAT_OBJS += compat/fileno.o
1967endif
1968
Clément Chigot400caaf2019-04-25 07:01:56 +00001969ifdef NEED_ACCESS_ROOT_HANDLER
1970 COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
1971 COMPAT_OBJS += compat/access.o
1972endif
1973
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001974ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001975NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001976endif
1977
Jeff King499c2932009-04-03 15:32:20 -04001978ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001979NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001980endif
1981
Johan Herlandd4e1b472009-11-18 02:42:31 +01001982ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001983NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001984endif
1985
Eric Wong995bc222016-08-04 11:40:25 +00001986ifndef PAGER_ENV
1987PAGER_ENV = LESS=FRX LV=-c
1988endif
1989
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001990QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001991QUIET_SUBDIR1 =
1992
John Keepingef49e052015-09-05 13:22:10 +01001993ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001994PRINT_DIR = --no-print-directory
1995else # "make -w"
1996NO_SUBDIR = :
1997endif
1998
John Keepingef49e052015-09-05 13:22:10 +01001999ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05002000ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01002001 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002002 QUIET_AR = @echo ' ' AR $@;
2003 QUIET_LINK = @echo ' ' LINK $@;
2004 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
2005 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07002006 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002007 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002008 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002009 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002010 QUIET_SP = @echo ' ' SP $<;
Denton Liub503a2d2019-09-25 01:21:01 -07002011 QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002012 QUIET_RC = @echo ' ' RC $@;
Denton Liu4f3c1dc2019-10-09 13:43:46 -07002013 QUIET_SPATCH = @echo ' ' SPATCH $<;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02002014 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01002015 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
2016 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05002017 export V
Alex Riesen31d03992007-03-06 23:37:18 +01002018 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01002019 export QUIET_BUILT_IN
2020endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002021endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04002022
Junio C Hamano70de5e62012-05-02 15:12:10 -07002023ifdef NO_INSTALL_HARDLINKS
2024 export NO_INSTALL_HARDLINKS
2025endif
2026
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002027### profile feedback build
2028#
2029
2030# Can adjust this to be a global directory if you want to do extended
2031# data gathering
2032PROFILE_DIR := $(CURDIR)
2033
Johannes Sixte60ec752012-02-09 09:22:26 +01002034ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07002035 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002036 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01002037 export CCACHE_DISABLE = t
2038 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01002039else
2040ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07002041 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01002042 export CCACHE_DISABLE = t
2043 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002044endif
Johannes Sixte60ec752012-02-09 09:22:26 +01002045endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002046
Pavel Roskinaddf88e2006-07-09 03:44:30 -04002047# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002048
Johannes Schindelin32043c92007-02-14 12:48:14 +01002049ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02002050ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002051
2052DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002053NO_GETTEXT_SQ = $(subst ','\'',$(NO_GETTEXT))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002054bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002055bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002056mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00002057mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
2058infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002059perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002060localedir_SQ = $(subst ','\'',$(localedir))
Dan Jacques07d90ea2018-04-10 11:05:43 -04002061localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002062gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +00002063gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002064template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00002065htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002066prefix_SQ = $(subst ','\'',$(prefix))
Dan Jacques07d90ea2018-04-10 11:05:43 -04002067perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05302068gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002069
2070SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05002071TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002072PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01002073PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07002074TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002075DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08002076PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002077
Dan Jacques07d90ea2018-04-10 11:05:43 -04002078# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
2079# relative to each other and share an installation path.
2080#
2081# This is a dependency in:
2082# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
2083# - The runtime prefix Perl header (see
2084# "perl/header_templates/runtime_prefix.template.pl").
2085ifdef RUNTIME_PREFIX
2086
2087ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
2088$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
2089endif
2090
2091ifneq ($(filter /%,$(firstword $(localedir_relative))),)
2092$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
2093endif
2094
2095ifndef NO_PERL
2096ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
2097$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
2098endif
2099endif
2100
2101endif
2102
Jeff King3f2e2292016-07-01 01:58:58 -04002103# We must filter out any object files from $(GITLIBS),
2104# as it is typically used like:
2105#
2106# foo: foo.o $(GITLIBS)
2107# $(CC) $(filter %.o,$^) $(LIBS)
2108#
2109# where we use it as a dependency. Since we also pull object files
2110# from the dependency list, that would make each entry appear twice.
2111LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07002112
brian m. carlsonf18f8162017-03-11 22:28:18 +00002113BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08002114LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02002115
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05002116# Quote for C
2117
2118ifdef DEFAULT_EDITOR
2119DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
2120DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
2121
2122BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
2123endif
2124
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05002125ifdef DEFAULT_PAGER
2126DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
2127DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
2128
2129BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
2130endif
2131
Ben Waltonb3e34dd2012-03-30 21:33:21 -04002132ifdef SHELL_PATH
2133SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
2134SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
2135
2136BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
2137endif
2138
Jeff King42dcbb72012-06-02 15:01:12 -04002139GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
2140GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
2141GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04002142GIT-USER-AGENT: FORCE
2143 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04002144 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
2145 fi
Jeff King42dcbb72012-06-02 15:01:12 -04002146
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00002147ifdef DEFAULT_HELP_FORMAT
2148BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
2149endif
2150
Petr Baudis8d7f5862006-06-25 03:47:03 +02002151ALL_CFLAGS += $(BASIC_CFLAGS)
2152ALL_LDFLAGS += $(BASIC_LDFLAGS)
2153
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00002154export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07002155
2156
Petr Baudis28818ff2005-07-29 17:50:24 +02002157### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07002158
Brandon Caseyc94c8e52008-08-07 14:03:42 -05002159SHELL = $(SHELL_PATH)
2160
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002161all:: shell_compatibility_test
2162
2163ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07002164all:: profile
2165endif
2166
2167profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002168 $(MAKE) PROFILE=GEN all
2169 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04002170 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
2171 $(MAKE) PROFILE=GEN -j1 perf; \
2172 else \
2173 echo "Skipping profile of perf tests..."; \
2174 fi
Andi Kleen066dd262014-07-07 23:35:11 -07002175 $(MAKE) PROFILE=USE all
2176
2177profile-fast: profile-clean
2178 $(MAKE) PROFILE=GEN all
2179 $(MAKE) PROFILE=GEN -j1 perf
2180 $(MAKE) PROFILE=USE all
2181
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002182
Johannes Schindelin179227d2020-09-21 22:28:16 +00002183all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002184ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00002185 $(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 -08002186endif
Petr Baudis28818ff2005-07-29 17:50:24 +02002187
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002188all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002189ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07002190 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08002191 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002192endif
Ben Walton502be952010-03-20 10:48:08 -04002193 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04002194
Brandon Casey6dc46272008-08-07 14:06:26 -05002195please_set_SHELL_PATH_to_a_more_modern_shell:
2196 @$$(:)
2197
2198shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
2199
Junio C Hamano4dc00022006-01-12 21:42:25 -08002200strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05002201 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08002202
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002203### Flags affecting all rules
2204
2205# A GNU make extension since gmake 3.72 (released in late 1994) to
2206# remove the target of rules if commands in those rules fail. The
2207# default is to only do that if make itself receives a signal. Affects
2208# all targets, see:
2209#
2210# info make --index-search=.DELETE_ON_ERROR
2211.DELETE_ON_ERROR:
2212
Jonathan Nieder7b63c772012-07-06 23:19:09 -05002213### Target-specific flags and dependencies
2214
2215# The generic compilation pattern rule and automatically
2216# computed header dependencies (falling back to a dependency on
2217# LIB_H) are enough to describe how most targets should be built,
2218# but some targets are special enough to need something a little
2219# different.
2220#
2221# - When a source file "foo.c" #includes a generated header file,
2222# we need to list that dependency for the "foo.o" target.
2223#
2224# We also list it from other targets that are built from foo.c
2225# like "foo.sp" and "foo.s", even though that is easy to forget
2226# to do because the generated header is already present around
2227# after a regular build attempt.
2228#
2229# - Some code depends on configuration kept in makefile
2230# variables. The target-specific variable EXTRA_CPPFLAGS can
2231# be used to convey that information to the C preprocessor
2232# using -D options.
2233#
2234# The "foo.o" target should have a corresponding dependency on
2235# a file that changes when the value of the makefile variable
2236# changes. For example, targets making use of the
2237# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
2238#
2239# Technically the ".sp" and ".s" targets do not need this
2240# dependency because they are force-built, but they get the
2241# same dependency for consistency. This way, you do not have to
2242# know how each target is implemented. And it means the
2243# dependencies here will not need to change if the force-build
2244# details change some day.
2245
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002246git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04002247git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002248 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2249 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2250 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07002251
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002252git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04002253 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2254 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07002255
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002256help.sp help.s help.o: command-list.h
Ævar Arnfjörð Bjarmasond3fd1a62021-12-17 01:13:01 +01002257builtin/bugreport.sp builtin/bugreport.s builtin/bugreport.o: hook-list.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01002258
Ævar Arnfjörð Bjarmasond3fd1a62021-12-17 01:13:01 +01002259builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002260builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002261 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2262 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2263 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07002264
Ævar Arnfjörð Bjarmason451a7db2021-12-17 01:19:15 +01002265PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
2266PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
2267PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
2268pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
2269 -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
2270
Jeff King520a6cd2012-06-20 14:32:22 -04002271version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04002272version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04002273 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01002274 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
Johannes Schindelin5cf8e062018-06-27 21:35:23 +02002275 '-DGIT_BUILT_FROM_COMMIT="$(shell \
2276 GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2277 git rev-parse -q --verify HEAD 2>/dev/null)"'
Jeff King816fb462012-06-02 14:51:42 -04002278
Junio C Hamano91730802006-04-10 17:37:58 -07002279$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02002280 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002281 ln $< $@ 2>/dev/null || \
2282 ln -s $< $@ 2>/dev/null || \
2283 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07002284
Emily Shaffer709df952020-04-16 14:18:03 -07002285config-list.h: generate-configlist.sh
2286
SZEDER Gábor56550ea2021-04-08 23:29:15 +02002287config-list.h: Documentation/*config.txt Documentation/config/*.txt
Ævar Arnfjörð Bjarmason7c812952021-09-23 12:29:58 +02002288 $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
Emily Shaffer709df952020-04-16 14:18:03 -07002289
Nguyễn Thái Ngọc Duyf318d732018-05-10 10:46:41 +02002290command-list.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07002291
SZEDER Gábor56550ea2021-04-08 23:29:15 +02002292command-list.h: $(wildcard Documentation/git*.txt)
Johannes Schindelin724d6352019-04-18 06:16:40 -07002293 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
2294 $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
Ævar Arnfjörð Bjarmason7c812952021-09-23 12:29:58 +02002295 command-list.txt >$@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002296
Ævar Arnfjörð Bjarmasoncfe853e2021-09-26 21:03:29 +02002297hook-list.h: generate-hooklist.sh Documentation/githooks.txt
2298 $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002299
Ævar Arnfjörð Bjarmasonab772942021-10-21 21:57:56 +02002300SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
Ævar Arnfjörð Bjarmasonc7c96922021-10-21 21:57:57 +02002301 $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmasonebeb39f2021-10-21 21:58:00 +02002302 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(PAGER_ENV):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002303 $(perllibdir_SQ)
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002304GIT-SCRIPT-DEFINES: FORCE
2305 @FLAGS='$(SCRIPT_DEFINES)'; \
2306 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002307 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002308 echo "$$FLAGS" >$@; \
2309 fi
2310
Jonathan Nieder46bac902010-01-31 11:46:53 -08002311define cmd_munge_script
Jonathan Nieder46bac902010-01-31 11:46:53 -08002312sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2313 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002314 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002315 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08002316 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002317 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04002318 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
2319 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00002320 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002321 $@.sh >$@+
2322endef
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002323
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002324$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002325 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002326 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002327 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002328
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002329$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002330 $(QUIET_GEN)$(cmd_munge_script) && \
2331 mv $@+ $@
2332
Johannes Schindelinadb59de2018-11-06 06:55:50 -08002333git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002334 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01002335 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
2336 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06002337 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002338
Jeff Kinge204b002014-11-18 12:43:09 -05002339# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002340$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05002341
Dan Jacques07d90ea2018-04-10 11:05:43 -04002342# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
2343# since the locale directory is injected.
2344perl_localedir_SQ = $(localedir_SQ)
Alex Riesenf8487182006-12-04 10:50:04 +01002345
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002346ifndef NO_PERL
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002347PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
Ævar Arnfjörð Bjarmason8c557532021-05-12 11:49:44 +02002348PERL_DEFINES =
Ævar Arnfjörð Bjarmason4070c9e2021-05-05 14:21:38 +02002349PERL_DEFINES += $(PERL_PATH_SQ)
2350PERL_DEFINES += $(PERLLIB_EXTRA_SQ)
2351PERL_DEFINES += $(perllibdir_SQ)
Dan Jacques07d90ea2018-04-10 11:05:43 -04002352PERL_DEFINES += $(RUNTIME_PREFIX)
Ævar Arnfjörð Bjarmason368a50d2021-05-05 14:21:40 +02002353PERL_DEFINES += $(NO_PERL_CPAN_FALLBACKS)
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002354PERL_DEFINES += $(NO_GETTEXT)
Dan Jacques07d90ea2018-04-10 11:05:43 -04002355
2356# Support Perl runtime prefix. In this mode, a different header is installed
2357# into Perl scripts.
2358ifdef RUNTIME_PREFIX
2359
2360PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
2361
2362# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
2363# at runtime.
2364perl_localedir_SQ =
2365
2366endif
2367
2368PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
2369
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002370$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002371 $(QUIET_GEN) \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002372 sed -e '1{' \
2373 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Alejandro R. Sedeño66000542018-06-25 15:13:25 -04002374 -e ' r GIT-PERL-HEADER' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002375 -e ' G' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002376 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07002377 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002378 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002379 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002380 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002381
Dan Jacques07d90ea2018-04-10 11:05:43 -04002382PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002383GIT-PERL-DEFINES: FORCE
2384 @FLAGS='$(PERL_DEFINES)'; \
2385 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2386 echo >&2 " * new perl-specific parameters"; \
2387 echo "$$FLAGS" >$@; \
2388 fi
2389
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002390GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002391 $(QUIET_GEN) \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002392 INSTLIBDIR='$(perllibdir_SQ)' && \
2393 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
2394 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
2395 sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
Jonathan Nieder64f982b2018-04-23 16:25:35 -07002396 -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002397 -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
2398 -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
2399 -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002400 $< >$@+ && \
2401 mv $@+ $@
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002402
Christian Hessed8698982018-04-19 06:44:40 +09002403.PHONY: perllibdir
Christian Hessecfb3a472018-04-10 15:36:41 +02002404perllibdir:
2405 @echo '$(perllibdir_SQ)'
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002406
2407.PHONY: gitweb
2408gitweb:
2409 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2410
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002411git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002412 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002413 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002414 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002415else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002416$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002417 $(QUIET_GEN) \
Jeff King499c2932009-04-03 15:32:20 -04002418 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2419 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2420 unimplemented.sh >$@+ && \
2421 chmod +x $@+ && \
2422 mv $@+ $@
2423endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002424
Jonathan Niederca2051d2014-11-18 10:43:47 -08002425# This makes sure we depend on the NO_PYTHON setting itself.
2426$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2427
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002428ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002429$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2430$(SCRIPT_PYTHON_GEN): % : %.py
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002431 $(QUIET_GEN) \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002432 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002433 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002434 chmod +x $@+ && \
2435 mv $@+ $@
2436else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002437$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002438 $(QUIET_GEN) \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002439 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2440 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2441 unimplemented.sh >$@+ && \
2442 chmod +x $@+ && \
2443 mv $@+ $@
2444endif # NO_PYTHON
2445
Ævar Arnfjörð Bjarmason7b76d6b2021-06-29 10:44:50 +02002446CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Jeff King7f1b6972013-02-21 01:26:14 -05002447 configure.ac >configure.ac+ && \
2448 autoconf -o configure configure.ac+ && \
2449 $(RM) configure.ac+
2450
Jeff King520a6cd2012-06-20 14:32:22 -04002451configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002452 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002453
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002454ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002455# We avoid depending on 'configure' here, because it gets rebuilt
2456# every time GIT-VERSION-FILE is modified, only to update the embedded
2457# version number string, which config.status does not care about. We
2458# do want to recheck when the platform/environment detection logic
2459# changes, hence this depends on configure.ac.
2460config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002461 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002462 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002463 ./config.status --recheck; \
2464 else \
2465 ./configure; \
2466 fi
2467reconfigure config.mak.autogen: config.status
2468 $(QUIET_GEN)./config.status
2469.PHONY: reconfigure # This is a convenience target.
2470endif
2471
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002472XDIFF_OBJS += xdiff/xdiffi.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002473XDIFF_OBJS += xdiff/xemit.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002474XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002475XDIFF_OBJS += xdiff/xmerge.o
2476XDIFF_OBJS += xdiff/xpatience.o
Denton Liu805d9ea2020-03-21 05:21:20 -04002477XDIFF_OBJS += xdiff/xprepare.o
2478XDIFF_OBJS += xdiff/xutils.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002479.PHONY: xdiff-objs
2480xdiff-objs: $(XDIFF_OBJS)
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002481
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002482REFTABLE_OBJS += reftable/basics.o
2483REFTABLE_OBJS += reftable/error.o
Han-Wen Nienhuyse581fd72021-10-07 20:25:04 +00002484REFTABLE_OBJS += reftable/block.o
Han-Wen Nienhuys1214aa82021-10-07 20:25:01 +00002485REFTABLE_OBJS += reftable/blocksource.o
Han-Wen Nienhuys46bc0e72021-10-07 20:25:08 +00002486REFTABLE_OBJS += reftable/iter.o
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002487REFTABLE_OBJS += reftable/publicbasics.o
Han-Wen Nienhuys1ae2b8c2021-10-07 20:25:11 +00002488REFTABLE_OBJS += reftable/merged.o
Han-Wen Nienhuys3b34f632021-10-07 20:25:10 +00002489REFTABLE_OBJS += reftable/pq.o
Han-Wen Nienhuys46bc0e72021-10-07 20:25:08 +00002490REFTABLE_OBJS += reftable/reader.o
Han-Wen Nienhuyse303bf22021-10-07 20:25:02 +00002491REFTABLE_OBJS += reftable/record.o
Han-Wen Nienhuys17df8db2021-10-07 20:25:07 +00002492REFTABLE_OBJS += reftable/refname.o
2493REFTABLE_OBJS += reftable/generic.o
2494REFTABLE_OBJS += reftable/stack.o
Han-Wen Nienhuys35425d12021-10-07 20:25:05 +00002495REFTABLE_OBJS += reftable/tree.o
Han-Wen Nienhuysf14bd712021-10-07 20:25:06 +00002496REFTABLE_OBJS += reftable/writer.o
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002497
Han-Wen Nienhuys35425d12021-10-07 20:25:05 +00002498REFTABLE_TEST_OBJS += reftable/basics_test.o
Han-Wen Nienhuyse581fd72021-10-07 20:25:04 +00002499REFTABLE_TEST_OBJS += reftable/block_test.o
Han-Wen Nienhuysd860c862021-10-07 20:25:15 +00002500REFTABLE_TEST_OBJS += reftable/dump.o
Han-Wen Nienhuys1ae2b8c2021-10-07 20:25:11 +00002501REFTABLE_TEST_OBJS += reftable/merged_test.o
Han-Wen Nienhuys3b34f632021-10-07 20:25:10 +00002502REFTABLE_TEST_OBJS += reftable/pq_test.o
Han-Wen Nienhuyse303bf22021-10-07 20:25:02 +00002503REFTABLE_TEST_OBJS += reftable/record_test.o
Han-Wen Nienhuysffc97f12021-10-07 20:25:09 +00002504REFTABLE_TEST_OBJS += reftable/readwrite_test.o
Han-Wen Nienhuysacb53342021-10-07 20:25:12 +00002505REFTABLE_TEST_OBJS += reftable/refname_test.o
Han-Wen Nienhuyse48d4272021-10-07 20:25:13 +00002506REFTABLE_TEST_OBJS += reftable/stack_test.o
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002507REFTABLE_TEST_OBJS += reftable/test_framework.o
Han-Wen Nienhuys35425d12021-10-07 20:25:05 +00002508REFTABLE_TEST_OBJS += reftable/tree_test.o
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002509
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002510TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002511
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002512.PHONY: test-objs
2513test-objs: $(TEST_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002514
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002515GIT_OBJS += $(LIB_OBJS)
2516GIT_OBJS += $(BUILTIN_OBJS)
2517GIT_OBJS += common-main.o
2518GIT_OBJS += git.o
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002519.PHONY: git-objs
2520git-objs: $(GIT_OBJS)
Ævar Arnfjörð Bjarmasonabc3c872021-02-23 12:41:30 +01002521
2522OBJECTS += $(GIT_OBJS)
Ævar Arnfjörð Bjarmason752b3ef2021-02-23 12:41:28 +01002523OBJECTS += $(PROGRAM_OBJS)
2524OBJECTS += $(TEST_OBJS)
2525OBJECTS += $(XDIFF_OBJS)
2526OBJECTS += $(FUZZ_OBJS)
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002527OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
2528
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002529ifndef NO_CURL
2530 OBJECTS += http.o http-walker.o remote-curl.o
2531endif
Johannes Schindelin0a43fb22021-12-03 13:34:16 +00002532
2533SCALAR_SOURCES := contrib/scalar/scalar.c
2534SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
2535OBJECTS += $(SCALAR_OBJECTS)
2536
Ævar Arnfjörð Bjarmason029bac02021-02-23 12:41:31 +01002537.PHONY: objects
2538objects: $(OBJECTS)
Jonathan Niederc3739912010-01-26 09:52:11 -06002539
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002540dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002541dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002542
Jonathan Nieder024c8432011-11-18 03:58:21 -06002543ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002544$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002545 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002546
2547missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002548dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002549dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002550endif
2551
Jonathan Nieder024c8432011-11-18 03:58:21 -06002552ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002553missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002554dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002555endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002556
Philippe Blain3821c382020-09-03 22:13:38 +00002557compdb_dir = compile_commands
2558
2559ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2560missing_compdb_dir = $(compdb_dir)
2561$(missing_compdb_dir):
2562 @mkdir -p $@
2563
2564compdb_file = $(compdb_dir)/$(subst /,-,$@.json)
2565compdb_args = -MJ $(compdb_file)
2566else
2567missing_compdb_dir =
2568compdb_args =
2569endif
2570
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002571ASM_SRC := $(wildcard $(OBJECTS:o=S))
2572ASM_OBJ := $(ASM_SRC:S=o)
2573C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002574
Jonathan Nieder30248882010-01-26 09:51:24 -06002575.SUFFIXES:
2576
Philippe Blain3821c382020-09-03 22:13:38 +00002577$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2578 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
2579$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
2580 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002581
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002582%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002583 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002584
2585ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2586# Take advantage of gcc's on-the-fly dependency generation
2587# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2588dep_files_present := $(wildcard $(dep_files))
2589ifneq ($(dep_files_present),)
2590include $(dep_files_present)
2591endif
2592else
Johannes Schindelin92b88eb2019-03-04 05:47:06 -08002593$(OBJECTS): $(LIB_H) $(GENERATED_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002594endif
Junio C Hamano7a590132005-08-06 13:10:43 -07002595
Philippe Blain3821c382020-09-03 22:13:38 +00002596ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
2597all:: compile_commands.json
2598compile_commands.json:
Philippe Blain3821c382020-09-03 22:13:38 +00002599 $(QUIET_GEN)sed -e '1s/^/[/' -e '$$s/,$$/]/' $(compdb_dir)/*.o.json > $@+
2600 @if test -s $@+; then mv $@+ $@; else $(RM) $@+; fi
2601endif
2602
Stefan Bellerd807c4a2018-04-10 14:26:18 -07002603exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
2604exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002605 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002606 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002607 '-DBINDIR="$(bindir_relative_SQ)"' \
Philip Oakley4d5b4c22018-04-21 13:18:42 +02002608 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002609
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002610builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002611builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002612 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002613
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002614config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002615config.sp config.s config.o: EXTRA_CPPFLAGS = \
2616 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002617
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002618attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002619attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2620 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002621
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002622gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002623gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002624 -DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002625
Ramsay Jones15caca22019-02-05 02:27:48 +00002626http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002627 -DCURL_DISABLE_TYPECHECK
2628
Ramsay Jones15caca22019-02-05 02:27:48 +00002629pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
Ramsay Jones54360a12018-02-12 00:21:02 +00002630
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002631ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002632http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002633endif
2634
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002635ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002636compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2637 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002638endif
2639
René Scharfed555ff52010-09-11 11:59:18 +02002640ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002641compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002642 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones15caca22019-02-05 02:27:48 +00002643compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002644endif
2645
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002646git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002647 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002648
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002649git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002650 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002651 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002652
John Keepingfd78ced2014-01-25 13:11:44 +00002653git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002654 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002655 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002656git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002657 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002658 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002659
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002660$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2661 $(QUIET_LNCP)$(RM) $@ && \
2662 ln $< $@ 2>/dev/null || \
2663 ln -s $< $@ 2>/dev/null || \
2664 cp $< $@
2665
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002666$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002667 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002668 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002669
Johannes Schindelin0a43fb22021-12-03 13:34:16 +00002670contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
2671 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2672 $(filter %.o,$^) $(LIBS)
2673
Petr Baudis28818ff2005-07-29 17:50:24 +02002674$(LIB_FILE): $(LIB_OBJS)
SZEDER Gábor325b06d2021-08-18 23:36:11 +02002675 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002676
Linus Torvalds34435462006-03-24 20:13:22 -08002677$(XDIFF_LIB): $(XDIFF_OBJS)
SZEDER Gábor325b06d2021-08-18 23:36:11 +02002678 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002679
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002680$(REFTABLE_LIB): $(REFTABLE_OBJS)
2681 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
2682
2683$(REFTABLE_TEST_LIB): $(REFTABLE_TEST_OBJS)
2684 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
2685
Jonathan Nieder5b586192012-03-31 03:44:53 -05002686export DEFAULT_EDITOR DEFAULT_PAGER
2687
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07002688Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
2689 @EXCLUDED='EXCLUDED_PROGRAMS := $(EXCLUDED_PROGRAMS)'; \
2690 if test x"$$EXCLUDED" != \
2691 x"`cat Documentation/GIT-EXCLUDED-PROGRAMS 2>/dev/null`" ; then \
2692 echo >&2 " * new documentation flags"; \
2693 echo "$$EXCLUDED" >Documentation/GIT-EXCLUDED-PROGRAMS; \
2694 fi
2695
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002696.PHONY: doc man man-perl html info pdf
2697doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002698 $(MAKE) -C Documentation all
2699
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002700man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002701 $(MAKE) -C Documentation man
2702
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002703man-perl: perl/build/man/man3/Git.3pm
2704
Michael J Gruber414851a2008-09-10 10:19:34 +02002705html:
2706 $(MAKE) -C Documentation html
2707
David Kastrup47398092007-08-06 12:22:57 +02002708info:
2709 $(MAKE) -C Documentation info
2710
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002711pdf:
2712 $(MAKE) -C Documentation pdf
2713
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002714XGETTEXT_FLAGS = \
2715 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002716 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002717 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2718 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002719XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2720 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002721XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2722 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002723XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002724 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002725LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002726LOCALIZED_SH = $(SCRIPT_SH)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002727LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002728LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002729
2730ifdef XGETTEXT_INCLUDE_TESTS
2731LOCALIZED_C += t/t0200/test.c
2732LOCALIZED_SH += t/t0200/test.sh
2733LOCALIZED_PERL += t/t0200/test.perl
2734endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002735
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002736## Note that this is meant to be run only by the localization coordinator
2737## under a very controlled condition, i.e. (1) it is to be run in a
2738## Git repository (not a tarball extract), (2) any local modifications
2739## will be lost.
2740## Gettext tools cannot work with our own custom PRItime type, so
2741## we replace PRItime with PRIuMAX. We need to update this to
2742## PRIdMAX if we switch to a signed type later.
2743
Jonathan Nieder1f319632014-08-22 00:32:08 -04002744po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002745 # All modifications will be reverted at the end, so we do not
2746 # want to have any local change.
2747 git diff --quiet HEAD && git diff --quiet --cached
2748
2749 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2750 do \
2751 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2752 cat "$$s+" >"$$s" && rm "$$s+"; \
2753 done
2754
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002755 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2756 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2757 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002758 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2759 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002760
2761 # Reverting the munged source, leaving only the updated $@
2762 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002763 mv $@+ $@
2764
Elia Pintoe6be2652015-12-15 15:21:00 +00002765.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002766pot: po/git.pot
2767
Johannes Schindelin43488242021-07-04 22:55:12 +00002768ifdef NO_GETTEXT
2769POFILES :=
2770MOFILES :=
2771else
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002772POFILES := $(wildcard po/*.po)
2773MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2774
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002775all:: $(MOFILES)
2776endif
2777
2778po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2779 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2780
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002781LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2782LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002783LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2784LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002785
2786ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002787all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002788ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002789all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002790endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002791NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002792endif
2793
Ævar Arnfjörð Bjarmason3d49f722021-05-05 14:21:39 +02002794perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002795 $(QUIET_GEN)mkdir -p $(dir $@) && \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002796 sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
Ævar Arnfjörð Bjarmason256c2dc2021-05-05 14:21:41 +02002797 -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002798 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2799 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002800
2801perl/build/man/man3/Git.3pm: perl/Git.pm
2802 $(QUIET_GEN)mkdir -p $(dir $@) && \
2803 pod2man $< $@
2804
Jeff Kinge951ebc2016-12-14 09:26:55 -05002805FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002806 git ls-files \
2807 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002808 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002809 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002810 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002811 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002812 $(FIND) . \
2813 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002814 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002815 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002816 -o \( -name build -type d -prune \) \
2817 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002818 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002819 -o \( -name '*.sh' -type f -print \) \
Denton Liu43f8c892019-09-16 12:23:14 -07002820 | sed -e 's|^\./||' \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002821 )
Junio C Hamano33533972011-10-18 00:26:18 -07002822
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002823FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002824
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002825$(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002826 $(QUIET_GEN)$(RM) $@+ && \
2827 echo $(FOUND_SOURCE_FILES) | xargs etags -a -o $@+ && \
2828 mv $@+ $@
Petr Baudis28818ff2005-07-29 17:50:24 +02002829
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002830tags: $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002831 $(QUIET_GEN)$(RM) $@+ && \
2832 echo $(FOUND_SOURCE_FILES) | xargs ctags -a -o $@+ && \
2833 mv $@+ $@
Petr Baudis28818ff2005-07-29 17:50:24 +02002834
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002835cscope.out: $(FOUND_SOURCE_FILES)
Ævar Arnfjörð Bjarmason89906242021-08-05 00:54:40 +02002836 $(QUIET_GEN)$(RM) $@+ && \
2837 echo $(FOUND_SOURCE_FILES) | xargs cscope -f$@+ -b && \
2838 mv $@+ $@
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02002839
2840.PHONY: cscope
2841cscope: cscope.out
Kristof Provosta2a91502007-10-06 16:24:42 +02002842
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002843### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002844TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2845 $(localedir_SQ)
2846
2847GIT-PREFIX: FORCE
2848 @FLAGS='$(TRACK_PREFIX)'; \
2849 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002850 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002851 echo "$$FLAGS" >GIT-PREFIX; \
2852 fi
2853
2854TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002855
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002856GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002857 @FLAGS='$(TRACK_CFLAGS)'; \
2858 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002859 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002860 echo "$$FLAGS" >GIT-CFLAGS; \
2861 fi
2862
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002863TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2864
2865GIT-LDFLAGS: FORCE
2866 @FLAGS='$(TRACK_LDFLAGS)'; \
2867 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002868 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002869 echo "$$FLAGS" >GIT-LDFLAGS; \
2870 fi
2871
Junio C Hamanobfce5082008-07-25 12:35:10 -07002872# We need to apply sq twice, once to protect from the shell
2873# that runs GIT-BUILD-OPTIONS, and then again to protect it
2874# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002875GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002876 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002877 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002878 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2879 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2880 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2881 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2882 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002883 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002884 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002885 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002886 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002887 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2888 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002889 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002890 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
Ævar Arnfjörð Bjarmason2cdc2922021-09-23 11:20:45 +02002891 @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
Johannes Schindelin8abfdf42018-11-14 08:32:11 -08002892 @echo X=\'$(X)\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002893ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002894 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002895endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002896ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002897 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002898endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002899ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002900 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002901endif
2902ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002903 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002904endif
Đoàn Trần Công Danh482c9622021-06-08 13:56:28 +07002905ifdef GIT_TEST_UTF8_LOCALE
2906 @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
2907endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002908 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002909ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002910 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002911endif
2912ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002913 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002914endif
2915ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002916 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002917endif
2918ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002919 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002920endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002921ifdef GIT_PERF_MAKE_COMMAND
2922 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2923endif
Jeff King3d893612017-02-25 04:37:07 -05002924ifdef GIT_INTEROP_MAKE_OPTS
2925 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2926endif
Ben Peart1f357b02018-09-18 23:29:36 +00002927ifdef GIT_TEST_INDEX_VERSION
2928 @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002929endif
Jeff King5338ed22020-10-21 23:24:00 -04002930ifdef GIT_TEST_PERL_FATAL_WARNINGS
2931 @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
2932endif
Johannes Schindelinb7d11a02021-07-24 22:06:49 +00002933ifdef RUNTIME_PREFIX
2934 @echo RUNTIME_PREFIX=\'true\' >>$@+
2935else
2936 @echo RUNTIME_PREFIX=\'false\' >>$@+
2937endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002938 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002939
Christian Couder96a46472012-12-18 16:26:38 +01002940### Detect Python interpreter path changes
2941ifndef NO_PYTHON
2942TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002943
Christian Couder96a46472012-12-18 16:26:38 +01002944GIT-PYTHON-VARS: FORCE
2945 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002946 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002947 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002948 echo "$$VARS" >$@; \
2949 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002950endif
2951
Matthew Ogilvieea925192009-12-02 22:14:05 -07002952test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2953
2954all:: $(TEST_PROGRAMS) $(test_bindir_programs)
2955
2956bin-wrappers/%: wrap-for-bin.sh
2957 @mkdir -p bin-wrappers
2958 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2959 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Johannes Schindelin3a94cb32019-07-29 13:08:16 -07002960 -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 -07002961 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002962
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002963# GNU make supports exporting all variables by "export" without parameters.
2964# However, the environment gets quite big, and some programs have problems
2965# with that.
2966
Johannes Schindelin140245b2006-07-07 13:26:31 +02002967export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002968export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002969
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002970### Testing rules
2971
Junio C Hamano96651ef2007-04-28 15:32:49 -07002972test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002973 $(MAKE) -C t/ all
2974
Thomas Rast342e9ef2012-02-17 11:25:09 +01002975perf: all
2976 $(MAKE) -C t/perf/ all
2977
2978.PHONY: test perf
2979
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002980.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002981
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002982t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2983
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00002984t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB)
David Barr1d73b522010-08-09 17:34:42 -05002985 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002986
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +01002987check-sha1:: t/helper/test-tool$X
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002988 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002989
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002990SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2991
Ævar Arnfjörð Bjarmason8a7a90b2021-10-21 22:00:14 +02002992$(SP_OBJ): %.sp: %.c %.o
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002993 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02002994 -Wsparse-error \
2995 $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $< && \
2996 >$@
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002997
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02002998.PHONY: sparse
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002999sparse: $(SP_OBJ)
3000
Ævar Arnfjörð Bjarmason7c3c0a92021-09-23 12:29:57 +02003001EXCEPT_HDRS := $(GENERATED_H) unicode-width.h compat/% xdiff/%
Ramsay Jonesf23aa182019-03-06 00:11:13 +00003002ifndef GCRYPT_SHA256
3003 EXCEPT_HDRS += sha256/gcrypt.h
3004endif
Denton Liucf6a2d22019-09-16 12:23:08 -07003005CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01003006HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
Denton Liub503a2d2019-09-25 01:21:01 -07003007HCC = $(HCO:hco=hcc)
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01003008
Denton Liub503a2d2019-09-25 01:21:01 -07003009%.hcc: %.h
3010 @echo '#include "git-compat-util.h"' >$@
3011 @echo '#include "$<"' >>$@
3012
3013$(HCO): %.hco: %.hcc FORCE
3014 $(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01003015
3016.PHONY: hdr-check $(HCO)
3017hdr-check: $(HCO)
3018
Brandon Williams21188052017-08-14 14:30:46 -07003019.PHONY: style
3020style:
3021 git clang-format --style file --diff --extensions c,h
3022
Ævar Arnfjörð Bjarmasonea47e592021-09-23 12:29:56 +02003023.PHONY: check
Ævar Arnfjörð Bjarmason7c3c0a92021-09-23 12:29:57 +02003024check: $(GENERATED_H)
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01003025 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08003026 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07003027 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01003028 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08003029 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07003030 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08003031 exit 1; \
3032 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02003033
Ævar Arnfjörð Bjarmason71712212021-07-22 01:23:04 +02003034FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
Denton Liu9027af52019-09-16 12:23:16 -07003035COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02003036
3037%.cocci.patch: %.cocci $(COCCI_SOURCES)
Denton Liu4f3c1dc2019-10-09 13:43:46 -07003038 $(QUIET_SPATCH) \
Jeff Kingbcb4edf2019-05-08 03:07:54 -04003039 if test $(SPATCH_BATCH_SIZE) = 0; then \
3040 limit=; \
3041 else \
3042 limit='-n $(SPATCH_BATCH_SIZE)'; \
3043 fi; \
3044 if ! echo $(COCCI_SOURCES) | xargs $$limit \
Jeff King960154b2019-05-06 19:43:34 -04003045 $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
3046 >$@+ 2>$@.log; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05003047 then \
3048 cat $@.log; \
3049 exit 1; \
3050 fi; \
3051 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02003052 if test -s $@; \
3053 then \
3054 echo ' ' SPATCH result: $@; \
3055 fi
SZEDER Gábordd5d0522018-11-09 16:10:52 -08003056coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
René Scharfe63f0a752016-09-15 20:30:56 +02003057
SZEDER Gábordd5d0522018-11-09 16:10:52 -08003058# See contrib/coccinelle/README
3059coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
3060
3061.PHONY: coccicheck coccicheck-pending
Petr Baudis28818ff2005-07-29 17:50:24 +02003062
Petr Baudis28818ff2005-07-29 17:50:24 +02003063### Installation rules
3064
Junio C Hamano0c0ead72009-02-05 00:04:17 -08003065ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01003066template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01003067else
3068template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01003069endif
3070export template_instdir
3071
Junio C Hamano0c0ead72009-02-05 00:04:17 -08003072ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003073gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01003074else
3075gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003076endif
3077gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
3078export gitexec_instdir
3079
David Aguilarbc7a96a2011-08-18 00:23:46 -07003080ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
3081mergetools_instdir = $(mergetoolsdir)
3082else
3083mergetools_instdir = $(prefix)/$(mergetoolsdir)
3084endif
3085mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
3086
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003087install_bindir_xprograms := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X))
3088install_bindir_programs := $(install_bindir_xprograms) $(BINDIR_PROGRAMS_NO_X)
Matthew Ogilvieea925192009-12-02 22:14:05 -07003089
Elia Pintoe6be2652015-12-15 15:21:00 +00003090.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07003091profile-install: profile
3092 $(MAKE) install
3093
3094profile-fast-install: profile-fast
3095 $(MAKE) install
3096
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003097INSTALL_STRIP =
3098
Andreas Ericssond6ebd252005-11-22 00:44:15 +01003099install: all
Robert Schiele41650762007-12-01 18:05:40 +01003100 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003101 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003102 $(INSTALL) $(INSTALL_STRIP) $(PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3103 $(INSTALL) $(SCRIPTS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08003104 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Bagas Sanjaya3231f412021-09-05 12:17:56 -07003105 $(INSTALL) $(INSTALL_STRIP) $(install_bindir_xprograms) '$(DESTDIR_SQ)$(bindir_SQ)'
3106 $(INSTALL) $(BINDIR_PROGRAMS_NO_X) '$(DESTDIR_SQ)$(bindir_SQ)'
3107
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003108ifdef MSVC
3109 # We DO NOT install the individual foo.o.pdb files because they
3110 # have already been rolled up into the exe's pdb file.
3111 # We DO NOT have pdb files for the builtin commands (like git-status.exe)
3112 # because it is just a copy/hardlink of git.exe, rather than a unique binary.
Johannes Schindelina8b53552020-09-21 22:28:15 +00003113 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS),$(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)))) '$(DESTDIR_SQ)$(bindir_SQ)'
3114 $(INSTALL) $(patsubst %.exe,%.pdb,$(filter-out $(BUILT_INS) $(REMOTE_CURL_ALIASES),$(PROGRAMS))) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003115ifndef DEBUG
3116 $(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
3117 $(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
3118else
3119 $(INSTALL) $(vcpkg_dbg_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
3120 $(INSTALL) $(vcpkg_dbg_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
3121endif
3122endif
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01003123 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07003124 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05003125 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003126ifndef NO_GETTEXT
3127 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
3128 (cd po/build/locale && $(TAR) cf - .) | \
3129 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
3130endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07003131ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003132 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
3133 (cd perl/build/lib && $(TAR) cf - .) | \
3134 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07003135 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07003136endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003137ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003138 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003139 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003140endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08003141ifneq (,$X)
Johannes Schindelin179227d2020-09-21 22:28:16 +00003142 $(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 -08003143endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003144
Johannes Sixt46beb552008-07-21 21:19:51 +02003145 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02003146 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003147 destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07003148 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05003149 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
3150 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003151 test -n "$(INSTALL_SYMLINKS)" && \
3152 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
3153 { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
3154 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
3155 cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
Brandon Casey76d079a2010-07-23 12:50:45 -05003156 done; \
3157 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05003158 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
3159 $(RM) "$$bindir/$$p" && \
Johannes Schindelin907e6372020-10-21 15:13:31 +00003160 test -n "$(INSTALL_SYMLINKS)" && \
3161 ln -s "git$X" "$$bindir/$$p" || \
3162 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3163 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
3164 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
3165 cp "$$bindir/git$X" "$$bindir/$$p" || exit; }; \
Brandon Casey40919c42010-07-23 12:50:44 -05003166 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003167 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06003168 $(RM) "$$execdir/$$p" && \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003169 if test -z "$(SKIP_DASHED_BUILT_INS)"; \
3170 then \
3171 test -n "$(INSTALL_SYMLINKS)" && \
3172 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
3173 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3174 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
3175 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
3176 cp "$$execdir/git$X" "$$execdir/$$p" || exit; }; \
3177 fi \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07003178 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07003179 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
3180 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02003181 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00003182 test -n "$(INSTALL_SYMLINKS)" && \
3183 ln -s "git-remote-http$X" "$$execdir/$$p" || \
3184 { test -z "$(NO_INSTALL_HARDLINKS)" && \
3185 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3186 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
3187 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
Ævar Arnfjörð Bjarmason72b113e2021-09-06 09:55:33 +02003188 done
Petr Baudis28818ff2005-07-29 17:50:24 +02003189
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003190.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00003191.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02003192install-gitweb:
3193 $(MAKE) -C gitweb install
3194
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003195install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02003196 $(MAKE) -C Documentation install
3197
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003198install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003199 $(MAKE) -C Documentation install-man
3200
SZEDER Gábor2530afd2018-02-15 03:14:10 +01003201install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003202 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
3203 (cd perl/build/man/man3 && $(TAR) cf - .) | \
3204 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
3205
Teemu Likonenae081f32008-06-10 11:34:25 +03003206install-html:
3207 $(MAKE) -C Documentation install-html
3208
David Kastrup47398092007-08-06 12:22:57 +02003209install-info:
3210 $(MAKE) -C Documentation install-info
3211
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01003212install-pdf:
3213 $(MAKE) -C Documentation install-pdf
3214
Eric Wong6538d1e2006-12-23 08:26:09 -08003215quick-install-doc:
3216 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02003217
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01003218quick-install-man:
3219 $(MAKE) -C Documentation quick-install-man
3220
Michael J Gruber6fe570d2008-09-09 22:44:17 +02003221quick-install-html:
3222 $(MAKE) -C Documentation quick-install-html
3223
Petr Baudis28818ff2005-07-29 17:50:24 +02003224
3225
3226### Maintainer's dist rules
3227
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01003228GIT_TARNAME = git-$(GIT_VERSION)
René Scharfedf368fa2020-09-19 23:23:50 +02003229GIT_ARCHIVE_EXTRA_FILES = \
3230 --prefix=$(GIT_TARNAME)/ \
3231 --add-file=configure \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003232 --add-file=.dist-tmp-dir/version \
René Scharfedf368fa2020-09-19 23:23:50 +02003233 --prefix=$(GIT_TARNAME)/git-gui/ \
Ramsay Jonesc5312032020-12-08 22:36:33 +00003234 --add-file=.dist-tmp-dir/git-gui/version
René Scharfedf368fa2020-09-19 23:23:50 +02003235ifdef DC_SHA1_SUBMODULE
3236GIT_ARCHIVE_EXTRA_FILES += \
3237 --prefix=$(GIT_TARNAME)/sha1collisiondetection/ \
3238 --add-file=sha1collisiondetection/LICENSE.txt \
3239 --prefix=$(GIT_TARNAME)/sha1collisiondetection/lib/ \
3240 --add-file=sha1collisiondetection/lib/sha1.c \
3241 --add-file=sha1collisiondetection/lib/sha1.h \
3242 --add-file=sha1collisiondetection/lib/ubc_check.c \
3243 --add-file=sha1collisiondetection/lib/ubc_check.h
3244endif
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02003245dist: git-archive$(X) configure
Ramsay Jonesc5312032020-12-08 22:36:33 +00003246 @$(RM) -r .dist-tmp-dir
3247 @mkdir .dist-tmp-dir
3248 @echo $(GIT_VERSION) > .dist-tmp-dir/version
3249 @$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
René Scharfedf368fa2020-09-19 23:23:50 +02003250 ./git-archive --format=tar \
3251 $(GIT_ARCHIVE_EXTRA_FILES) \
3252 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Ramsay Jonesc5312032020-12-08 22:36:33 +00003253 @$(RM) -r .dist-tmp-dir
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06003254 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07003255
Junio C Hamanoab214332016-04-04 23:42:41 -07003256rpm::
3257 @echo >&2 "Use distro packaged sources to run rpmbuild"
3258 @false
3259.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07003260
Johannes Schindelin46689312019-10-04 08:09:36 -07003261ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
3262OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
3263endif
3264
Johannes Schindelin179227d2020-09-21 22:28:16 +00003265artifacts-tar:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) \
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003266 GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003267 $(MOFILES)
Johannes Schindelinb819f1d2019-01-29 06:19:38 -08003268 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
3269 SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
3270 test -n "$(ARTIFACTS_DIRECTORY)"
3271 mkdir -p "$(ARTIFACTS_DIRECTORY)"
3272 $(TAR) czf "$(ARTIFACTS_DIRECTORY)/artifacts.tar.gz" $^ templates/blt/
3273.PHONY: artifacts-tar
3274
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003275htmldocs = git-htmldocs-$(GIT_VERSION)
3276manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00003277.PHONY: dist-doc distclean
René Scharfe93e70312020-10-10 18:45:18 +02003278dist-doc: git$X
Emil Medve4cb08df2007-07-14 12:51:44 -05003279 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003280 mkdir .doc-tmp-dir
3281 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
René Scharfe93e70312020-10-10 18:45:18 +02003282 ./git -C .doc-tmp-dir init
3283 ./git -C .doc-tmp-dir add .
3284 ./git -C .doc-tmp-dir commit -m htmldocs
3285 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3286 > $(htmldocs).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003287 gzip -n -9 -f $(htmldocs).tar
3288 :
Emil Medve4cb08df2007-07-14 12:51:44 -05003289 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07003290 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02003291 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003292 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07003293 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02003294 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003295 install
René Scharfe93e70312020-10-10 18:45:18 +02003296 ./git -C .doc-tmp-dir init
3297 ./git -C .doc-tmp-dir add .
3298 ./git -C .doc-tmp-dir commit -m manpages
3299 ./git -C .doc-tmp-dir archive --format=tar --prefix=./ HEAD^{tree} \
3300 > $(manpages).tar
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003301 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05003302 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02003303
Petr Baudis28818ff2005-07-29 17:50:24 +02003304### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06003305
Mathias Megyei922aa802007-10-04 23:49:19 +02003306distclean: clean
3307 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02003308 $(RM) config.log config.status config.cache
3309 $(RM) config.mak.autogen config.mak.append
3310 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02003311
Theodore Ts'of2d713f2012-02-06 01:00:17 -05003312profile-clean:
3313 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3314 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
3315
SZEDER Gábor1a966382018-07-23 15:51:00 +02003316cocciclean:
3317 $(RM) contrib/coccinelle/*.cocci.patch*
3318
3319clean: profile-clean coverage-clean cocciclean
Junio C Hamano7897d842016-04-15 10:06:52 -07003320 $(RM) *.res
3321 $(RM) $(OBJECTS)
Han-Wen Nienhuysef8a6c62021-10-07 20:25:00 +00003322 $(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08003323 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Johannes Schindelin0b64e212019-04-18 06:16:39 -07003324 $(RM) $(TEST_PROGRAMS)
Josh Steadmon5e472152018-10-12 17:58:40 -07003325 $(RM) $(FUZZ_PROGRAMS)
Ævar Arnfjörð Bjarmasonc234e8a2021-09-23 02:07:16 +02003326 $(RM) $(SP_OBJ)
Denton Liub503a2d2019-09-25 01:21:01 -07003327 $(RM) $(HCC)
Philippe Blain3821c382020-09-03 22:13:38 +00003328 $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01003329 $(RM) -r po/build/
Junio C Hamanof3719842019-12-13 15:15:34 -08003330 $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
Ramsay Jonesc5312032020-12-08 22:36:33 +00003331 $(RM) -r .dist-tmp-dir .doc-tmp-dir
Ramsay Jones98836a82020-12-08 22:35:27 +00003332 $(RM) $(GIT_TARNAME).tar.gz
Emil Medve4cb08df2007-07-14 12:51:44 -05003333 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02003334 $(MAKE) -C Documentation/ clean
Johannes Schindelinfaa7a092019-04-18 06:16:44 -07003335 $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
Jeff King499c2932009-04-03 15:32:20 -04003336ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01003337 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00003338 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04003339endif
Petr Baudisb1edc532006-06-24 04:34:29 +02003340 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07003341 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003342ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08003343 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07003344 $(MAKE) -C git-gui clean
3345endif
Christian Couder8f26aa42012-12-18 16:26:37 +01003346 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08003347 $(RM) GIT-USER-AGENT GIT-PREFIX
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04003348 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
Jeff Hostetlerdce7d292019-06-25 07:49:39 -07003349ifdef MSVC
3350 $(RM) $(patsubst %.o,%.o.pdb,$(OBJECTS))
3351 $(RM) $(patsubst %.exe,%.pdb,$(OTHER_PROGRAMS))
3352 $(RM) $(patsubst %.exe,%.iobj,$(OTHER_PROGRAMS))
3353 $(RM) $(patsubst %.exe,%.ipdb,$(OTHER_PROGRAMS))
3354 $(RM) $(patsubst %.exe,%.pdb,$(PROGRAMS))
3355 $(RM) $(patsubst %.exe,%.iobj,$(PROGRAMS))
3356 $(RM) $(patsubst %.exe,%.ipdb,$(PROGRAMS))
3357 $(RM) $(patsubst %.exe,%.pdb,$(TEST_PROGRAMS))
3358 $(RM) $(patsubst %.exe,%.iobj,$(TEST_PROGRAMS))
3359 $(RM) $(patsubst %.exe,%.ipdb,$(TEST_PROGRAMS))
3360 $(RM) compat/vcbuild/MSVC-DEFS-GEN
3361endif
Junio C Hamano9b88fce2005-12-27 14:40:17 -08003362
SZEDER Gábor1a966382018-07-23 15:51:00 +02003363.PHONY: all install profile-clean cocciclean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05003364.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Ævar Arnfjörð Bjarmason922f8bb2021-06-29 13:12:55 +02003365.PHONY: FORCE
Junio C Hamanod89056c2005-12-19 17:59:58 -08003366
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003367### Check documentation
3368#
Johannes Schindelin179227d2020-09-21 22:28:16 +00003369ALL_COMMANDS = $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB)
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003370ALL_COMMANDS += git
Denton Liu805d9ea2020-03-21 05:21:20 -04003371ALL_COMMANDS += git-citool
3372ALL_COMMANDS += git-gui
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003373ALL_COMMANDS += gitk
3374ALL_COMMANDS += gitweb
Elia Pintoe6be2652015-12-15 15:21:00 +00003375
3376.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003377check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07003378 $(MAKE) -C Documentation lint-docs
Johannes Schindelin5ee42462019-03-25 14:41:39 -07003379 @(for v in $(patsubst %$X,%,$(ALL_COMMANDS)); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003380 do \
3381 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003382 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02003383 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08003384 git-fsck-objects | git-init-db | \
Johannes Schindelin31cf4a62019-04-18 06:16:46 -07003385 git-remote-* | git-stage | git-legacy-* | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08003386 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003387 esac ; \
3388 test -f "Documentation/$$v.txt" || \
3389 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02003390 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08003391 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003392 case "$$v" in \
3393 git) ;; \
3394 *) echo "no link: $$v";; \
3395 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003396 done; \
3397 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02003398 sed -e '1,/^### command list/d' \
3399 -e '/^#/d' \
Johannes Schindelin8e6d6952019-03-25 14:41:38 -07003400 -e '/guide$$/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003401 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08003402 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04003403 $(MAKE) -C Documentation print-man1 | \
3404 grep '\.txt$$' | \
Johannes Schindelin057ccba2019-03-25 14:41:37 -07003405 sed -e 's|^|documented |' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003406 -e 's/\.txt//'; \
3407 ) | while read how cmd; \
3408 do \
Johannes Schindelin179227d2020-09-21 22:28:16 +00003409 case " $(patsubst %$X,%,$(ALL_COMMANDS) $(BUILT_INS) $(EXCLUDED_PROGRAMS)) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003410 *" $$cmd "*) ;; \
3411 *) echo "removed but $$how: $$cmd" ;; \
3412 esac; \
3413 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08003414
3415### Make sure built-ins do not have dups and listed in git.c
3416#
3417check-builtins::
3418 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08003419
Thomas Rast901c3692009-02-19 12:13:35 +01003420### Test suite coverage testing
3421#
Thomas Rast0c38a952013-05-13 23:27:25 +02003422.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00003423.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003424.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01003425
3426coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02003427 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02003428 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01003429
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003430object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003431coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003432 $(RM) $(addsuffix *.gcov,$(object_dirs))
3433 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003434 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003435 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003436 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01003437
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003438coverage-clean: coverage-clean-results
3439 $(RM) $(addsuffix *.gcno,$(object_dirs))
3440
Thomas Rast901c3692009-02-19 12:13:35 +01003441COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
3442COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003443GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01003444
Thomas Rast0c38a952013-05-13 23:27:25 +02003445coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01003446 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02003447
3448coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01003449 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02003450 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01003451
Derrick Stolee22991202019-01-29 09:05:18 -08003452coverage-prove: coverage-clean-results coverage-compile
3453 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
3454 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
3455 -j1 test
3456
Thomas Rast901c3692009-02-19 12:13:35 +01003457coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003458 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02003459 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003460 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00003461
3462coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01003463 grep '^function.*called 0 ' *.c.gcov \
3464 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003465 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003466
3467cover_db: coverage-report
3468 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003469
3470cover_db_html: cover_db
3471 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07003472
Josh Steadmon5e472152018-10-12 17:58:40 -07003473
3474### Fuzz testing
3475#
3476# Building fuzz targets generally requires a special set of compiler flags that
3477# are not necessarily appropriate for general builds, and that vary greatly
3478# depending on the compiler version used.
3479#
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003480# An example command to build against libFuzzer from LLVM 11.0.0:
Josh Steadmon5e472152018-10-12 17:58:40 -07003481#
3482# make CC=clang CXX=clang++ \
Andrzej Hunt68b5c3a2021-03-08 17:14:42 +00003483# CFLAGS="-fsanitize=fuzzer-no-link,address" \
3484# LIB_FUZZING_ENGINE="-fsanitize=fuzzer" \
Josh Steadmon5e472152018-10-12 17:58:40 -07003485# fuzz-all
3486#
Josh Steadmon927c77e2018-11-14 11:41:47 -08003487FUZZ_CXXFLAGS ?= $(CFLAGS)
3488
Josh Steadmon5e472152018-10-12 17:58:40 -07003489.PHONY: fuzz-all
3490
3491$(FUZZ_PROGRAMS): all
Josh Steadmon927c77e2018-11-14 11:41:47 -08003492 $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07003493 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3494
3495fuzz-all: $(FUZZ_PROGRAMS)