blob: 416a8e39c1d636f0597f3c3a3cc642714ef13aa1 [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ð Bjarmason94da9192017-06-01 18:20:56 +000032# Currently USE_LIBPCRE is a synonym for USE_LIBPCRE1, define
33# USE_LIBPCRE2 instead if you'd like to use version 2 of the PCRE
34# library. The USE_LIBPCRE flag will likely be changed to mean v2 by
35# default in future releases.
36#
Æ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#
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080062# Define NO_EXPAT if you do not have expat installed. git-http-push is
Tay Ray Chuand24d9052011-08-03 20:07:57 +080063# not built, and you cannot push using http:// and https:// transports (dumb).
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080064#
Serge van den Boom85b45182009-01-28 21:43:57 +010065# Define EXPATDIR=/foo/bar if your expat header and library files are in
66# /foo/bar/include and /foo/bar/lib directories.
67#
Matt Kraai081fd8d2013-02-11 14:03:45 -080068# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
69# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
70#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010071# Define NO_GETTEXT if you don't want Git output to be translated.
72# A translated Git requires GNU libintl or another gettext implementation,
73# plus libintl-perl at runtime.
74#
Alex Riesenad17ea72012-01-23 14:04:29 -080075# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
76# the installed gettext translation of the shell scripts output.
77#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010078# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
79# trust the langinfo.h's nl_langinfo(CODESET) function to return the
80# current character set. GNU and Solaris have a nl_langinfo(CODESET),
81# FreeBSD can use either, but MinGW and some others need to use
82# libcharset.h's locale_charset() instead.
83#
Дилян Палаузов3064b132014-03-11 23:37:33 +010084# Define CHARSET_LIB to the library you need to link with in order to
Дилян Палаузовb5225282012-02-12 17:23:36 +010085# use locale_charset() function. On some platforms this needs to set to
Дилян Палаузов3064b132014-03-11 23:37:33 +010086# -lcharset, on others to -liconv .
Дилян Палаузовb5225282012-02-12 17:23:36 +010087#
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +010088# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
89# need -lintl when linking.
90#
91# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
92# doesn't support GNU extensions like --check and --statistics
93#
Chris Webbcb6a22c2010-04-13 10:07:13 +010094# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
95# it specifies.
96#
Junio C Hamano63be37b2006-01-19 17:13:57 -080097# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
Eric Blakea50dec22010-04-01 16:43:54 -060098# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
Junio C Hamano63be37b2006-01-19 17:13:57 -080099#
David Michaelb3e103d2012-12-14 14:57:01 -0500100# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
101#
Linus Torvaldsef34af22005-09-18 18:30:50 -0700102# Define NO_STRCASESTR if you don't have strcasestr.
103#
René Scharfeb21b9f12007-09-07 00:32:54 +0200104# Define NO_MEMMEM if you don't have memmem.
105#
Matt Kraai40036be2012-12-18 14:03:55 -0800106# Define NO_GETPAGESIZE if you don't have getpagesize.
107#
Peter Eriksen817151e2006-06-24 16:01:25 +0200108# Define NO_STRLCPY if you don't have strlcpy.
109#
Nick Alcocke3eed7f2011-11-02 15:46:22 +0000110# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
111# C library. If your compiler also does not support long long or does not have
Jason Riedybc6b4f52007-02-19 16:22:56 -0800112# strtoull, define NO_STRTOULL.
113#
Jason Riedye40b61f2005-12-02 15:08:28 -0800114# Define NO_SETENV if you don't have setenv in the C library.
115#
Jakub Narebskibfa8fcc2008-01-18 02:03:51 +0100116# Define NO_UNSETENV if you don't have unsetenv in the C library.
117#
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -0400118# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
119#
Joachim Schmitzdc9f4622012-09-08 19:01:31 +0200120# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
121#
Rafael Gieschke590e0812011-05-19 13:37:55 +0200122# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
123# in the C library.
124#
David Aguilare1c06882009-05-31 01:35:51 -0700125# Define NO_LIBGEN_H if you don't have libgen.h.
126#
Brandon Caseyecc395c2009-07-10 12:10:45 -0500127# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
128#
Robert Schiele26009732008-01-24 19:34:46 +0100129# Define NO_SYS_SELECT_H if you don't have sys/select.h.
130#
Junio C Hamano9f0bb902006-05-02 00:40:24 -0700131# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
132# Enable it on Windows. By default, symrefs are still used.
Pavel Roskin2fabd212005-11-15 00:59:50 -0500133#
Pavel Roskin02853582006-07-09 02:44:58 -0700134# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
Eric Wong60d02cc2006-07-06 00:14:16 -0700135# tests. These tests take up a significant amount of the total test time
136# but are not needed unless you plan to talk to SVN repos.
137#
Shawn Pearce8eb38ca2006-07-24 00:28:28 -0400138# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
139# installed in /sw, but don't want GIT to link against any libraries
140# installed there. If defined you may specify your own (or Fink's)
141# include directories and library directories by defining CFLAGS
142# and LDFLAGS appropriately.
143#
144# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
145# have DarwinPorts installed in /opt/local, but don't want GIT to
146# link against any libraries installed there. If defined you may
147# specify your own (or DarwinPort's) include directories and
148# library directories by defining CFLAGS and LDFLAGS appropriately.
149#
David Aguilar4dcd7732013-05-19 06:23:34 -0400150# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
151# and do not want to use Apple's CommonCrypto library. This allows you
152# to provide your own OpenSSL library, for example from MacPorts.
153#
Jonathan Niederf2001972012-07-23 01:29:14 -0500154# Define BLK_SHA1 environment variable to make use of the bundled
155# optimized C SHA1 routine.
Linus Torvaldsd7c208a2009-08-05 16:13:20 -0700156#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200157# Define PPC_SHA1 environment variable when running make to make use of
158# a bundled SHA1 routine optimized for PowerPC.
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700159#
Jeff King8325e432017-03-16 18:09:12 -0400160# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
161# algorithm. This is slower, but may detect attempted collision attacks.
162# Takes priority over other *_SHA1 knobs.
163#
Takashi Iwai3964cbb2017-08-15 14:04:17 +0200164# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
165# git with the external SHA1 collision-detect library.
166# Without this option, i.e. the default behavior is to build git with its
167# own built-in code (or submodule).
168#
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +0000169# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
170# sha1collisiondetection shipped as a submodule instead of the
171# non-submodule copy in sha1dc/. This is an experimental option used
172# by the git project to migrate to using sha1collisiondetection as a
173# submodule.
174#
Junio C Hamanoe6b07da2017-03-17 10:00:15 -0700175# Define OPENSSL_SHA1 environment variable when running make to link
176# with the SHA1 routine from openssl library.
177#
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -0800178# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
179# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
180# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
181#
Brian Gernhardt0460dba2009-09-08 09:54:38 -0400182# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
183#
184# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200185#
Junio C Hamanob2feb642014-04-30 10:58:10 -0700186# Define NEEDS_SSL_WITH_CURL if you need -lssl with -lcurl (Minix).
Thomas Cortbc5f8132011-07-19 18:55:47 -0400187#
Junio C Hamanob2feb642014-04-30 10:58:10 -0700188# Define NEEDS_IDN_WITH_CURL if you need -lidn when using -lcurl (Minix).
Thomas Cortbc5f8132011-07-19 18:55:47 -0400189#
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700190# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200191#
Joachim Schmitz6c109902012-09-19 12:03:30 +0200192# Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
193#
Justin Lebar01689902014-03-31 15:11:46 -0700194# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
Joachim Schmitz6c109902012-09-19 12:03:30 +0200195#
196# Define NO_UINTMAX_T if you don't have uintmax_t.
197#
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200198# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
199# Patrick Mauritz).
200#
Brandon Casey70cf9912009-06-05 18:36:10 -0500201# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
202# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
203# inet_ntop and inet_pton additionally reside there.
204#
Johannes Schindelin730d48a2005-10-08 15:54:36 -0700205# Define NO_MMAP if you want to avoid mmap.
206#
Michael Haggerty5b633612017-09-25 10:00:10 +0200207# Define MMAP_PREVENTS_DELETE if a file that is currently mmapped cannot be
208# deleted or cannot be replaced using rename().
209#
Joachim Schmitz6d45eb12012-09-17 23:16:39 +0200210# Define NO_SYS_POLL_H if you don't have sys/poll.h.
211#
212# Define NO_POLL if you do not have or don't want to use poll().
213# This also implies NO_SYS_POLL_H.
214#
Junio C Hamanob2d05e02012-12-18 09:35:33 -0800215# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
216# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
217# we want to know more about the issue.
David Michael6ede7202012-12-14 14:56:58 -0500218#
Junio C Hamano46059cc2008-11-15 04:08:14 -0800219# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
220#
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100221# Define NO_PREAD if you have a problem with pread() system call (e.g.
Eric Blakea50dec22010-04-01 16:43:54 -0600222# cygwin1.dll before v1.5.22).
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100223#
Joachim Schmitz7f9e8482012-09-08 18:54:34 +0200224# Define NO_SETITIMER if you don't have setitimer()
225#
226# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
227# This also implies NO_SETITIMER
228#
Shawn O. Pearce1510fea2006-12-14 06:15:57 -0500229# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
230# generally faster on your platform than accessing the working directory.
231#
Shawn O. Pearcec8697532006-12-30 23:53:55 -0500232# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
233# the executable mode bit, but doesn't really do so.
234#
David Michaeld543d9c2014-12-03 21:24:17 -0500235# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
236# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
237# usual 0xF000).
238#
hpa49744d62005-09-28 16:52:21 -0700239# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
240#
Johannes Sixt63203582011-12-12 22:12:56 +0100241# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
242#
Junio C Hamanobdc37f52006-01-19 17:13:32 -0800243# Define NO_SOCKADDR_STORAGE if your platform does not have struct
244# sockaddr_storage.
245#
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +0100246# Define NO_ICONV if your libc does not properly support iconv.
247#
Ramsay Jonesfd547a92007-03-03 18:29:03 +0000248# Define OLD_ICONV if your library has an old iconv(), where the second
249# (input buffer pointer) parameter is declared with type (const char **).
250#
David Symonds609a2282007-11-07 14:24:28 +1100251# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
252#
Matt Kraai20648872007-06-30 10:05:03 -0700253# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
254# that tells runtime paths to dynamic libraries;
255# "-Wl,-rpath=/path/lib" is used instead.
Junio C Hamanobbfc63d2006-12-27 14:17:35 -0800256#
Junio C Hamano6520c842011-06-18 18:07:03 -0700257# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
258# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
259#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200260# Define USE_NSEC below if you want git to care about sub-second file mtimes
Karsten Bleesb1ffafa2015-07-01 21:10:52 +0200261# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
262# Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
263# on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
264# on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
265# Documentation/technical/racy-git.txt for details.
Junio C Hamanof6af75d2006-06-23 17:57:48 -0700266#
Brian Gernhardtc5673832009-03-08 16:04:28 -0400267# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
268# "st_ctim"
269#
Kjetil Barvikc06ff492009-03-04 18:47:40 +0100270# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
271# available. This automatically turns USE_NSEC off.
272#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200273# Define USE_STDEV below if you want git to care about the underlying device
Johannes Schindelin10455d22007-11-30 11:35:23 +0000274# change being considered an inode change from the update-index perspective.
Alex Riesenf8487182006-12-04 10:50:04 +0100275#
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +0200276# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
277# field that counts the on-disk footprint in 512-byte blocks.
278#
Jonathan Nieder162213d2009-10-09 05:15:29 -0500279# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
280# (not v1.73 or v1.71).
281#
Jeff King79c461d2010-11-19 12:54:24 -0500282# Define ASCIIDOC_ROFF if your DocBook XSL does not escape raw roff directives
283# (versions 1.68.1 through v1.72).
Jonas Fonseca7f55cf42007-11-14 10:38:46 +0100284#
Thomas Rast204d3632009-10-22 10:19:06 +0200285# Define GNU_ROFF if your target system uses GNU groff. This forces
286# apostrophes to be ASCII so that cut&pasting examples to the shell
287# will work.
288#
brian m. carlsonec3366e2017-01-22 02:41:56 +0000289# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
290# documentation.
291#
292# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
293# Extensions Lab if you have it available.
294#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800295# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
296#
Jeff King499c2932009-04-03 15:32:20 -0400297# Define NO_PERL if you do not want Perl scripts or libraries at all.
298#
Todd Zullinger075321c2018-03-03 15:38:16 +0000299# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
300# copies of CPAN modules that serve as a fallback in case the modules
301# are not available on the system. This option is intended for
302# distributions that want to use their packaged versions of Perl
303# modules, instead of the fallbacks shipped with Git.
304#
Junio C Hamanocdbada72013-01-13 22:48:07 -0800305# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
306# but /usr/bin/python2.7 on some platforms).
307#
Johan Herlandd4e1b472009-11-18 02:42:31 +0100308# Define NO_PYTHON if you do not want Python scripts or libraries at all.
309#
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700310# Define NO_TCLTK if you do not want Tcl/Tk GUI.
311#
Junio C Hamano71b40102016-03-08 15:47:57 -0800312# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
313# and egrep that are pickier when their input contains non-ASCII data.
314#
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400315# The TCL_PATH variable governs the location of the Tcl interpreter
316# used to optimize git-gui for your system. Only used if NO_TCLTK
317# is not set. Defaults to the bare 'tclsh'.
318#
319# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700320# If not set it defaults to the bare 'wish'. If it is set to the empty
321# string then NO_TCLTK will be forced (this is used by configure script).
322#
Brian Downing43fe9012008-02-05 15:10:44 -0600323# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
324# is a simplified version of the merge sort used in glibc. This is
325# recommended if Git triggers O(n^2) behavior in your platform's qsort().
326#
René Scharfe04ee8b82017-01-22 18:51:11 +0100327# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
328# compatible with the one described in C11 Annex K.
329#
Johannes Sixt34779c52009-04-20 10:17:00 +0200330# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
331# information on a not yet closed file that lstat would return for the same
332# file after it was closed.
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200333#
Johannes Schindelin348df162009-04-28 00:32:25 +0200334# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
335# when hardlinking a file to another name and unlinking the original file right
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200336# away (some NTFS drivers seem to zero the contents in that scenario).
Junio C Hamano2c8f8b12009-05-23 01:43:08 -0700337#
Johannes Schindelin3426e342009-05-11 13:02:18 +0200338# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
339# programs as a tar, where bin/ and libexec/ might be on different file systems.
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200340#
Junio C Hamano70de5e62012-05-02 15:12:10 -0700341# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
342# copies to install built-in git commands e.g. git-cat-file.
343#
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200344# Define USE_NED_ALLOCATOR if you want to replace the platforms default
345# memory allocators with the nedmalloc allocator written by Niall Douglas.
Jeff King02232ad2009-06-16 15:07:40 -0400346#
René Scharfeca2baa32016-09-03 17:59:15 +0200347# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
348# This is necessary when using a custom allocator in order to avoid
349# crashes due to allocation and free working on different 'heaps'.
350# It's defined automatically if USE_NED_ALLOCATOR is set.
351#
Johannes Schindelin2f895222016-09-21 20:24:04 +0200352# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
353# feature.
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500354#
Jeff King21aeafc2011-12-10 05:41:01 -0500355# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
356# user.
357#
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +0000358# Define GETTEXT_POISON if you are debugging the choice of strings marked
Jonathan Nieder30955222011-02-22 23:41:22 +0000359# for translation. In a GETTEXT_POISON build, you can turn all strings marked
360# for translation into gibberish by setting the GIT_GETTEXT_POISON variable
361# (to any value) in your environment.
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +0000362#
Jakub Narebski63267de2009-09-01 13:39:20 +0200363# Define JSMIN to point to JavaScript minifier that functions as
364# a filter to have gitweb.js minified.
Junio C Hamano8678bc02009-12-01 11:28:15 -0800365#
Mark Rada0e6ce212010-04-02 20:35:05 -0400366# Define CSSMIN to point to a CSS minifier in order to generate a minified
367# version of gitweb.css
368#
Junio C Hamanoa3d023d2009-10-30 20:45:34 -0500369# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
370# you want to use something different. The value will be interpreted by the
371# shell at runtime when it is used.
372#
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500373# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
374# want to use something different. The value will be interpreted by the shell
375# if necessary when it is used. Examples:
376#
377# DEFAULT_EDITOR='~/bin/vi',
378# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
379# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
Jonathan Niederdfea5752010-01-26 09:52:49 -0600380#
Jonathan Nieder024c8432011-11-18 03:58:21 -0600381# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
382# header files to be automatically computed, to avoid rebuilding objects when
383# an unrelated header file changes. Define it to "no" to use the hard-coded
384# dependency rules. The default is "auto", which means to use computed header
385# dependencies if your compiler is detected to support it.
386#
Eyvind Bernhardsen942e7742010-06-04 21:29:08 +0200387# Define NATIVE_CRLF if your platform uses CRLF for line endings.
Thomas Rast6942efc2012-04-06 23:01:23 +0200388#
Jeff King42dcbb72012-06-02 15:01:12 -0400389# Define GIT_USER_AGENT if you want to change how git identifies itself during
390# network interactions. The default is "git/$(GIT_VERSION)".
Junio C Hamanoa88d7aa2012-06-21 14:42:38 -0700391#
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +0000392# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
393# (defaults to "man") if you want to have a different default when
394# "git help" is called without a parameter specifying the format.
Thomas Gummerer5d9fc882014-02-23 21:49:58 +0100395#
396# Define TEST_GIT_INDEX_VERSION to 2, 3 or 4 to run the test suite
397# with a different indexfile format version. If it isn't set the index
398# file format used is index-v[23].
Junio C Hamanobdb830c2014-04-08 11:59:05 -0700399#
Jeff King66547542014-04-01 17:28:42 -0400400# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
401# return NULL when it receives a bogus time_t.
Karsten Blees148d6772014-07-12 02:05:42 +0200402#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400403# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -0800404#
Ronald Wamplerd19e3a52016-07-07 16:45:54 -0400405# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
406#
407# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
408# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
Reuben Hawkins88e01182015-01-08 12:00:57 -0800409#
Kyle J. McKay290c8e72015-01-11 12:09:22 -0800410# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
411# compiles the following initialization:
412#
413# static const char s[] = ("FOO");
414#
415# and define it to "no" if you need to remove the parentheses () around the
416# constant. The default is "auto", which means to use parentheses if your
417# compiler is detected to support it.
Junio C Hamano551fc7a2015-03-20 13:11:49 -0700418#
Kyle J. McKay95290802015-03-07 23:14:36 -0800419# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
Jeff King0cc30e02015-04-16 05:01:38 -0400420#
421# Define HAVE_GETDELIM if your system has the getdelim() function.
Eric Wong995bc222016-08-04 11:40:25 +0000422#
423# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
424# default environment variables to be passed when a pager is spawned, e.g.
425#
426# PAGER_ENV = LESS=FRX LV=-c
427#
428# to say "export LESS=FRX (and LV=-c) if the environment variable
429# LESS (and LV) is not set, respectively".
Eric Sunshineb2289402017-12-15 00:34:34 +0100430#
Jeff King3f824e92017-12-08 05:47:22 -0500431# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
432# running the test scripts (e.g., bash has better support for "set -x"
433# tracing).
Junio C Hamano07b747d2018-01-05 13:28:09 -0800434#
Eric Sunshineb2289402017-12-15 00:34:34 +0100435# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
436# which the built Git will run (for instance "x86_64").
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200437
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600438GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100439 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800440-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200441
Junio C Hamano94d23312005-11-13 01:46:13 -0800442# CFLAGS and LDFLAGS are for the users to override from the command line.
Junio C Hamano12aa7452005-11-04 23:50:09 -0800443
Pavel Roskinb05701c2005-08-06 01:36:15 -0400444CFLAGS = -g -O2 -Wall
Matthieu Moy51dd3e82016-06-01 10:00:08 +0200445DEVELOPER_CFLAGS = -Werror \
Lars Schneider658df952016-02-25 09:42:22 +0100446 -Wdeclaration-after-statement \
447 -Wno-format-zero-length \
448 -Wold-style-definition \
449 -Woverflow \
450 -Wpointer-arith \
451 -Wstrict-prototypes \
452 -Wunused \
453 -Wvla
Junio C Hamano94d23312005-11-13 01:46:13 -0800454LDFLAGS =
Gary V. Vaughanebef8272010-05-14 09:31:32 +0000455ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
Junio C Hamano94d23312005-11-13 01:46:13 -0800456ALL_LDFLAGS = $(LDFLAGS)
Junio C Hamano4dc00022006-01-12 21:42:25 -0800457STRIP ?= strip
Lars Schneider658df952016-02-25 09:42:22 +0100458
Junio C Hamanoac179b42015-09-10 14:27:21 -0700459# Create as necessary, replace existing, make ranlib unneeded.
460ARFLAGS = rcs
461
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200462# Among the variables below, these:
463# gitexecdir
464# template_dir
Johannes Sixt9fb1e692011-05-09 10:24:55 +0200465# sysconfdir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100466# can be specified as a relative path some/where/else;
467# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200468# runtime figures out where they are based on the path to the executable.
John Keeping971f8532013-02-24 19:55:01 +0000469# Additionally, the following will be treated as relative by "git" if they
470# begin with "$(prefix)/":
471# mandir
472# infodir
473# htmldir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200474# This can help installing the suite in a relocatable way.
475
Pavel Roskinb05701c2005-08-06 01:36:15 -0400476prefix = $(HOME)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100477bindir_relative = bin
478bindir = $(prefix)/$(bindir_relative)
John Keeping971f8532013-02-24 19:55:01 +0000479mandir = $(prefix)/share/man
480infodir = $(prefix)/share/info
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100481gitexecdir = libexec/git-core
David Aguilarbc7a96a2011-08-18 00:23:46 -0700482mergetoolsdir = $(gitexecdir)/mergetools
Johannes Sixt93547682007-06-11 10:02:17 +0200483sharedir = $(prefix)/share
Pavan Kumar Sunkarabc951962010-05-28 11:55:50 +0530484gitwebdir = $(sharedir)/gitweb
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000485perllibdir = $(sharedir)/perl5
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100486localedir = $(sharedir)/locale
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100487template_dir = share/git-core/templates
John Keeping971f8532013-02-24 19:55:01 +0000488htmldir = $(prefix)/share/doc/git-doc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100489ETC_GITCONFIG = $(sysconfdir)/gitconfig
Petr Onderka6df42ab2010-09-01 00:42:43 +0200490ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
Robert Schiele10861be2007-08-01 06:30:35 +0200491lib = lib
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100492# DESTDIR =
Johannes Schindelin352c8112009-05-23 10:04:48 +0200493pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700494
John Keeping971f8532013-02-24 19:55:01 +0000495mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
496infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
497htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
498
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +0000499export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200500
Ævar Arnfjörð Bjarmason6d62c982011-12-20 23:40:47 +0000501CC = cc
Pavel Roskinb05701c2005-08-06 01:36:15 -0400502AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500503RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000504DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700505TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700506FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400507INSTALL = install
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400508TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700509TCLTK_PATH = wish
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +0000510XGETTEXT = xgettext
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100511MSGFMT = msgfmt
Remi Pommarelf8915872015-10-21 19:10:46 +0200512CURL_CONFIG = curl-config
David M. Syzdek158629b2008-11-02 14:43:20 -0900513PTHREAD_LIBS = -lpthread
Gary V. Vaughan48793cf2010-05-14 09:31:34 +0000514PTHREAD_CFLAGS =
Thomas Raste146d172010-07-26 09:43:41 +0200515GCOV = gcov
René Scharfe63f0a752016-09-15 20:30:56 +0200516SPATCH = spatch
Linus Torvaldse83c5162005-04-07 15:13:13 -0700517
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400518export TCL_PATH TCLTK_PATH
519
Ramsay Jonesf228d1f2011-04-07 19:22:18 +0100520SPARSE_FLAGS =
René Scharfea9a884a2016-09-30 01:21:17 +0200521SPATCH_FLAGS = --all-includes
Linus Torvalds44c9e852005-07-03 10:02:35 -0700522
Petr Baudis28818ff2005-07-29 17:50:24 +0200523
524
525### --- END CONFIGURATION SECTION ---
526
Petr Baudis8d7f5862006-06-25 03:47:03 +0200527# Those must not be GNU-specific; they are shared with perl/ which may
Petr Baudis18b0fc12006-09-23 20:20:47 +0200528# be built by a different compiler. (Note that this is an artifact now
529# but it still might be nice to keep that distinction.)
Linus Torvalds81b50f32010-02-22 08:42:18 -0800530BASIC_CFLAGS = -I.
Petr Baudis18b0fc12006-09-23 20:20:47 +0200531BASIC_LDFLAGS =
Petr Baudis8d7f5862006-06-25 03:47:03 +0200532
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100533# Guard against environment variables
534BUILTIN_OBJS =
535BUILT_INS =
536COMPAT_CFLAGS =
537COMPAT_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500538XDIFF_OBJS =
Jonathan Nieder3371f9b2011-03-27 13:13:22 -0500539VCSSVN_OBJS =
Jeff Kingb8ba6292012-06-20 14:30:56 -0400540GENERATED_H =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500541EXTRA_CPPFLAGS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100542LIB_OBJS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600543PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100544PROGRAMS =
545SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100546SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100547SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800548SCRIPT_LIB =
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100549TEST_BUILTINS_OBJS =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600550TEST_PROGRAMS_NEED_X =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100551
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500552# Having this variable in your environment would break pipelines because
553# you cause "cd" to echo its destination to stdout. It can also take
554# scripts to unexpected places. If you like CDPATH, define it for your
555# interactive shell sessions without exporting it.
556unexport CDPATH
557
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700558SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700559SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700560SCRIPT_SH += git-filter-branch.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700561SCRIPT_SH += git-merge-octopus.sh
562SCRIPT_SH += git-merge-one-file.sh
563SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700564SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700565SCRIPT_SH += git-quiltimport.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700566SCRIPT_SH += git-rebase.sh
Junio C Hamano709a9572013-04-26 16:30:40 -0700567SCRIPT_SH += git-remote-testgit.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700568SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700569SCRIPT_SH += git-stash.sh
570SCRIPT_SH += git-submodule.sh
571SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200572
Jonathan Nieder46bac902010-01-31 11:46:53 -0800573SCRIPT_LIB += git-mergetool--lib
574SCRIPT_LIB += git-parse-remote
Martin von Zweigbergkfdb76c12011-02-24 22:32:06 -0500575SCRIPT_LIB += git-rebase--am
576SCRIPT_LIB += git-rebase--interactive
577SCRIPT_LIB += git-rebase--merge
Jonathan Nieder46bac902010-01-31 11:46:53 -0800578SCRIPT_LIB += git-sh-setup
Ævar Arnfjörð Bjarmasone00cf072011-05-14 13:47:43 +0000579SCRIPT_LIB += git-sh-i18n
Jonathan Nieder46bac902010-01-31 11:46:53 -0800580
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700581SCRIPT_PERL += git-add--interactive.perl
582SCRIPT_PERL += git-archimport.perl
583SCRIPT_PERL += git-cvsexportcommit.perl
584SCRIPT_PERL += git-cvsimport.perl
585SCRIPT_PERL += git-cvsserver.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700586SCRIPT_PERL += git-send-email.perl
587SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700588
Pete Wyckoffb6f93052012-04-08 20:18:00 -0400589SCRIPT_PYTHON += git-p4.py
Sverre Rabbelier7aeaa2f2010-03-29 11:48:28 -0500590
Felipe Contreras7ded0552013-06-07 17:03:07 -0500591NO_INSTALL += git-remote-testgit
Felipe Contreras416fda62013-05-24 21:41:06 -0500592
Matthieu Moy4c06b412013-02-08 18:31:16 +0100593# Generated files for scripts
594SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
595SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
596SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
597
Felipe Contreras4331ea82013-05-24 21:41:05 -0500598SCRIPT_SH_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_SH_GEN))
599SCRIPT_PERL_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PERL_GEN))
600SCRIPT_PYTHON_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PYTHON_GEN))
601
Matthieu Moy4c06b412013-02-08 18:31:16 +0100602# Individual rules to allow e.g.
603# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
604# from subdirectories like contrib/*/
605.PHONY: build-perl-script build-sh-script build-python-script
606build-perl-script: $(SCRIPT_PERL_GEN)
607build-sh-script: $(SCRIPT_SH_GEN)
608build-python-script: $(SCRIPT_PYTHON_GEN)
609
610.PHONY: install-perl-script install-sh-script install-python-script
Felipe Contreras4331ea82013-05-24 21:41:05 -0500611install-sh-script: $(SCRIPT_SH_INS)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500612 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Felipe Contreras4331ea82013-05-24 21:41:05 -0500613install-perl-script: $(SCRIPT_PERL_INS)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500614 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Felipe Contreras4331ea82013-05-24 21:41:05 -0500615install-python-script: $(SCRIPT_PYTHON_INS)
Felipe Contreras654f23f2013-05-24 21:41:02 -0500616 $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthieu Moy4c06b412013-02-08 18:31:16 +0100617
618.PHONY: clean-perl-script clean-sh-script clean-python-script
619clean-sh-script:
620 $(RM) $(SCRIPT_SH_GEN)
621clean-perl-script:
622 $(RM) $(SCRIPT_PERL_GEN)
623clean-python-script:
624 $(RM) $(SCRIPT_PYTHON_GEN)
625
Felipe Contreras4331ea82013-05-24 21:41:05 -0500626SCRIPTS = $(SCRIPT_SH_INS) \
627 $(SCRIPT_PERL_INS) \
628 $(SCRIPT_PYTHON_INS) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500629 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100630
Junio C Hamano2f769192010-09-28 16:08:38 -0500631ETAGS_TARGET = TAGS
632
Junio C Hamano42f77402006-08-15 21:38:07 -0700633# Empty...
634EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100635
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700636# ... and all the rest that could be moved out of bindir to gitexecdir
637PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600638
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700639PROGRAM_OBJS += credential-store.o
Erik Faye-Lunda666b472010-11-04 02:35:24 +0100640PROGRAM_OBJS += daemon.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600641PROGRAM_OBJS += fast-import.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700642PROGRAM_OBJS += http-backend.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600643PROGRAM_OBJS += imap-send.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700644PROGRAM_OBJS += sh-i18n--envsubst.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600645PROGRAM_OBJS += shell.o
646PROGRAM_OBJS += show-index.o
647PROGRAM_OBJS += upload-pack.o
Florian Achleitner48ea9f92012-09-19 17:21:16 +0200648PROGRAM_OBJS += remote-testsvn.o
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600649
Michael Palimakaace5e972012-02-08 21:59:04 +1100650# Binary suffix, set to .exe for Windows builds
651X =
652
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600653PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700654
Nguyễn Thái Ngọc Duy0e496492018-03-24 08:44:31 +0100655TEST_BUILTINS_OBJS += test-chmtime.o
656
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600657TEST_PROGRAMS_NEED_X += test-ctype
Tanay Abhra4c715eb2014-07-28 03:10:39 -0700658TEST_PROGRAMS_NEED_X += test-config
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600659TEST_PROGRAMS_NEED_X += test-date
660TEST_PROGRAMS_NEED_X += test-delta
Ben Peart14527b32017-09-22 12:35:48 -0400661TEST_PROGRAMS_NEED_X += test-drop-caches
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600662TEST_PROGRAMS_NEED_X += test-dump-cache-tree
Ben Peartdd3551f2017-09-22 12:35:44 -0400663TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
Nguyễn Thái Ngọc Duy3e52f702014-06-13 19:19:51 +0700664TEST_PROGRAMS_NEED_X += test-dump-split-index
Nguyễn Thái Ngọc Duya3ddcef2015-03-08 17:12:44 +0700665TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
Jonathan Tanddd3e312017-12-07 16:14:24 -0800666TEST_PROGRAMS_NEED_X += test-example-decorate
Johannes Schindelin3064d5a2016-01-27 17:19:37 +0100667TEST_PROGRAMS_NEED_X += test-fake-ssh
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600668TEST_PROGRAMS_NEED_X += test-genrandom
Karsten Blees6a364ce2013-11-14 20:17:54 +0100669TEST_PROGRAMS_NEED_X += test-hashmap
Jeff Kingd1925082011-05-19 17:24:24 -0400670TEST_PROGRAMS_NEED_X += test-index-version
Jeff Hostetlerea194892017-03-23 13:47:04 +0000671TEST_PROGRAMS_NEED_X += test-lazy-init-name-hash
David Barr3bbaec02010-08-09 17:39:43 -0500672TEST_PROGRAMS_NEED_X += test-line-buffer
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600673TEST_PROGRAMS_NEED_X += test-match-trees
René Scharfe0db71e02012-04-01 00:10:11 +0200674TEST_PROGRAMS_NEED_X += test-mergesort
Jeff Kingd1925082011-05-19 17:24:24 -0400675TEST_PROGRAMS_NEED_X += test-mktemp
Jeff Hostetlere3482cc2017-04-03 15:16:41 +0000676TEST_PROGRAMS_NEED_X += test-online-cpus
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600677TEST_PROGRAMS_NEED_X += test-parse-options
678TEST_PROGRAMS_NEED_X += test-path-utils
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700679TEST_PROGRAMS_NEED_X += test-prio-queue
René Scharfe1ecb5ff2013-06-09 19:39:17 +0200680TEST_PROGRAMS_NEED_X += test-read-cache
Kevin Willford3921a0b2017-08-21 15:24:30 -0600681TEST_PROGRAMS_NEED_X += test-write-cache
Nguyễn Thái Ngọc Duy80f2a602017-03-26 09:42:38 +0700682TEST_PROGRAMS_NEED_X += test-ref-store
Ramsay Jonesc9184152012-09-01 18:46:54 +0100683TEST_PROGRAMS_NEED_X += test-regex
Heiko Voigtbcc0a3e2012-03-29 09:21:21 +0200684TEST_PROGRAMS_NEED_X += test-revision-walking
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600685TEST_PROGRAMS_NEED_X += test-run-command
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700686TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600687TEST_PROGRAMS_NEED_X += test-sha1
René Scharfe38d905b2014-10-01 17:00:33 +0200688TEST_PROGRAMS_NEED_X += test-sha1-array
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600689TEST_PROGRAMS_NEED_X += test-sigchain
Jeff Hostetlera6db3fb2017-04-14 19:12:28 +0000690TEST_PROGRAMS_NEED_X += test-strcmp-offset
Michael Haggertyff919f92012-09-12 16:04:43 +0200691TEST_PROGRAMS_NEED_X += test-string-list
Heiko Voigt959b5452015-08-17 17:21:57 -0700692TEST_PROGRAMS_NEED_X += test-submodule-config
Nguyễn Thái Ngọc Duy0ed74812010-12-27 08:26:04 +0700693TEST_PROGRAMS_NEED_X += test-subprocess
David Barr21746aa2010-08-09 17:55:00 -0500694TEST_PROGRAMS_NEED_X += test-svn-fe
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +0100695TEST_PROGRAMS_NEED_X += test-tool
Kyle J. McKay6a569932013-08-05 13:20:36 -0700696TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +0700697TEST_PROGRAMS_NEED_X += test-wildmatch
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600698
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +0700699TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100700
Junio C Hamano17368552008-02-23 11:08:25 -0800701# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800702# builtin/$C.o but is linked in as part of some other command.
703BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700704
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700705BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100706BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700707BUILT_INS += git-format-patch$X
708BUILT_INS += git-fsck-objects$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700709BUILT_INS += git-init$X
710BUILT_INS += git-merge-subtree$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700711BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800712BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700713BUILT_INS += git-status$X
714BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700715
Junio C Hamanoad17f012009-08-07 12:09:29 -0700716# what 'all' will build and 'install' will install in gitexecdir,
717# excluding programs for built-in commands
Junio C Hamano6506e152007-02-06 21:27:09 -0800718ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
Linus Torvaldse83c5162005-04-07 15:13:13 -0700719
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700720# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400721OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700722
Matthew Ogilvieea925192009-12-02 22:14:05 -0700723# what test wrappers are needed and 'install' will install, in bindir
724BINDIR_PROGRAMS_NEED_X += git
725BINDIR_PROGRAMS_NEED_X += git-upload-pack
726BINDIR_PROGRAMS_NEED_X += git-receive-pack
727BINDIR_PROGRAMS_NEED_X += git-upload-archive
728BINDIR_PROGRAMS_NEED_X += git-shell
729
730BINDIR_PROGRAMS_NO_X += git-cvsserver
731
Ryan Anderson3d320512005-11-21 00:11:22 -0500732# Set paths to tools early so that they can be used for version tests.
733ifndef SHELL_PATH
734 SHELL_PATH = /bin/sh
735endif
736ifndef PERL_PATH
737 PERL_PATH = /usr/bin/perl
738endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100739ifndef PYTHON_PATH
740 PYTHON_PATH = /usr/bin/python
741endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700742
Luben Tuikov3a793472006-12-14 23:03:03 -0800743export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100744export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800745
Jeff King3f824e92017-12-08 05:47:22 -0500746TEST_SHELL_PATH = $(SHELL_PATH)
747
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +0100748LIB_FILE = libgit.a
749XDIFF_LIB = xdiff/lib.a
750VCSSVN_LIB = vcs-svn/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700751
Jeff Kingb8ba6292012-06-20 14:30:56 -0400752GENERATED_H += common-cmds.h
Nguyễn Thái Ngọc Duy1b8b2e42012-04-23 19:30:21 +0700753
Jeff Kingd85b0df2014-08-25 16:00:42 -0400754LIB_H = $(shell $(FIND) . \
755 -name .git -prune -o \
756 -name t -prune -o \
757 -name Documentation -prune -o \
758 -name '*.h' -print)
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700759
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400760LIB_OBJS += abspath.o
Jeff King75194432009-09-09 07:38:58 -0400761LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700762LIB_OBJS += alias.o
763LIB_OBJS += alloc.o
Christian Couderbb493a52016-08-08 23:03:07 +0200764LIB_OBJS += apply.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700765LIB_OBJS += archive.o
766LIB_OBJS += archive-tar.o
767LIB_OBJS += archive-zip.o
Jeff Kingc1189ca2011-09-13 17:57:57 -0400768LIB_OBJS += argv-array.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700769LIB_OBJS += attr.o
770LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100771LIB_OBJS += bisect.o
Jeff Smithf5dd7542017-05-24 00:15:33 -0500772LIB_OBJS += blame.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700773LIB_OBJS += blob.o
774LIB_OBJS += branch.o
Junio C Hamano568508e2011-10-28 14:48:40 -0700775LIB_OBJS += bulk-checkin.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700776LIB_OBJS += bundle.o
777LIB_OBJS += cache-tree.o
Thomas Gummerer7c85a872017-11-26 19:43:51 +0000778LIB_OBJS += checkout.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700779LIB_OBJS += color.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700780LIB_OBJS += column.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700781LIB_OBJS += combine-diff.o
782LIB_OBJS += commit.o
Fredrik Kuivinene8311712011-08-21 00:40:40 +0200783LIB_OBJS += compat/obstack.o
Jeff King21aeafc2011-12-10 05:41:01 -0500784LIB_OBJS += compat/terminal.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700785LIB_OBJS += config.o
786LIB_OBJS += connect.o
Junio C Hamanof96400c2011-09-02 16:33:22 -0700787LIB_OBJS += connected.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700788LIB_OBJS += convert.o
789LIB_OBJS += copy.o
Jeff Kingabca9272011-12-10 05:31:11 -0500790LIB_OBJS += credential.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700791LIB_OBJS += csum-file.o
792LIB_OBJS += ctype.o
793LIB_OBJS += date.o
794LIB_OBJS += decorate.o
795LIB_OBJS += diffcore-break.o
796LIB_OBJS += diffcore-delta.o
797LIB_OBJS += diffcore-order.o
798LIB_OBJS += diffcore-pickaxe.o
799LIB_OBJS += diffcore-rename.o
800LIB_OBJS += diff-delta.o
801LIB_OBJS += diff-lib.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100802LIB_OBJS += diff-no-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700803LIB_OBJS += diff.o
804LIB_OBJS += dir.o
Michael Haggerty0fe50432016-06-18 06:15:18 +0200805LIB_OBJS += dir-iterator.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200806LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700807LIB_OBJS += entry.o
808LIB_OBJS += environment.o
Vicent Martie1273102013-11-14 07:43:51 -0500809LIB_OBJS += ewah/bitmap.o
810LIB_OBJS += ewah/ewah_bitmap.o
811LIB_OBJS += ewah/ewah_io.o
812LIB_OBJS += ewah/ewah_rlw.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700813LIB_OBJS += exec_cmd.o
Jonathan Tan88e2f9e2017-12-05 16:58:49 +0000814LIB_OBJS += fetch-object.o
Nguyễn Thái Ngọc Duy745f7a82012-10-26 22:53:55 +0700815LIB_OBJS += fetch-pack.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700816LIB_OBJS += fsck.o
Ben Peart883e2482017-09-22 12:35:40 -0400817LIB_OBJS += fsmonitor.o
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +0100818LIB_OBJS += gettext.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700819LIB_OBJS += gpg-interface.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700820LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700821LIB_OBJS += grep.o
Karsten Blees6a364ce2013-11-14 20:17:54 +0100822LIB_OBJS += hashmap.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700823LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800824LIB_OBJS += hex.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700825LIB_OBJS += ident.o
Fredrik Kuivinenb95c5ad2011-08-21 00:41:57 +0200826LIB_OBJS += kwset.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200827LIB_OBJS += levenshtein.o
Thomas Rast12da1d12013-03-28 17:47:32 +0100828LIB_OBJS += line-log.o
Bo Yang25ed3412013-03-28 17:47:30 +0100829LIB_OBJS += line-range.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700830LIB_OBJS += list-objects.o
Jeff Hostetler25ec7bc2017-11-21 20:58:50 +0000831LIB_OBJS += list-objects-filter.o
832LIB_OBJS += list-objects-filter-options.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700833LIB_OBJS += ll-merge.o
834LIB_OBJS += lockfile.o
835LIB_OBJS += log-tree.o
Junio C Hamanoc6905e42015-10-14 17:44:55 -0700836LIB_OBJS += mailinfo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700837LIB_OBJS += mailmap.o
838LIB_OBJS += match-trees.o
Nguyễn Thái Ngọc Duydb699a82012-10-26 22:53:49 +0700839LIB_OBJS += merge.o
Junio C Hamanofa2364e2012-12-06 15:08:01 -0800840LIB_OBJS += merge-blobs.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200841LIB_OBJS += merge-recursive.o
René Scharfe0db71e02012-04-01 00:10:11 +0200842LIB_OBJS += mergesort.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700843LIB_OBJS += name-hash.o
Johannes Schindelina97a7462009-10-09 12:21:57 +0200844LIB_OBJS += notes.o
Jeff Kinga941d5e2010-04-01 20:07:40 -0400845LIB_OBJS += notes-cache.o
Johan Herland75ef3f42010-11-09 22:49:46 +0100846LIB_OBJS += notes-merge.o
Johan Herland49c24702013-06-12 02:13:00 +0200847LIB_OBJS += notes-utils.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700848LIB_OBJS += object.o
Jonathan Tan9e6fabde2017-09-29 15:54:22 -0700849LIB_OBJS += oidmap.o
Jeff King29c2bd52017-02-08 15:53:07 -0500850LIB_OBJS += oidset.o
Jonathan Tan4f39cd82017-08-18 15:20:16 -0700851LIB_OBJS += packfile.o
Vicent Martifff42752013-12-21 09:00:01 -0500852LIB_OBJS += pack-bitmap.o
Vicent Marti7cc8f972013-12-21 09:00:16 -0500853LIB_OBJS += pack-bitmap-write.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700854LIB_OBJS += pack-check.o
Vicent Marti2834bc22013-10-24 14:01:06 -0400855LIB_OBJS += pack-objects.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700856LIB_OBJS += pack-revindex.o
857LIB_OBJS += pack-write.o
858LIB_OBJS += pager.o
859LIB_OBJS += parse-options.o
Dmitry Ivankov06876282011-08-11 15:15:38 +0600860LIB_OBJS += parse-options-cb.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700861LIB_OBJS += patch-delta.o
862LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700863LIB_OBJS += path.o
Adam Spiers6f525e72013-01-06 16:58:08 +0000864LIB_OBJS += pathspec.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700865LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100866LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700867LIB_OBJS += pretty.o
Junio C Hamanob4b594a2013-06-06 19:13:50 -0700868LIB_OBJS += prio-queue.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700869LIB_OBJS += progress.o
Jeff Kingd3c58b82011-12-10 05:40:54 -0500870LIB_OBJS += prompt.o
Brandon Williams373d70e2017-10-16 10:55:24 -0700871LIB_OBJS += protocol.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700872LIB_OBJS += quote.o
873LIB_OBJS += reachable.o
874LIB_OBJS += read-cache.o
875LIB_OBJS += reflog-walk.o
876LIB_OBJS += refs.o
Michael Haggerty7bd9bcf2015-11-09 14:34:01 +0100877LIB_OBJS += refs/files-backend.o
Michael Haggerty3bc581b2016-06-18 06:15:15 +0200878LIB_OBJS += refs/iterator.o
Michael Haggerty67be7c52017-06-23 09:01:37 +0200879LIB_OBJS += refs/packed-backend.o
Michael Haggerty958f9642017-04-16 08:41:31 +0200880LIB_OBJS += refs/ref-cache.o
Karthik Nayakc95b7582015-06-14 01:07:27 +0530881LIB_OBJS += ref-filter.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700882LIB_OBJS += remote.o
Christian Couder68095572009-01-23 10:06:53 +0100883LIB_OBJS += replace_object.o
Brandon Williams359efef2017-06-22 11:43:32 -0700884LIB_OBJS += repository.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200885LIB_OBJS += rerere.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800886LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700887LIB_OBJS += revision.o
888LIB_OBJS += run-command.o
Nguyễn Thái Ngọc Duyf5d942e2012-10-26 22:53:53 +0700889LIB_OBJS += send-pack.o
Nguyễn Thái Ngọc Duy82759052012-05-04 20:52:36 +0700890LIB_OBJS += sequencer.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700891LIB_OBJS += server-info.o
892LIB_OBJS += setup.o
Jeff King902bb362011-05-19 17:34:33 -0400893LIB_OBJS += sha1-array.o
Junio C Hamano628522e2007-12-29 02:05:47 -0800894LIB_OBJS += sha1-lookup.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100895LIB_OBJS += sha1_file.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700896LIB_OBJS += sha1_name.o
897LIB_OBJS += shallow.o
898LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -0500899LIB_OBJS += sigchain.o
Nguyễn Thái Ngọc Duy5fc2fc82014-06-13 19:19:36 +0700900LIB_OBJS += split-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700901LIB_OBJS += strbuf.o
Junio C Hamano46bf0432011-05-11 19:30:25 -0700902LIB_OBJS += streaming.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100903LIB_OBJS += string-list.o
Johannes Schindelin752c0c22009-10-19 14:38:32 +0200904LIB_OBJS += submodule.o
Heiko Voigt959b5452015-08-17 17:21:57 -0700905LIB_OBJS += submodule-config.o
Ben Peart99605d62017-05-05 11:28:01 -0400906LIB_OBJS += sub-process.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700907LIB_OBJS += symlinks.o
908LIB_OBJS += tag.o
Michael Haggerty1a9d15d2015-08-10 11:47:41 +0200909LIB_OBJS += tempfile.o
Jeff King2564d992016-10-03 16:49:11 -0400910LIB_OBJS += tmp-objdir.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700911LIB_OBJS += trace.o
Christian Couder9385b5d2014-10-13 20:16:23 +0200912LIB_OBJS += trailer.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700913LIB_OBJS += transport.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -0400914LIB_OBJS += transport-helper.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700915LIB_OBJS += tree-diff.o
916LIB_OBJS += tree.o
917LIB_OBJS += tree-walk.o
918LIB_OBJS += unpack-trees.o
Jeff King638794c2010-05-23 05:17:55 -0400919LIB_OBJS += url.o
Kyle J. McKay6a569932013-08-05 13:20:36 -0700920LIB_OBJS += urlmatch.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700921LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100922LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700923LIB_OBJS += utf8.o
Junio C Hamanod2c18982012-04-03 15:53:08 -0700924LIB_OBJS += varint.o
Jeff King816fb462012-06-02 14:51:42 -0400925LIB_OBJS += version.o
Nguyễn Thái Ngọc Duy9ef176b2014-02-27 19:56:52 +0700926LIB_OBJS += versioncmp.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700927LIB_OBJS += walker.o
Nguyễn Thái Ngọc Duyfeabcc12012-10-15 13:25:55 +0700928LIB_OBJS += wildmatch.o
Michael Rappazzoac6c5612015-10-02 07:55:31 -0400929LIB_OBJS += worktree.o
Linus Torvalds112db552008-06-22 12:19:25 -0700930LIB_OBJS += wrapper.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700931LIB_OBJS += write_or_die.o
932LIB_OBJS += ws.o
933LIB_OBJS += wt-status.o
934LIB_OBJS += xdiff-interface.o
Jonathan Niederb0613ce2010-11-06 06:47:34 -0500935LIB_OBJS += zlib.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +0200936
Linus Torvalds81b50f32010-02-22 08:42:18 -0800937BUILTIN_OBJS += builtin/add.o
Paul Tan73c27792015-08-04 21:51:24 +0800938BUILTIN_OBJS += builtin/am.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800939BUILTIN_OBJS += builtin/annotate.o
940BUILTIN_OBJS += builtin/apply.o
941BUILTIN_OBJS += builtin/archive.o
942BUILTIN_OBJS += builtin/bisect--helper.o
943BUILTIN_OBJS += builtin/blame.o
944BUILTIN_OBJS += builtin/branch.o
945BUILTIN_OBJS += builtin/bundle.o
946BUILTIN_OBJS += builtin/cat-file.o
947BUILTIN_OBJS += builtin/check-attr.o
Adam Spiers368aa522013-01-06 16:58:13 +0000948BUILTIN_OBJS += builtin/check-ignore.o
Eric Sunshine226ad342013-07-12 20:53:10 -0400949BUILTIN_OBJS += builtin/check-mailmap.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800950BUILTIN_OBJS += builtin/check-ref-format.o
951BUILTIN_OBJS += builtin/checkout-index.o
952BUILTIN_OBJS += builtin/checkout.o
953BUILTIN_OBJS += builtin/clean.o
954BUILTIN_OBJS += builtin/clone.o
Nguyễn Thái Ngọc Duy7e29b822012-04-21 11:44:32 +0700955BUILTIN_OBJS += builtin/column.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800956BUILTIN_OBJS += builtin/commit-tree.o
957BUILTIN_OBJS += builtin/commit.o
958BUILTIN_OBJS += builtin/config.o
959BUILTIN_OBJS += builtin/count-objects.o
Javier Roucher Iglesiase30b2fe2012-06-24 13:39:59 +0200960BUILTIN_OBJS += builtin/credential.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800961BUILTIN_OBJS += builtin/describe.o
962BUILTIN_OBJS += builtin/diff-files.o
963BUILTIN_OBJS += builtin/diff-index.o
964BUILTIN_OBJS += builtin/diff-tree.o
965BUILTIN_OBJS += builtin/diff.o
Johannes Schindelinbe8a90e2017-01-17 16:54:57 +0100966BUILTIN_OBJS += builtin/difftool.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800967BUILTIN_OBJS += builtin/fast-export.o
968BUILTIN_OBJS += builtin/fetch-pack.o
969BUILTIN_OBJS += builtin/fetch.o
970BUILTIN_OBJS += builtin/fmt-merge-msg.o
971BUILTIN_OBJS += builtin/for-each-ref.o
972BUILTIN_OBJS += builtin/fsck.o
973BUILTIN_OBJS += builtin/gc.o
Jonathan Niederbb5d5312013-12-02 15:37:10 -0800974BUILTIN_OBJS += builtin/get-tar-commit-id.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800975BUILTIN_OBJS += builtin/grep.o
976BUILTIN_OBJS += builtin/hash-object.o
977BUILTIN_OBJS += builtin/help.o
978BUILTIN_OBJS += builtin/index-pack.o
979BUILTIN_OBJS += builtin/init-db.o
Christian Couder6634f052014-10-13 20:16:29 +0200980BUILTIN_OBJS += builtin/interpret-trailers.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800981BUILTIN_OBJS += builtin/log.o
982BUILTIN_OBJS += builtin/ls-files.o
983BUILTIN_OBJS += builtin/ls-remote.o
984BUILTIN_OBJS += builtin/ls-tree.o
985BUILTIN_OBJS += builtin/mailinfo.o
986BUILTIN_OBJS += builtin/mailsplit.o
987BUILTIN_OBJS += builtin/merge.o
988BUILTIN_OBJS += builtin/merge-base.o
989BUILTIN_OBJS += builtin/merge-file.o
990BUILTIN_OBJS += builtin/merge-index.o
991BUILTIN_OBJS += builtin/merge-ours.o
992BUILTIN_OBJS += builtin/merge-recursive.o
993BUILTIN_OBJS += builtin/merge-tree.o
994BUILTIN_OBJS += builtin/mktag.o
995BUILTIN_OBJS += builtin/mktree.o
996BUILTIN_OBJS += builtin/mv.o
997BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -0700998BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800999BUILTIN_OBJS += builtin/pack-objects.o
1000BUILTIN_OBJS += builtin/pack-redundant.o
1001BUILTIN_OBJS += builtin/pack-refs.o
1002BUILTIN_OBJS += builtin/patch-id.o
1003BUILTIN_OBJS += builtin/prune-packed.o
1004BUILTIN_OBJS += builtin/prune.o
Paul Tan1e1ea692015-06-14 16:41:51 +08001005BUILTIN_OBJS += builtin/pull.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001006BUILTIN_OBJS += builtin/push.o
1007BUILTIN_OBJS += builtin/read-tree.o
Johannes Schindelin4557f1a2017-02-09 23:23:06 +01001008BUILTIN_OBJS += builtin/rebase--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001009BUILTIN_OBJS += builtin/receive-pack.o
1010BUILTIN_OBJS += builtin/reflog.o
1011BUILTIN_OBJS += builtin/remote.o
Ilari Liusvaara7f3eceb2010-10-12 19:39:43 +03001012BUILTIN_OBJS += builtin/remote-ext.o
Ilari Liusvaara3a9ed4b2010-10-12 19:39:42 +03001013BUILTIN_OBJS += builtin/remote-fd.o
Stefan Bellera1bbc6c2013-09-15 17:33:20 +02001014BUILTIN_OBJS += builtin/repack.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001015BUILTIN_OBJS += builtin/replace.o
1016BUILTIN_OBJS += builtin/rerere.o
1017BUILTIN_OBJS += builtin/reset.o
1018BUILTIN_OBJS += builtin/rev-list.o
1019BUILTIN_OBJS += builtin/rev-parse.o
1020BUILTIN_OBJS += builtin/revert.o
1021BUILTIN_OBJS += builtin/rm.o
1022BUILTIN_OBJS += builtin/send-pack.o
1023BUILTIN_OBJS += builtin/shortlog.o
1024BUILTIN_OBJS += builtin/show-branch.o
1025BUILTIN_OBJS += builtin/show-ref.o
1026BUILTIN_OBJS += builtin/stripspace.o
Stefan Beller74703a12015-09-02 14:42:24 -07001027BUILTIN_OBJS += builtin/submodule--helper.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001028BUILTIN_OBJS += builtin/symbolic-ref.o
1029BUILTIN_OBJS += builtin/tag.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001030BUILTIN_OBJS += builtin/unpack-file.o
1031BUILTIN_OBJS += builtin/unpack-objects.o
1032BUILTIN_OBJS += builtin/update-index.o
1033BUILTIN_OBJS += builtin/update-ref.o
1034BUILTIN_OBJS += builtin/update-server-info.o
1035BUILTIN_OBJS += builtin/upload-archive.o
1036BUILTIN_OBJS += builtin/var.o
Michael J Gruberd07b00b2014-06-23 09:05:49 +02001037BUILTIN_OBJS += builtin/verify-commit.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001038BUILTIN_OBJS += builtin/verify-pack.o
1039BUILTIN_OBJS += builtin/verify-tag.o
Nguyễn Thái Ngọc Duydf0b6cf2015-06-29 19:51:18 +07001040BUILTIN_OBJS += builtin/worktree.o
Linus Torvalds81b50f32010-02-22 08:42:18 -08001041BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -07001042
Jeff King3f2e2292016-07-01 01:58:58 -04001043GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +02001044EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -07001045
Jeff King42dcbb72012-06-02 15:01:12 -04001046GIT_USER_AGENT = git/$(GIT_VERSION)
1047
Junio C Hamanocac87dc2017-07-01 22:05:47 +00001048ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/sha1.h)
1049DC_SHA1_SUBMODULE = auto
1050endif
1051
Jeff Kinge1b6dbb2013-01-03 16:05:41 -05001052include config.mak.uname
Jakub Narebski55667712006-07-03 01:56:48 +02001053-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001054-include config.mak
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001055
Matthieu Moyd6156282016-05-31 15:24:43 +02001056ifdef DEVELOPER
Matthieu Moy51dd3e82016-06-01 10:00:08 +02001057CFLAGS += $(DEVELOPER_CFLAGS)
Matthieu Moyd6156282016-05-31 15:24:43 +02001058endif
1059
René Scharfe425ca672017-07-15 19:18:56 +02001060comma := ,
1061empty :=
1062space := $(empty) $(empty)
1063
Jeff King56b5db32017-07-10 09:24:42 -04001064ifdef SANITIZE
René Scharfe425ca672017-07-15 19:18:56 +02001065SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
Jeff King56b5db32017-07-10 09:24:42 -04001066BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
Jeff Kingddbc8a62017-07-10 09:24:47 -04001067BASIC_CFLAGS += -fno-omit-frame-pointer
René Scharfe425ca672017-07-15 19:18:56 +02001068ifneq ($(filter undefined,$(SANITIZERS)),)
Jeff King566cf0b2017-07-10 09:24:50 -04001069BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
1070endif
Jeff King0e5bba52017-09-08 02:38:41 -04001071ifneq ($(filter leak,$(SANITIZERS)),)
1072BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
1073endif
Jeff King56b5db32017-07-10 09:24:42 -04001074endif
1075
Johannes Sixt9fb1e692011-05-09 10:24:55 +02001076ifndef sysconfdir
1077ifeq ($(prefix),/usr)
1078sysconfdir = /etc
1079else
1080sysconfdir = etc
1081endif
1082endif
1083
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001084ifndef COMPUTE_HEADER_DEPENDENCIES
Jonathan Nieder024c8432011-11-18 03:58:21 -06001085COMPUTE_HEADER_DEPENDENCIES = auto
1086endif
1087
1088ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
David Aguilar1816bf22011-08-30 01:27:35 -07001089dep_check = $(shell $(CC) $(ALL_CFLAGS) \
Jonathan Nieder69789342011-11-18 17:23:24 -06001090 -c -MF /dev/null -MQ /dev/null -MMD -MP \
1091 -x c /dev/null -o /dev/null 2>&1; \
David Aguilar1816bf22011-08-30 01:27:35 -07001092 echo $$?)
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001093ifeq ($(dep_check),0)
Jonathan Nieder024c8432011-11-18 03:58:21 -06001094override COMPUTE_HEADER_DEPENDENCIES = yes
1095else
1096override COMPUTE_HEADER_DEPENDENCIES = no
Fredrik Kuivinen111ee182011-08-18 20:34:39 +02001097endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001098endif
1099
Jonathan Nieder024c8432011-11-18 03:58:21 -06001100ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001101USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
Jonathan Nieder024c8432011-11-18 03:58:21 -06001102else
1103ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
1104$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
1105(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
1106endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001107endif
1108
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001109ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001110SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
1111BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001112PATH := $(SANE_TOOL_PATH):${PATH}
1113else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001114BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001115endif
1116
Eric Sunshineb2289402017-12-15 00:34:34 +01001117ifeq (,$(HOST_CPU))
1118 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
1119else
1120 BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
1121endif
1122
Gary V. Vaughanf9f33cd2010-05-14 09:31:43 +00001123ifneq (,$(INLINE))
1124 BASIC_CFLAGS += -Dinline=$(INLINE)
1125endif
1126
Gary V. Vaughane88a1352010-05-14 09:31:42 +00001127ifneq (,$(SOCKLEN_T))
1128 BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
1129endif
1130
Kyle J. McKay290c8e72015-01-11 12:09:22 -08001131ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
1132 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
1133else
1134ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
1135 BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
1136endif
1137endif
1138
Brian Gernhardt59f86742006-12-12 12:01:47 -05001139ifeq ($(uname_S),Darwin)
1140 ifndef NO_FINK
1141 ifeq ($(shell test -d /sw/lib && echo y),y)
1142 BASIC_CFLAGS += -I/sw/include
1143 BASIC_LDFLAGS += -L/sw/lib
1144 endif
1145 endif
1146 ifndef NO_DARWIN_PORTS
1147 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1148 BASIC_CFLAGS += -I/opt/local/include
1149 BASIC_LDFLAGS += -L/opt/local/lib
1150 endif
1151 endif
David Aguilar4dcd7732013-05-19 06:23:34 -04001152 ifndef NO_APPLE_COMMON_CRYPTO
Lars Schneiderf01fe922016-11-06 20:35:04 +01001153 NO_OPENSSL = YesPlease
David Aguilar4dcd7732013-05-19 06:23:34 -04001154 APPLE_COMMON_CRYPTO = YesPlease
1155 COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1156 endif
David Aguilar29de2052013-05-11 01:22:26 -07001157 NO_REGEX = YesPlease
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001158 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001159endif
1160
Junio C Hamanof5b904d2008-08-16 21:56:24 -07001161ifndef CC_LD_DYNPATH
1162 ifdef NO_R_TO_GCC_LINKER
1163 # Some gcc does not accept and pass -R to the linker to specify
1164 # the runtime dynamic library path.
1165 CC_LD_DYNPATH = -Wl,-rpath,
1166 else
1167 CC_LD_DYNPATH = -R
1168 endif
Junio C Hamanobbfc63d2006-12-27 14:17:35 -08001169endif
1170
David Aguilare1c06882009-05-31 01:35:51 -07001171ifdef NO_LIBGEN_H
1172 COMPAT_CFLAGS += -DNO_LIBGEN_H
1173 COMPAT_OBJS += compat/basename.o
1174endif
1175
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001176USE_LIBPCRE1 ?= $(USE_LIBPCRE)
1177
1178ifneq (,$(USE_LIBPCRE1))
1179 ifdef USE_LIBPCRE2
1180$(error Only set USE_LIBPCRE1 (or its alias USE_LIBPCRE) or USE_LIBPCRE2, not both!)
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001181 endif
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001182
1183 BASIC_CFLAGS += -DUSE_LIBPCRE1
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001184 EXTLIBS += -lpcre
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00001185
1186ifdef NO_LIBPCRE1_JIT
1187 BASIC_CFLAGS += -DNO_LIBPCRE1_JIT
1188endif
Michał Kiedrowicz63e7e9d2011-05-09 23:52:05 +02001189endif
1190
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00001191ifdef USE_LIBPCRE2
1192 BASIC_CFLAGS += -DUSE_LIBPCRE2
1193 EXTLIBS += -lpcre2-8
1194endif
1195
1196ifdef LIBPCREDIR
1197 BASIC_CFLAGS += -I$(LIBPCREDIR)/include
1198 EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001199endif
1200
Kirill Smelkov61f76a32014-03-27 18:22:50 +04001201ifdef HAVE_ALLOCA_H
1202 BASIC_CFLAGS += -DHAVE_ALLOCA_H
1203endif
1204
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001205IMAP_SEND_BUILDDEPS =
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001206IMAP_SEND_LDFLAGS =
Bernhard Reiter1e16b252014-11-09 15:55:53 +01001207
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001208ifdef NO_CURL
1209 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001210 REMOTE_CURL_PRIMARY =
1211 REMOTE_CURL_ALIASES =
1212 REMOTE_CURL_NAMES =
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001213else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001214 ifdef CURLDIR
Junio C Hamanob2feb642014-04-30 10:58:10 -07001215 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
1216 BASIC_CFLAGS += -I$(CURLDIR)/include
1217 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001218 else
Junio C Hamanob2feb642014-04-30 10:58:10 -07001219 CURL_LIBCURL = -lcurl
1220 endif
1221 ifdef NEEDS_SSL_WITH_CURL
1222 CURL_LIBCURL += -lssl
1223 ifdef NEEDS_CRYPTO_WITH_SSL
1224 CURL_LIBCURL += -lcrypto
Dave Borowitzf3f11fa2014-04-28 14:01:23 -07001225 endif
1226 endif
Junio C Hamanob2feb642014-04-30 10:58:10 -07001227 ifdef NEEDS_IDN_WITH_CURL
1228 CURL_LIBCURL += -lidn
Thomas Cortbc5f8132011-07-19 18:55:47 -04001229 endif
1230
Johannes Sixt4256f362010-01-19 16:39:12 +01001231 REMOTE_CURL_PRIMARY = git-remote-http$X
1232 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1233 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001234 PROGRAM_OBJS += http-fetch.o
1235 PROGRAMS += $(REMOTE_CURL_NAMES)
Remi Pommarelf8915872015-10-21 19:10:46 +02001236 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 -08001237 ifeq "$(curl_check)" "070908"
1238 ifndef NO_EXPAT
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001239 PROGRAM_OBJS += http-push.o
Nick Hengeveld08900982005-11-18 17:08:36 -08001240 endif
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001241 endif
Remi Pommarelf8915872015-10-21 19:10:46 +02001242 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 +01001243 ifeq "$(curl_check)" "072200"
1244 USE_CURL_FOR_IMAP_SEND = YesPlease
1245 endif
1246 ifdef USE_CURL_FOR_IMAP_SEND
1247 BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1248 IMAP_SEND_BUILDDEPS = http.o
1249 IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1250 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001251 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001252 ifdef EXPATDIR
1253 BASIC_CFLAGS += -I$(EXPATDIR)/include
1254 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1255 else
1256 EXPAT_LIBEXPAT = -lexpat
1257 endif
Matt Kraai081fd8d2013-02-11 14:03:45 -08001258 ifdef EXPAT_NEEDS_XMLPARSE_H
1259 BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
1260 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001261 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001262endif
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02001263IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001264
Robert Schielebef19da2007-07-29 20:35:45 +02001265ifdef ZLIB_PATH
1266 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001267 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001268endif
1269EXTLIBS += -lz
1270
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001271ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001272 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001273 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001274 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001275 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001276 else
1277 OPENSSL_LINK =
1278 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001279 ifdef NEEDS_CRYPTO_WITH_SSL
Thomas Cortbc5f8132011-07-19 18:55:47 -04001280 OPENSSL_LIBSSL += -lcrypto
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001281 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001282else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001283 BASIC_CFLAGS += -DNO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001284 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001285endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001286ifdef NO_OPENSSL
1287 LIB_4_CRYPTO =
1288else
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001289ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001290 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001291else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001292 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001293endif
Brian Gernhardtc9849382013-08-05 11:59:22 -04001294ifdef APPLE_COMMON_CRYPTO
1295 LIB_4_CRYPTO += -framework Security -framework CoreFoundation
1296endif
Junio C Hamano5b02b9b2010-12-08 14:54:13 -08001297endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001298ifdef NEEDS_LIBICONV
Junio C Hamano455a7f32005-09-30 13:31:16 -07001299 ifdef ICONVDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001300 BASIC_CFLAGS += -I$(ICONVDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001301 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001302 else
1303 ICONV_LINK =
1304 endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001305 ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1306 ICONV_LINK += -lintl
1307 endif
Petr Baudisd595a472006-06-24 18:35:12 -07001308 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001309endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001310ifdef NEEDS_LIBGEN
1311 EXTLIBS += -lgen
1312endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001313ifndef NO_GETTEXT
1314ifndef LIBC_CONTAINS_LIBINTL
1315 EXTLIBS += -lintl
1316endif
1317endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001318ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001319 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001320endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001321ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001322 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001323endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001324ifdef NEEDS_RESOLV
1325 EXTLIBS += -lresolv
1326endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001327ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001328 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001329endif
David Michael110d6982012-12-14 14:56:59 -05001330ifdef NO_GECOS_IN_PWENT
1331 BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
1332endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001333ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1334 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1335endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001336ifdef USE_NSEC
1337 BASIC_CFLAGS += -DUSE_NSEC
1338endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001339ifdef USE_ST_TIMESPEC
1340 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1341endif
Junio C Hamano6520c842011-06-18 18:07:03 -07001342ifdef NO_NORETURN
1343 BASIC_CFLAGS += -DNO_NORETURN
1344endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001345ifdef NO_NSEC
1346 BASIC_CFLAGS += -DNO_NSEC
1347endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001348ifdef SNPRINTF_RETURNS_BOGUS
1349 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1350 COMPAT_OBJS += compat/snprintf.o
1351endif
Brandon Caseycba22522008-02-08 20:32:47 -06001352ifdef FREAD_READS_DIRECTORIES
1353 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1354 COMPAT_OBJS += compat/fopen.o
1355endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001356ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001357 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001358endif
Ævar Arnfjörð Bjarmasonbb946bb2011-02-22 23:41:21 +00001359ifdef GETTEXT_POISON
1360 BASIC_CFLAGS += -DGETTEXT_POISON
1361endif
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001362ifdef NO_GETTEXT
1363 BASIC_CFLAGS += -DNO_GETTEXT
Junio C Hamano60f40792012-01-23 18:31:09 -06001364 USE_GETTEXT_SCHEME ?= fallthrough
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001365endif
Joachim Schmitz6d45eb12012-09-17 23:16:39 +02001366ifdef NO_POLL
1367 NO_SYS_POLL_H = YesPlease
1368 COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
1369 COMPAT_OBJS += compat/poll/poll.o
1370endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001371ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001372 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001373 COMPAT_OBJS += compat/strcasestr.o
1374endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001375ifdef NO_STRLCPY
1376 COMPAT_CFLAGS += -DNO_STRLCPY
1377 COMPAT_OBJS += compat/strlcpy.o
1378endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001379ifdef NO_STRTOUMAX
1380 COMPAT_CFLAGS += -DNO_STRTOUMAX
Nick Alcocke3eed7f2011-11-02 15:46:22 +00001381 COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
Jason Riedybc6b4f52007-02-19 16:22:56 -08001382endif
1383ifdef NO_STRTOULL
1384 COMPAT_CFLAGS += -DNO_STRTOULL
1385endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001386ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001387 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001388 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001389endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001390ifdef NO_MKDTEMP
1391 COMPAT_CFLAGS += -DNO_MKDTEMP
1392 COMPAT_OBJS += compat/mkdtemp.o
1393endif
Joachim Schmitzdc9f4622012-09-08 19:01:31 +02001394ifdef MKDIR_WO_TRAILING_SLASH
1395 COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
1396 COMPAT_OBJS += compat/mkdir.o
1397endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001398ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001399 COMPAT_CFLAGS += -DNO_UNSETENV
1400 COMPAT_OBJS += compat/unsetenv.o
1401endif
Robert Schiele26009732008-01-24 19:34:46 +01001402ifdef NO_SYS_SELECT_H
1403 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1404endif
Markus Duft28449232010-10-27 10:39:52 +02001405ifdef NO_SYS_POLL_H
1406 BASIC_CFLAGS += -DNO_SYS_POLL_H
1407endif
Junio C Hamanob2d05e02012-12-18 09:35:33 -08001408ifdef NEEDS_SYS_PARAM_H
1409 BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
David Michael6ede7202012-12-14 14:56:58 -05001410endif
Markus Duft28449232010-10-27 10:39:52 +02001411ifdef NO_INTTYPES_H
1412 BASIC_CFLAGS += -DNO_INTTYPES_H
1413endif
1414ifdef NO_INITGROUPS
1415 BASIC_CFLAGS += -DNO_INITGROUPS
1416endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001417ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001418 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001419 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001420else
1421 ifdef USE_WIN32_MMAP
1422 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1423 COMPAT_OBJS += compat/win32mmap.o
1424 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001425endif
Michael Haggerty5b633612017-09-25 10:00:10 +02001426ifdef MMAP_PREVENTS_DELETE
1427 BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
1428endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001429ifdef OBJECT_CREATION_USES_RENAMES
1430 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001431endif
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001432ifdef NO_STRUCT_ITIMERVAL
1433 COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001434 NO_SETITIMER = YesPlease
Joachim Schmitz7f9e8482012-09-08 18:54:34 +02001435endif
1436ifdef NO_SETITIMER
1437 COMPAT_CFLAGS += -DNO_SETITIMER
1438endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001439ifdef NO_PREAD
1440 COMPAT_CFLAGS += -DNO_PREAD
1441 COMPAT_OBJS += compat/pread.o
1442endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001443ifdef NO_FAST_WORKING_DIRECTORY
1444 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1445endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001446ifdef NO_TRUSTABLE_FILEMODE
1447 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1448endif
David Michaeld543d9c2014-12-03 21:24:17 -05001449ifdef NEEDS_MODE_TRANSLATION
1450 COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
1451 COMPAT_OBJS += compat/stat.o
1452endif
hpa49744d62005-09-28 16:52:21 -07001453ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001454 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001455endif
Joachim Schmitz6c109902012-09-19 12:03:30 +02001456ifdef NO_INTPTR_T
1457 COMPAT_CFLAGS += -DNO_INTPTR_T
1458endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001459ifdef NO_UINTMAX_T
1460 BASIC_CFLAGS += -Duintmax_t=uint32_t
1461endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001462ifdef NO_SOCKADDR_STORAGE
1463ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001464 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001465else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001466 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001467endif
hpa49744d62005-09-28 16:52:21 -07001468endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001469ifdef NO_INET_NTOP
1470 LIB_OBJS += compat/inet_ntop.o
Mike Papeda523cc2010-11-04 02:35:11 +01001471 BASIC_CFLAGS += -DNO_INET_NTOP
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001472endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001473ifdef NO_INET_PTON
1474 LIB_OBJS += compat/inet_pton.o
Mike Papeda523cc2010-11-04 02:35:11 +01001475 BASIC_CFLAGS += -DNO_INET_PTON
Jon Loeligerdd467622006-09-26 09:47:43 -05001476endif
Johannes Sixt63203582011-12-12 22:12:56 +01001477ifndef NO_UNIX_SOCKETS
1478 LIB_OBJS += unix-socket.o
Johannes Sixt63203582011-12-12 22:12:56 +01001479 PROGRAM_OBJS += credential-cache.o
1480 PROGRAM_OBJS += credential-cache--daemon.o
1481endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001482
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001483ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001484 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001485endif
1486
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001487ifdef OLD_ICONV
1488 BASIC_CFLAGS += -DOLD_ICONV
1489endif
1490
David Symonds609a2282007-11-07 14:24:28 +11001491ifdef NO_DEFLATE_BOUND
1492 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1493endif
1494
Erik Faye-Lunda666b472010-11-04 02:35:24 +01001495ifdef NO_POSIX_GOODIES
1496 BASIC_CFLAGS += -DNO_POSIX_GOODIES
1497endif
1498
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001499ifdef APPLE_COMMON_CRYPTO
1500 # Apple CommonCrypto requires chunking
1501 SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
1502endif
1503
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001504ifdef OPENSSL_SHA1
1505 EXTLIBS += $(LIB_4_CRYPTO)
1506 BASIC_CFLAGS += -DSHA1_OPENSSL
Jeff King8325e432017-03-16 18:09:12 -04001507else
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001508ifdef BLK_SHA1
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001509 LIB_OBJS += block-sha1/sha1.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001510 BASIC_CFLAGS += -DSHA1_BLK
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001511else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001512ifdef PPC_SHA1
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001513 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
brian m. carlsonf18f8162017-03-11 22:28:18 +00001514 BASIC_CFLAGS += -DSHA1_PPC
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001515else
David Aguilar61067952013-05-19 06:23:35 -04001516ifdef APPLE_COMMON_CRYPTO
1517 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
brian m. carlsonf18f8162017-03-11 22:28:18 +00001518 BASIC_CFLAGS += -DSHA1_APPLE
David Aguilar61067952013-05-19 06:23:35 -04001519else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001520 DC_SHA1 := YesPlease
Takashi Iwai36f048c2017-08-15 14:04:16 +02001521 BASIC_CFLAGS += -DSHA1_DC
1522 LIB_OBJS += sha1dc_git.o
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001523ifdef DC_SHA1_EXTERNAL
1524 ifdef DC_SHA1_SUBMODULE
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001525 ifneq ($(DC_SHA1_SUBMODULE),auto)
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001526$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
Ævar Arnfjörð Bjarmasonf39e05f2017-12-08 22:29:57 +00001527 endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001528 endif
1529 BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
1530 EXTLIBS += -lsha1detectcoll
1531else
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001532ifdef DC_SHA1_SUBMODULE
1533 LIB_OBJS += sha1collisiondetection/lib/sha1.o
1534 LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
1535 BASIC_CFLAGS += -DDC_SHA1_SUBMODULE
1536else
Junio C Hamanoe6b07da2017-03-17 10:00:15 -07001537 LIB_OBJS += sha1dc/sha1.o
1538 LIB_OBJS += sha1dc/ubc_check.o
Ævar Arnfjörð Bjarmason86cfd612017-07-01 22:05:46 +00001539endif
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001540 BASIC_CFLAGS += \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001541 -DSHA1DC_NO_STANDARD_INCLUDES \
1542 -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
1543 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
Ævar Arnfjörð Bjarmasona0103912017-05-20 11:54:28 +00001544 -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001545endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001546endif
1547endif
David Aguilar61067952013-05-19 06:23:35 -04001548endif
Takashi Iwai3964cbb2017-08-15 14:04:17 +02001549endif
David Aguilar61067952013-05-19 06:23:35 -04001550
Atousa Pahlevan Duprat001fd7a2015-11-04 22:38:42 -08001551ifdef SHA1_MAX_BLOCK_SIZE
1552 LIB_OBJS += compat/sha1-chunked.o
1553 BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
1554endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001555ifdef NO_HSTRERROR
1556 COMPAT_CFLAGS += -DNO_HSTRERROR
1557 COMPAT_OBJS += compat/hstrerror.o
1558endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001559ifdef NO_MEMMEM
1560 COMPAT_CFLAGS += -DNO_MEMMEM
1561 COMPAT_OBJS += compat/memmem.o
1562endif
Matt Kraai40036be2012-12-18 14:03:55 -08001563ifdef NO_GETPAGESIZE
1564 COMPAT_CFLAGS += -DNO_GETPAGESIZE
1565endif
Brian Downing43fe9012008-02-05 15:10:44 -06001566ifdef INTERNAL_QSORT
1567 COMPAT_CFLAGS += -DINTERNAL_QSORT
1568 COMPAT_OBJS += compat/qsort.o
1569endif
René Scharfe04ee8b82017-01-22 18:51:11 +01001570ifdef HAVE_ISO_QSORT_S
1571 COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
1572else
1573 COMPAT_OBJS += compat/qsort_s.o
1574endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001575ifdef RUNTIME_PREFIX
1576 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1577endif
Alex Riesenb7774342007-03-07 00:44:49 +01001578
Junio C Hamano46059cc2008-11-15 04:08:14 -08001579ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001580 BASIC_CFLAGS += -DNO_PTHREADS
1581else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001582 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001583 EXTLIBS += $(PTHREAD_LIBS)
Andreas Ericsson833e3df2008-02-22 20:11:56 -06001584 LIB_OBJS += thread-utils.o
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001585endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001586
Chris Webbcb6a22c2010-04-13 10:07:13 +01001587ifdef HAVE_PATHS_H
1588 BASIC_CFLAGS += -DHAVE_PATHS_H
1589endif
1590
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001591ifdef HAVE_LIBCHARSET_H
1592 BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
Дилян Палаузовb5225282012-02-12 17:23:36 +01001593 EXTLIBS += $(CHARSET_LIB)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001594endif
1595
David Michaelb3e103d2012-12-14 14:57:01 -05001596ifdef HAVE_STRINGS_H
1597 BASIC_CFLAGS += -DHAVE_STRINGS_H
1598endif
1599
Jeff King21aeafc2011-12-10 05:41:01 -05001600ifdef HAVE_DEV_TTY
1601 BASIC_CFLAGS += -DHAVE_DEV_TTY
1602endif
1603
Alex Riesen81a24b52008-03-05 00:15:39 +01001604ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1605 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1606endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001607ifdef UNRELIABLE_FSTAT
1608 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1609endif
Jeff King02232ad2009-06-16 15:07:40 -04001610ifdef NO_REGEX
1611 COMPAT_CFLAGS += -Icompat/regex
1612 COMPAT_OBJS += compat/regex/regex.o
1613endif
Pat Thoyts5491e9e2014-08-30 23:38:59 +02001614ifdef NATIVE_CRLF
1615 BASIC_CFLAGS += -DNATIVE_CRLF
1616endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001617
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001618ifdef USE_NED_ALLOCATOR
René Scharfeca2baa32016-09-03 17:59:15 +02001619 COMPAT_CFLAGS += -Icompat/nedmalloc
1620 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1621 OVERRIDE_STRDUP = YesPlease
1622endif
1623
1624ifdef OVERRIDE_STRDUP
1625 COMPAT_CFLAGS += -DOVERRIDE_STRDUP
1626 COMPAT_OBJS += compat/strdup.o
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001627endif
1628
Junio C Hamano7b3bdbb2010-05-31 17:35:20 -07001629ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
1630 export GIT_TEST_CMP_USE_COPIED_CONTEXT
1631endif
1632
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001633ifndef NO_MSGFMT_EXTENDED_OPTIONS
1634 MSGFMT += --check --statistics
1635endif
1636
Jeff King66547542014-04-01 17:28:42 -04001637ifdef GMTIME_UNRELIABLE_ERRORS
1638 COMPAT_OBJS += compat/gmtime.o
1639 BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
1640endif
1641
Karsten Blees148d6772014-07-12 02:05:42 +02001642ifdef HAVE_CLOCK_GETTIME
1643 BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
Karsten Blees148d6772014-07-12 02:05:42 +02001644endif
1645
Reuben Hawkinsa6c3c632015-01-08 12:00:56 -08001646ifdef HAVE_CLOCK_MONOTONIC
1647 BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1648endif
1649
Ronald Wamplerd19e3a52016-07-07 16:45:54 -04001650ifdef NEEDS_LIBRT
1651 EXTLIBS += -lrt
1652endif
1653
Kyle J. McKay95290802015-03-07 23:14:36 -08001654ifdef HAVE_BSD_SYSCTL
1655 BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
1656endif
1657
Jeff King0cc30e02015-04-16 05:01:38 -04001658ifdef HAVE_GETDELIM
1659 BASIC_CFLAGS += -DHAVE_GETDELIM
1660endif
1661
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001662ifeq ($(TCLTK_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001663NO_TCLTK = NoThanks
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001664endif
1665
Jeff King499c2932009-04-03 15:32:20 -04001666ifeq ($(PERL_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001667NO_PERL = NoThanks
Jeff King499c2932009-04-03 15:32:20 -04001668endif
1669
Johan Herlandd4e1b472009-11-18 02:42:31 +01001670ifeq ($(PYTHON_PATH),)
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001671NO_PYTHON = NoThanks
Johan Herlandd4e1b472009-11-18 02:42:31 +01001672endif
1673
Eric Wong995bc222016-08-04 11:40:25 +00001674ifndef PAGER_ENV
1675PAGER_ENV = LESS=FRX LV=-c
1676endif
1677
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001678QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001679QUIET_SUBDIR1 =
1680
John Keepingef49e052015-09-05 13:22:10 +01001681ifneq ($(findstring w,$(MAKEFLAGS)),w)
Alex Riesena6f37092007-03-07 00:05:34 +01001682PRINT_DIR = --no-print-directory
1683else # "make -w"
1684NO_SUBDIR = :
1685endif
1686
John Keepingef49e052015-09-05 13:22:10 +01001687ifneq ($(findstring s,$(MAKEFLAGS)),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001688ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001689 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001690 QUIET_AR = @echo ' ' AR $@;
1691 QUIET_LINK = @echo ' ' LINK $@;
1692 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1693 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001694 QUIET_LNCP = @echo ' ' LN/CP $@;
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00001695 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001696 QUIET_MSGFMT = @echo ' ' MSGFMT $@;
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00001697 QUIET_GCOV = @echo ' ' GCOV $@;
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001698 QUIET_SP = @echo ' ' SP $<;
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001699 QUIET_RC = @echo ' ' RC $@;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001700 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001701 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1702 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001703 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001704 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001705 export QUIET_BUILT_IN
1706endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001707endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001708
Junio C Hamano70de5e62012-05-02 15:12:10 -07001709ifdef NO_INSTALL_HARDLINKS
1710 export NO_INSTALL_HARDLINKS
1711endif
1712
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001713### profile feedback build
1714#
1715
1716# Can adjust this to be a global directory if you want to do extended
1717# data gathering
1718PROFILE_DIR := $(CURDIR)
1719
Johannes Sixte60ec752012-02-09 09:22:26 +01001720ifeq ("$(PROFILE)","GEN")
Andi Kleen0be314c2014-07-04 16:43:48 -07001721 BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001722 EXTLIBS += -lgcov
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001723 export CCACHE_DISABLE = t
1724 V = 1
Johannes Sixte60ec752012-02-09 09:22:26 +01001725else
1726ifneq ("$(PROFILE)","")
Andi Kleen0be314c2014-07-04 16:43:48 -07001727 BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01001728 export CCACHE_DISABLE = t
1729 V = 1
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001730endif
Johannes Sixte60ec752012-02-09 09:22:26 +01001731endif
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001732
Pavel Roskinaddf88e2006-07-09 03:44:30 -04001733# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001734
Johannes Schindelin32043c92007-02-14 12:48:14 +01001735ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Petr Onderka6df42ab2010-09-01 00:42:43 +02001736ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001737
1738DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1739bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001740bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001741mandir_SQ = $(subst ','\'',$(mandir))
John Keeping971f8532013-02-24 19:55:01 +00001742mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
1743infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001744perllibdir_SQ = $(subst ','\'',$(perllibdir))
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001745localedir_SQ = $(subst ','\'',$(localedir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001746gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
1747template_dir_SQ = $(subst ','\'',$(template_dir))
John Keeping971f8532013-02-24 19:55:01 +00001748htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001749prefix_SQ = $(subst ','\'',$(prefix))
Pavan Kumar Sunkarac0cb4ed2010-05-28 11:55:52 +05301750gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001751
1752SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Jeff King3f824e92017-12-08 05:47:22 -05001753TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001754PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01001755PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001756TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07001757DIFF_SQ = $(subst ','\'',$(DIFF))
Jonathan Nieder0386dd32013-11-15 13:10:28 -08001758PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001759
Jeff King3f2e2292016-07-01 01:58:58 -04001760# We must filter out any object files from $(GITLIBS),
1761# as it is typically used like:
1762#
1763# foo: foo.o $(GITLIBS)
1764# $(CC) $(filter %.o,$^) $(LIBS)
1765#
1766# where we use it as a dependency. Since we also pull object files
1767# from the dependency list, that would make each entry appear twice.
1768LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
Petr Baudisd595a472006-06-24 18:35:12 -07001769
brian m. carlsonf18f8162017-03-11 22:28:18 +00001770BASIC_CFLAGS += $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08001771LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02001772
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05001773# Quote for C
1774
1775ifdef DEFAULT_EDITOR
1776DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
1777DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
1778
1779BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
1780endif
1781
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05001782ifdef DEFAULT_PAGER
1783DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
1784DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
1785
1786BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
1787endif
1788
Ben Waltonb3e34dd2012-03-30 21:33:21 -04001789ifdef SHELL_PATH
1790SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
1791SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
1792
1793BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
1794endif
1795
Jeff King42dcbb72012-06-02 15:01:12 -04001796GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
1797GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
1798GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
Jeff King620c2932012-06-20 14:31:51 -04001799GIT-USER-AGENT: FORCE
1800 @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
Jeff King620c2932012-06-20 14:31:51 -04001801 echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
1802 fi
Jeff King42dcbb72012-06-02 15:01:12 -04001803
Vincent van Ravesteijn1cc8af02012-06-06 20:28:16 +00001804ifdef DEFAULT_HELP_FORMAT
1805BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
1806endif
1807
Eric Wong995bc222016-08-04 11:40:25 +00001808PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
1809PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
1810PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
1811BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
1812
Petr Baudis8d7f5862006-06-25 03:47:03 +02001813ALL_CFLAGS += $(BASIC_CFLAGS)
1814ALL_LDFLAGS += $(BASIC_LDFLAGS)
1815
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00001816export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07001817
1818
Petr Baudis28818ff2005-07-29 17:50:24 +02001819### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07001820
Brandon Caseyc94c8e52008-08-07 14:03:42 -05001821SHELL = $(SHELL_PATH)
1822
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001823all:: shell_compatibility_test
1824
1825ifeq "$(PROFILE)" "BUILD"
Andi Kleen066dd262014-07-07 23:35:11 -07001826all:: profile
1827endif
1828
1829profile:: profile-clean
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001830 $(MAKE) PROFILE=GEN all
1831 $(MAKE) PROFILE=GEN -j1 test
Jeff King93b53932014-08-19 02:12:03 -04001832 @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
1833 $(MAKE) PROFILE=GEN -j1 perf; \
1834 else \
1835 echo "Skipping profile of perf tests..."; \
1836 fi
Andi Kleen066dd262014-07-07 23:35:11 -07001837 $(MAKE) PROFILE=USE all
1838
1839profile-fast: profile-clean
1840 $(MAKE) PROFILE=GEN all
1841 $(MAKE) PROFILE=GEN -j1 perf
1842 $(MAKE) PROFILE=USE all
1843
Theodore Ts'of2d713f2012-02-06 01:00:17 -05001844
1845all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001846ifneq (,$X)
Sebastian Schuberthade2ca02009-10-27 12:23:33 +01001847 $(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 -08001848endif
Petr Baudis28818ff2005-07-29 17:50:24 +02001849
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001850all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07001851ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07001852 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08001853 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07001854endif
Ben Walton502be952010-03-20 10:48:08 -04001855 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04001856
Brandon Casey6dc46272008-08-07 14:06:26 -05001857please_set_SHELL_PATH_to_a_more_modern_shell:
1858 @$$(:)
1859
1860shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
1861
Junio C Hamano4dc00022006-01-12 21:42:25 -08001862strip: $(PROGRAMS) git$X
Felipe Contreras654f23f2013-05-24 21:41:02 -05001863 $(STRIP) $(STRIP_OPTS) $^
Junio C Hamano4dc00022006-01-12 21:42:25 -08001864
Jonathan Nieder7b63c772012-07-06 23:19:09 -05001865### Target-specific flags and dependencies
1866
1867# The generic compilation pattern rule and automatically
1868# computed header dependencies (falling back to a dependency on
1869# LIB_H) are enough to describe how most targets should be built,
1870# but some targets are special enough to need something a little
1871# different.
1872#
1873# - When a source file "foo.c" #includes a generated header file,
1874# we need to list that dependency for the "foo.o" target.
1875#
1876# We also list it from other targets that are built from foo.c
1877# like "foo.sp" and "foo.s", even though that is easy to forget
1878# to do because the generated header is already present around
1879# after a regular build attempt.
1880#
1881# - Some code depends on configuration kept in makefile
1882# variables. The target-specific variable EXTRA_CPPFLAGS can
1883# be used to convey that information to the C preprocessor
1884# using -D options.
1885#
1886# The "foo.o" target should have a corresponding dependency on
1887# a file that changes when the value of the makefile variable
1888# changes. For example, targets making use of the
1889# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
1890#
1891# Technically the ".sp" and ".s" targets do not need this
1892# dependency because they are force-built, but they get the
1893# same dependency for consistency. This way, you do not have to
1894# know how each target is implemented. And it means the
1895# dependencies here will not need to change if the force-build
1896# details change some day.
1897
Jeff Kingbe1dbd02012-06-20 14:31:55 -04001898git.sp git.s git.o: GIT-PREFIX
Jeff King816fb462012-06-02 14:51:42 -04001899git.sp git.s git.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00001900 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
1901 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
1902 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07001903
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02001904git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
Jeff King3f2e2292016-07-01 01:58:58 -04001905 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
1906 $(filter %.o,$^) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07001907
Jeff Kingc0219dd2012-06-20 14:31:33 -04001908help.sp help.s help.o: common-cmds.h
Erik Faye-Lund6612b9e2010-11-26 17:00:39 +01001909
Jeff Kingbe1dbd02012-06-20 14:31:55 -04001910builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01001911builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
John Keeping971f8532013-02-24 19:55:01 +00001912 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
1913 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
1914 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07001915
Jeff King520a6cd2012-06-20 14:32:22 -04001916version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
Jeff King816fb462012-06-02 14:51:42 -04001917version.sp version.s version.o: EXTRA_CPPFLAGS = \
Jeff King620c2932012-06-20 14:31:51 -04001918 '-DGIT_VERSION="$(GIT_VERSION)"' \
Johannes Schindelined32b782017-12-15 00:34:38 +01001919 '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
1920 '-DGIT_BUILT_FROM_COMMIT="$(shell GIT_CEILING_DIRECTORIES=\"$(CURDIR)/..\" \
1921 git rev-parse -q --verify HEAD || :)"'
Jeff King816fb462012-06-02 14:51:42 -04001922
Junio C Hamano91730802006-04-10 17:37:58 -07001923$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02001924 $(QUIET_BUILT_IN)$(RM) $@ && \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05001925 ln $< $@ 2>/dev/null || \
1926 ln -s $< $@ 2>/dev/null || \
1927 cp $< $@
Junio C Hamano91730802006-04-10 17:37:58 -07001928
Eric Sunshine82aec452015-08-23 17:31:09 -04001929common-cmds.h: generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07001930
Junio C Hamano766b0842007-04-05 15:03:48 -07001931common-cmds.h: $(wildcard Documentation/git-*.txt)
Alejandro R. Sedeño57cee8a2015-09-10 19:37:07 -04001932 $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01001933
Jeff Kinge4dd89a2012-06-20 14:32:16 -04001934SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
Jeff Kingb5295f32012-06-20 14:32:19 -04001935 $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001936 $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
1937 $(perllibdir_SQ)
Jonathan Nieder46bac902010-01-31 11:46:53 -08001938define cmd_munge_script
1939$(RM) $@ $@+ && \
1940sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1941 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
Junio C Hamano09ce4bb2010-06-05 09:36:13 -07001942 -e 's|@@DIFF@@|$(DIFF_SQ)|' \
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01001943 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08001944 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Alex Riesenad17ea72012-01-23 14:04:29 -08001945 -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08001946 -e $(BROKEN_PATH_FIX) \
Jeff Kingb5295f32012-06-20 14:32:19 -04001947 -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
1948 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Junio C Hamano71b40102016-03-08 15:47:57 -08001949 -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
Eric Wong995bc222016-08-04 11:40:25 +00001950 -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
Jonathan Nieder46bac902010-01-31 11:46:53 -08001951 $@.sh >$@+
1952endef
1953
Jeff Kinge4dd89a2012-06-20 14:32:16 -04001954GIT-SCRIPT-DEFINES: FORCE
1955 @FLAGS='$(SCRIPT_DEFINES)'; \
1956 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01001957 echo >&2 " * new script parameters"; \
Jeff Kinge4dd89a2012-06-20 14:32:16 -04001958 echo "$$FLAGS" >$@; \
1959 fi
1960
1961
Jonathan Nieder64c07db2014-11-18 10:38:38 -08001962$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08001963 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001964 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02001965 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07001966
Jeff Kinge4dd89a2012-06-20 14:32:16 -04001967$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
Jonathan Nieder46bac902010-01-31 11:46:53 -08001968 $(QUIET_GEN)$(cmd_munge_script) && \
1969 mv $@+ $@
1970
Pat Thoytsbbc284d2012-06-01 23:29:33 +01001971git.res: git.rc GIT-VERSION-FILE
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001972 $(QUIET_RC)$(RC) \
Johannes Schindelin39bb86b2017-10-30 18:19:42 +01001973 $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
1974 $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
Steven Penny7c44b332017-01-07 15:41:10 -06001975 -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
Pat Thoytsce39c2e2012-05-24 00:56:24 +01001976
Jeff Kinge204b002014-11-18 12:43:09 -05001977# This makes sure we depend on the NO_PERL setting itself.
Jonathan Nieder64c07db2014-11-18 10:38:38 -08001978$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
Jeff Kinge204b002014-11-18 12:43:09 -05001979
Jeff King499c2932009-04-03 15:32:20 -04001980ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001981$(SCRIPT_PERL_GEN):
Alex Riesenf8487182006-12-04 10:50:04 +01001982
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00001983PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
1984$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE
Emil Medve4cb08df2007-07-14 12:51:44 -05001985 $(QUIET_GEN)$(RM) $@ $@+ && \
Jonathan Nieder7a7bfc72018-01-02 12:01:40 -08001986 INSTLIBDIR='$(perllibdir_SQ)' && \
Jonathan Nieder0386dd32013-11-15 13:10:28 -08001987 INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
1988 INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
Junio C Hamano998c4da2006-07-07 13:04:35 -07001989 sed -e '1{' \
1990 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1991 -e ' h' \
Ævar Arnfjörð Bjarmasona6c60602010-05-30 17:12:41 +00001992 -e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07001993 -e ' H' \
1994 -e ' x' \
1995 -e '}' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07001996 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05001997 $< >$@+ && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001998 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02001999 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07002000
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002001GIT-PERL-DEFINES: FORCE
2002 @FLAGS='$(PERL_DEFINES)'; \
2003 if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
2004 echo >&2 " * new perl-specific parameters"; \
2005 echo "$$FLAGS" >$@; \
2006 fi
2007
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01002008
2009.PHONY: gitweb
2010gitweb:
2011 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2012
Jeff Kinge25c7cc2015-05-29 03:25:45 -04002013git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
Jeff Kingb5295f32012-06-20 14:32:19 -04002014 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002015 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07002016 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04002017else # NO_PERL
Jonathan Nieder64c07db2014-11-18 10:38:38 -08002018$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
Jeff King499c2932009-04-03 15:32:20 -04002019 $(QUIET_GEN)$(RM) $@ $@+ && \
2020 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2021 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
2022 unimplemented.sh >$@+ && \
2023 chmod +x $@+ && \
2024 mv $@+ $@
2025endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07002026
Jonathan Niederca2051d2014-11-18 10:43:47 -08002027# This makes sure we depend on the NO_PYTHON setting itself.
2028$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
2029
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002030ifndef NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002031$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
2032$(SCRIPT_PYTHON_GEN): % : %.py
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002033 $(QUIET_GEN)$(RM) $@ $@+ && \
Brian Gernhardtf733f6a2010-04-09 11:57:45 -04002034 sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
Felipe Contrerasf530aa92013-05-24 21:41:03 -05002035 $< >$@+ && \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002036 chmod +x $@+ && \
2037 mv $@+ $@
2038else # NO_PYTHON
Felipe Contreras1b0a0f82013-05-24 21:41:01 -05002039$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002040 $(QUIET_GEN)$(RM) $@ $@+ && \
2041 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2042 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
2043 unimplemented.sh >$@+ && \
2044 chmod +x $@+ && \
2045 mv $@+ $@
2046endif # NO_PYTHON
2047
Jeff King7f1b6972013-02-21 01:26:14 -05002048CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
2049 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
2050 configure.ac >configure.ac+ && \
2051 autoconf -o configure configure.ac+ && \
2052 $(RM) configure.ac+
2053
Jeff King520a6cd2012-06-20 14:32:22 -04002054configure: configure.ac GIT-VERSION-FILE
Jeff King7f1b6972013-02-21 01:26:14 -05002055 $(QUIET_GEN)$(CONFIGURE_RECIPE)
Jakub Narebski39001452006-08-08 18:35:23 +02002056
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002057ifdef AUTOCONFIGURED
Jonathan Nieder12265042013-01-02 00:25:44 -08002058# We avoid depending on 'configure' here, because it gets rebuilt
2059# every time GIT-VERSION-FILE is modified, only to update the embedded
2060# version number string, which config.status does not care about. We
2061# do want to recheck when the platform/environment detection logic
2062# changes, hence this depends on configure.ac.
2063config.status: configure.ac
Jeff King7f1b6972013-02-21 01:26:14 -05002064 $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
Jonathan Nieder12265042013-01-02 00:25:44 -08002065 if test -f config.status; then \
Stefano Lattarini8242ff42012-07-19 09:50:02 +02002066 ./config.status --recheck; \
2067 else \
2068 ./configure; \
2069 fi
2070reconfigure config.mak.autogen: config.status
2071 $(QUIET_GEN)./config.status
2072.PHONY: reconfigure # This is a convenience target.
2073endif
2074
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002075XDIFF_OBJS += xdiff/xdiffi.o
2076XDIFF_OBJS += xdiff/xprepare.o
2077XDIFF_OBJS += xdiff/xutils.o
2078XDIFF_OBJS += xdiff/xemit.o
2079XDIFF_OBJS += xdiff/xmerge.o
2080XDIFF_OBJS += xdiff/xpatience.o
Junio C Hamanod4755362012-01-27 11:04:28 -08002081XDIFF_OBJS += xdiff/xhistogram.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002082
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002083VCSSVN_OBJS += vcs-svn/line_buffer.o
Jonathan Nieder9d2f5dd2011-01-02 21:54:58 -06002084VCSSVN_OBJS += vcs-svn/sliding_window.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002085VCSSVN_OBJS += vcs-svn/fast_export.o
Jonathan Niederddcc8c52010-12-25 05:11:32 -06002086VCSSVN_OBJS += vcs-svn/svndiff.o
Jonathan Nieder3371f9b2011-03-27 13:13:22 -05002087VCSSVN_OBJS += vcs-svn/svndump.o
2088
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002089TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002090OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
2091 $(XDIFF_OBJS) \
2092 $(VCSSVN_OBJS) \
Jeff King3f2e2292016-07-01 01:58:58 -04002093 common-main.o \
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002094 git.o
2095ifndef NO_CURL
2096 OBJECTS += http.o http-walker.o remote-curl.o
2097endif
Jonathan Niederc3739912010-01-26 09:52:11 -06002098
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002099dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06002100dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06002101
Jonathan Nieder024c8432011-11-18 03:58:21 -06002102ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002103$(dep_dirs):
Junio C Hamanoeb0e0dd2011-10-05 12:36:21 -07002104 @mkdir -p $@
Jonathan Niederdfea5752010-01-26 09:52:49 -06002105
2106missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06002107dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Nieder69789342011-11-18 17:23:24 -06002108dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002109endif
2110
Jonathan Nieder024c8432011-11-18 03:58:21 -06002111ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002112dep_dirs =
2113missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002114dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06002115endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002116
2117ASM_SRC := $(wildcard $(OBJECTS:o=S))
2118ASM_OBJ := $(ASM_SRC:S=o)
2119C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06002120
Jonathan Nieder30248882010-01-26 09:51:24 -06002121.SUFFIXES:
2122
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002123$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05002124 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002125$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05002126 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002127
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002128%.s: %.c GIT-CFLAGS FORCE
Jonathan Nieder1015cc42012-07-22 18:47:26 -05002129 $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06002130
2131ifdef USE_COMPUTED_HEADER_DEPENDENCIES
2132# Take advantage of gcc's on-the-fly dependency generation
2133# See <http://gcc.gnu.org/gcc-3.0/features.html>.
2134dep_files_present := $(wildcard $(dep_files))
2135ifneq ($(dep_files_present),)
2136include $(dep_files_present)
2137endif
2138else
Jonathan Niederdfea5752010-01-26 09:52:49 -06002139# Dependencies on header files, for platforms that do not support
2140# the gcc -MMD option.
2141#
2142# Dependencies on automatically generated headers such as common-cmds.h
2143# should _not_ be included here, since they are necessary even when
2144# building an object for the first time.
Pavel Roskinb05701c2005-08-06 01:36:15 -04002145
Jonathan Nieder60d24dd2012-07-06 22:39:18 -05002146$(OBJECTS): $(LIB_H)
Jonathan Niederdfea5752010-01-26 09:52:49 -06002147endif
Junio C Hamano7a590132005-08-06 13:10:43 -07002148
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002149exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002150exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002151 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
2152 '-DBINDIR="$(bindir_relative_SQ)"' \
2153 '-DPREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002154
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002155builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002156builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06002157 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05002158
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002159config.sp config.s config.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002160config.sp config.s config.o: EXTRA_CPPFLAGS = \
2161 -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01002162
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002163attr.sp attr.s attr.o: GIT-PREFIX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002164attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2165 -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
Petr Onderka6df42ab2010-09-01 00:42:43 +02002166
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002167gettext.sp gettext.s gettext.o: GIT-PREFIX
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002168gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
2169 -DGIT_LOCALE_PATH='"$(localedir_SQ)"'
2170
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002171http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SPARSE_FLAGS += \
Ramsay Jones93713222013-10-06 21:52:21 +01002172 -DCURL_DISABLE_TYPECHECK
2173
Ramsay Jones54360a12018-02-12 00:21:02 +00002174pack-revindex.sp: SPARSE_FLAGS += -Wno-memcpy-max-count
2175
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002176ifdef NO_EXPAT
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002177http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07002178endif
2179
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002180ifdef NO_REGEX
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002181compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
2182 -DGAWK -DNO_MBSUPPORT
Ævar Arnfjörð Bjarmasona997bf42010-08-17 09:24:39 +00002183endif
2184
René Scharfed555ff52010-09-11 11:59:18 +02002185ifdef USE_NED_ALLOCATOR
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002186compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
René Scharfeca2baa32016-09-03 17:59:15 +02002187 -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
Ramsay Jones241c9572013-04-27 19:45:02 +01002188compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null
René Scharfed555ff52010-09-11 11:59:18 +02002189endif
2190
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002191git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002192 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07002193
Bernhard Reiter1e16b252014-11-09 15:55:53 +01002194git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
Robert Shearman684ec6c2008-07-09 22:29:00 +01002195 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Steven Pennyaa38ad22017-01-08 00:12:38 -06002196 $(IMAP_SEND_LDFLAGS) $(LIBS)
Mike McCormackf2561fd2006-03-10 14:32:50 +09002197
John Keepingfd78ced2014-01-25 13:11:44 +00002198git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04002199 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002200 $(CURL_LIBCURL) $(LIBS)
John Keepingfd78ced2014-01-25 13:11:44 +00002201git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05002202 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002203 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Johannes Schindelin39c015c2006-02-18 12:40:22 +01002204
Florian Achleitner48ea9f92012-09-19 17:21:16 +02002205git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
2206 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
2207 $(VCSSVN_LIB)
2208
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002209$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
2210 $(QUIET_LNCP)$(RM) $@ && \
2211 ln $< $@ 2>/dev/null || \
2212 ln -s $< $@ 2>/dev/null || \
2213 cp $< $@
2214
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002215$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002216 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Remi Pommarel9eaa78b2015-10-21 19:01:13 +02002217 $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04002218
Petr Baudis28818ff2005-07-29 17:50:24 +02002219$(LIB_FILE): $(LIB_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002220 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Petr Baudis28818ff2005-07-29 17:50:24 +02002221
Linus Torvalds34435462006-03-24 20:13:22 -08002222$(XDIFF_LIB): $(XDIFF_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002223 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002224
Jonathan Nieder3f527372010-08-09 17:04:29 -05002225$(VCSSVN_LIB): $(VCSSVN_OBJS)
Junio C Hamanoac179b42015-09-10 14:27:21 -07002226 $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
Linus Torvalds34435462006-03-24 20:13:22 -08002227
Jonathan Nieder5b586192012-03-31 03:44:53 -05002228export DEFAULT_EDITOR DEFAULT_PAGER
2229
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002230.PHONY: doc man man-perl html info pdf
2231doc: man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002232 $(MAKE) -C Documentation all
2233
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002234man: man-perl
Michael J Gruber414851a2008-09-10 10:19:34 +02002235 $(MAKE) -C Documentation man
2236
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002237man-perl: perl/build/man/man3/Git.3pm
2238
Michael J Gruber414851a2008-09-10 10:19:34 +02002239html:
2240 $(MAKE) -C Documentation html
2241
David Kastrup47398092007-08-06 12:22:57 +02002242info:
2243 $(MAKE) -C Documentation info
2244
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002245pdf:
2246 $(MAKE) -C Documentation pdf
2247
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002248XGETTEXT_FLAGS = \
2249 --force-po \
Jiang Xin47fbfde2014-04-17 13:37:18 +08002250 --add-comments=TRANSLATORS: \
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002251 --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
2252 --from-code=UTF-8
Ævar Arnfjörð Bjarmasonff46a492011-04-10 19:37:01 +00002253XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2254 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xinc2d140d2012-07-25 22:53:07 +08002255XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
2256 --keyword=gettextln --keyword=eval_gettextln
Vasco Almeidac4a85c32016-12-14 11:54:29 -01002257XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
Vasco Almeida0539d5e2016-12-14 11:54:30 -01002258 --keyword=__ --keyword=N__ --keyword="__n:1,2"
Jeff Kingd85b0df2014-08-25 16:00:42 -04002259LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002260LOCALIZED_SH = $(SCRIPT_SH)
2261LOCALIZED_SH += git-parse-remote.sh
Vasco Almeida9588c522016-06-17 20:21:03 +00002262LOCALIZED_SH += git-rebase--interactive.sh
Vasco Almeidad323c6b2016-06-17 20:21:02 +00002263LOCALIZED_SH += git-sh-setup.sh
Jeff Kingd85b0df2014-08-25 16:00:42 -04002264LOCALIZED_PERL = $(SCRIPT_PERL)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002265
2266ifdef XGETTEXT_INCLUDE_TESTS
2267LOCALIZED_C += t/t0200/test.c
2268LOCALIZED_SH += t/t0200/test.sh
2269LOCALIZED_PERL += t/t0200/test.perl
2270endif
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002271
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002272## Note that this is meant to be run only by the localization coordinator
2273## under a very controlled condition, i.e. (1) it is to be run in a
2274## Git repository (not a tarball extract), (2) any local modifications
2275## will be lost.
2276## Gettext tools cannot work with our own custom PRItime type, so
2277## we replace PRItime with PRIuMAX. We need to update this to
2278## PRIdMAX if we switch to a signed type later.
2279
Jonathan Nieder1f319632014-08-22 00:32:08 -04002280po/git.pot: $(GENERATED_H) FORCE
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002281 # All modifications will be reverted at the end, so we do not
2282 # want to have any local change.
2283 git diff --quiet HEAD && git diff --quiet --cached
2284
2285 @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
2286 do \
2287 sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
2288 cat "$$s+" >"$$s" && rm "$$s+"; \
2289 done
2290
Ævar Arnfjörð Bjarmasonadc3b2b2011-05-14 13:47:45 +00002291 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
2292 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
2293 $(LOCALIZED_SH)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002294 $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
2295 $(LOCALIZED_PERL)
Junio C Hamanofc0fd5b2017-07-20 11:57:01 -07002296
2297 # Reverting the munged source, leaving only the updated $@
2298 git reset --hard
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002299 mv $@+ $@
2300
Elia Pintoe6be2652015-12-15 15:21:00 +00002301.PHONY: pot
Ævar Arnfjörð Bjarmasoncd5513a2011-02-22 23:41:23 +00002302pot: po/git.pot
2303
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002304POFILES := $(wildcard po/*.po)
2305MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
2306
2307ifndef NO_GETTEXT
2308all:: $(MOFILES)
2309endif
2310
2311po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
2312 $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
2313
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002314LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
2315LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002316LIB_CPAN := $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
2317LIB_CPAN_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_CPAN))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002318
2319ifndef NO_PERL
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002320all:: $(LIB_PERL_GEN)
Todd Zullinger075321c2018-03-03 15:38:16 +00002321ifndef NO_PERL_CPAN_FALLBACKS
Ævar Arnfjörð Bjarmason382029f2018-03-03 15:38:15 +00002322all:: $(LIB_CPAN_GEN)
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002323endif
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002324NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002325endif
2326
Ævar Arnfjörð Bjarmason805a3782017-12-22 11:07:21 -08002327perl/build/lib/%.pm: perl/%.pm
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002328 $(QUIET_GEN)mkdir -p $(dir $@) && \
Ævar Arnfjörð Bjarmason1aca69c2018-03-03 15:38:17 +00002329 sed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
2330 -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
2331 < $< > $@
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002332
2333perl/build/man/man3/Git.3pm: perl/Git.pm
2334 $(QUIET_GEN)mkdir -p $(dir $@) && \
2335 pod2man $< $@
2336
Jeff Kinge951ebc2016-12-14 09:26:55 -05002337FIND_SOURCE_FILES = ( \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002338 git ls-files \
2339 '*.[hcS]' \
Jeff King8fa20432016-12-14 09:29:44 -05002340 '*.sh' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002341 ':!*[tp][0-9][0-9][0-9][0-9]*' \
Jeff King046e4c12016-12-14 09:32:35 -05002342 ':!contrib' \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002343 2>/dev/null || \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002344 $(FIND) . \
2345 \( -name .git -type d -prune \) \
Jeff King8fa20432016-12-14 09:29:44 -05002346 -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
Jeff King046e4c12016-12-14 09:32:35 -05002347 -o \( -name contrib -type d -prune \) \
Jeff Kinge6fc85b2016-12-14 09:28:04 -05002348 -o \( -name build -type d -prune \) \
2349 -o \( -name 'trash*' -type d -prune \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002350 -o \( -name '*.[hcS]' -type f -print \) \
Jeff King8fa20432016-12-14 09:29:44 -05002351 -o \( -name '*.sh' -type f -print \) \
Jeff Kinge951ebc2016-12-14 09:26:55 -05002352 )
Junio C Hamano33533972011-10-18 00:26:18 -07002353
Junio C Hamano2f769192010-09-28 16:08:38 -05002354$(ETAGS_TARGET): FORCE
2355 $(RM) $(ETAGS_TARGET)
Junio C Hamano33533972011-10-18 00:26:18 -07002356 $(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01002357
Junio C Hamano2f769192010-09-28 16:08:38 -05002358tags: FORCE
Emil Medve4cb08df2007-07-14 12:51:44 -05002359 $(RM) tags
Junio C Hamano33533972011-10-18 00:26:18 -07002360 $(FIND_SOURCE_FILES) | xargs ctags -a
Petr Baudis28818ff2005-07-29 17:50:24 +02002361
Kristof Provosta2a91502007-10-06 16:24:42 +02002362cscope:
2363 $(RM) cscope*
Junio C Hamano33533972011-10-18 00:26:18 -07002364 $(FIND_SOURCE_FILES) | xargs cscope -b
Kristof Provosta2a91502007-10-06 16:24:42 +02002365
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002366### Detect prefix changes
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002367TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2368 $(localedir_SQ)
2369
2370GIT-PREFIX: FORCE
2371 @FLAGS='$(TRACK_PREFIX)'; \
2372 if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002373 echo >&2 " * new prefix flags"; \
Jeff Kingbe1dbd02012-06-20 14:31:55 -04002374 echo "$$FLAGS" >GIT-PREFIX; \
2375 fi
2376
2377TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002378
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002379GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002380 @FLAGS='$(TRACK_CFLAGS)'; \
2381 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002382 echo >&2 " * new build flags"; \
Yakov Lernerca3bcab2006-06-15 01:36:00 +03002383 echo "$$FLAGS" >GIT-CFLAGS; \
2384 fi
2385
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002386TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
2387
2388GIT-LDFLAGS: FORCE
2389 @FLAGS='$(TRACK_LDFLAGS)'; \
2390 if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002391 echo >&2 " * new link flags"; \
Fredrik Kuivinend9a25fc2011-06-22 12:50:56 +02002392 echo "$$FLAGS" >GIT-LDFLAGS; \
2393 fi
2394
Junio C Hamanobfce5082008-07-25 12:35:10 -07002395# We need to apply sq twice, once to protect from the shell
2396# that runs GIT-BUILD-OPTIONS, and then again to protect it
2397# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002398GIT-BUILD-OPTIONS: FORCE
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002399 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
Jeff King3f824e92017-12-08 05:47:22 -05002400 @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002401 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
2402 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
2403 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
2404 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
2405 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
Junio C Hamano0d5d7db2015-06-16 14:27:06 -07002406 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
Ævar Arnfjörð Bjarmason94da9192017-06-01 18:20:56 +00002407 @echo USE_LIBPCRE1=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE1)))'\' >>$@+
2408 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
Ævar Arnfjörð Bjarmasonfb95e2e2017-06-01 18:20:55 +00002409 @echo NO_LIBPCRE1_JIT=\''$(subst ','\'',$(subst ','\'',$(NO_LIBPCRE1_JIT)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002410 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
Ævar Arnfjörð Bjarmason68c7d272017-05-25 19:45:31 +00002411 @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002412 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
2413 @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
Eric Wong995bc222016-08-04 11:40:25 +00002414 @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04002415 @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002416ifdef TEST_OUTPUT_DIRECTORY
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002417 @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
John Keeping2d14e132013-04-29 19:16:21 +01002418endif
Thomas Rast342e9ef2012-02-17 11:25:09 +01002419ifdef GIT_TEST_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002420 @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002421endif
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002422ifdef GIT_TEST_CMP
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002423 @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002424endif
2425ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002426 @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
Junio C Hamano5e87eae2010-06-11 09:40:25 -07002427endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002428 @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
2429 @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002430ifdef GIT_PERF_REPEAT_COUNT
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002431 @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002432endif
2433ifdef GIT_PERF_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002434 @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002435endif
2436ifdef GIT_PERF_LARGE_REPO
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002437 @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002438endif
2439ifdef GIT_PERF_MAKE_OPTS
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002440 @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
Thomas Rast342e9ef2012-02-17 11:25:09 +01002441endif
Ævar Arnfjörð Bjarmason88b61972017-05-20 21:42:18 +00002442ifdef GIT_PERF_MAKE_COMMAND
2443 @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
2444endif
Jeff King3d893612017-02-25 04:37:07 -05002445ifdef GIT_INTEROP_MAKE_OPTS
2446 @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
2447endif
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002448ifdef TEST_GIT_INDEX_VERSION
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002449 @echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
Thomas Gummerer5d9fc882014-02-23 21:49:58 +01002450endif
Jeff Kinga2d25ef2015-05-29 03:26:30 -04002451 @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
Jeff King7cf7f542008-02-24 14:40:45 -05002452
Christian Couder96a46472012-12-18 16:26:38 +01002453### Detect Python interpreter path changes
2454ifndef NO_PYTHON
2455TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002456
Christian Couder96a46472012-12-18 16:26:38 +01002457GIT-PYTHON-VARS: FORCE
2458 @VARS='$(TRACK_PYTHON)'; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002459 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
Christian Couder1a59d882012-12-18 16:26:39 +01002460 echo >&2 " * new Python interpreter location"; \
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002461 echo "$$VARS" >$@; \
2462 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07002463endif
2464
Matthew Ogilvieea925192009-12-02 22:14:05 -07002465test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
2466
2467all:: $(TEST_PROGRAMS) $(test_bindir_programs)
Felipe Contreras6c473a52013-06-07 17:03:06 -05002468all:: $(NO_INSTALL)
Matthew Ogilvieea925192009-12-02 22:14:05 -07002469
2470bin-wrappers/%: wrap-for-bin.sh
2471 @mkdir -p bin-wrappers
2472 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
2473 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002474 -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
Matthew Ogilvieea925192009-12-02 22:14:05 -07002475 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07002476
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002477# GNU make supports exporting all variables by "export" without parameters.
2478# However, the environment gets quite big, and some programs have problems
2479# with that.
2480
Johannes Schindelin140245b2006-07-07 13:26:31 +02002481export NO_SVN_TESTS
Ramsay Jones12666862012-10-06 18:33:08 +01002482export TEST_NO_MALLOC_CHECK
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01002483
Jonathan Nieder225f78c2010-01-26 10:08:44 -06002484### Testing rules
2485
Junio C Hamano96651ef2007-04-28 15:32:49 -07002486test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02002487 $(MAKE) -C t/ all
2488
Thomas Rast342e9ef2012-02-17 11:25:09 +01002489perf: all
2490 $(MAKE) -C t/perf/ all
2491
2492.PHONY: test perf
2493
Jeff King4df7c8a2016-07-01 03:59:44 -04002494t/helper/test-line-buffer$X: $(VCSSVN_LIB)
René Scharfeb4285c72009-01-17 16:50:13 +01002495
Jeff King4df7c8a2016-07-01 03:59:44 -04002496t/helper/test-svn-fe$X: $(VCSSVN_LIB)
David Barr21746aa2010-08-09 17:55:00 -05002497
Jonathan Niederdaa99a92010-01-26 09:45:54 -06002498.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07002499
Nguyễn Thái Ngọc Duyefd71f82018-03-24 08:44:30 +01002500t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2501
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002502t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
David Barr1d73b522010-08-09 17:34:42 -05002503 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04002504
Nguyễn Thái Ngọc Duye6e75302016-04-13 20:22:42 +07002505check-sha1:: t/helper/test-sha1$X
2506 t/helper/test-sha1.sh
Junio C Hamanob65bc212006-06-24 00:59:49 -07002507
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002508SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
2509
2510$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
2511 $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
2512 $(SPARSE_FLAGS) $<
2513
2514.PHONY: sparse $(SP_OBJ)
2515sparse: $(SP_OBJ)
2516
Brandon Williams21188052017-08-14 14:30:46 -07002517.PHONY: style
2518style:
2519 git clang-format --style file --diff --extensions c,h
2520
René Scharfe7c4c9f42007-01-04 19:33:48 +01002521check: common-cmds.h
Ramsay Jonesf228d1f2011-04-07 19:22:18 +01002522 @if sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002523 then \
Junio C Hamanod55de702016-04-05 00:02:14 -07002524 echo >&2 "Use 'make sparse' instead"; \
Ramsay Jones0bcd9ae2011-04-21 20:14:42 +01002525 $(MAKE) --no-print-directory sparse; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002526 else \
Junio C Hamanod55de702016-04-05 00:02:14 -07002527 echo >&2 "Did you mean 'make test'?"; \
Junio C Hamano912f9982008-11-11 13:12:17 -08002528 exit 1; \
2529 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02002530
René Scharfe63f0a752016-09-15 20:30:56 +02002531C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
2532%.cocci.patch: %.cocci $(C_SOURCES)
2533 @echo ' ' SPATCH $<; \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002534 ret=0; \
René Scharfe63f0a752016-09-15 20:30:56 +02002535 for f in $(C_SOURCES); do \
Jeff Kingf5c2bc22017-03-10 03:31:18 -05002536 $(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS) || \
2537 { ret=$$?; break; }; \
2538 done >$@+ 2>$@.log; \
2539 if test $$ret != 0; \
2540 then \
2541 cat $@.log; \
2542 exit 1; \
2543 fi; \
2544 mv $@+ $@; \
René Scharfe63f0a752016-09-15 20:30:56 +02002545 if test -s $@; \
2546 then \
2547 echo ' ' SPATCH result: $@; \
2548 fi
2549coccicheck: $(patsubst %.cocci,%.cocci.patch,$(wildcard contrib/coccinelle/*.cocci))
2550
Petr Baudis28818ff2005-07-29 17:50:24 +02002551### Installation rules
2552
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002553ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002554template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002555else
2556template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01002557endif
2558export template_instdir
2559
Junio C Hamano0c0ead72009-02-05 00:04:17 -08002560ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002561gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01002562else
2563gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002564endif
2565gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
2566export gitexec_instdir
2567
David Aguilarbc7a96a2011-08-18 00:23:46 -07002568ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
2569mergetools_instdir = $(mergetoolsdir)
2570else
2571mergetools_instdir = $(prefix)/$(mergetoolsdir)
2572endif
2573mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
2574
Matthew Ogilvieea925192009-12-02 22:14:05 -07002575install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
2576
Elia Pintoe6be2652015-12-15 15:21:00 +00002577.PHONY: profile-install profile-fast-install
Andi Kleen066dd262014-07-07 23:35:11 -07002578profile-install: profile
2579 $(MAKE) install
2580
2581profile-fast-install: profile-fast
2582 $(MAKE) install
2583
Andreas Ericssond6ebd252005-11-22 00:44:15 +01002584install: all
Robert Schiele41650762007-12-01 18:05:40 +01002585 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002586 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2587 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08002588 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthew Ogilvieea925192009-12-02 22:14:05 -07002589 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01002590 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
David Aguilarbc7a96a2011-08-18 00:23:46 -07002591 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Jonathan Nieder53b74252011-10-09 04:17:07 -05002592 $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002593ifndef NO_GETTEXT
2594 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
2595 (cd po/build/locale && $(TAR) cf - .) | \
2596 (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
2597endif
Junio C Hamano5be3b172009-04-22 22:42:28 -07002598ifndef NO_PERL
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002599 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
2600 (cd perl/build/lib && $(TAR) cf - .) | \
2601 (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
Junio C Hamano8d676d82010-06-21 06:02:44 -07002602 $(MAKE) -C gitweb install
Junio C Hamano5be3b172009-04-22 22:42:28 -07002603endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002604ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002605 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002606 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002607endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002608ifneq (,$X)
Eric Blaked4b19022009-04-28 06:28:31 -06002609 $(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 -08002610endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002611
Johannes Sixt46beb552008-07-21 21:19:51 +02002612 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02002613 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07002614 { test "$$bindir/" = "$$execdir/" || \
Brandon Casey76d079a2010-07-23 12:50:45 -05002615 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
2616 $(RM) "$$execdir/$$p" && \
Junio C Hamano70de5e62012-05-02 15:12:10 -07002617 test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
Brandon Casey76d079a2010-07-23 12:50:45 -05002618 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
2619 cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
2620 done; \
2621 } && \
Brandon Casey40919c42010-07-23 12:50:44 -05002622 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
2623 $(RM) "$$bindir/$$p" && \
Junio C Hamano70de5e62012-05-02 15:12:10 -07002624 test -z "$(NO_INSTALL_HARDLINKS)" && \
Brandon Casey40919c42010-07-23 12:50:44 -05002625 ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2626 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2627 cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
2628 done && \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002629 for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06002630 $(RM) "$$execdir/$$p" && \
Junio C Hamano70de5e62012-05-02 15:12:10 -07002631 test -z "$(NO_INSTALL_HARDLINKS)" && \
Jeff King4ecbc172009-07-09 02:37:35 -04002632 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2633 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2634 cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
Brandon Caseyba2b4d72010-07-02 11:50:28 -07002635 done && \
Brandon Casey49a43f52010-07-06 14:56:51 -07002636 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
2637 for p in $$remote_curl_aliases; do \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002638 $(RM) "$$execdir/$$p" && \
Junio C Hamano70de5e62012-05-02 15:12:10 -07002639 test -z "$(NO_INSTALL_HARDLINKS)" && \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002640 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2641 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2642 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
Brandon Casey49a43f52010-07-06 14:56:51 -07002643 done && \
Johannes Sixt7b4b59a2008-07-21 21:19:58 +02002644 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
Petr Baudis28818ff2005-07-29 17:50:24 +02002645
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002646.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
Elia Pintoe6be2652015-12-15 15:21:00 +00002647.PHONY: quick-install-doc quick-install-man quick-install-html
Jakub Narebski152d9432010-05-01 22:36:15 +02002648install-gitweb:
2649 $(MAKE) -C gitweb install
2650
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002651install-doc: install-man-perl
Petr Baudis28818ff2005-07-29 17:50:24 +02002652 $(MAKE) -C Documentation install
2653
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002654install-man: install-man-perl
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002655 $(MAKE) -C Documentation install-man
2656
SZEDER Gábor2530afd2018-02-15 03:14:10 +01002657install-man-perl: man-perl
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002658 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
2659 (cd perl/build/man/man3 && $(TAR) cf - .) | \
2660 (cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
2661
Teemu Likonenae081f32008-06-10 11:34:25 +03002662install-html:
2663 $(MAKE) -C Documentation install-html
2664
David Kastrup47398092007-08-06 12:22:57 +02002665install-info:
2666 $(MAKE) -C Documentation install-info
2667
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002668install-pdf:
2669 $(MAKE) -C Documentation install-pdf
2670
Eric Wong6538d1e2006-12-23 08:26:09 -08002671quick-install-doc:
2672 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02002673
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002674quick-install-man:
2675 $(MAKE) -C Documentation quick-install-man
2676
Michael J Gruber6fe570d2008-09-09 22:44:17 +02002677quick-install-html:
2678 $(MAKE) -C Documentation quick-install-html
2679
Petr Baudis28818ff2005-07-29 17:50:24 +02002680
2681
2682### Maintainer's dist rules
2683
Stefano Lattarinidd6fc7c2012-12-09 11:36:17 +01002684GIT_TARNAME = git-$(GIT_VERSION)
Dennis Kaarsemakeref642ff2016-04-27 19:54:35 +02002685dist: git-archive$(X) configure
Junio C Hamano9ccb64c2006-10-05 02:26:12 -07002686 ./git-archive --format=tar \
2687 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07002688 @mkdir -p $(GIT_TARNAME)
Junio C Hamanoab214332016-04-04 23:42:41 -07002689 @cp configure $(GIT_TARNAME)
H. Peter Anvin181129d2006-01-09 18:07:01 -08002690 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05002691 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
H. Peter Anvin181129d2006-01-09 18:07:01 -08002692 $(TAR) rf $(GIT_TARNAME).tar \
Matthias Lederhoferf58494b2007-06-18 23:30:36 +02002693 $(GIT_TARNAME)/configure \
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05002694 $(GIT_TARNAME)/version \
Shawn O. Pearce115f0fe2007-03-12 13:40:31 -04002695 $(GIT_TARNAME)/git-gui/version
Ævar Arnfjörð Bjarmasonbc2ed312017-12-08 22:29:58 +00002696ifdef DC_SHA1_SUBMODULE
2697 @mkdir -p $(GIT_TARNAME)/sha1collisiondetection/lib
2698 @cp sha1collisiondetection/LICENSE.txt \
2699 $(GIT_TARNAME)/sha1collisiondetection/
2700 @cp sha1collisiondetection/LICENSE.txt \
2701 $(GIT_TARNAME)/sha1collisiondetection/
2702 @cp sha1collisiondetection/lib/sha1.[ch] \
2703 $(GIT_TARNAME)/sha1collisiondetection/lib/
2704 @cp sha1collisiondetection/lib/ubc_check.[ch] \
2705 $(GIT_TARNAME)/sha1collisiondetection/lib/
2706 $(TAR) rf $(GIT_TARNAME).tar \
2707 $(GIT_TARNAME)/sha1collisiondetection/LICENSE.txt \
2708 $(GIT_TARNAME)/sha1collisiondetection/lib/sha1.[ch] \
2709 $(GIT_TARNAME)/sha1collisiondetection/lib/ubc_check.[ch]
2710endif
Emil Medve4cb08df2007-07-14 12:51:44 -05002711 @$(RM) -r $(GIT_TARNAME)
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06002712 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07002713
Junio C Hamanoab214332016-04-04 23:42:41 -07002714rpm::
2715 @echo >&2 "Use distro packaged sources to run rpmbuild"
2716 @false
2717.PHONY: rpm
Chris Wrighta9db2972005-07-07 13:09:50 -07002718
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002719htmldocs = git-htmldocs-$(GIT_VERSION)
2720manpages = git-manpages-$(GIT_VERSION)
Elia Pintoe6be2652015-12-15 15:21:00 +00002721.PHONY: dist-doc distclean
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002722dist-doc:
Emil Medve4cb08df2007-07-14 12:51:44 -05002723 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002724 mkdir .doc-tmp-dir
2725 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
2726 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
2727 gzip -n -9 -f $(htmldocs).tar
2728 :
Emil Medve4cb08df2007-07-14 12:51:44 -05002729 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07002730 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02002731 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02002732 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07002733 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02002734 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002735 install
2736 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
2737 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05002738 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002739
Petr Baudis28818ff2005-07-29 17:50:24 +02002740### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06002741
Mathias Megyei922aa802007-10-04 23:49:19 +02002742distclean: clean
2743 $(RM) configure
Stefano Lattarinidc7ace52012-07-19 09:50:01 +02002744 $(RM) config.log config.status config.cache
2745 $(RM) config.mak.autogen config.mak.append
2746 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02002747
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002748profile-clean:
2749 $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
2750 $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
2751
Thomas Rastdcbe7f12013-05-13 23:27:26 +02002752clean: profile-clean coverage-clean
Junio C Hamano7897d842016-04-15 10:06:52 -07002753 $(RM) *.res
2754 $(RM) $(OBJECTS)
Vicent Martie1273102013-11-14 07:43:51 -05002755 $(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002756 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Felipe Contreras6c473a52013-06-07 17:03:06 -05002757 $(RM) $(TEST_PROGRAMS) $(NO_INSTALL)
Matt Kraai61564ca2013-02-13 07:57:48 -08002758 $(RM) -r bin-wrappers $(dep_dirs)
Ævar Arnfjörð Bjarmason5e9637c2011-11-18 00:14:42 +01002759 $(RM) -r po/build/
Todd Zullinger4321bdc2018-02-16 22:06:24 -05002760 $(RM) *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
Emil Medve4cb08df2007-07-14 12:51:44 -05002761 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
2762 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
2763 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
René Scharfe63f0a752016-09-15 20:30:56 +02002764 $(RM) contrib/coccinelle/*.cocci.patch*
Thomas Glanzmannca67f002005-05-22 20:27:28 +02002765 $(MAKE) -C Documentation/ clean
Jeff King499c2932009-04-03 15:32:20 -04002766ifndef NO_PERL
Ramsay Jonese5bd0a12010-05-08 18:36:15 +01002767 $(MAKE) -C gitweb clean
Ævar Arnfjörð Bjarmason20d2a302017-12-10 21:13:33 +00002768 $(RM) -r perl/build/
Jeff King499c2932009-04-03 15:32:20 -04002769endif
Petr Baudisb1edc532006-06-24 04:34:29 +02002770 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07002771 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002772ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002773 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002774 $(MAKE) -C git-gui clean
2775endif
Christian Couder8f26aa42012-12-18 16:26:37 +01002776 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
Jonathan Nieder07981dc2013-11-18 14:23:11 -08002777 $(RM) GIT-USER-AGENT GIT-PREFIX
2778 $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PYTHON-VARS
Junio C Hamano9b88fce2005-12-27 14:40:17 -08002779
Theodore Ts'of2d713f2012-02-06 01:00:17 -05002780.PHONY: all install profile-clean clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05002781.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Junio C Hamano2f769192010-09-28 16:08:38 -05002782.PHONY: FORCE cscope
Junio C Hamanod89056c2005-12-19 17:59:58 -08002783
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002784### Check documentation
2785#
Jeff Kingcf6aaff2012-08-08 16:56:04 -04002786ALL_COMMANDS = $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS)
2787ALL_COMMANDS += git
2788ALL_COMMANDS += gitk
2789ALL_COMMANDS += gitweb
Jeff Kingeb285012012-08-08 16:56:42 -04002790ALL_COMMANDS += git-gui git-citool
Elia Pintoe6be2652015-12-15 15:21:00 +00002791
2792.PHONY: check-docs
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002793check-docs::
Junio C Hamanoab814112016-05-04 14:34:23 -07002794 $(MAKE) -C Documentation lint-docs
Jeff Kingcf6aaff2012-08-08 16:56:04 -04002795 @(for v in $(ALL_COMMANDS); \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002796 do \
2797 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002798 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02002799 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08002800 git-fsck-objects | git-init-db | \
Junio C Hamanoc88cd032010-03-10 15:31:34 -08002801 git-remote-* | git-stage | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08002802 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002803 esac ; \
2804 test -f "Documentation/$$v.txt" || \
2805 echo "no doc: $$v"; \
Eric Sunshine11c66592015-05-21 19:39:18 +02002806 sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08002807 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002808 case "$$v" in \
2809 git) ;; \
2810 *) echo "no link: $$v";; \
2811 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002812 done; \
2813 ( \
Eric Sunshine11c66592015-05-21 19:39:18 +02002814 sed -e '1,/^### command list/d' \
2815 -e '/^#/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002816 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08002817 -e 's/^/listed /' command-list.txt; \
Jeff King5fafce02012-08-08 16:57:52 -04002818 $(MAKE) -C Documentation print-man1 | \
2819 grep '\.txt$$' | \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002820 sed -e 's|Documentation/|documented |' \
2821 -e 's/\.txt//'; \
2822 ) | while read how cmd; \
2823 do \
Jeff Kingcf6aaff2012-08-08 16:56:04 -04002824 case " $(ALL_COMMANDS) " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002825 *" $$cmd "*) ;; \
2826 *) echo "removed but $$how: $$cmd" ;; \
2827 esac; \
2828 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08002829
2830### Make sure built-ins do not have dups and listed in git.c
2831#
2832check-builtins::
2833 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08002834
Thomas Rast901c3692009-02-19 12:13:35 +01002835### Test suite coverage testing
2836#
Thomas Rast0c38a952013-05-13 23:27:25 +02002837.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
Elia Pintoe6be2652015-12-15 15:21:00 +00002838.PHONY: coverage-untested-functions cover_db cover_db_html
Thomas Rastdcbe7f12013-05-13 23:27:26 +02002839.PHONY: coverage-clean-results
Thomas Rast901c3692009-02-19 12:13:35 +01002840
2841coverage:
Thomas Rast0c38a952013-05-13 23:27:25 +02002842 $(MAKE) coverage-test
Thomas Rast5ce43672013-05-13 23:27:28 +02002843 $(MAKE) coverage-untested-functions
Thomas Rast901c3692009-02-19 12:13:35 +01002844
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002845object_dirs := $(sort $(dir $(OBJECTS)))
Thomas Rastdcbe7f12013-05-13 23:27:26 +02002846coverage-clean-results:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002847 $(RM) $(addsuffix *.gcov,$(object_dirs))
2848 $(RM) $(addsuffix *.gcda,$(object_dirs))
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002849 $(RM) coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00002850 $(RM) -r cover_db/
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00002851 $(RM) -r cover_db_html/
Thomas Rast901c3692009-02-19 12:13:35 +01002852
Thomas Rastdcbe7f12013-05-13 23:27:26 +02002853coverage-clean: coverage-clean-results
2854 $(RM) $(addsuffix *.gcno,$(object_dirs))
2855
Thomas Rast901c3692009-02-19 12:13:35 +01002856COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
2857COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002858GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
Thomas Rast901c3692009-02-19 12:13:35 +01002859
Thomas Rast0c38a952013-05-13 23:27:25 +02002860coverage-compile:
Thomas Rast901c3692009-02-19 12:13:35 +01002861 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
Thomas Rast0c38a952013-05-13 23:27:25 +02002862
2863coverage-test: coverage-clean-results coverage-compile
Thomas Rast901c3692009-02-19 12:13:35 +01002864 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
Thomas Rastc14cc772013-05-13 23:27:27 +02002865 DEFAULT_TEST_TARGET=test -j1 test
Thomas Rast901c3692009-02-19 12:13:35 +01002866
2867coverage-report:
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002868 $(QUIET_GCOV)for dir in $(object_dirs); do \
Thomas Raste146d172010-07-26 09:43:41 +02002869 $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002870 done
Ævar Arnfjörð Bjarmasonb5eed982010-07-25 19:52:41 +00002871
2872coverage-untested-functions: coverage-report
Thomas Rast901c3692009-02-19 12:13:35 +01002873 grep '^function.*called 0 ' *.c.gcov \
2874 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
Ævar Arnfjörð Bjarmasonbc548ef2010-07-25 19:52:40 +00002875 > coverage-untested-functions
Ævar Arnfjörð Bjarmason7432bd52010-07-25 19:52:42 +00002876
2877cover_db: coverage-report
2878 gcov2perl -db cover_db *.gcov
Ævar Arnfjörð Bjarmasondf07acf2010-07-25 19:52:43 +00002879
2880cover_db_html: cover_db
2881 cover -report html -outputdir cover_db_html cover_db
Andi Kleen7ddc2712011-06-18 18:07:05 -07002882