blob: fced94cb733380cca5ea4820615ec2cc320aae35 [file] [log] [blame]
Junio C Hamano2731d042005-12-01 12:26:41 -08001# The default target of this Makefile is...
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002all::
Junio C Hamano2731d042005-12-01 12:26:41 -08003
Shawn O. Pearce2314c942007-03-06 02:09:14 -05004# Define V=1 to have a more verbose compile.
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05005#
Junio C Hamano0e0aea52009-06-05 18:36:15 -05006# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
7#
8# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
9# to PATH if your tools in /usr/bin are broken.
10#
Gary V. Vaughane88a1352010-05-14 09:31:42 +000011# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
12# system headers do not define a socklen_t type.
13#
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +000014# Define INLINE to a suitable substitute (such as '__inline' or '') if git
15# fails to compile with errors about undefined inline functions or similar.
16#
Ian Liu Rodrigues3b2c5412014-09-13 11:20:22 -030017# Define SNPRINTF_RETURNS_BOGUS if you are on a system which snprintf()
Michal Rokosc4582f92008-03-05 16:46:13 +010018# or vsnprintf() return -1 instead of number of characters which would
19# have been written to the final string if enough space had been available.
20#
Ian Liu Rodrigues3b2c5412014-09-13 11:20:22 -030021# Define FREAD_READS_DIRECTORIES if you are on a system which succeeds
Jeff King3adf9fd2017-06-14 01:30:18 -040022# when attempting to read from an fopen'ed directory (or even to fopen
23# it at all).
Brandon Caseycba22522008-02-08 20:32:47 -060024#
Linus Torvalds765ac8e2006-02-28 15:07:20 -080025# Define NO_OPENSSL environment variable if you do not have OpenSSL.
Petr Baudis5bdac8b2005-07-29 17:48:26 +020026#
Ævar Arnfjörð Bjarmason072473e2017-05-20 21:42:04 +000027# Define USE_LIBPCRE if you have and want to use libpcre. Various
28# commands such as log and grep offer runtime options to use
29# Perl-compatible regular expressions instead of standard or extended
30# POSIX regular expressions.
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +020031#
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +000032# USE_LIBPCRE is a synonym for USE_LIBPCRE2, define USE_LIBPCRE1
33# instead if you'd like to use the legacy version 1 of the PCRE
34# library. Support for version 1 will likely be removed in some future
35# release of Git, as upstream has all but abandoned it.
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +000036#
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +000037# When using USE_LIBPCRE1, define NO_LIBPCRE1_JIT if the PCRE v1
38# library is compiled without --enable-jit. We will auto-detect
39# whether the version of the PCRE v1 library in use has JIT support at
40# all, but we unfortunately can't auto-detect whether JIT support
41# hasn't been compiled in in an otherwise JIT-supporting version. If
42# you have link-time errors about a missing `pcre_jit_exec` define
43# this, or recompile PCRE v1 with --enable-jit.
44#
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +000045# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
46# in /foo/bar/include and /foo/bar/lib directories. Which version of
47# PCRE this points to determined by the USE_LIBPCRE1 and USE_LIBPCRE2
48# variables.
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +020049#
Kirill Smelkov61f76a32014-03-27 18:22:50 +040050# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
51#
Tay Ray Chuand24d9052011-08-03 20:07:57 +080052# Define NO_CURL if you do not have libcurl installed. git-http-fetch and
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080053# git-http-push are not built, and you cannot use http:// and https://
Tay Ray Chuand24d9052011-08-03 20:07:57 +080054# transports (neither smart nor dumb).
Johannes Schindelinb2c0bd62005-07-31 02:14:23 +020055#
Patrick Mauritz6d9bbc52005-09-19 16:11:19 +020056# Define CURLDIR=/foo/bar if your curl header and library files are in
Junio C Hamanob2feb642014-04-30 10:58:10 -070057# /foo/bar/include and /foo/bar/lib directories.
Patrick Mauritz6d9bbc52005-09-19 16:11:19 +020058#
Remi Pommarelf8915872015-10-21 19:10:46 +020059# Define CURL_CONFIG to curl's configuration program that prints information
60# about the library (e.g., its version number). The default is 'curl-config'.
61#
James Knight23c4bbe2018-11-03 05:12:11 +000062# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl,
63# if you do not want to rely on the libraries provided by CURL_CONFIG. The
64# default value is a result of `curl-config --libs`. An example value for
65# CURL_LDFLAGS is as follows:
66#
67# CURL_LDFLAGS=-lcurl
68#
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080069# Define NO_EXPAT if you do not have expat installed. git-http-push is
Tay Ray Chuand24d9052011-08-03 20:07:57 +080070# not built, and you cannot push using http:// and https:// transports (dumb).
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080071#
Serge van den Boom85b45182009-01-28 21:43:57 +010072# Define EXPATDIR=/foo/bar if your expat header and library files are in
73# /foo/bar/include and /foo/bar/lib directories.
74#
Matt Kraai081fd8d2013-02-11 14:03:45 -080075# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
76# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
77#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010078# Define NO_GETTEXT if you don't want Git output to be translated.
79# A translated Git requires GNU libintl or another gettext implementation,
80# plus libintl-perl at runtime.
81#
Alex Riesenad17ea72012-01-23 14:04:29 -080082# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
83# the installed gettext translation of the shell scripts output.
84#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010085# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
86# trust the langinfo.h's nl_langinfo(CODESET) function to return the
87# current character set. GNU and Solaris have a nl_langinfo(CODESET),
88# FreeBSD can use either, but MinGW and some others need to use
89# libcharset.h's locale_charset() instead.
90#
Дилян Палаузов3064b132014-03-11 23:37:33 +010091# Define CHARSET_LIB to the library you need to link with in order to
Дилян Палаузовb5225282012-02-12 17:23:36 +010092# use locale_charset() function. On some platforms this needs to set to
Дилян Палаузов3064b132014-03-11 23:37:33 +010093# -lcharset, on others to -liconv .
Дилян Палаузовb5225282012-02-12 17:23:36 +010094#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010095# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
96# need -lintl when linking.
97#
98# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
99# doesn't support GNU extensions like --check and --statistics
100#
Chris Webbcb6a22c2010-04-13 10:07:13 +0100101# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
102# it specifies.
103#
Junio C Hamano63be37b2006-01-19 17:13:57 -0800104# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
Eric Blakea50dec22010-04-01 16:43:54 -0600105# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
Junio C Hamano63be37b2006-01-19 17:13:57 -0800106#
David Michaelb3e103d2012-12-14 14:57:01 -0500107# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
108#
Linus Torvaldsef34af22005-09-18 18:30:50 -0700109# Define NO_STRCASESTR if you don't have strcasestr.
110#
René Scharfeb21b9f12007-09-07 00:32:54 +0200111# Define NO_MEMMEM if you don't have memmem.
112#
Matt Kraai40036be2012-12-18 14:03:55 -0800113# Define NO_GETPAGESIZE if you don't have getpagesize.
114#
Peter Eriksen817151e2006-06-24 16:01:25 +0200115# Define NO_STRLCPY if you don't have strlcpy.
116#
Nick Alcocke3eed7f2011-11-02 15:46:22 +0000117# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
118# C library. If your compiler also does not support long long or does not have
Jason Riedybc6b4f52007-02-19 16:22:56 -0800119# strtoull, define NO_STRTOULL.
120#
Jason Riedye40b61f2005-12-02 15:08:28 -0800121# Define NO_SETENV if you don't have setenv in the C library.
122#
Jakub Narebskibfa8fcc2008-01-18 02:03:51 +0100123# Define NO_UNSETENV if you don't have unsetenv in the C library.
124#
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -0400125# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
126#
Joachim Schmitzdc9f4622012-09-08 19:01:31 +0200127# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
128#
Rafael Gieschke590e0812011-05-19 13:37:55 +0200129# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
130# in the C library.
131#
David Aguilare1c06882009-05-31 01:35:51 -0700132# Define NO_LIBGEN_H if you don't have libgen.h.
133#
Brandon Caseyecc395c2009-07-10 12:10:45 -0500134# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
135#
Robert Schiele26009732008-01-24 19:34:46 +0100136# Define NO_SYS_SELECT_H if you don't have sys/select.h.
137#
Junio C Hamano9f0bb902006-05-02 00:40:24 -0700138# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
139# Enable it on Windows. By default, symrefs are still used.
Pavel Roskin2fabd212005-11-15 00:59:50 -0500140#
Pavel Roskin02853582006-07-09 02:44:58 -0700141# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
Eric Wong60d02cc2006-07-06 00:14:16 -0700142# tests. These tests take up a significant amount of the total test time
143# but are not needed unless you plan to talk to SVN repos.
144#
Shawn Pearce8eb38ca2006-07-24 00:28:28 -0400145# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
146# installed in /sw, but don't want GIT to link against any libraries
147# installed there. If defined you may specify your own (or Fink's)
148# include directories and library directories by defining CFLAGS
149# and LDFLAGS appropriately.
150#
151# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
152# have DarwinPorts installed in /opt/local, but don't want GIT to
153# link against any libraries installed there. If defined you may
154# specify your own (or DarwinPort's) include directories and
155# library directories by defining CFLAGS and LDFLAGS appropriately.
156#
David Aguilar4dcd7732013-05-19 06:23:34 -0400157# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
158# and do not want to use Apple's CommonCrypto library. This allows you
159# to provide your own OpenSSL library, for example from MacPorts.
160#
Jonathan Niederf2001972012-07-23 01:29:14 -0500161# Define BLK_SHA1 environment variable to make use of the bundled
162# optimized C SHA1 routine.
Linus Torvaldsd7c208a2009-08-05 16:13:20 -0700163#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200164# Define PPC_SHA1 environment variable when running make to make use of
165# a bundled SHA1 routine optimized for PowerPC.
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700166#
Jeff King8325e432017-03-16 18:09:12 -0400167# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
168# algorithm. This is slower, but may detect attempted collision attacks.
169# Takes priority over other *_SHA1 knobs.
170#
Takashi Iwai3964cbb2017-08-15 14:04:17 +0200171# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
172# git with the external SHA1 collision-detect library.
173# Without this option, i.e. the default behavior is to build git with its
174# own built-in code (or submodule).
175#
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +0000176# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
177# sha1collisiondetection shipped as a submodule instead of the
178# non-submodule copy in sha1dc/. This is an experimental option used
179# by the git project to migrate to using sha1collisiondetection as a
180# submodule.
181#
Junio C Hamanoe6b07da2017-03-17 10:00:15 -0700182# Define OPENSSL_SHA1 environment variable when running make to link
183# with the SHA1 routine from openssl library.
184#
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -0800185# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
186# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
187# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
188#
Brian Gernhardt0460dba2009-09-08 09:54:38 -0400189# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
190#
191# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200192#
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700193# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200194#
Joachim Schmitz6c109902012-09-19 12:03:30 +0200195# Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
196#
Justin Lebar01689902014-03-31 15:11:46 -0700197# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
Joachim Schmitz6c109902012-09-19 12:03:30 +0200198#
199# Define NO_UINTMAX_T if you don't have uintmax_t.
200#
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200201# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
202# Patrick Mauritz).
203#
Brandon Casey70cf9912009-06-05 18:36:10 -0500204# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
205# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
206# inet_ntop and inet_pton additionally reside there.
207#
Johannes Schindelin730d48a2005-10-08 15:54:36 -0700208# Define NO_MMAP if you want to avoid mmap.
209#
Michael Haggerty5b633612017-09-25 10:00:10 +0200210# Define MMAP_PREVENTS_DELETE if a file that is currently mmapped cannot be
211# deleted or cannot be replaced using rename().
212#
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +0700213# Define NO_POLL_H if you don't have poll.h.
214#
Joachim Schmitz6d45eb12012-09-17 23:16:39 +0200215# Define NO_SYS_POLL_H if you don't have sys/poll.h.
216#
217# 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 +0700218# This also implies NO_POLL_H and NO_SYS_POLL_H.
Joachim Schmitz6d45eb12012-09-17 23:16:39 +0200219#
Junio C Hamanob2d05e02012-12-18 09:35:33 -0800220# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
221# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
222# we want to know more about the issue.
David Michael6ede7202012-12-14 14:56:58 -0500223#
Junio C Hamano46059cc2008-11-15 04:08:14 -0800224# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
225#
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100226# Define NO_PREAD if you have a problem with pread() system call (e.g.
Eric Blakea50dec22010-04-01 16:43:54 -0600227# cygwin1.dll before v1.5.22).
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100228#
Joachim Schmitz7f9e8482012-09-08 18:54:34 +0200229# Define NO_SETITIMER if you don't have setitimer()
230#
231# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
232# This also implies NO_SETITIMER
233#
Shawn O. Pearce1510fea2006-12-14 06:15:57 -0500234# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
235# generally faster on your platform than accessing the working directory.
236#
Shawn O. Pearcec8697532006-12-30 23:53:55 -0500237# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
238# the executable mode bit, but doesn't really do so.
239#
David Michaeld543d9c2014-12-03 21:24:17 -0500240# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
241# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
242# usual 0xF000).
243#
hpa49744d62005-09-28 16:52:21 -0700244# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
245#
Johannes Sixt63203582011-12-12 22:12:56 +0100246# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
247#
Junio C Hamanobdc37f52006-01-19 17:13:32 -0800248# Define NO_SOCKADDR_STORAGE if your platform does not have struct
249# sockaddr_storage.
250#
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +0100251# Define NO_ICONV if your libc does not properly support iconv.
252#
Ramsay Jonesfd547a92007-03-03 18:29:03 +0000253# Define OLD_ICONV if your library has an old iconv(), where the second
254# (input buffer pointer) parameter is declared with type (const char **).
255#
David Symonds609a2282007-11-07 14:24:28 +1100256# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
257#
Matt Kraai20648872007-06-30 10:05:03 -0700258# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
259# that tells runtime paths to dynamic libraries;
260# "-Wl,-rpath=/path/lib" is used instead.
Junio C Hamanobbfc63d2006-12-27 14:17:35 -0800261#
Junio C Hamano6520c842011-06-18 18:07:03 -0700262# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
263# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
264#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200265# Define USE_NSEC below if you want git to care about sub-second file mtimes
Karsten Bleesb1ffafa2015-07-01 21:10:52 +0200266# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
267# Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
268# on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
269# on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
270# Documentation/technical/racy-git.txt for details.
Junio C Hamanof6af75d2006-06-23 17:57:48 -0700271#
Brian Gernhardtc5673832009-03-08 16:04:28 -0400272# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
273# "st_ctim"
274#
Kjetil Barvikc06ff492009-03-04 18:47:40 +0100275# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
276# available. This automatically turns USE_NSEC off.
277#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200278# Define USE_STDEV below if you want git to care about the underlying device
Johannes Schindelin10455d22007-11-30 11:35:23 +0000279# change being considered an inode change from the update-index perspective.
Alex Riesenf8487182006-12-04 10:50:04 +0100280#
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +0200281# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
282# field that counts the on-disk footprint in 512-byte blocks.
283#
Jonathan Nieder162213d2009-10-09 05:15:29 -0500284# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
285# (not v1.73 or v1.71).
286#
Jeff King79c461d2010-11-19 12:54:24 -0500287# Define ASCIIDOC_ROFF if your DocBook XSL does not escape raw roff directives
288# (versions 1.68.1 through v1.72).
Jonas Fonseca7f55cf42007-11-14 10:38:46 +0100289#
Thomas Rast204d3632009-10-22 10:19:06 +0200290# Define GNU_ROFF if your target system uses GNU groff. This forces
291# apostrophes to be ASCII so that cut&pasting examples to the shell
292# will work.
293#
brian m. carlsonec3366e2017-01-22 02:41:56 +0000294# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
295# documentation.
296#
297# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
298# Extensions Lab if you have it available.
299#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800300# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
301#
Jeff King499c2932009-04-03 15:32:20 -0400302# Define NO_PERL if you do not want Perl scripts or libraries at all.
303#
Todd Zullinger075321c2018-03-03 15:38:16 +0000304# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
305# copies of CPAN modules that serve as a fallback in case the modules
306# are not available on the system. This option is intended for
307# distributions that want to use their packaged versions of Perl
308# modules, instead of the fallbacks shipped with Git.
309#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800310# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
311# but /usr/bin/python2.7 on some platforms).
312#
Johan Herlandd4e1b472009-11-18 02:42:31 +0100313# Define NO_PYTHON if you do not want Python scripts or libraries at all.
314#
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700315# Define NO_TCLTK if you do not want Tcl/Tk GUI.
316#
Junio C Hamano71b40102016-03-08 15:47:57 -0800317# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
318# and egrep that are pickier when their input contains non-ASCII data.
319#
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400320# The TCL_PATH variable governs the location of the Tcl interpreter
321# used to optimize git-gui for your system. Only used if NO_TCLTK
322# is not set. Defaults to the bare 'tclsh'.
323#
324# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700325# If not set it defaults to the bare 'wish'. If it is set to the empty
326# string then NO_TCLTK will be forced (this is used by configure script).
327#
Brian Downing43fe9012008-02-05 15:10:44 -0600328# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
329# is a simplified version of the merge sort used in glibc. This is
330# recommended if Git triggers O(n^2) behavior in your platform's qsort().
331#
René Scharfe04ee8b82017-01-22 18:51:11 +0100332# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
333# compatible with the one described in C11 Annex K.
334#
Johannes Sixt34779c52009-04-20 10:17:00 +0200335# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
336# information on a not yet closed file that lstat would return for the same
337# file after it was closed.
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200338#
Johannes Schindelin348df162009-04-28 00:32:25 +0200339# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
340# when hardlinking a file to another name and unlinking the original file right
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200341# away (some NTFS drivers seem to zero the contents in that scenario).
Junio C Hamano2c8f8b12009-05-23 01:43:08 -0700342#
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +0000343# Define INSTALL_SYMLINKS if you prefer to have everything that can be
344# symlinked between bin/ and libexec/ to use relative symlinks between
345# the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and
346# NO_INSTALL_HARDLINKS which will also use symlinking by indirection
347# within the same directory in some cases, INSTALL_SYMLINKS will
348# always symlink to the final target directly.
349#
Johannes Schindelin3426e342009-05-11 13:02:18 +0200350# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
351# programs as a tar, where bin/ and libexec/ might be on different file systems.
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200352#
Junio C Hamano70de5e62012-05-02 15:12:10 -0700353# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
354# copies to install built-in git commands e.g. git-cat-file.
355#
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200356# Define USE_NED_ALLOCATOR if you want to replace the platforms default
357# memory allocators with the nedmalloc allocator written by Niall Douglas.
Jeff King02232ad2009-06-16 15:07:40 -0400358#
René Scharfeca2baa32016-09-03 17:59:15 +0200359# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
360# This is necessary when using a custom allocator in order to avoid
361# crashes due to allocation and free working on different 'heaps'.
362# It's defined automatically if USE_NED_ALLOCATOR is set.
363#
Johannes Schindelin2f895222016-09-21 20:24:04 +0200364# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
365# feature.
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500366#
Jeff King21aeafc2011-12-10 05:41:01 -0500367# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
368# user.
369#
Jakub Narebski63267de2009-09-01 13:39:20 +0200370# Define JSMIN to point to JavaScript minifier that functions as
371# a filter to have gitweb.js minified.
Junio C Hamano8678bc02009-12-01 11:28:15 -0800372#
Mark Rada0e6ce212010-04-02 20:35:05 -0400373# Define CSSMIN to point to a CSS minifier in order to generate a minified
374# version of gitweb.css
375#
Junio C Hamanoa3d023d2009-10-30 20:45:34 -0500376# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
377# you want to use something different. The value will be interpreted by the
378# shell at runtime when it is used.
379#
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500380# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
381# want to use something different. The value will be interpreted by the shell
382# if necessary when it is used. Examples:
383#
384# DEFAULT_EDITOR='~/bin/vi',
385# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
386# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
Jonathan Niederdfea5752010-01-26 09:52:49 -0600387#
Jonathan Nieder024c8432011-11-18 03:58:21 -0600388# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
389# header files to be automatically computed, to avoid rebuilding objects when
390# an unrelated header file changes. Define it to "no" to use the hard-coded
391# dependency rules. The default is "auto", which means to use computed header
392# dependencies if your compiler is detected to support it.
393#
Eyvind Bernhardsen942e7742010-06-04 21:29:08 +0200394# Define NATIVE_CRLF if your platform uses CRLF for line endings.
Thomas Rast6942efc2012-04-06 23:01:23 +0200395#
Jeff King42dcbb72012-06-02 15:01:12 -0400396# Define GIT_USER_AGENT if you want to change how git identifies itself during
397# network interactions. The default is "git/$(GIT_VERSION)".
Junio C Hamanoa88d7aa2012-06-21 14:42:38 -0700398#
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +0000399# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
400# (defaults to "man") if you want to have a different default when
401# "git help" is called without a parameter specifying the format.
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100402#
Ben Peart1f357b02018-09-18 23:29:36 +0000403# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100404# with a different indexfile format version. If it isn't set the index
405# file format used is index-v[23].
Junio C Hamanobdb830c2014-04-08 11:59:05 -0700406#
Jeff King66547542014-04-01 17:28:42 -0400407# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
408# return NULL when it receives a bogus time_t.
Karsten Blees148d6772014-07-12 02:05:42 +0200409#
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#
414# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
415# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
Reuben Hawkins88e01182015-01-08 12:00:57 -0800416#
Kyle J. McKay290c8e72015-01-11 12:09:22 -0800417# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
418# compiles the following initialization:
419#
420# static const char s[] = ("FOO");
421#
422# and define it to "no" if you need to remove the parentheses () around the
423# constant. The default is "auto", which means to use parentheses if your
424# compiler is detected to support it.
Junio C Hamano551fc7a2015-03-20 13:11:49 -0700425#
Kyle J. McKay95290802015-03-07 23:14:36 -0800426# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
Jeff King0cc30e02015-04-16 05:01:38 -0400427#
428# Define HAVE_GETDELIM if your system has the getdelim() function.
Eric Wong995bc222016-08-04 11:40:25 +0000429#
430# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
431# default environment variables to be passed when a pager is spawned, e.g.
432#
433# PAGER_ENV = LESS=FRX LV=-c
434#
435# to say "export LESS=FRX (and LV=-c) if the environment variable
436# LESS (and LV) is not set, respectively".
Eric Sunshineb2289402017-12-15 00:34:34 +0100437#
Jeff King3f824e92017-12-08 05:47:22 -0500438# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
439# running the test scripts (e.g., bash has better support for "set -x"
440# tracing).
Junio C Hamano07b747d2018-01-05 13:28:09 -0800441#
Eric Sunshineb2289402017-12-15 00:34:34 +0100442# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
443# which the built Git will run (for instance "x86_64").
Dan Jacques07d90ea2018-04-10 11:05:43 -0400444#
445# Define RUNTIME_PREFIX to configure Git to resolve its ancillary tooling and
446# support files relative to the location of the runtime binary, rather than
447# hard-coding them into the binary. Git installations built with RUNTIME_PREFIX
448# can be moved to arbitrary filesystem locations. RUNTIME_PREFIX also causes
449# Perl scripts to use a modified entry point header allowing them to resolve
450# support files at runtime.
Dan Jacques226c0dd2018-04-10 11:05:44 -0400451#
452# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform
453# supports the KERN_PROC BSD sysctl function.
454#
455# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform
456# mounts a "procfs" filesystem capable of resolving the path of the current
457# executable. If defined, this must be the canonical path for the "procfs"
458# current executable path.
459#
460# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform
461# supports calling _NSGetExecutablePath to retrieve the path of the running
462# executable.
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -0400463#
464# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
465# the global variable _wpgmptr containing the absolute path of the current
466# executable (this is the case on Windows).
Junio C Hamanoe998e7a2018-05-08 15:59:21 +0900467#
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +0000468# Define DEVELOPER to enable more compiler warnings. Compiler version
469# and family are auto detected, but could be overridden by defining
470# COMPILER_FEATURES (see config.mak.dev)
Ævar Arnfjörð Bjarmason99f763b2018-04-14 19:19:45 +0000471#
472# When DEVELOPER is set, DEVOPTS can be used to control compiler
473# options. This variable contains keywords separated by
474# whitespace. The following keywords are are recognized:
475#
476# no-error:
477#
478# suppresses the -Werror that implicitly comes with
479# DEVELOPER=1. Useful for getting the full set of errors
480# without immediately dying, or for logging them.
Ævar Arnfjörð Bjarmason26d2e4f2018-04-14 19:19:46 +0000481#
482# extra-all:
483#
484# The DEVELOPER mode enables -Wextra with a few exceptions. By
485# setting this flag the exceptions are removed, and all of
486# -Wextra is used.
Beat Bolli729b3922018-07-24 21:26:43 +0200487#
488# pedantic:
489#
490# Enable -pedantic compilation. This also disables
491# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200492
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600493GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100494 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800495-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200496
Junio C Hamano94d23312005-11-13 01:46:13 -0800497# CFLAGS and LDFLAGS are for the users to override from the command line.
Junio C Hamano12aa7452005-11-04 23:50:09 -0800498
Pavel Roskinb05701c2005-08-06 01:36:15 -0400499CFLAGS = -g -O2 -Wall
Junio C Hamano94d23312005-11-13 01:46:13 -0800500LDFLAGS =
Gary V. Vaughanebef8272010-05-14 09:31:32 +0000501ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
Junio C Hamano94d23312005-11-13 01:46:13 -0800502ALL_LDFLAGS = $(LDFLAGS)
Junio C Hamano4dc00022006-01-12 21:42:25 -0800503STRIP ?= strip
Lars Schneider658df952016-02-25 09:42:22 +0100504
Junio C Hamanoac179b42015-09-10 14:27:21 -0700505# Create as necessary, replace existing, make ranlib unneeded.
506ARFLAGS = rcs
507
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200508# Among the variables below, these:
509# gitexecdir
510# template_dir
Johannes Sixt9fb1e692011-05-09 10:24:55 +0200511# sysconfdir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100512# can be specified as a relative path some/where/else;
513# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200514# runtime figures out where they are based on the path to the executable.
John Keeping971f8532013-02-24 19:55:01 +0000515# Additionally, the following will be treated as relative by "git" if they
516# begin with "$(prefix)/":
517# mandir
518# infodir
519# htmldir
Dan Jacques07d90ea2018-04-10 11:05:43 -0400520# localedir
521# perllibdir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200522# This can help installing the suite in a relocatable way.
523
Pavel Roskinb05701c2005-08-06 01:36:15 -0400524prefix = $(HOME)
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000525bindir = $(prefix)/bin
John Keeping971f8532013-02-24 19:55:01 +0000526mandir = $(prefix)/share/man
527infodir = $(prefix)/share/info
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100528gitexecdir = libexec/git-core
David Aguilarbc7a96a2011-08-18 00:23:46 -0700529mergetoolsdir = $(gitexecdir)/mergetools
Johannes Sixt93547682007-06-11 10:02:17 +0200530sharedir = $(prefix)/share
Pavan Kumar Sunkarabc951962010-05-28 11:55:50 +0530531gitwebdir = $(sharedir)/gitweb
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000532perllibdir = $(sharedir)/perl5
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100533localedir = $(sharedir)/locale
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100534template_dir = share/git-core/templates
John Keeping971f8532013-02-24 19:55:01 +0000535htmldir = $(prefix)/share/doc/git-doc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100536ETC_GITCONFIG = $(sysconfdir)/gitconfig
Petr Onderka6df42ab2010-09-01 00:42:43 +0200537ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
Robert Schiele10861be2007-08-01 06:30:35 +0200538lib = lib
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100539# DESTDIR =
Johannes Schindelin352c8112009-05-23 10:04:48 +0200540pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700541
Ævar Arnfjörð Bjarmason7bc506d2018-03-13 20:39:33 +0000542bindir_relative = $(patsubst $(prefix)/%,%,$(bindir))
John Keeping971f8532013-02-24 19:55:01 +0000543mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
544infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +0000545gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400546localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
John Keeping971f8532013-02-24 19:55:01 +0000547htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
Dan Jacques07d90ea2018-04-10 11:05:43 -0400548perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
John Keeping971f8532013-02-24 19:55:01 +0000549
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000550export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200551
Ævar Arnfjörð Bjarmason6d62c982011-12-20 23:40:47 +0000552CC = cc
Pavel Roskinb05701c2005-08-06 01:36:15 -0400553AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500554RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000555DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700556TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700557FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400558INSTALL = install
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400559TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700560TCLTK_PATH = wish
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +0000561XGETTEXT = xgettext
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100562MSGFMT = msgfmt
Remi Pommarelf8915872015-10-21 19:10:46 +0200563CURL_CONFIG = curl-config
David M. Syzdek158629b2008-11-02 14:43:20 -0900564PTHREAD_LIBS = -lpthread
Gary V. Vaughan48793cf2010-05-14 09:31:34 +0000565PTHREAD_CFLAGS =
Thomas Raste146d172010-07-26 09:43:41 +0200566GCOV = gcov
René Scharfe63f0a752016-09-15 20:30:56 +0200567SPATCH = spatch
Linus Torvaldse83c5162005-04-07 15:13:13 -0700568
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400569export TCL_PATH TCLTK_PATH
570
Ramsay Jones15caca22019-02-05 02:27:48 +0000571# user customisation variable for 'sparse' target
572SPARSE_FLAGS ?=
573# internal/platform customisation variable for 'sparse'
574SP_EXTRA_FLAGS =
575
SZEDER Gáborf57d1172018-07-23 15:50:59 +0200576SPATCH_FLAGS = --all-includes --patch .
Linus Torvalds44c9e852005-07-03 10:02:35 -0700577
Petr Baudis28818ff2005-07-29 17:50:24 +0200578
579
580### --- END CONFIGURATION SECTION ---
581
Petr Baudis8d7f5862006-06-25 03:47:03 +0200582# Those must not be GNU-specific; they are shared with perl/ which may
Petr Baudis18b0fc12006-09-23 20:20:47 +0200583# be built by a different compiler. (Note that this is an artifact now
584# but it still might be nice to keep that distinction.)
Linus Torvalds81b50f32010-02-22 08:42:18 -0800585BASIC_CFLAGS = -I.
Petr Baudis18b0fc12006-09-23 20:20:47 +0200586BASIC_LDFLAGS =
Petr Baudis8d7f5862006-06-25 03:47:03 +0200587
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100588# Guard against environment variables
589BUILTIN_OBJS =
590BUILT_INS =
591COMPAT_CFLAGS =
592COMPAT_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500593XDIFF_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500594VCSSVN_OBJS =
Jeff Kingb8ba6292012-06-20 14:30:56 -0400595GENERATED_H =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500596EXTRA_CPPFLAGS =
Josh Steadmon5e472152018-10-12 17:58:40 -0700597FUZZ_OBJS =
598FUZZ_PROGRAMS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100599LIB_OBJS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600600PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100601PROGRAMS =
602SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100603SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100604SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800605SCRIPT_LIB =
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100606TEST_BUILTINS_OBJS =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600607TEST_PROGRAMS_NEED_X =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100608
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500609# Having this variable in your environment would break pipelines because
610# you cause "cd" to echo its destination to stdout. It can also take
611# scripts to unexpected places. If you like CDPATH, define it for your
612# interactive shell sessions without exporting it.
613unexport CDPATH
614
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700615SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700616SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700617SCRIPT_SH += git-filter-branch.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700618SCRIPT_SH += git-merge-octopus.sh
619SCRIPT_SH += git-merge-one-file.sh
620SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700621SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700622SCRIPT_SH += git-quiltimport.sh
Pratik Karki55071ea2018-08-07 01:16:09 +0545623SCRIPT_SH += git-legacy-rebase.sh
Junio C Hamano709a9572013-04-26 16:30:40 -0700624SCRIPT_SH += git-remote-testgit.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700625SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700626SCRIPT_SH += git-stash.sh
627SCRIPT_SH += git-submodule.sh
628SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200629
Jonathan Nieder46bac902010-01-31 11:46:53 -0800630SCRIPT_LIB += git-mergetool--lib
631SCRIPT_LIB += git-parse-remote
Martin von Zweigbergkfdb76c12011-02-24 22:32:06 -0500632SCRIPT_LIB += git-rebase--am
Pratik Karkic7b64aa2018-08-07 01:16:10 +0545633SCRIPT_LIB += git-rebase--common
Alban Gruinc42abfe2018-05-28 14:34:19 +0200634SCRIPT_LIB += git-rebase--preserve-merges
Martin von Zweigbergkfdb76c12011-02-24 22:32:06 -0500635SCRIPT_LIB += git-rebase--merge
Jonathan Nieder46bac902010-01-31 11:46:53 -0800636SCRIPT_LIB += git-sh-setup
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000637SCRIPT_LIB += git-sh-i18n
Jonathan Nieder46bac902010-01-31 11:46:53 -0800638
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700639SCRIPT_PERL += git-add--interactive.perl
640SCRIPT_PERL += git-archimport.perl
641SCRIPT_PERL += git-cvsexportcommit.perl
642SCRIPT_PERL += git-cvsimport.perl
643SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700644SCRIPT_PERL += git-send-email.perl
645SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700646
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400647SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500648
Felipe Contreras7ded0552013-06-07 17:03:07 -0500649NO_INSTALL += git-remote-testgit
Felipe Contreras416fda62013-05-24 21:41:06 -0500650
Matthieu Moy4c06b412013-02-08 18:31:16 +0100651# Generated files for scripts
652SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
653SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
654SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
655
Felipe Contreras4331ea82013-05-24 21:41:05 -0500656SCRIPT_SH_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_SH_GEN))
657SCRIPT_PERL_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PERL_GEN))
658SCRIPT_PYTHON_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PYTHON_GEN))
659
Matthieu Moy4c06b412013-02-08 18:31:16 +0100660# Individual rules to allow e.g.
661# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
662# from subdirectories like contrib/*/
663.PHONY: build-perl-script build-sh-script build-python-script
664build-perl-script: $(SCRIPT_PERL_GEN)
665build-sh-script: $(SCRIPT_SH_GEN)
666build-python-script: $(SCRIPT_PYTHON_GEN)
667
668.PHONY: install-perl-script install-sh-script install-python-script
Felipe Contreras4331ea82013-05-24 21:41:05 -0500669install-sh-script: $(SCRIPT_SH_INS)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500670 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Felipe Contreras4331ea82013-05-24 21:41:05 -0500671install-perl-script: $(SCRIPT_PERL_INS)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500672 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Felipe Contreras4331ea82013-05-24 21:41:05 -0500673install-python-script: $(SCRIPT_PYTHON_INS)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500674 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100675
676.PHONY: clean-perl-script clean-sh-script clean-python-script
677clean-sh-script:
678 $(RM) $(SCRIPT_SH_GEN)
679clean-perl-script:
680 $(RM) $(SCRIPT_PERL_GEN)
681clean-python-script:
682 $(RM) $(SCRIPT_PYTHON_GEN)
683
Felipe Contreras4331ea82013-05-24 21:41:05 -0500684SCRIPTS = $(SCRIPT_SH_INS) \
685 $(SCRIPT_PERL_INS) \
686 $(SCRIPT_PYTHON_INS) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500687 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100688
Junio C Hamano2f769192010-09-28 16:08:38 -0500689ETAGS_TARGET = TAGS
690
Josh Steadmon5e472152018-10-12 17:58:40 -0700691FUZZ_OBJS += fuzz-pack-headers.o
Josh Steadmon1127a982018-10-12 17:58:41 -0700692FUZZ_OBJS += fuzz-pack-idx.o
Josh Steadmon5e472152018-10-12 17:58:40 -0700693
694# Always build fuzz objects even if not testing, to prevent bit-rot.
695all:: $(FUZZ_OBJS)
696
697FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
698
Junio C Hamano42f77402006-08-15 21:38:07 -0700699# Empty...
700EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100701
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700702# ... and all the rest that could be moved out of bindir to gitexecdir
703PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600704
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700705PROGRAM_OBJS += credential-store.o
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100706PROGRAM_OBJS += daemon.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600707PROGRAM_OBJS += fast-import.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700708PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600709PROGRAM_OBJS += imap-send.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700710PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600711PROGRAM_OBJS += shell.o
Florian Achleitner48ea9f92012-09-19 17:21:16 +0200712PROGRAM_OBJS += remote-testsvn.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600713
Michael Palimakaace5e972012-02-08 21:59:04 +1100714# Binary suffix, set to .exe for Windows builds
715X =
716
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600717PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700718
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100719TEST_BUILTINS_OBJS += test-chmtime.o
Nguyễn Thái Ngọc Duy0e2678a2018-03-24 08:44:34 +0100720TEST_BUILTINS_OBJS += test-config.o
Nguyễn Thái Ngọc Duye4998942018-03-24 08:44:35 +0100721TEST_BUILTINS_OBJS += test-ctype.o
Nguyễn Thái Ngọc Duya801a7c2018-03-24 08:44:36 +0100722TEST_BUILTINS_OBJS += test-date.o
Nguyễn Thái Ngọc Duy9153dde2018-03-24 08:44:37 +0100723TEST_BUILTINS_OBJS += test-delta.o
Nguyễn Thái Ngọc Duy1c854742018-03-24 08:44:38 +0100724TEST_BUILTINS_OBJS += test-drop-caches.o
Nguyễn Thái Ngọc Duy06ccb292018-03-24 08:44:39 +0100725TEST_BUILTINS_OBJS += test-dump-cache-tree.o
Nguyễn Thái Ngọc Duyf1ef0b02018-09-09 19:36:30 +0200726TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
Nguyễn Thái Ngọc Duy81330612018-03-24 08:44:40 +0100727TEST_BUILTINS_OBJS += test-dump-split-index.o
Nguyễn Thái Ngọc Duycd780f02018-09-09 19:36:27 +0200728TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
Nguyễn Thái Ngọc Duydbceb3e2018-03-24 08:44:41 +0100729TEST_BUILTINS_OBJS += test-example-decorate.o
Nguyễn Thái Ngọc Duyc6806682018-03-24 08:44:42 +0100730TEST_BUILTINS_OBJS += test-genrandom.o
Nguyễn Thái Ngọc Duy7c18cbd2018-03-24 08:44:43 +0100731TEST_BUILTINS_OBJS += test-hashmap.o
Nguyễn Thái Ngọc Duycc6f6632018-03-24 08:44:44 +0100732TEST_BUILTINS_OBJS += test-index-version.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000733TEST_BUILTINS_OBJS += test-json-writer.o
Nguyễn Thái Ngọc Duy64eb82f2018-03-24 08:44:33 +0100734TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
Nguyễn Thái Ngọc Duy9080e752018-03-24 08:44:45 +0100735TEST_BUILTINS_OBJS += test-match-trees.o
Nguyễn Thái Ngọc Duy34889d32018-03-24 08:44:46 +0100736TEST_BUILTINS_OBJS += test-mergesort.o
Nguyễn Thái Ngọc Duyd9cc2c82018-03-24 08:44:47 +0100737TEST_BUILTINS_OBJS += test-mktemp.o
Nguyễn Thái Ngọc Duyc033cc12018-03-24 08:44:48 +0100738TEST_BUILTINS_OBJS += test-online-cpus.o
Nguyễn Thái Ngọc Duy2f17c782018-09-09 19:36:29 +0200739TEST_BUILTINS_OBJS += test-parse-options.o
Nguyễn Thái Ngọc Duyb8d5cf42018-03-24 08:44:49 +0100740TEST_BUILTINS_OBJS += test-path-utils.o
Nguyễn Thái Ngọc Duy8ea40cc2018-09-09 19:36:28 +0200741TEST_BUILTINS_OBJS += test-pkt-line.o
Nguyễn Thái Ngọc Duy15b75812018-03-24 08:44:50 +0100742TEST_BUILTINS_OBJS += test-prio-queue.o
Derrick Stoleeab176ac2018-07-20 16:33:15 +0000743TEST_BUILTINS_OBJS += test-reach.o
Nguyễn Thái Ngọc Duy5fbe6002018-03-24 08:44:51 +0100744TEST_BUILTINS_OBJS += test-read-cache.o
Derrick Stolee4d805602018-07-12 15:39:23 -0400745TEST_BUILTINS_OBJS += test-read-midx.o
Nguyễn Thái Ngọc Duy65370d82018-03-24 08:44:52 +0100746TEST_BUILTINS_OBJS += test-ref-store.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
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +0100752TEST_BUILTINS_OBJS += test-sha1.o
Nguyễn Thái Ngọc Duya0fe6e62018-09-09 19:36:26 +0200753TEST_BUILTINS_OBJS += test-sha1-array.o
Nguyễn Thái Ngọc Duye154a6f2018-03-24 08:44:58 +0100754TEST_BUILTINS_OBJS += test-sigchain.o
Nguyễn Thái Ngọc Duy1a5f3d72018-03-24 08:44:59 +0100755TEST_BUILTINS_OBJS += test-strcmp-offset.o
Nguyễn Thái Ngọc Duyc932a5f2018-03-24 08:45:00 +0100756TEST_BUILTINS_OBJS += test-string-list.o
Nguyễn Thái Ngọc Duyb6188212018-03-24 08:45:01 +0100757TEST_BUILTINS_OBJS += test-submodule-config.o
Antonio Ospite2b1257e2018-10-25 18:18:13 +0200758TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
Nguyễn Thái Ngọc Duy112edd62018-03-24 08:45:02 +0100759TEST_BUILTINS_OBJS += test-subprocess.o
Nguyễn Thái Ngọc Duy599fbd82018-03-24 08:45:03 +0100760TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
Nguyễn Thái Ngọc Duy04892892018-03-24 08:45:04 +0100761TEST_BUILTINS_OBJS += test-wildmatch.o
Jeff Hostetler06ba9d02018-09-11 13:06:01 -0700762TEST_BUILTINS_OBJS += test-windows-named-pipe.o
Nguyễn Thái Ngọc Duyc81f8432018-03-24 08:45:05 +0100763TEST_BUILTINS_OBJS += test-write-cache.o
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100764
Nguyễn Thái Ngọc Duyc9a1f412018-09-09 19:36:31 +0200765# Do not add more tests here unless they have extra dependencies. Add
766# them in TEST_BUILTINS_OBJS above.
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100767TEST_PROGRAMS_NEED_X += test-fake-ssh
David Barr3bbaec02010-08-09 17:39:43 -0500768TEST_PROGRAMS_NEED_X += test-line-buffer
David Barr21746aa2010-08-09 17:55:00 -0500769TEST_PROGRAMS_NEED_X += test-svn-fe
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100770TEST_PROGRAMS_NEED_X += test-tool
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600771
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700772TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100773
Junio C Hamano17368552008-02-23 11:08:25 -0800774# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800775# builtin/$C.o but is linked in as part of some other command.
776BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700777
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700778BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100779BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700780BUILT_INS += git-format-patch$X
781BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700782BUILT_INS += git-init$X
783BUILT_INS += git-merge-subtree$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700784BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800785BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700786BUILT_INS += git-status$X
787BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700788
Junio C Hamanoad17f012009-08-07 12:09:29 -0700789# what 'all' will build and 'install' will install in gitexecdir,
790# excluding programs for built-in commands
Junio C Hamano6506e152007-02-06 21:27:09 -0800791ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
Linus Torvaldse83c5162005-04-07 15:13:13 -0700792
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700793# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400794OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700795
Matthew Ogilvieea925192009-12-02 22:14:05 -0700796# what test wrappers are needed and 'install' will install, in bindir
797BINDIR_PROGRAMS_NEED_X += git
798BINDIR_PROGRAMS_NEED_X += git-upload-pack
799BINDIR_PROGRAMS_NEED_X += git-receive-pack
800BINDIR_PROGRAMS_NEED_X += git-upload-archive
801BINDIR_PROGRAMS_NEED_X += git-shell
802
803BINDIR_PROGRAMS_NO_X += git-cvsserver
804
Ryan Anderson3d320512005-11-21 00:11:22 -0500805# Set paths to tools early so that they can be used for version tests.
806ifndef SHELL_PATH
807 SHELL_PATH = /bin/sh
808endif
809ifndef PERL_PATH
810 PERL_PATH = /usr/bin/perl
811endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100812ifndef PYTHON_PATH
813 PYTHON_PATH = /usr/bin/python
814endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700815
Luben Tuikov3a793472006-12-14 23:03:03 -0800816export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100817export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800818
Jeff King3f824e92017-12-08 05:47:22 -0500819TEST_SHELL_PATH = $(SHELL_PATH)
820
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100821LIB_FILE = libgit.a
822XDIFF_LIB = xdiff/lib.a
823VCSSVN_LIB = vcs-svn/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700824
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +0200825GENERATED_H += command-list.h
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700826
Jeff Kingd85b0df2014-08-25 16:00:42 -0400827LIB_H = $(shell $(FIND) . \
828 -name .git -prune -o \
829 -name t -prune -o \
830 -name Documentation -prune -o \
831 -name '*.h' -print)
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700832
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400833LIB_OBJS += abspath.o
Jeff King75194432009-09-09 07:38:58 -0400834LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700835LIB_OBJS += alias.o
836LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200837LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700838LIB_OBJS += archive.o
839LIB_OBJS += archive-tar.o
840LIB_OBJS += archive-zip.o
Jeff Kingc1189ca2011-09-13 17:57:57 -0400841LIB_OBJS += argv-array.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700842LIB_OBJS += attr.o
843LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100844LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500845LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700846LIB_OBJS += blob.o
847LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700848LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700849LIB_OBJS += bundle.o
850LIB_OBJS += cache-tree.o
Jeff King2b5ed372018-03-30 14:35:04 -0400851LIB_OBJS += chdir-notify.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000852LIB_OBJS += checkout.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700853LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700854LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700855LIB_OBJS += combine-diff.o
856LIB_OBJS += commit.o
Derrick Stolee08fd81c2018-04-02 16:34:19 -0400857LIB_OBJS += commit-graph.o
Derrick Stolee5227c382018-07-20 16:33:02 +0000858LIB_OBJS += commit-reach.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200859LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500860LIB_OBJS += compat/terminal.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700861LIB_OBJS += config.o
862LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700863LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700864LIB_OBJS += convert.o
865LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500866LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700867LIB_OBJS += csum-file.o
868LIB_OBJS += ctype.o
869LIB_OBJS += date.o
870LIB_OBJS += decorate.o
Jeff Kingc8d521f2018-08-16 08:13:07 +0200871LIB_OBJS += delta-islands.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700872LIB_OBJS += diffcore-break.o
873LIB_OBJS += diffcore-delta.o
874LIB_OBJS += diffcore-order.o
875LIB_OBJS += diffcore-pickaxe.o
876LIB_OBJS += diffcore-rename.o
877LIB_OBJS += diff-delta.o
878LIB_OBJS += diff-lib.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100879LIB_OBJS += diff-no-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700880LIB_OBJS += diff.o
881LIB_OBJS += dir.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200882LIB_OBJS += dir-iterator.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200883LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700884LIB_OBJS += entry.o
885LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500886LIB_OBJS += ewah/bitmap.o
887LIB_OBJS += ewah/ewah_bitmap.o
888LIB_OBJS += ewah/ewah_io.o
889LIB_OBJS += ewah/ewah_rlw.o
Stefan Bellerd807c4a2018-04-10 14:26:18 -0700890LIB_OBJS += exec-cmd.o
Jonathan Tanec062832018-06-14 15:54:28 -0700891LIB_OBJS += fetch-negotiator.o
Jonathan Tan88e2f9e2017-12-05 16:58:49 +0000892LIB_OBJS += fetch-object.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700893LIB_OBJS += fetch-pack.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700894LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400895LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100896LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700897LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700898LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700899LIB_OBJS += grep.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100900LIB_OBJS += hashmap.o
Johannes Schindelin22d87332018-08-13 04:33:00 -0700901LIB_OBJS += linear-assignment.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700902LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800903LIB_OBJS += hex.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700904LIB_OBJS += ident.o
Eric Sunshine126facf2018-07-22 05:57:05 -0400905LIB_OBJS += interdiff.o
Jeff Hostetler75459412018-07-13 16:54:08 +0000906LIB_OBJS += json-writer.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200907LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200908LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100909LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100910LIB_OBJS += line-range.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700911LIB_OBJS += list-objects.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000912LIB_OBJS += list-objects-filter.o
913LIB_OBJS += list-objects-filter-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700914LIB_OBJS += ll-merge.o
915LIB_OBJS += lockfile.o
916LIB_OBJS += log-tree.o
Brandon Williams72d0ea02018-03-15 10:31:20 -0700917LIB_OBJS += ls-refs.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700918LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700919LIB_OBJS += mailmap.o
920LIB_OBJS += match-trees.o
Jameson Miller065feab2018-04-11 18:37:55 +0000921LIB_OBJS += mem-pool.o
Nguyễn Thái Ngọc Duydb699a82012-10-26 22:53:49 +0700922LIB_OBJS += merge.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800923LIB_OBJS += merge-blobs.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200924LIB_OBJS += merge-recursive.o
René Scharfe0db71e02012-04-01 00:10:11 +0200925LIB_OBJS += mergesort.o
Derrick Stoleea3407732018-07-12 15:39:21 -0400926LIB_OBJS += midx.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700927LIB_OBJS += name-hash.o
Jonathan Tanec062832018-06-14 15:54:28 -0700928LIB_OBJS += negotiator/default.o
Jonathan Tan42cc7482018-07-16 11:44:01 -0700929LIB_OBJS += negotiator/skipping.o
Johannes Schindelina97a7462009-10-09 12:21:57 +0200930LIB_OBJS += notes.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400931LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100932LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200933LIB_OBJS += notes-utils.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700934LIB_OBJS += object.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700935LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500936LIB_OBJS += oidset.o
Jonathan Tan4f39cd82017-08-18 15:20:16 -0700937LIB_OBJS += packfile.o
Vicent Martifff42752013-12-21 09:00:01 -0500938LIB_OBJS += pack-bitmap.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500939LIB_OBJS += pack-bitmap-write.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700940LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400941LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700942LIB_OBJS += pack-revindex.o
943LIB_OBJS += pack-write.o
944LIB_OBJS += pager.o
945LIB_OBJS += parse-options.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600946LIB_OBJS += parse-options-cb.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700947LIB_OBJS += patch-delta.o
948LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700949LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000950LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700951LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100952LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700953LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700954LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700955LIB_OBJS += progress.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500956LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700957LIB_OBJS += protocol.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700958LIB_OBJS += quote.o
Johannes Schindelind9c66f02018-08-13 04:33:04 -0700959LIB_OBJS += range-diff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700960LIB_OBJS += reachable.o
961LIB_OBJS += read-cache.o
Alban Gruin145e05a2018-08-10 18:51:29 +0200962LIB_OBJS += rebase-interactive.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700963LIB_OBJS += reflog-walk.o
964LIB_OBJS += refs.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100965LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200966LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200967LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200968LIB_OBJS += refs/ref-cache.o
Brandon Williamsec0cb492018-05-16 15:57:48 -0700969LIB_OBJS += refspec.o
Karthik Nayakc95b7582015-06-14 01:07:27 +0530970LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700971LIB_OBJS += remote.o
Stefan Beller11bc0582018-04-10 14:26:21 -0700972LIB_OBJS += replace-object.o
Brandon Williams359efef2017-06-22 11:43:32 -0700973LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200974LIB_OBJS += rerere.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800975LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700976LIB_OBJS += revision.o
977LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +0700978LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700979LIB_OBJS += sequencer.o
Brandon Williamsed10cb92018-03-15 10:31:19 -0700980LIB_OBJS += serve.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700981LIB_OBJS += server-info.o
982LIB_OBJS += setup.o
Jeff King902bb362011-05-19 17:34:33 -0400983LIB_OBJS += sha1-array.o
Junio C Hamano628522e2007-12-29 02:05:47 -0800984LIB_OBJS += sha1-lookup.o
Stefan Bellerfc1395f2018-04-10 14:26:20 -0700985LIB_OBJS += sha1-file.o
Stefan Bellere5e5e0882018-04-10 14:26:19 -0700986LIB_OBJS += sha1-name.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700987LIB_OBJS += shallow.o
988LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -0500989LIB_OBJS += sigchain.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +0700990LIB_OBJS += split-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700991LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -0700992LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100993LIB_OBJS += string-list.o
Johannes Schindelin752c0c22009-10-19 14:38:32 +0200994LIB_OBJS += submodule.o
Heiko Voigt959b5452015-08-17 17:21:57 -0700995LIB_OBJS += submodule-config.o
Ben Peart99605d62017-05-05 11:28:01 -0400996LIB_OBJS += sub-process.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700997LIB_OBJS += symlinks.o
998LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +0200999LIB_OBJS += tempfile.o
Nguyễn Thái Ngọc Duy0ec79352018-10-27 19:29:59 +02001000LIB_OBJS += thread-utils.o
Jeff King2564d992016-10-03 16:49:11 -04001001LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001002LIB_OBJS += trace.o
Christian Couder9385b5d2014-10-13 20:16:23 +02001003LIB_OBJS += trailer.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001004LIB_OBJS += transport.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -04001005LIB_OBJS += transport-helper.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001006LIB_OBJS += tree-diff.o
1007LIB_OBJS += tree.o
1008LIB_OBJS += tree-walk.o
1009LIB_OBJS += unpack-trees.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001010LIB_OBJS += upload-pack.o
Jeff King638794c2010-05-23 05:17:55 -04001011LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -07001012LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001013LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +01001014LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001015LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -07001016LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -04001017LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +07001018LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001019LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +07001020LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -04001021LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -07001022LIB_OBJS += wrapper.o
Stefan Bellerfa2656f2018-04-10 14:26:16 -07001023LIB_OBJS += write-or-die.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -07001024LIB_OBJS += ws.o
1025LIB_OBJS += wt-status.o
1026LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -05001027LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +02001028
Linus Torvalds81b50f32010-02-22 08:42:18 -08001029BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +08001030BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001031BUILTIN_OBJS += builtin/annotate.o
1032BUILTIN_OBJS += builtin/apply.o
1033BUILTIN_OBJS += builtin/archive.o
1034BUILTIN_OBJS += builtin/bisect--helper.o
1035BUILTIN_OBJS += builtin/blame.o
1036BUILTIN_OBJS += builtin/branch.o
1037BUILTIN_OBJS += builtin/bundle.o
1038BUILTIN_OBJS += builtin/cat-file.o
1039BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +00001040BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -04001041BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001042BUILTIN_OBJS += builtin/check-ref-format.o
1043BUILTIN_OBJS += builtin/checkout-index.o
1044BUILTIN_OBJS += builtin/checkout.o
1045BUILTIN_OBJS += builtin/clean.o
1046BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +07001047BUILTIN_OBJS += builtin/column.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001048BUILTIN_OBJS += builtin/commit-tree.o
1049BUILTIN_OBJS += builtin/commit.o
Derrick Stolee4ce58ee2018-04-02 16:34:18 -04001050BUILTIN_OBJS += builtin/commit-graph.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001051BUILTIN_OBJS += builtin/config.o
1052BUILTIN_OBJS += builtin/count-objects.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +02001053BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001054BUILTIN_OBJS += builtin/describe.o
1055BUILTIN_OBJS += builtin/diff-files.o
1056BUILTIN_OBJS += builtin/diff-index.o
1057BUILTIN_OBJS += builtin/diff-tree.o
1058BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +01001059BUILTIN_OBJS += builtin/difftool.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001060BUILTIN_OBJS += builtin/fast-export.o
1061BUILTIN_OBJS += builtin/fetch-pack.o
1062BUILTIN_OBJS += builtin/fetch.o
1063BUILTIN_OBJS += builtin/fmt-merge-msg.o
1064BUILTIN_OBJS += builtin/for-each-ref.o
1065BUILTIN_OBJS += builtin/fsck.o
1066BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -08001067BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001068BUILTIN_OBJS += builtin/grep.o
1069BUILTIN_OBJS += builtin/hash-object.o
1070BUILTIN_OBJS += builtin/help.o
1071BUILTIN_OBJS += builtin/index-pack.o
1072BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +02001073BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001074BUILTIN_OBJS += builtin/log.o
1075BUILTIN_OBJS += builtin/ls-files.o
1076BUILTIN_OBJS += builtin/ls-remote.o
1077BUILTIN_OBJS += builtin/ls-tree.o
1078BUILTIN_OBJS += builtin/mailinfo.o
1079BUILTIN_OBJS += builtin/mailsplit.o
1080BUILTIN_OBJS += builtin/merge.o
1081BUILTIN_OBJS += builtin/merge-base.o
1082BUILTIN_OBJS += builtin/merge-file.o
1083BUILTIN_OBJS += builtin/merge-index.o
1084BUILTIN_OBJS += builtin/merge-ours.o
1085BUILTIN_OBJS += builtin/merge-recursive.o
1086BUILTIN_OBJS += builtin/merge-tree.o
1087BUILTIN_OBJS += builtin/mktag.o
1088BUILTIN_OBJS += builtin/mktree.o
Derrick Stolee6a257f02018-07-12 15:39:20 -04001089BUILTIN_OBJS += builtin/multi-pack-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001090BUILTIN_OBJS += builtin/mv.o
1091BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -07001092BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001093BUILTIN_OBJS += builtin/pack-objects.o
1094BUILTIN_OBJS += builtin/pack-redundant.o
1095BUILTIN_OBJS += builtin/pack-refs.o
1096BUILTIN_OBJS += builtin/patch-id.o
1097BUILTIN_OBJS += builtin/prune-packed.o
1098BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001099BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001100BUILTIN_OBJS += builtin/push.o
Johannes Schindelin348ae562018-08-13 04:33:02 -07001101BUILTIN_OBJS += builtin/range-diff.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001102BUILTIN_OBJS += builtin/read-tree.o
Pratik Karki55071ea2018-08-07 01:16:09 +05451103BUILTIN_OBJS += builtin/rebase.o
Alban Gruincf808202018-09-27 23:56:09 +02001104BUILTIN_OBJS += builtin/rebase--interactive.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001105BUILTIN_OBJS += builtin/receive-pack.o
1106BUILTIN_OBJS += builtin/reflog.o
1107BUILTIN_OBJS += builtin/remote.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001108BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001109BUILTIN_OBJS += builtin/remote-fd.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001110BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001111BUILTIN_OBJS += builtin/replace.o
1112BUILTIN_OBJS += builtin/rerere.o
1113BUILTIN_OBJS += builtin/reset.o
1114BUILTIN_OBJS += builtin/rev-list.o
1115BUILTIN_OBJS += builtin/rev-parse.o
1116BUILTIN_OBJS += builtin/revert.o
1117BUILTIN_OBJS += builtin/rm.o
1118BUILTIN_OBJS += builtin/send-pack.o
Brandon Williamsed10cb92018-03-15 10:31:19 -07001119BUILTIN_OBJS += builtin/serve.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001120BUILTIN_OBJS += builtin/shortlog.o
1121BUILTIN_OBJS += builtin/show-branch.o
Jeff Kingff417262018-05-28 05:38:53 -04001122BUILTIN_OBJS += builtin/show-index.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001123BUILTIN_OBJS += builtin/show-ref.o
1124BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001125BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001126BUILTIN_OBJS += builtin/symbolic-ref.o
1127BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001128BUILTIN_OBJS += builtin/unpack-file.o
1129BUILTIN_OBJS += builtin/unpack-objects.o
1130BUILTIN_OBJS += builtin/update-index.o
1131BUILTIN_OBJS += builtin/update-ref.o
1132BUILTIN_OBJS += builtin/update-server-info.o
1133BUILTIN_OBJS += builtin/upload-archive.o
Brandon Williamsa3d6b532018-03-14 11:31:41 -07001134BUILTIN_OBJS += builtin/upload-pack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001135BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001136BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001137BUILTIN_OBJS += builtin/verify-pack.o
1138BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001139BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001140BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001141
Jeff King3f2e2292016-07-01 01:58:58 -04001142GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +02001143EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001144
Jeff King42dcbb72012-06-02 15:01:12 -04001145GIT_USER_AGENT = git/$(GIT_VERSION)
1146
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001147ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1148DC_SHA1_SUBMODULE = auto
1149endif
1150
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001151include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001152-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001153-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001154
Matthieu Moyd6156282016-05-31 15:24:43 +02001155ifdef DEVELOPER
Nguyễn Thái Ngọc Duy1da15802018-04-14 19:19:44 +00001156include config.mak.dev
Matthieu Moyd6156282016-05-31 15:24:43 +02001157endif
1158
René Scharfe425ca672017-07-15 19:18:56 +02001159comma := ,
1160empty :=
1161space := $(empty) $(empty)
1162
Jeff King56b5db32017-07-10 09:24:42 -04001163ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001164SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001165BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001166BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001167ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King566cf0b2017-07-10 09:24:50 -04001168BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
1169endif
Jeff King0e5bba52017-09-08 02:38:41 -04001170ifneq ($(filter leak,$(SANITIZERS)),)
1171BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
1172endif
Jeff King56b5db32017-07-10 09:24:42 -04001173endif
1174
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001175ifndef sysconfdir
1176ifeq ($(prefix),/usr)
1177sysconfdir = /etc
1178else
1179sysconfdir = etc
1180endif
1181endif
1182
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001183ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001184COMPUTE_HEADER_DEPENDENCIES = auto
1185endif
1186
1187ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001188dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Jonathan Nieder69789342011-11-18 17:23:24 -06001189 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1190 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001191 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001192ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001193override COMPUTE_HEADER_DEPENDENCIES = yes
1194else
1195override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001196endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001197endif
1198
Jonathan Nieder024c8432011-11-18 03:58:21 -06001199ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001200USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001201else
1202ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1203$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1204(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1205endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001206endif
1207
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001208ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001209SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
1210BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001211PATH := $(SANE_TOOL_PATH):${PATH}
1212else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001213BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001214endif
1215
Eric Sunshineb2289402017-12-15 00:34:34 +01001216ifeq (,$(HOST_CPU))
1217 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1218else
1219 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1220endif
1221
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001222ifneq (,$(INLINE))
1223 BASIC_CFLAGS += -Dinline=$(INLINE)
1224endif
1225
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001226ifneq (,$(SOCKLEN_T))
1227 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1228endif
1229
Kyle J. McKay290c8e72015-01-11 12:09:22 -08001230ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
1231 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
1232else
1233ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
1234 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
1235endif
1236endif
1237
Brian Gernhardt59f86742006-12-12 12:01:47 -05001238ifeq ($(uname_S),Darwin)
1239 ifndef NO_FINK
1240 ifeq ($(shell test -d /sw/lib && echo y),y)
1241 BASIC_CFLAGS += -I/sw/include
1242 BASIC_LDFLAGS += -L/sw/lib
1243 endif
1244 endif
1245 ifndef NO_DARWIN_PORTS
1246 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1247 BASIC_CFLAGS += -I/opt/local/include
1248 BASIC_LDFLAGS += -L/opt/local/lib
1249 endif
1250 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001251 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001252 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001253 APPLE_COMMON_CRYPTO = YesPlease
1254 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1255 endif
David Aguilar29de2052013-05-11 01:22:26 -07001256 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001257 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001258endif
1259
Junio C Hamanof5b904d2008-08-16 21:56:24 -07001260ifndef CC_LD_DYNPATH
1261 ifdef NO_R_TO_GCC_LINKER
1262 # Some gcc does not accept and pass -R to the linker to specify
1263 # the runtime dynamic library path.
1264 CC_LD_DYNPATH = -Wl,-rpath,
1265 else
1266 CC_LD_DYNPATH = -R
1267 endif
Junio C Hamanobbfc63d2006-12-27 14:17:35 -08001268endif
1269
David Aguilare1c06882009-05-31 01:35:51 -07001270ifdef NO_LIBGEN_H
1271 COMPAT_CFLAGS += -DNO_LIBGEN_H
1272 COMPAT_OBJS += compat/basename.o
1273endif
1274
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001275USE_LIBPCRE2 ?= $(USE_LIBPCRE)
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001276
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001277ifneq (,$(USE_LIBPCRE2))
1278 ifdef USE_LIBPCRE1
1279$(error Only set USE_LIBPCRE2 (or its alias USE_LIBPCRE) or USE_LIBPCRE1, not both!)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001280 endif
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001281
Ævar Arnfjörð Bjarmasone6c531b2018-03-11 13:26:09 +00001282 BASIC_CFLAGS += -DUSE_LIBPCRE2
1283 EXTLIBS += -lpcre2-8
1284endif
1285
1286ifdef USE_LIBPCRE1
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001287 BASIC_CFLAGS += -DUSE_LIBPCRE1
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001288 EXTLIBS += -lpcre
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00001289
1290ifdef NO_LIBPCRE1_JIT
1291 BASIC_CFLAGS += -DNO_LIBPCRE1_JIT
1292endif
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001293endif
1294
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001295ifdef LIBPCREDIR
1296 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1297 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001298endif
1299
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001300ifdef HAVE_ALLOCA_H
1301 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1302endif
1303
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001304IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001305IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001306
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001307ifdef NO_CURL
1308 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001309 REMOTE_CURL_PRIMARY =
1310 REMOTE_CURL_ALIASES =
1311 REMOTE_CURL_NAMES =
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001312else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001313 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001314 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
1315 BASIC_CFLAGS += -I$(CURLDIR)/include
James Knight23c4bbe2018-11-03 05:12:11 +00001316 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001317 else
James Knight23c4bbe2018-11-03 05:12:11 +00001318 CURL_LIBCURL =
Junio C Hamanob2feb642014-04-30 10:58:10 -07001319 endif
James Knight23c4bbe2018-11-03 05:12:11 +00001320
1321ifdef CURL_LDFLAGS
1322 CURL_LIBCURL += $(CURL_LDFLAGS)
1323else
1324 CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs)
1325endif
Thomas Cortbc5f8132011-07-19 18:55:47 -04001326
Johannes Sixt4256f362010-01-19 16:39:12 +01001327 REMOTE_CURL_PRIMARY = git-remote-http$X
1328 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1329 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001330 PROGRAM_OBJS += http-fetch.o
1331 PROGRAMS += $(REMOTE_CURL_NAMES)
Remi Pommarelf8915872015-10-21 19:10:46 +02001332 curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
Nick Hengeveld08900982005-11-18 17:08:36 -08001333 ifeq "$(curl_check)" "070908"
1334 ifndef NO_EXPAT
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001335 PROGRAM_OBJS += http-push.o
Nick Hengeveld08900982005-11-18 17:08:36 -08001336 endif
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001337 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001338 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 +01001339 ifeq "$(curl_check)" "072200"
1340 USE_CURL_FOR_IMAP_SEND = YesPlease
1341 endif
1342 ifdef USE_CURL_FOR_IMAP_SEND
1343 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1344 IMAP_SEND_BUILDDEPS = http.o
1345 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1346 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001347 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001348 ifdef EXPATDIR
1349 BASIC_CFLAGS += -I$(EXPATDIR)/include
1350 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1351 else
1352 EXPAT_LIBEXPAT = -lexpat
1353 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001354 ifdef EXPAT_NEEDS_XMLPARSE_H
1355 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1356 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001357 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001358endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001359IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001360
Robert Schielebef19da2007-07-29 20:35:45 +02001361ifdef ZLIB_PATH
1362 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001363 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001364endif
1365EXTLIBS += -lz
1366
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001367ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001368 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001369 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001370 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001371 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001372 else
1373 OPENSSL_LINK =
1374 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001375 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001376 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001377 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001378else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001379 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001380 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001381endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001382ifdef NO_OPENSSL
1383 LIB_4_CRYPTO =
1384else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001385ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001386 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001387else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001388 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001389endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001390ifdef APPLE_COMMON_CRYPTO
1391 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1392endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001393endif
Eric Sunshinefdb1fbb2018-06-14 22:25:03 -04001394ifndef NO_ICONV
1395 ifdef NEEDS_LIBICONV
1396 ifdef ICONVDIR
1397 BASIC_CFLAGS += -I$(ICONVDIR)/include
1398 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1399 else
1400 ICONV_LINK =
1401 endif
1402 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1403 ICONV_LINK += -lintl
1404 endif
1405 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano455a7f32005-09-30 13:31:16 -07001406 endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001407endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001408ifdef NEEDS_LIBGEN
1409 EXTLIBS += -lgen
1410endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001411ifndef NO_GETTEXT
1412ifndef LIBC_CONTAINS_LIBINTL
1413 EXTLIBS += -lintl
1414endif
1415endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001416ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001417 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001418endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001419ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001420 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001421endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001422ifdef NEEDS_RESOLV
1423 EXTLIBS += -lresolv
1424endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001425ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001426 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001427endif
David Michael110d6982012-12-14 14:56:59 -05001428ifdef NO_GECOS_IN_PWENT
1429 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1430endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001431ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1432 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1433endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001434ifdef USE_NSEC
1435 BASIC_CFLAGS += -DUSE_NSEC
1436endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001437ifdef USE_ST_TIMESPEC
1438 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1439endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001440ifdef NO_NORETURN
1441 BASIC_CFLAGS += -DNO_NORETURN
1442endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001443ifdef NO_NSEC
1444 BASIC_CFLAGS += -DNO_NSEC
1445endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001446ifdef SNPRINTF_RETURNS_BOGUS
1447 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1448 COMPAT_OBJS += compat/snprintf.o
1449endif
Brandon Caseycba22522008-02-08 20:32:47 -06001450ifdef FREAD_READS_DIRECTORIES
1451 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1452 COMPAT_OBJS += compat/fopen.o
1453endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001454ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001455 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001456endif
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +00001457ifdef GETTEXT_POISON
Junio C Hamanoc6a9a302018-11-08 21:15:30 +00001458$(warning The GETTEXT_POISON option has been removed in favor of runtime GIT_TEST_GETTEXT_POISON. See t/README!)
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +00001459endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001460ifdef NO_GETTEXT
1461 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001462 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001463endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001464ifdef NO_POLL
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001465 NO_POLL_H = YesPlease
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001466 NO_SYS_POLL_H = YesPlease
1467 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1468 COMPAT_OBJS += compat/poll/poll.o
1469endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001470ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001471 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001472 COMPAT_OBJS += compat/strcasestr.o
1473endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001474ifdef NO_STRLCPY
1475 COMPAT_CFLAGS += -DNO_STRLCPY
1476 COMPAT_OBJS += compat/strlcpy.o
1477endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001478ifdef NO_STRTOUMAX
1479 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001480 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001481endif
1482ifdef NO_STRTOULL
1483 COMPAT_CFLAGS += -DNO_STRTOULL
1484endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001485ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001486 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001487 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001488endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001489ifdef NO_MKDTEMP
1490 COMPAT_CFLAGS += -DNO_MKDTEMP
1491 COMPAT_OBJS += compat/mkdtemp.o
1492endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001493ifdef MKDIR_WO_TRAILING_SLASH
1494 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1495 COMPAT_OBJS += compat/mkdir.o
1496endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001497ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001498 COMPAT_CFLAGS += -DNO_UNSETENV
1499 COMPAT_OBJS += compat/unsetenv.o
1500endif
Robert Schiele26009732008-01-24 19:34:46 +01001501ifdef NO_SYS_SELECT_H
1502 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1503endif
Đoàn Trần Công Danh2648ccc2018-11-14 08:10:43 +07001504ifdef NO_POLL_H
1505 BASIC_CFLAGS += -DNO_POLL_H
1506endif
Markus Duft28449232010-10-27 10:39:52 +02001507ifdef NO_SYS_POLL_H
1508 BASIC_CFLAGS += -DNO_SYS_POLL_H
1509endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001510ifdef NEEDS_SYS_PARAM_H
1511 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001512endif
Markus Duft28449232010-10-27 10:39:52 +02001513ifdef NO_INTTYPES_H
1514 BASIC_CFLAGS += -DNO_INTTYPES_H
1515endif
1516ifdef NO_INITGROUPS
1517 BASIC_CFLAGS += -DNO_INITGROUPS
1518endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001519ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001520 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001521 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001522else
1523 ifdef USE_WIN32_MMAP
1524 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1525 COMPAT_OBJS += compat/win32mmap.o
1526 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001527endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001528ifdef MMAP_PREVENTS_DELETE
1529 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1530endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001531ifdef OBJECT_CREATION_USES_RENAMES
1532 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001533endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001534ifdef NO_STRUCT_ITIMERVAL
1535 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001536 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001537endif
1538ifdef NO_SETITIMER
1539 COMPAT_CFLAGS += -DNO_SETITIMER
1540endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001541ifdef NO_PREAD
1542 COMPAT_CFLAGS += -DNO_PREAD
1543 COMPAT_OBJS += compat/pread.o
1544endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001545ifdef NO_FAST_WORKING_DIRECTORY
1546 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1547endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001548ifdef NO_TRUSTABLE_FILEMODE
1549 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1550endif
David Michaeld543d9c2014-12-03 21:24:17 -05001551ifdef NEEDS_MODE_TRANSLATION
1552 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1553 COMPAT_OBJS += compat/stat.o
1554endif
hpa49744d62005-09-28 16:52:21 -07001555ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001556 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001557endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001558ifdef NO_INTPTR_T
1559 COMPAT_CFLAGS += -DNO_INTPTR_T
1560endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001561ifdef NO_UINTMAX_T
1562 BASIC_CFLAGS += -Duintmax_t=uint32_t
1563endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001564ifdef NO_SOCKADDR_STORAGE
1565ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001566 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001567else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001568 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001569endif
hpa49744d62005-09-28 16:52:21 -07001570endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001571ifdef NO_INET_NTOP
1572 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001573 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001574endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001575ifdef NO_INET_PTON
1576 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001577 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001578endif
Johannes Sixt63203582011-12-12 22:12:56 +01001579ifndef NO_UNIX_SOCKETS
1580 LIB_OBJS += unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001581 PROGRAM_OBJS += credential-cache.o
1582 PROGRAM_OBJS += credential-cache--daemon.o
1583endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001584
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001585ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001586 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001587endif
1588
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001589ifdef OLD_ICONV
1590 BASIC_CFLAGS += -DOLD_ICONV
1591endif
1592
David Symonds609a2282007-11-07 14:24:28 +11001593ifdef NO_DEFLATE_BOUND
1594 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1595endif
1596
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001597ifdef NO_POSIX_GOODIES
1598 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1599endif
1600
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001601ifdef APPLE_COMMON_CRYPTO
1602 # Apple CommonCrypto requires chunking
1603 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1604endif
1605
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001606ifdef OPENSSL_SHA1
1607 EXTLIBS += $(LIB_4_CRYPTO)
1608 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001609else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001610ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001611 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001612 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001613else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001614ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001615 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001616 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001617else
David Aguilar61067952013-05-19 06:23:35 -04001618ifdef APPLE_COMMON_CRYPTO
1619 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001620 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001621else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001622 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001623 BASIC_CFLAGS += -DSHA1_DC
1624 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001625ifdef DC_SHA1_EXTERNAL
1626 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001627 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001628$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001629 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001630 endif
1631 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1632 EXTLIBS += -lsha1detectcoll
1633else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001634ifdef DC_SHA1_SUBMODULE
1635 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1636 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1637 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1638else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001639 LIB_OBJS += sha1dc/sha1.o
1640 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001641endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001642 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001643 -DSHA1DC_NO_STANDARD_INCLUDES \
1644 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1645 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001646 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001647endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001648endif
1649endif
David Aguilar61067952013-05-19 06:23:35 -04001650endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001651endif
David Aguilar61067952013-05-19 06:23:35 -04001652
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001653ifdef SHA1_MAX_BLOCK_SIZE
1654 LIB_OBJS += compat/sha1-chunked.o
1655 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1656endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001657ifdef NO_HSTRERROR
1658 COMPAT_CFLAGS += -DNO_HSTRERROR
1659 COMPAT_OBJS += compat/hstrerror.o
1660endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001661ifdef NO_MEMMEM
1662 COMPAT_CFLAGS += -DNO_MEMMEM
1663 COMPAT_OBJS += compat/memmem.o
1664endif
Matt Kraai40036be2012-12-18 14:03:55 -08001665ifdef NO_GETPAGESIZE
1666 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1667endif
Brian Downing43fe9012008-02-05 15:10:44 -06001668ifdef INTERNAL_QSORT
1669 COMPAT_CFLAGS += -DINTERNAL_QSORT
1670 COMPAT_OBJS += compat/qsort.o
1671endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001672ifdef HAVE_ISO_QSORT_S
1673 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1674else
1675 COMPAT_OBJS += compat/qsort_s.o
1676endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001677ifdef RUNTIME_PREFIX
1678 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1679endif
Alex Riesenb7774342007-03-07 00:44:49 +01001680
Junio C Hamano46059cc2008-11-15 04:08:14 -08001681ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001682 BASIC_CFLAGS += -DNO_PTHREADS
1683else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001684 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001685 EXTLIBS += $(PTHREAD_LIBS)
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001686endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001687
Chris Webbcb6a22c2010-04-13 10:07:13 +01001688ifdef HAVE_PATHS_H
1689 BASIC_CFLAGS += -DHAVE_PATHS_H
1690endif
1691
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001692ifdef HAVE_LIBCHARSET_H
1693 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001694 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001695endif
1696
David Michaelb3e103d2012-12-14 14:57:01 -05001697ifdef HAVE_STRINGS_H
1698 BASIC_CFLAGS += -DHAVE_STRINGS_H
1699endif
1700
Jeff King21aeafc2011-12-10 05:41:01 -05001701ifdef HAVE_DEV_TTY
1702 BASIC_CFLAGS += -DHAVE_DEV_TTY
1703endif
1704
Alex Riesen81a24b52008-03-05 00:15:39 +01001705ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1706 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1707endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001708ifdef UNRELIABLE_FSTAT
1709 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1710endif
Jeff King02232ad2009-06-16 15:07:40 -04001711ifdef NO_REGEX
1712 COMPAT_CFLAGS += -Icompat/regex
1713 COMPAT_OBJS += compat/regex/regex.o
1714endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001715ifdef NATIVE_CRLF
1716 BASIC_CFLAGS += -DNATIVE_CRLF
1717endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001718
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001719ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001720 COMPAT_CFLAGS += -Icompat/nedmalloc
1721 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1722 OVERRIDE_STRDUP = YesPlease
1723endif
1724
1725ifdef OVERRIDE_STRDUP
1726 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1727 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001728endif
1729
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001730ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1731 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1732endif
1733
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001734ifndef NO_MSGFMT_EXTENDED_OPTIONS
1735 MSGFMT += --check --statistics
1736endif
1737
Jeff King66547542014-04-01 17:28:42 -04001738ifdef GMTIME_UNRELIABLE_ERRORS
1739 COMPAT_OBJS += compat/gmtime.o
1740 BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
1741endif
1742
Karsten Blees148d6772014-07-12 02:05:42 +02001743ifdef HAVE_CLOCK_GETTIME
1744 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001745endif
1746
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001747ifdef HAVE_CLOCK_MONOTONIC
1748 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1749endif
1750
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001751ifdef NEEDS_LIBRT
1752 EXTLIBS += -lrt
1753endif
1754
Kyle J. McKay95290802015-03-07 23:14:36 -08001755ifdef HAVE_BSD_SYSCTL
1756 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1757endif
1758
Dan Jacques226c0dd2018-04-10 11:05:44 -04001759ifdef HAVE_BSD_KERN_PROC_SYSCTL
1760 BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL
1761endif
1762
Jeff King0cc30e02015-04-16 05:01:38 -04001763ifdef HAVE_GETDELIM
1764 BASIC_CFLAGS += -DHAVE_GETDELIM
1765endif
1766
Dan Jacques226c0dd2018-04-10 11:05:44 -04001767ifneq ($(PROCFS_EXECUTABLE_PATH),)
1768 procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
1769 BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
1770endif
1771
1772ifdef HAVE_NS_GET_EXECUTABLE_PATH
1773 BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
1774endif
1775
Johannes Schindelinc1be1cb2018-04-10 11:05:45 -04001776ifdef HAVE_WPGMPTR
1777 BASIC_CFLAGS += -DHAVE_WPGMPTR
1778endif
1779
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001780ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001781NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001782endif
1783
Jeff King499c2932009-04-03 15:32:20 -04001784ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001785NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001786endif
1787
Johan Herlandd4e1b472009-11-18 02:42:31 +01001788ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001789NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001790endif
1791
Eric Wong995bc222016-08-04 11:40:25 +00001792ifndef PAGER_ENV
1793PAGER_ENV = LESS=FRX LV=-c
1794endif
1795
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001796QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001797QUIET_SUBDIR1 =
1798
John Keepingef49e052015-09-05 13:22:10 +01001799ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001800PRINT_DIR = --no-print-directory
1801else # "make -w"
1802NO_SUBDIR = :
1803endif
1804
John Keepingef49e052015-09-05 13:22:10 +01001805ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001806ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001807 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001808 QUIET_AR = @echo ' ' AR $@;
1809 QUIET_LINK = @echo ' ' LINK $@;
1810 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1811 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001812 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00001813 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001814 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00001815 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001816 QUIET_SP = @echo ' ' SP $<;
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01001817 QUIET_HDR = @echo ' ' HDR $<;
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001818 QUIET_RC = @echo ' ' RC $@;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001819 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001820 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1821 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001822 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001823 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001824 export QUIET_BUILT_IN
1825endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001826endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001827
Junio C Hamano70de5e62012-05-02 15:12:10 -07001828ifdef NO_INSTALL_HARDLINKS
1829 export NO_INSTALL_HARDLINKS
1830endif
1831
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001832### profile feedback build
1833#
1834
1835# Can adjust this to be a global directory if you want to do extended
1836# data gathering
1837PROFILE_DIR := $(CURDIR)
1838
Johannes Sixte60ec752012-02-09 09:22:26 +01001839ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07001840 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001841 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001842 export CCACHE_DISABLE = t
1843 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01001844else
1845ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07001846 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001847 export CCACHE_DISABLE = t
1848 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001849endif
Johannes Sixte60ec752012-02-09 09:22:26 +01001850endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001851
Pavel Roskinaddf88e2006-07-09 03:44:30 -04001852# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001853
Johannes Schindelin32043c92007-02-14 12:48:14 +01001854ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02001855ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001856
1857DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1858bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001859bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001860mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00001861mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
1862infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001863perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001864localedir_SQ = $(subst ','\'',$(localedir))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001865localedir_relative_SQ = $(subst ','\'',$(localedir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001866gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
Ævar Arnfjörð Bjarmasona4d79b92018-03-13 20:39:34 +00001867gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001868template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00001869htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001870prefix_SQ = $(subst ','\'',$(prefix))
Dan Jacques07d90ea2018-04-10 11:05:43 -04001871perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05301872gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001873
1874SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05001875TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001876PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01001877PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001878TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07001879DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08001880PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001881
Dan Jacques07d90ea2018-04-10 11:05:43 -04001882# RUNTIME_PREFIX's resolution logic requires resource paths to be expressed
1883# relative to each other and share an installation path.
1884#
1885# This is a dependency in:
1886# - Git's binary RUNTIME_PREFIX logic in (see "exec_cmd.c").
1887# - The runtime prefix Perl header (see
1888# "perl/header_templates/runtime_prefix.template.pl").
1889ifdef RUNTIME_PREFIX
1890
1891ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
1892$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))
1893endif
1894
1895ifneq ($(filter /%,$(firstword $(localedir_relative))),)
1896$(error RUNTIME_PREFIX requires a relative localedir, not: $(localedir))
1897endif
1898
1899ifndef NO_PERL
1900ifneq ($(filter /%,$(firstword $(perllibdir_relative))),)
1901$(error RUNTIME_PREFIX requires a relative perllibdir, not: $(perllibdir))
1902endif
1903endif
1904
1905endif
1906
Jeff King3f2e2292016-07-01 01:58:58 -04001907# We must filter out any object files from $(GITLIBS),
1908# as it is typically used like:
1909#
1910# foo: foo.o $(GITLIBS)
1911# $(CC) $(filter %.o,$^) $(LIBS)
1912#
1913# where we use it as a dependency. Since we also pull object files
1914# from the dependency list, that would make each entry appear twice.
1915LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07001916
brian m. carlsonf18f8162017-03-11 22:28:18 +00001917BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08001918LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02001919
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05001920# Quote for C
1921
1922ifdef DEFAULT_EDITOR
1923DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
1924DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
1925
1926BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
1927endif
1928
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05001929ifdef DEFAULT_PAGER
1930DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
1931DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
1932
1933BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
1934endif
1935
Ben Waltonb3e34dd2012-03-30 21:33:21 -04001936ifdef SHELL_PATH
1937SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
1938SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
1939
1940BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
1941endif
1942
Jeff King42dcbb72012-06-02 15:01:12 -04001943GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
1944GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
1945GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04001946GIT-USER-AGENT: FORCE
1947 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04001948 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
1949 fi
Jeff King42dcbb72012-06-02 15:01:12 -04001950
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00001951ifdef DEFAULT_HELP_FORMAT
1952BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
1953endif
1954
Eric Wong995bc222016-08-04 11:40:25 +00001955PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
1956PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
1957PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
1958BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
1959
Petr Baudis8d7f5862006-06-25 03:47:03 +02001960ALL_CFLAGS += $(BASIC_CFLAGS)
1961ALL_LDFLAGS += $(BASIC_LDFLAGS)
1962
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00001963export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07001964
1965
Petr Baudis28818ff2005-07-29 17:50:24 +02001966### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07001967
Brandon Caseyc94c8e52008-08-07 14:03:42 -05001968SHELL = $(SHELL_PATH)
1969
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001970all:: shell_compatibility_test
1971
1972ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07001973all:: profile
1974endif
1975
1976profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001977 $(MAKE) PROFILE=GEN all
1978 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04001979 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
1980 $(MAKE) PROFILE=GEN -j1 perf; \
1981 else \
1982 echo "Skipping profile of perf tests..."; \
1983 fi
Andi Kleen066dd262014-07-07 23:35:11 -07001984 $(MAKE) PROFILE=USE all
1985
1986profile-fast: profile-clean
1987 $(MAKE) PROFILE=GEN all
1988 $(MAKE) PROFILE=GEN -j1 perf
1989 $(MAKE) PROFILE=USE all
1990
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001991
1992all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001993ifneq (,$X)
Sebastian Schuberthade2ca02009-10-27 12:23:33 +01001994 $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001995endif
Petr Baudis28818ff2005-07-29 17:50:24 +02001996
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001997all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07001998ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07001999 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08002000 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002001endif
Ben Walton502be952010-03-20 10:48:08 -04002002 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04002003
Brandon Casey6dc46272008-08-07 14:06:26 -05002004please_set_SHELL_PATH_to_a_more_modern_shell:
2005 @$$(:)
2006
2007shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
2008
Junio C Hamano4dc00022006-01-12 21:42:25 -08002009strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05002010 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08002011
Jonathan Nieder7b63c772012-07-06 23:19:09 -05002012### Target-specific flags and dependencies
2013
2014# The generic compilation pattern rule and automatically
2015# computed header dependencies (falling back to a dependency on
2016# LIB_H) are enough to describe how most targets should be built,
2017# but some targets are special enough to need something a little
2018# different.
2019#
2020# - When a source file "foo.c" #includes a generated header file,
2021# we need to list that dependency for the "foo.o" target.
2022#
2023# We also list it from other targets that are built from foo.c
2024# like "foo.sp" and "foo.s", even though that is easy to forget
2025# to do because the generated header is already present around
2026# after a regular build attempt.
2027#
2028# - Some code depends on configuration kept in makefile
2029# variables. The target-specific variable EXTRA_CPPFLAGS can
2030# be used to convey that information to the C preprocessor
2031# using -D options.
2032#
2033# The "foo.o" target should have a corresponding dependency on
2034# a file that changes when the value of the makefile variable
2035# changes. For example, targets making use of the
2036# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
2037#
2038# Technically the ".sp" and ".s" targets do not need this
2039# dependency because they are force-built, but they get the
2040# same dependency for consistency. This way, you do not have to
2041# know how each target is implemented. And it means the
2042# dependencies here will not need to change if the force-build
2043# details change some day.
2044
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002045git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04002046git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002047 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2048 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2049 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07002050
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002051git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04002052 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
2053 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07002054
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002055help.sp help.s help.o: command-list.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01002056
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002057builtin/help.sp builtin/help.s builtin/help.o: command-list.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002058builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00002059 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
2060 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
2061 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07002062
Jeff King520a6cd2012-06-20 14:32:22 -04002063version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04002064version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04002065 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01002066 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
Johannes Schindelin5cf8e062018-06-27 21:35:23 +02002067 '-DGIT_BUILT_FROM_COMMIT="$(shell \
2068 GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2069 git rev-parse -q --verify HEAD 2>/dev/null)"'
Jeff King816fb462012-06-02 14:51:42 -04002070
Junio C Hamano91730802006-04-10 17:37:58 -07002071$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02002072 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002073 ln $< $@ 2>/dev/null || \
2074 ln -s $< $@ 2>/dev/null || \
2075 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07002076
Nguyễn Thái Ngọc Duyf318d732018-05-10 10:46:41 +02002077command-list.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07002078
Nguyễn Thái Ngọc Duy76b993a2018-10-27 08:22:34 +02002079command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
Alejandro R. Sedeño57cee8a2015-09-10 19:37:07 -04002080 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01002081
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002082SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
Jeff Kingb5295f32012-06-20 14:32:19 -04002083 $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002084 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
2085 $(perllibdir_SQ)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002086define cmd_munge_script
2087$(RM) $@ $@+ && \
2088sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2089 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07002090 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002091 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002092 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08002093 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002094 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04002095 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
2096 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Junio C Hamano71b40102016-03-08 15:47:57 -08002097 -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00002098 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002099 $@.sh >$@+
2100endef
2101
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002102GIT-SCRIPT-DEFINES: FORCE
2103 @FLAGS='$(SCRIPT_DEFINES)'; \
2104 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002105 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002106 echo "$$FLAGS" >$@; \
2107 fi
2108
2109
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002110$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002111 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002112 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002113 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002114
Jeff Kinge4dd89a2012-06-20 14:32:16 -04002115$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08002116 $(QUIET_GEN)$(cmd_munge_script) && \
2117 mv $@+ $@
2118
Johannes Schindelinadb59de2018-11-06 06:55:50 -08002119git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002120 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01002121 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
2122 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06002123 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01002124
Jeff Kinge204b002014-11-18 12:43:09 -05002125# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002126$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05002127
Dan Jacques07d90ea2018-04-10 11:05:43 -04002128# Used for substitution in Perl modules. Disabled when using RUNTIME_PREFIX
2129# since the locale directory is injected.
2130perl_localedir_SQ = $(localedir_SQ)
Alex Riesenf8487182006-12-04 10:50:04 +01002131
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002132ifndef NO_PERL
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002133PERL_HEADER_TEMPLATE = perl/header_templates/fixed_prefix.template.pl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002134PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002135
Dan Jacques07d90ea2018-04-10 11:05:43 -04002136PERL_DEFINES := $(PERL_PATH_SQ) $(PERLLIB_EXTRA_SQ) $(perllibdir_SQ)
2137PERL_DEFINES += $(RUNTIME_PREFIX)
2138
2139# Support Perl runtime prefix. In this mode, a different header is installed
2140# into Perl scripts.
2141ifdef RUNTIME_PREFIX
2142
2143PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl
2144
2145# Don't export a fixed $(localedir) path; it will be resolved by the Perl header
2146# at runtime.
2147perl_localedir_SQ =
2148
2149endif
2150
2151PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
2152
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002153$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
Emil Medve4cb08df2007-07-14 12:51:44 -05002154 $(QUIET_GEN)$(RM) $@ $@+ && \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002155 sed -e '1{' \
2156 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
Alejandro R. Sedeño66000542018-06-25 15:13:25 -04002157 -e ' r GIT-PERL-HEADER' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002158 -e ' G' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07002159 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07002160 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002161 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002162 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002163 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002164
Dan Jacques07d90ea2018-04-10 11:05:43 -04002165PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002166GIT-PERL-DEFINES: FORCE
2167 @FLAGS='$(PERL_DEFINES)'; \
2168 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2169 echo >&2 " * new perl-specific parameters"; \
2170 echo "$$FLAGS" >$@; \
2171 fi
2172
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002173GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
2174 $(QUIET_GEN)$(RM) $@ && \
2175 INSTLIBDIR='$(perllibdir_SQ)' && \
2176 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
2177 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
2178 sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
Jonathan Nieder64f982b2018-04-23 16:25:35 -07002179 -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002180 -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
2181 -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
2182 -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002183 $< >$@+ && \
2184 mv $@+ $@
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002185
Christian Hessed8698982018-04-19 06:44:40 +09002186.PHONY: perllibdir
Christian Hessecfb3a472018-04-10 15:36:41 +02002187perllibdir:
2188 @echo '$(perllibdir_SQ)'
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002189
2190.PHONY: gitweb
2191gitweb:
2192 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2193
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002194git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002195 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002196 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002197 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002198else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002199$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Jeff King499c2932009-04-03 15:32:20 -04002200 $(QUIET_GEN)$(RM) $@ $@+ && \
2201 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2202 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2203 unimplemented.sh >$@+ && \
2204 chmod +x $@+ && \
2205 mv $@+ $@
2206endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002207
Jonathan Niederca2051d2014-11-18 10:43:47 -08002208# This makes sure we depend on the NO_PYTHON setting itself.
2209$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2210
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002211ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002212$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2213$(SCRIPT_PYTHON_GEN): % : %.py
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002214 $(QUIET_GEN)$(RM) $@ $@+ && \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002215 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002216 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002217 chmod +x $@+ && \
2218 mv $@+ $@
2219else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002220$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002221 $(QUIET_GEN)$(RM) $@ $@+ && \
2222 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2223 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2224 unimplemented.sh >$@+ && \
2225 chmod +x $@+ && \
2226 mv $@+ $@
2227endif # NO_PYTHON
2228
Jeff King7f1b6972013-02-21 01:26:14 -05002229CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
2230 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
2231 configure.ac >configure.ac+ && \
2232 autoconf -o configure configure.ac+ && \
2233 $(RM) configure.ac+
2234
Jeff King520a6cd2012-06-20 14:32:22 -04002235configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002236 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002237
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002238ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002239# We avoid depending on 'configure' here, because it gets rebuilt
2240# every time GIT-VERSION-FILE is modified, only to update the embedded
2241# version number string, which config.status does not care about. We
2242# do want to recheck when the platform/environment detection logic
2243# changes, hence this depends on configure.ac.
2244config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002245 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002246 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002247 ./config.status --recheck; \
2248 else \
2249 ./configure; \
2250 fi
2251reconfigure config.mak.autogen: config.status
2252 $(QUIET_GEN)./config.status
2253.PHONY: reconfigure # This is a convenience target.
2254endif
2255
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002256XDIFF_OBJS += xdiff/xdiffi.o
2257XDIFF_OBJS += xdiff/xprepare.o
2258XDIFF_OBJS += xdiff/xutils.o
2259XDIFF_OBJS += xdiff/xemit.o
2260XDIFF_OBJS += xdiff/xmerge.o
2261XDIFF_OBJS += xdiff/xpatience.o
Junio C Hamanod4755362012-01-27 11:04:28 -08002262XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002263
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002264VCSSVN_OBJS += vcs-svn/line_buffer.o
Jonathan Nieder9d2f5dd2011-01-02 21:54:58 -06002265VCSSVN_OBJS += vcs-svn/sliding_window.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002266VCSSVN_OBJS += vcs-svn/fast_export.o
Jonathan Niederddcc8c52010-12-25 05:11:32 -06002267VCSSVN_OBJS += vcs-svn/svndiff.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002268VCSSVN_OBJS += vcs-svn/svndump.o
2269
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002270TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002271OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
2272 $(XDIFF_OBJS) \
2273 $(VCSSVN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07002274 $(FUZZ_OBJS) \
Jeff King3f2e2292016-07-01 01:58:58 -04002275 common-main.o \
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002276 git.o
2277ifndef NO_CURL
2278 OBJECTS += http.o http-walker.o remote-curl.o
2279endif
Jonathan Niederc3739912010-01-26 09:52:11 -06002280
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002281dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002282dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002283
Jonathan Nieder024c8432011-11-18 03:58:21 -06002284ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002285$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002286 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002287
2288missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002289dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002290dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002291endif
2292
Jonathan Nieder024c8432011-11-18 03:58:21 -06002293ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002294dep_dirs =
2295missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002296dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002297endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002298
2299ASM_SRC := $(wildcard $(OBJECTS:o=S))
2300ASM_OBJ := $(ASM_SRC:S=o)
2301C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002302
Jonathan Nieder30248882010-01-26 09:51:24 -06002303.SUFFIXES:
2304
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002305$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05002306 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002307$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05002308 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002309
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002310%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002311 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002312
2313ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2314# Take advantage of gcc's on-the-fly dependency generation
2315# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2316dep_files_present := $(wildcard $(dep_files))
2317ifneq ($(dep_files_present),)
2318include $(dep_files_present)
2319endif
2320else
Jonathan Niederdfea5752010-01-26 09:52:49 -06002321# Dependencies on header files, for platforms that do not support
2322# the gcc -MMD option.
2323#
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002324# Dependencies on automatically generated headers such as command-list.h
Jonathan Niederdfea5752010-01-26 09:52:49 -06002325# should _not_ be included here, since they are necessary even when
2326# building an object for the first time.
Pavel Roskinb05701c2005-08-06 01:36:15 -04002327
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002328$(OBJECTS): $(LIB_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002329endif
Junio C Hamano7a590132005-08-06 13:10:43 -07002330
Stefan Bellerd807c4a2018-04-10 14:26:18 -07002331exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
2332exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002333 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002334 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002335 '-DBINDIR="$(bindir_relative_SQ)"' \
Philip Oakley4d5b4c22018-04-21 13:18:42 +02002336 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002337
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002338builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002339builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002340 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002341
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002342config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002343config.sp config.s config.o: EXTRA_CPPFLAGS = \
2344 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002345
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002346attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002347attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2348 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002349
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002350gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002351gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
Dan Jacques226c0dd2018-04-10 11:05:44 -04002352 -DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002353
Ramsay Jones15caca22019-02-05 02:27:48 +00002354http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002355 -DCURL_DISABLE_TYPECHECK
2356
Ramsay Jones15caca22019-02-05 02:27:48 +00002357pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
Ramsay Jones54360a12018-02-12 00:21:02 +00002358
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002359ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002360http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002361endif
2362
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002363ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002364compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2365 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002366endif
2367
René Scharfed555ff52010-09-11 11:59:18 +02002368ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002369compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002370 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones15caca22019-02-05 02:27:48 +00002371compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002372endif
2373
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002374git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002375 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002376
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002377git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002378 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002379 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002380
John Keepingfd78ced2014-01-25 13:11:44 +00002381git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002382 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002383 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002384git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002385 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002386 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002387
Florian Achleitner48ea9f92012-09-19 17:21:16 +02002388git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
2389 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
2390 $(VCSSVN_LIB)
2391
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002392$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2393 $(QUIET_LNCP)$(RM) $@ && \
2394 ln $< $@ 2>/dev/null || \
2395 ln -s $< $@ 2>/dev/null || \
2396 cp $< $@
2397
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002398$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002399 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002400 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002401
Petr Baudis28818ff2005-07-29 17:50:24 +02002402$(LIB_FILE): $(LIB_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002403 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002404
Linus Torvalds34435462006-03-24 20:13:22 -08002405$(XDIFF_LIB): $(XDIFF_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002406 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002407
Jonathan Nieder3f527372010-08-09 17:04:29 -05002408$(VCSSVN_LIB): $(VCSSVN_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002409 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002410
Jonathan Nieder5b586192012-03-31 03:44:53 -05002411export DEFAULT_EDITOR DEFAULT_PAGER
2412
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002413.PHONY: doc man man-perl html info pdf
2414doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002415 $(MAKE) -C Documentation all
2416
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002417man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002418 $(MAKE) -C Documentation man
2419
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002420man-perl: perl/build/man/man3/Git.3pm
2421
Michael J Gruber414851a2008-09-10 10:19:34 +02002422html:
2423 $(MAKE) -C Documentation html
2424
David Kastrup47398092007-08-06 12:22:57 +02002425info:
2426 $(MAKE) -C Documentation info
2427
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002428pdf:
2429 $(MAKE) -C Documentation pdf
2430
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002431XGETTEXT_FLAGS = \
2432 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002433 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002434 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2435 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002436XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2437 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002438XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2439 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002440XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002441 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002442LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002443LOCALIZED_SH = $(SCRIPT_SH)
2444LOCALIZED_SH += git-parse-remote.sh
Alban Gruinc42abfe2018-05-28 14:34:19 +02002445LOCALIZED_SH += git-rebase--preserve-merges.sh
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002446LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002447LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002448
2449ifdef XGETTEXT_INCLUDE_TESTS
2450LOCALIZED_C += t/t0200/test.c
2451LOCALIZED_SH += t/t0200/test.sh
2452LOCALIZED_PERL += t/t0200/test.perl
2453endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002454
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002455## Note that this is meant to be run only by the localization coordinator
2456## under a very controlled condition, i.e. (1) it is to be run in a
2457## Git repository (not a tarball extract), (2) any local modifications
2458## will be lost.
2459## Gettext tools cannot work with our own custom PRItime type, so
2460## we replace PRItime with PRIuMAX. We need to update this to
2461## PRIdMAX if we switch to a signed type later.
2462
Jonathan Nieder1f319632014-08-22 00:32:08 -04002463po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002464 # All modifications will be reverted at the end, so we do not
2465 # want to have any local change.
2466 git diff --quiet HEAD && git diff --quiet --cached
2467
2468 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2469 do \
2470 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2471 cat "$$s+" >"$$s" && rm "$$s+"; \
2472 done
2473
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002474 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2475 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2476 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002477 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2478 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002479
2480 # Reverting the munged source, leaving only the updated $@
2481 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002482 mv $@+ $@
2483
Elia Pintoe6be2652015-12-15 15:21:00 +00002484.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002485pot: po/git.pot
2486
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002487POFILES := $(wildcard po/*.po)
2488MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2489
2490ifndef NO_GETTEXT
2491all:: $(MOFILES)
2492endif
2493
2494po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2495 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2496
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002497LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2498LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002499LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2500LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002501
2502ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002503all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002504ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002505all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002506endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002507NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002508endif
2509
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002510perl/build/lib/%.pm: perl/%.pm
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002511 $(QUIET_GEN)mkdir -p $(dir $@) && \
Dan Jacques07d90ea2018-04-10 11:05:43 -04002512 sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002513 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2514 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002515
2516perl/build/man/man3/Git.3pm: perl/Git.pm
2517 $(QUIET_GEN)mkdir -p $(dir $@) && \
2518 pod2man $< $@
2519
Jeff Kinge951ebc2016-12-14 09:26:55 -05002520FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002521 git ls-files \
2522 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002523 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002524 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002525 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002526 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002527 $(FIND) . \
2528 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002529 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002530 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002531 -o \( -name build -type d -prune \) \
2532 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002533 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002534 -o \( -name '*.sh' -type f -print \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002535 )
Junio C Hamano33533972011-10-18 00:26:18 -07002536
Junio C Hamano2f769192010-09-28 16:08:38 -05002537$(ETAGS_TARGET): FORCE
2538 $(RM) $(ETAGS_TARGET)
Junio C Hamano33533972011-10-18 00:26:18 -07002539 $(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002540
Junio C Hamano2f769192010-09-28 16:08:38 -05002541tags: FORCE
Emil Medve4cb08df2007-07-14 12:51:44 -05002542 $(RM) tags
Junio C Hamano33533972011-10-18 00:26:18 -07002543 $(FIND_SOURCE_FILES) | xargs ctags -a
Petr Baudis28818ff2005-07-29 17:50:24 +02002544
Kristof Provosta2a91502007-10-06 16:24:42 +02002545cscope:
2546 $(RM) cscope*
Junio C Hamano33533972011-10-18 00:26:18 -07002547 $(FIND_SOURCE_FILES) | xargs cscope -b
Kristof Provosta2a91502007-10-06 16:24:42 +02002548
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002549### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002550TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2551 $(localedir_SQ)
2552
2553GIT-PREFIX: FORCE
2554 @FLAGS='$(TRACK_PREFIX)'; \
2555 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002556 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002557 echo "$$FLAGS" >GIT-PREFIX; \
2558 fi
2559
2560TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002561
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002562GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002563 @FLAGS='$(TRACK_CFLAGS)'; \
2564 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002565 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002566 echo "$$FLAGS" >GIT-CFLAGS; \
2567 fi
2568
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002569TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2570
2571GIT-LDFLAGS: FORCE
2572 @FLAGS='$(TRACK_LDFLAGS)'; \
2573 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002574 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002575 echo "$$FLAGS" >GIT-LDFLAGS; \
2576 fi
2577
Junio C Hamanobfce5082008-07-25 12:35:10 -07002578# We need to apply sq twice, once to protect from the shell
2579# that runs GIT-BUILD-OPTIONS, and then again to protect it
2580# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002581GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002582 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002583 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002584 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2585 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2586 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2587 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2588 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002589 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002590 @echo USE_LIBPCRE1=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE1)))'\' >>$@+
2591 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00002592 @echo NO_LIBPCRE1_JIT=\''$(subst ','\'',$(subst ','\'',$(NO_LIBPCRE1_JIT)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002593 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002594 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002595 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2596 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002597 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002598 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
Johannes Schindelin8abfdf42018-11-14 08:32:11 -08002599 @echo X=\'$(X)\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002600ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002601 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002602endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002603ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002604 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002605endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002606ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002607 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002608endif
2609ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002610 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002611endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002612 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002613ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002614 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002615endif
2616ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002617 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002618endif
2619ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002620 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002621endif
2622ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002623 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002624endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002625ifdef GIT_PERF_MAKE_COMMAND
2626 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2627endif
Jeff King3d893612017-02-25 04:37:07 -05002628ifdef GIT_INTEROP_MAKE_OPTS
2629 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2630endif
Ben Peart1f357b02018-09-18 23:29:36 +00002631ifdef GIT_TEST_INDEX_VERSION
2632 @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002633endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002634 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002635
Christian Couder96a46472012-12-18 16:26:38 +01002636### Detect Python interpreter path changes
2637ifndef NO_PYTHON
2638TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002639
Christian Couder96a46472012-12-18 16:26:38 +01002640GIT-PYTHON-VARS: FORCE
2641 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002642 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002643 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002644 echo "$$VARS" >$@; \
2645 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002646endif
2647
Matthew Ogilvieea925192009-12-02 22:14:05 -07002648test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2649
2650all:: $(TEST_PROGRAMS) $(test_bindir_programs)
Felipe Contreras6c473a52013-06-07 17:03:06 -05002651all:: $(NO_INSTALL)
Matthew Ogilvieea925192009-12-02 22:14:05 -07002652
2653bin-wrappers/%: wrap-for-bin.sh
2654 @mkdir -p bin-wrappers
2655 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2656 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002657 -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
Matthew Ogilvieea925192009-12-02 22:14:05 -07002658 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002659
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002660# GNU make supports exporting all variables by "export" without parameters.
2661# However, the environment gets quite big, and some programs have problems
2662# with that.
2663
Johannes Schindelin140245b2006-07-07 13:26:31 +02002664export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002665export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002666
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002667### Testing rules
2668
Junio C Hamano96651ef2007-04-28 15:32:49 -07002669test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002670 $(MAKE) -C t/ all
2671
Thomas Rast342e9ef2012-02-17 11:25:09 +01002672perf: all
2673 $(MAKE) -C t/perf/ all
2674
2675.PHONY: test perf
2676
Jeff King4df7c8a2016-07-01 03:59:44 -04002677t/helper/test-line-buffer$X: $(VCSSVN_LIB)
René Scharfeb4285c72009-01-17 16:50:13 +01002678
Jeff King4df7c8a2016-07-01 03:59:44 -04002679t/helper/test-svn-fe$X: $(VCSSVN_LIB)
David Barr21746aa2010-08-09 17:55:00 -05002680
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002681.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002682
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002683t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2684
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002685t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
David Barr1d73b522010-08-09 17:34:42 -05002686 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002687
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +01002688check-sha1:: t/helper/test-tool$X
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002689 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002690
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002691SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2692
2693$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
2694 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
Ramsay Jones15caca22019-02-05 02:27:48 +00002695 $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $<
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002696
2697.PHONY: sparse $(SP_OBJ)
2698sparse: $(SP_OBJ)
2699
Ramsay Jonesebb7baf2018-09-19 01:07:08 +01002700GEN_HDRS := command-list.h unicode-width.h
2701EXCEPT_HDRS := $(GEN_HDRS) compat% xdiff%
2702CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
2703HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
2704
2705$(HCO): %.hco: %.h FORCE
2706 $(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
2707
2708.PHONY: hdr-check $(HCO)
2709hdr-check: $(HCO)
2710
Brandon Williams21188052017-08-14 14:30:46 -07002711.PHONY: style
2712style:
2713 git clang-format --style file --diff --extensions c,h
2714
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002715check: command-list.h
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01002716 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002717 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07002718 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002719 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002720 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07002721 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002722 exit 1; \
2723 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02002724
René Scharfe63f0a752016-09-15 20:30:56 +02002725C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02002726ifdef DC_SHA1_SUBMODULE
2727COCCI_SOURCES = $(filter-out sha1collisiondetection/%,$(C_SOURCES))
2728else
2729COCCI_SOURCES = $(filter-out sha1dc/%,$(C_SOURCES))
2730endif
2731
2732%.cocci.patch: %.cocci $(COCCI_SOURCES)
René Scharfe63f0a752016-09-15 20:30:56 +02002733 @echo ' ' SPATCH $<; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002734 ret=0; \
SZEDER Gáborac1e31d2018-07-23 15:50:58 +02002735 for f in $(COCCI_SOURCES); do \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002736 $(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS) || \
2737 { ret=$$?; break; }; \
2738 done >$@+ 2>$@.log; \
2739 if test $$ret != 0; \
2740 then \
2741 cat $@.log; \
2742 exit 1; \
2743 fi; \
2744 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02002745 if test -s $@; \
2746 then \
2747 echo ' ' SPATCH result: $@; \
2748 fi
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002749coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
René Scharfe63f0a752016-09-15 20:30:56 +02002750
SZEDER Gábordd5d0522018-11-09 16:10:52 -08002751# See contrib/coccinelle/README
2752coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
2753
2754.PHONY: coccicheck coccicheck-pending
Petr Baudis28818ff2005-07-29 17:50:24 +02002755
Petr Baudis28818ff2005-07-29 17:50:24 +02002756### Installation rules
2757
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002758ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002759template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002760else
2761template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002762endif
2763export template_instdir
2764
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002765ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002766gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002767else
2768gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002769endif
2770gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
2771export gitexec_instdir
2772
David Aguilarbc7a96a2011-08-18 00:23:46 -07002773ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2774mergetools_instdir = $(mergetoolsdir)
2775else
2776mergetools_instdir = $(prefix)/$(mergetoolsdir)
2777endif
2778mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2779
Matthew Ogilvieea925192009-12-02 22:14:05 -07002780install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
2781
Elia Pintoe6be2652015-12-15 15:21:00 +00002782.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07002783profile-install: profile
2784 $(MAKE) install
2785
2786profile-fast-install: profile-fast
2787 $(MAKE) install
2788
Andreas Ericssond6ebd252005-11-22 00:44:15 +01002789install: all
Robert Schiele41650762007-12-01 18:05:40 +01002790 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002791 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2792 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08002793 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthew Ogilvieea925192009-12-02 22:14:05 -07002794 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01002795 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07002796 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05002797 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002798ifndef NO_GETTEXT
2799 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
2800 (cd po/build/locale && $(TAR) cf - .) | \
2801 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
2802endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07002803ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002804 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
2805 (cd perl/build/lib && $(TAR) cf - .) | \
2806 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07002807 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07002808endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002809ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002810 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002811 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002812endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002813ifneq (,$X)
Eric Blaked4b19022009-04-28 06:28:31 -06002814 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002815endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002816
Johannes Sixt46beb552008-07-21 21:19:51 +02002817 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002818 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002819 destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07002820 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05002821 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
2822 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002823 test -n "$(INSTALL_SYMLINKS)" && \
2824 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
2825 { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
2826 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
2827 cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
Brandon Casey76d079a2010-07-23 12:50:45 -05002828 done; \
2829 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05002830 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
2831 $(RM) "$$bindir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002832 test -n "$(INSTALL_SYMLINKS)" && \
2833 ln -s "git$X" "$$bindir/$$p" || \
2834 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2835 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2836 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2837 cp "$$bindir/git$X" "$$bindir/$$p" || exit; } \
Brandon Casey40919c42010-07-23 12:50:44 -05002838 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002839 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06002840 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002841 test -n "$(INSTALL_SYMLINKS)" && \
2842 ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
2843 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2844 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2845 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2846 cp "$$execdir/git$X" "$$execdir/$$p" || exit; } \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002847 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07002848 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
2849 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002850 $(RM) "$$execdir/$$p" && \
Ævar Arnfjörð Bjarmasonad874602018-03-13 20:39:35 +00002851 test -n "$(INSTALL_SYMLINKS)" && \
2852 ln -s "git-remote-http$X" "$$execdir/$$p" || \
2853 { test -z "$(NO_INSTALL_HARDLINKS)" && \
2854 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2855 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2856 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
Brandon Casey49a43f52010-07-06 14:56:51 -07002857 done && \
Johannes Sixt7b4b59a2008-07-21 21:19:58 +02002858 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
Petr Baudis28818ff2005-07-29 17:50:24 +02002859
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002860.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00002861.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02002862install-gitweb:
2863 $(MAKE) -C gitweb install
2864
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002865install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002866 $(MAKE) -C Documentation install
2867
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002868install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002869 $(MAKE) -C Documentation install-man
2870
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002871install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002872 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
2873 (cd perl/build/man/man3 && $(TAR) cf - .) | \
2874 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
2875
Teemu Likonenae081f32008-06-10 11:34:25 +03002876install-html:
2877 $(MAKE) -C Documentation install-html
2878
David Kastrup47398092007-08-06 12:22:57 +02002879install-info:
2880 $(MAKE) -C Documentation install-info
2881
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002882install-pdf:
2883 $(MAKE) -C Documentation install-pdf
2884
Eric Wong6538d1e2006-12-23 08:26:09 -08002885quick-install-doc:
2886 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02002887
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002888quick-install-man:
2889 $(MAKE) -C Documentation quick-install-man
2890
Michael J Gruber6fe570d2008-09-09 22:44:17 +02002891quick-install-html:
2892 $(MAKE) -C Documentation quick-install-html
2893
Petr Baudis28818ff2005-07-29 17:50:24 +02002894
2895
2896### Maintainer's dist rules
2897
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01002898GIT_TARNAME = git-$(GIT_VERSION)
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02002899dist: git-archive$(X) configure
Junio C Hamano9ccb64c2006-10-05 02:26:12 -07002900 ./git-archive --format=tar \
2901 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07002902 @mkdir -p $(GIT_TARNAME)
Junio C Hamanoab214332016-04-04 23:42:41 -07002903 @cp configure $(GIT_TARNAME)
H. Peter Anvin181129d2006-01-09 18:07:01 -08002904 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05002905 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
H. Peter Anvin181129d2006-01-09 18:07:01 -08002906 $(TAR) rf $(GIT_TARNAME).tar \
Matthias Lederhoferf58494b2007-06-18 23:30:36 +02002907 $(GIT_TARNAME)/configure \
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05002908 $(GIT_TARNAME)/version \
Shawn O. Pearce115f0fe2007-03-12 13:40:31 -04002909 $(GIT_TARNAME)/git-gui/version
Ævar Arnfjörð Bjarmasonbc2ed312017-12-08 22:29:58 +00002910ifdef DC_SHA1_SUBMODULE
2911 @mkdir -p $(GIT_TARNAME)/sha1collisiondetection/lib
2912 @cp sha1collisiondetection/LICENSE.txt \
2913 $(GIT_TARNAME)/sha1collisiondetection/
2914 @cp sha1collisiondetection/LICENSE.txt \
2915 $(GIT_TARNAME)/sha1collisiondetection/
2916 @cp sha1collisiondetection/lib/sha1.[ch] \
2917 $(GIT_TARNAME)/sha1collisiondetection/lib/
2918 @cp sha1collisiondetection/lib/ubc_check.[ch] \
2919 $(GIT_TARNAME)/sha1collisiondetection/lib/
2920 $(TAR) rf $(GIT_TARNAME).tar \
2921 $(GIT_TARNAME)/sha1collisiondetection/LICENSE.txt \
2922 $(GIT_TARNAME)/sha1collisiondetection/lib/sha1.[ch] \
2923 $(GIT_TARNAME)/sha1collisiondetection/lib/ubc_check.[ch]
2924endif
Emil Medve4cb08df2007-07-14 12:51:44 -05002925 @$(RM) -r $(GIT_TARNAME)
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06002926 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07002927
Junio C Hamanoab214332016-04-04 23:42:41 -07002928rpm::
2929 @echo >&2 "Use distro packaged sources to run rpmbuild"
2930 @false
2931.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07002932
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002933htmldocs = git-htmldocs-$(GIT_VERSION)
2934manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00002935.PHONY: dist-doc distclean
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002936dist-doc:
Emil Medve4cb08df2007-07-14 12:51:44 -05002937 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002938 mkdir .doc-tmp-dir
2939 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
2940 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
2941 gzip -n -9 -f $(htmldocs).tar
2942 :
Emil Medve4cb08df2007-07-14 12:51:44 -05002943 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07002944 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02002945 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02002946 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07002947 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02002948 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002949 install
2950 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
2951 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05002952 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002953
Petr Baudis28818ff2005-07-29 17:50:24 +02002954### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06002955
Mathias Megyei922aa802007-10-04 23:49:19 +02002956distclean: clean
2957 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02002958 $(RM) config.log config.status config.cache
2959 $(RM) config.mak.autogen config.mak.append
2960 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02002961
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002962profile-clean:
2963 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
2964 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
2965
SZEDER Gábor1a966382018-07-23 15:51:00 +02002966cocciclean:
2967 $(RM) contrib/coccinelle/*.cocci.patch*
2968
2969clean: profile-clean coverage-clean cocciclean
Junio C Hamano7897d842016-04-15 10:06:52 -07002970 $(RM) *.res
2971 $(RM) $(OBJECTS)
Vicent Martie1273102013-11-14 07:43:51 -05002972 $(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002973 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Felipe Contreras6c473a52013-06-07 17:03:06 -05002974 $(RM) $(TEST_PROGRAMS) $(NO_INSTALL)
Josh Steadmon5e472152018-10-12 17:58:40 -07002975 $(RM) $(FUZZ_PROGRAMS)
Matt Kraai61564ca2013-02-13 07:57:48 -08002976 $(RM) -r bin-wrappers $(dep_dirs)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002977 $(RM) -r po/build/
Nguyễn Thái Ngọc Duy60f487a2018-05-10 10:46:43 +02002978 $(RM) *.pyc *.pyo */*.pyc */*.pyo command-list.h $(ETAGS_TARGET) tags cscope*
Emil Medve4cb08df2007-07-14 12:51:44 -05002979 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
2980 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
2981 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02002982 $(MAKE) -C Documentation/ clean
Jeff King499c2932009-04-03 15:32:20 -04002983ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01002984 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002985 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04002986endif
Petr Baudisb1edc532006-06-24 04:34:29 +02002987 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07002988 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002989ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002990 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002991 $(MAKE) -C git-gui clean
2992endif
Christian Couder8f26aa42012-12-18 16:26:37 +01002993 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002994 $(RM) GIT-USER-AGENT GIT-PREFIX
Dan Jacquesf6a0ad42018-04-10 11:05:42 -04002995 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
Junio C Hamano9b88fce2005-12-27 14:40:17 -08002996
SZEDER Gábor1a966382018-07-23 15:51:00 +02002997.PHONY: all install profile-clean cocciclean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05002998.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Junio C Hamano2f769192010-09-28 16:08:38 -05002999.PHONY: FORCE cscope
Junio C Hamanod89056c2005-12-19 17:59:58 -08003000
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003001### Check documentation
3002#
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003003ALL_COMMANDS = $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS)
3004ALL_COMMANDS += git
3005ALL_COMMANDS += gitk
3006ALL_COMMANDS += gitweb
Jeff Kingeb285012012-08-08 16:56:42 -04003007ALL_COMMANDS += git-gui git-citool
Elia Pintoe6be2652015-12-15 15:21:00 +00003008
3009.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003010check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07003011 $(MAKE) -C Documentation lint-docs
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003012 @(for v in $(ALL_COMMANDS); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003013 do \
3014 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003015 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02003016 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08003017 git-fsck-objects | git-init-db | \
Junio C Hamanoc88cd032010-03-10 15:31:34 -08003018 git-remote-* | git-stage | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08003019 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003020 esac ; \
3021 test -f "Documentation/$$v.txt" || \
3022 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02003023 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08003024 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07003025 case "$$v" in \
3026 git) ;; \
3027 *) echo "no link: $$v";; \
3028 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003029 done; \
3030 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02003031 sed -e '1,/^### command list/d' \
3032 -e '/^#/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003033 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08003034 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04003035 $(MAKE) -C Documentation print-man1 | \
3036 grep '\.txt$$' | \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003037 sed -e 's|Documentation/|documented |' \
3038 -e 's/\.txt//'; \
3039 ) | while read how cmd; \
3040 do \
Jeff Kingcf6aaff2012-08-08 16:56:04 -04003041 case " $(ALL_COMMANDS) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08003042 *" $$cmd "*) ;; \
3043 *) echo "removed but $$how: $$cmd" ;; \
3044 esac; \
3045 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08003046
3047### Make sure built-ins do not have dups and listed in git.c
3048#
3049check-builtins::
3050 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08003051
Thomas Rast901c3692009-02-19 12:13:35 +01003052### Test suite coverage testing
3053#
Thomas Rast0c38a952013-05-13 23:27:25 +02003054.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00003055.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003056.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01003057
3058coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02003059 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02003060 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01003061
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003062object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003063coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003064 $(RM) $(addsuffix *.gcov,$(object_dirs))
3065 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003066 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003067 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003068 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01003069
Thomas Rastdcbe7f12013-05-13 23:27:26 +02003070coverage-clean: coverage-clean-results
3071 $(RM) $(addsuffix *.gcno,$(object_dirs))
3072
Thomas Rast901c3692009-02-19 12:13:35 +01003073COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
3074COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003075GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01003076
Thomas Rast0c38a952013-05-13 23:27:25 +02003077coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01003078 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02003079
3080coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01003081 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02003082 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01003083
3084coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003085 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02003086 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003087 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00003088
3089coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01003090 grep '^function.*called 0 ' *.c.gcov \
3091 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00003092 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00003093
3094cover_db: coverage-report
3095 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00003096
3097cover_db_html: cover_db
3098 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07003099
Josh Steadmon5e472152018-10-12 17:58:40 -07003100
3101### Fuzz testing
3102#
3103# Building fuzz targets generally requires a special set of compiler flags that
3104# are not necessarily appropriate for general builds, and that vary greatly
3105# depending on the compiler version used.
3106#
3107# An example command to build against libFuzzer from LLVM 4.0.0:
3108#
3109# make CC=clang CXX=clang++ \
Josh Steadmon927c77e2018-11-14 11:41:47 -08003110# FUZZ_CXXFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
Josh Steadmon5e472152018-10-12 17:58:40 -07003111# LIB_FUZZING_ENGINE=/usr/lib/llvm-4.0/lib/libFuzzer.a \
3112# fuzz-all
3113#
Josh Steadmon927c77e2018-11-14 11:41:47 -08003114FUZZ_CXXFLAGS ?= $(CFLAGS)
3115
Josh Steadmon5e472152018-10-12 17:58:40 -07003116.PHONY: fuzz-all
3117
3118$(FUZZ_PROGRAMS): all
Josh Steadmon927c77e2018-11-14 11:41:47 -08003119 $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
Josh Steadmon5e472152018-10-12 17:58:40 -07003120 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3121
3122fuzz-all: $(FUZZ_PROGRAMS)