Makefile 85.8 KB
Newer Older
1
# The default target of this Makefile is...
2
all::
3

4
# Define V=1 to have a more verbose compile.
5
#
6 7 8 9 10
# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
#
# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
# to PATH if your tools in /usr/bin are broken.
#
11 12 13
# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
# system headers do not define a socklen_t type.
#
Gary V. Vaughan's avatar
Gary V. Vaughan committed
14 15 16
# Define INLINE to a suitable substitute (such as '__inline' or '') if git
# fails to compile with errors about undefined inline functions or similar.
#
17
# Define SNPRINTF_RETURNS_BOGUS if you are on a system which snprintf()
18 19 20
# or vsnprintf() return -1 instead of number of characters which would
# have been written to the final string if enough space had been available.
#
21
# Define FREAD_READS_DIRECTORIES if you are on a system which succeeds
22 23
# when attempting to read from an fopen'ed directory (or even to fopen
# it at all).
24
#
25
# Define NO_OPENSSL environment variable if you do not have OpenSSL.
26
#
27 28 29 30
# Define USE_LIBPCRE if you have and want to use libpcre. Various
# commands such as log and grep offer runtime options to use
# Perl-compatible regular expressions instead of standard or extended
# POSIX regular expressions.
Michał Kiedrowicz's avatar
Michał Kiedrowicz committed
31
#
32 33 34 35
# USE_LIBPCRE is a synonym for USE_LIBPCRE2, define USE_LIBPCRE1
# instead if you'd like to use the legacy version 1 of the PCRE
# library. Support for version 1 will likely be removed in some future
# release of Git, as upstream has all but abandoned it.
36
#
37 38 39 40 41 42 43 44
# When using USE_LIBPCRE1, define NO_LIBPCRE1_JIT if the PCRE v1
# library is compiled without --enable-jit. We will auto-detect
# whether the version of the PCRE v1 library in use has JIT support at
# all, but we unfortunately can't auto-detect whether JIT support
# hasn't been compiled in in an otherwise JIT-supporting version. If
# you have link-time errors about a missing `pcre_jit_exec` define
# this, or recompile PCRE v1 with --enable-jit.
#
45 46 47 48
# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
# in /foo/bar/include and /foo/bar/lib directories. Which version of
# PCRE this points to determined by the USE_LIBPCRE1 and USE_LIBPCRE2
# variables.
Michał Kiedrowicz's avatar
Michał Kiedrowicz committed
49
#
Kirill Smelkov's avatar
Kirill Smelkov committed
50 51
# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
#
52
# Define NO_CURL if you do not have libcurl installed.  git-http-fetch and
53
# git-http-push are not built, and you cannot use http:// and https://
54
# transports (neither smart nor dumb).
55
#
56
# Define CURLDIR=/foo/bar if your curl header and library files are in
57
# /foo/bar/include and /foo/bar/lib directories.
58
#
59 60 61
# Define CURL_CONFIG to curl's configuration program that prints information
# about the library (e.g., its version number).  The default is 'curl-config'.
#
62
# Define NO_EXPAT if you do not have expat installed.  git-http-push is
63
# not built, and you cannot push using http:// and https:// transports (dumb).
64
#
65 66 67
# Define EXPATDIR=/foo/bar if your expat header and library files are in
# /foo/bar/include and /foo/bar/lib directories.
#
Matt Kraai's avatar
Matt Kraai committed
68 69 70
# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
#
71 72 73 74
# Define NO_GETTEXT if you don't want Git output to be translated.
# A translated Git requires GNU libintl or another gettext implementation,
# plus libintl-perl at runtime.
#
75 76 77
# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
# the installed gettext translation of the shell scripts output.
#
78 79 80 81 82 83
# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
# trust the langinfo.h's nl_langinfo(CODESET) function to return the
# current character set. GNU and Solaris have a nl_langinfo(CODESET),
# FreeBSD can use either, but MinGW and some others need to use
# libcharset.h's locale_charset() instead.
#
84
# Define CHARSET_LIB to the library you need to link with in order to
85
# use locale_charset() function.  On some platforms this needs to set to
86
# -lcharset, on others to -liconv .
87
#
88 89 90 91 92 93
# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
# need -lintl when linking.
#
# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
# doesn't support GNU extensions like --check and --statistics
#
94 95 96
# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
# it specifies.
#
97
# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
98
# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
99
#
100 101
# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
#
102 103
# Define NO_STRCASESTR if you don't have strcasestr.
#
René Scharfe's avatar
René Scharfe committed
104 105
# Define NO_MEMMEM if you don't have memmem.
#
Matt Kraai's avatar
Matt Kraai committed
106 107
# Define NO_GETPAGESIZE if you don't have getpagesize.
#
108 109
# Define NO_STRLCPY if you don't have strlcpy.
#
110 111
# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
# C library. If your compiler also does not support long long or does not have
112 113
# strtoull, define NO_STRTOULL.
#
114 115
# Define NO_SETENV if you don't have setenv in the C library.
#
116 117
# Define NO_UNSETENV if you don't have unsetenv in the C library.
#
118 119
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
#
120 121
# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
#
122 123 124
# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
# in the C library.
#
125 126
# Define NO_LIBGEN_H if you don't have libgen.h.
#
127 128
# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
#
129 130
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
#
131 132
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
# Enable it on Windows.  By default, symrefs are still used.
133
#
Pavel Roskin's avatar
Pavel Roskin committed
134
# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
Eric Wong's avatar
Eric Wong committed
135 136 137
# tests.  These tests take up a significant amount of the total test time
# but are not needed unless you plan to talk to SVN repos.
#
138 139 140 141 142 143 144 145 146 147 148 149
# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
# installed in /sw, but don't want GIT to link against any libraries
# installed there.  If defined you may specify your own (or Fink's)
# include directories and library directories by defining CFLAGS
# and LDFLAGS appropriately.
#
# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
# have DarwinPorts installed in /opt/local, but don't want GIT to
# link against any libraries installed there.  If defined you may
# specify your own (or DarwinPort's) include directories and
# library directories by defining CFLAGS and LDFLAGS appropriately.
#
150 151 152 153
# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
# and do not want to use Apple's CommonCrypto library.  This allows you
# to provide your own OpenSSL library, for example from MacPorts.
#
154 155
# Define BLK_SHA1 environment variable to make use of the bundled
# optimized C SHA1 routine.
156
#
157 158
# Define PPC_SHA1 environment variable when running make to make use of
# a bundled SHA1 routine optimized for PowerPC.
159
#
Jeff King's avatar
Jeff King committed
160 161 162 163
# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
# algorithm. This is slower, but may detect attempted collision attacks.
# Takes priority over other *_SHA1 knobs.
#
164 165 166 167 168
# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
# git with the external SHA1 collision-detect library.
# Without this option, i.e. the default behavior is to build git with its
# own built-in code (or submodule).
#
169 170 171 172 173 174
# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
# sha1collisiondetection shipped as a submodule instead of the
# non-submodule copy in sha1dc/. This is an experimental option used
# by the git project to migrate to using sha1collisiondetection as a
# submodule.
#
175 176 177
# Define OPENSSL_SHA1 environment variable when running make to link
# with the SHA1 routine from openssl library.
#
178 179 180 181
# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
#
182 183 184
# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
#
# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
185
#
186
# Define NEEDS_SSL_WITH_CURL if you need -lssl with -lcurl (Minix).
187
#
188
# Define NEEDS_IDN_WITH_CURL if you need -lidn when using -lcurl (Minix).
189
#
190
# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
191
#
Joachim Schmitz's avatar
Joachim Schmitz committed
192 193
# Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
#
194
# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
Joachim Schmitz's avatar
Joachim Schmitz committed
195 196 197
#
# Define NO_UINTMAX_T if you don't have uintmax_t.
#
198 199 200
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
# Patrick Mauritz).
#
201 202 203 204
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
# inet_ntop and inet_pton additionally reside there.
#
205 206
# Define NO_MMAP if you want to avoid mmap.
#
207 208 209
# Define MMAP_PREVENTS_DELETE if a file that is currently mmapped cannot be
# deleted or cannot be replaced using rename().
#
210 211 212 213 214
# Define NO_SYS_POLL_H if you don't have sys/poll.h.
#
# Define NO_POLL if you do not have or don't want to use poll().
# This also implies NO_SYS_POLL_H.
#
215 216 217
# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
# *PLEASE* REPORT to [email protected] if your platform needs this;
# we want to know more about the issue.
218
#
219 220
# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
#
221
# Define NO_PREAD if you have a problem with pread() system call (e.g.
222
# cygwin1.dll before v1.5.22).
223
#
224 225 226 227 228
# Define NO_SETITIMER if you don't have setitimer()
#
# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
# This also implies NO_SETITIMER
#
229 230 231
# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
# generally faster on your platform than accessing the working directory.
#
232 233 234
# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
# the executable mode bit, but doesn't really do so.
#
235 236 237 238
# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
# bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
# usual 0xF000).
#
239 240
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
#
241 242
# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
#
243 244 245
# Define NO_SOCKADDR_STORAGE if your platform does not have struct
# sockaddr_storage.
#
246 247
# Define NO_ICONV if your libc does not properly support iconv.
#
248 249 250
# Define OLD_ICONV if your library has an old iconv(), where the second
# (input buffer pointer) parameter is declared with type (const char **).
#
251 252
# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
#
253 254 255
# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
# that tells runtime paths to dynamic libraries;
# "-Wl,-rpath=/path/lib" is used instead.
256
#
257 258 259
# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
#
260
# Define USE_NSEC below if you want git to care about sub-second file mtimes
261 262 263 264 265
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
# Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
# on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
# on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
# Documentation/technical/racy-git.txt for details.
266
#
267 268 269
# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
# "st_ctim"
#
270 271 272
# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
# available.  This automatically turns USE_NSEC off.
#
273
# Define USE_STDEV below if you want git to care about the underlying device
274
# change being considered an inode change from the update-index perspective.
275
#
276 277 278
# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
# field that counts the on-disk footprint in 512-byte blocks.
#
279 280 281
# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
# (not v1.73 or v1.71).
#
282 283
# Define ASCIIDOC_ROFF if your DocBook XSL does not escape raw roff directives
# (versions 1.68.1 through v1.72).
284
#
Thomas Rast's avatar
Thomas Rast committed
285 286 287 288
# Define GNU_ROFF if your target system uses GNU groff.  This forces
# apostrophes to be ASCII so that cut&pasting examples to the shell
# will work.
#
289 290 291 292 293 294
# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
# documentation.
#
# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
# Extensions Lab if you have it available.
#
295 296
# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
#
297 298
# Define NO_PERL if you do not want Perl scripts or libraries at all.
#
299 300 301 302 303 304
# Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
# copies of CPAN modules that serve as a fallback in case the modules
# are not available on the system. This option is intended for
# distributions that want to use their packaged versions of Perl
# modules, instead of the fallbacks shipped with Git.
#
305 306 307
# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
# but /usr/bin/python2.7 on some platforms).
#
308 309
# Define NO_PYTHON if you do not want Python scripts or libraries at all.
#
Eygene Ryabinkin's avatar
Eygene Ryabinkin committed
310 311
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
#
312 313 314
# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
# and egrep that are pickier when their input contains non-ASCII data.
#
315 316 317 318 319
# The TCL_PATH variable governs the location of the Tcl interpreter
# used to optimize git-gui for your system.  Only used if NO_TCLTK
# is not set.  Defaults to the bare 'tclsh'.
#
# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
320 321 322
# If not set it defaults to the bare 'wish'. If it is set to the empty
# string then NO_TCLTK will be forced (this is used by configure script).
#
323 324 325 326
# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
# is a simplified version of the merge sort used in glibc. This is
# recommended if Git triggers O(n^2) behavior in your platform's qsort().
#
René Scharfe's avatar
René Scharfe committed
327 328 329
# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
# compatible with the one described in C11 Annex K.
#
330 331 332
# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
# information on a not yet closed file that lstat would return for the same
# file after it was closed.
333
#
334 335
# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
# when hardlinking a file to another name and unlinking the original file right
336
# away (some NTFS drivers seem to zero the contents in that scenario).
337
#
338 339
# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
# programs as a tar, where bin/ and libexec/ might be on different file systems.
340
#
341 342 343
# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
# copies to install built-in git commands e.g. git-cat-file.
#
344 345
# Define USE_NED_ALLOCATOR if you want to replace the platforms default
# memory allocators with the nedmalloc allocator written by Niall Douglas.
346
#
347 348 349 350 351
# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
# This is necessary when using a custom allocator in order to avoid
# crashes due to allocation and free working on different 'heaps'.
# It's defined automatically if USE_NED_ALLOCATOR is set.
#
352 353
# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
# feature.
354
#
355 356 357
# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
# user.
#
358
# Define GETTEXT_POISON if you are debugging the choice of strings marked
359 360 361
# for translation.  In a GETTEXT_POISON build, you can turn all strings marked
# for translation into gibberish by setting the GIT_GETTEXT_POISON variable
# (to any value) in your environment.
362
#
363 364
# Define JSMIN to point to JavaScript minifier that functions as
# a filter to have gitweb.js minified.
365
#
366 367 368
# Define CSSMIN to point to a CSS minifier in order to generate a minified
# version of gitweb.css
#
369 370 371 372
# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
# you want to use something different.  The value will be interpreted by the
# shell at runtime when it is used.
#
373 374 375 376 377 378 379
# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
# want to use something different.  The value will be interpreted by the shell
# if necessary when it is used.  Examples:
#
#   DEFAULT_EDITOR='~/bin/vi',
#   DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
#   DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
380
#
381 382 383 384 385 386
# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
# header files to be automatically computed, to avoid rebuilding objects when
# an unrelated header file changes.  Define it to "no" to use the hard-coded
# dependency rules.  The default is "auto", which means to use computed header
# dependencies if your compiler is detected to support it.
#
387
# Define NATIVE_CRLF if your platform uses CRLF for line endings.
388
#
389 390
# Define GIT_USER_AGENT if you want to change how git identifies itself during
# network interactions.  The default is "git/$(GIT_VERSION)".
391
#
392 393 394
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
# (defaults to "man") if you want to have a different default when
# "git help" is called without a parameter specifying the format.
395 396 397 398
#
# Define TEST_GIT_INDEX_VERSION to 2, 3 or 4 to run the test suite
# with a different indexfile format version.  If it isn't set the index
# file format used is index-v[23].
399
#
400 401
# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
# return NULL when it receives a bogus time_t.
402
#
403
# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
404
#
405 406 407 408
# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
#
# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
# before 2.17) for clock_gettime and CLOCK_MONOTONIC.
409
#
410 411 412 413 414 415 416 417
# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
# compiles the following initialization:
#
#   static const char s[] = ("FOO");
#
# and define it to "no" if you need to remove the parentheses () around the
# constant.  The default is "auto", which means to use parentheses if your
# compiler is detected to support it.
418
#
419
# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
420 421
#
# Define HAVE_GETDELIM if your system has the getdelim() function.
422 423 424 425 426 427 428 429
#
# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
# default environment variables to be passed when a pager is spawned, e.g.
#
#    PAGER_ENV = LESS=FRX LV=-c
#
# to say "export LESS=FRX (and LV=-c) if the environment variable
# LESS (and LV) is not set, respectively".
430
#
431 432 433
# Define TEST_SHELL_PATH if you want to use a shell besides SHELL_PATH for
# running the test scripts (e.g., bash has better support for "set -x"
# tracing).
434
#
435 436
# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
# which the built Git will run (for instance "x86_64").
437

438
GIT-VERSION-FILE: FORCE
439
	@$(SHELL_PATH) ./GIT-VERSION-GEN
440
-include GIT-VERSION-FILE
441

442
# CFLAGS and LDFLAGS are for the users to override from the command line.
443

444
CFLAGS = -g -O2 -Wall
445
DEVELOPER_CFLAGS = -Werror \
446 447 448 449 450 451 452 453
	-Wdeclaration-after-statement \
	-Wno-format-zero-length \
	-Wold-style-definition \
	-Woverflow \
	-Wpointer-arith \
	-Wstrict-prototypes \
	-Wunused \
	-Wvla
454
LDFLAGS =
455
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
456
ALL_LDFLAGS = $(LDFLAGS)
457
STRIP ?= strip
458

459 460 461
# Create as necessary, replace existing, make ranlib unneeded.
ARFLAGS = rcs

462 463 464
# Among the variables below, these:
#   gitexecdir
#   template_dir
465
#   sysconfdir
466 467
# can be specified as a relative path some/where/else;
# this is interpreted as relative to $(prefix) and "git" at
468
# runtime figures out where they are based on the path to the executable.
469 470 471 472 473
# Additionally, the following will be treated as relative by "git" if they
# begin with "$(prefix)/":
#   mandir
#   infodir
#   htmldir
474 475
# This can help installing the suite in a relocatable way.

476
prefix = $(HOME)
477 478
bindir_relative = bin
bindir = $(prefix)/$(bindir_relative)
479 480
mandir = $(prefix)/share/man
infodir = $(prefix)/share/info
481
gitexecdir = libexec/git-core
482
mergetoolsdir = $(gitexecdir)/mergetools
483
sharedir = $(prefix)/share
484
gitwebdir = $(sharedir)/gitweb
485
perllibdir = $(sharedir)/perl5
486
localedir = $(sharedir)/locale
487
template_dir = share/git-core/templates
488
htmldir = $(prefix)/share/doc/git-doc
489
ETC_GITCONFIG = $(sysconfdir)/gitconfig
490
ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
491
lib = lib
492
# DESTDIR =
493
pathsep = :
494

495 496 497 498
mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))

499
export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
500

501
CC = cc
502
AR = ar
503
RM = rm -f
504
DIFF = diff
505
TAR = tar
506
FIND = find
507
INSTALL = install
508
TCL_PATH = tclsh
509
TCLTK_PATH = wish
510
XGETTEXT = xgettext
511
MSGFMT = msgfmt
512
CURL_CONFIG = curl-config
513
PTHREAD_LIBS = -lpthread
514
PTHREAD_CFLAGS =
515
GCOV = gcov
René Scharfe's avatar
René Scharfe committed
516
SPATCH = spatch
517

518 519
export TCL_PATH TCLTK_PATH

520
SPARSE_FLAGS =
521
SPATCH_FLAGS = --all-includes
522

Petr Baudis's avatar
Petr Baudis committed
523 524 525 526


### --- END CONFIGURATION SECTION ---

527
# Those must not be GNU-specific; they are shared with perl/ which may
Petr Baudis's avatar
Petr Baudis committed
528 529
# be built by a different compiler. (Note that this is an artifact now
# but it still might be nice to keep that distinction.)
530
BASIC_CFLAGS = -I.
Petr Baudis's avatar
Petr Baudis committed
531
BASIC_LDFLAGS =
532

533 534 535 536 537
# Guard against environment variables
BUILTIN_OBJS =
BUILT_INS =
COMPAT_CFLAGS =
COMPAT_OBJS =
538 539
XDIFF_OBJS =
VCSSVN_OBJS =
Jeff King's avatar
Jeff King committed
540
GENERATED_H =
541
EXTRA_CPPFLAGS =
542
LIB_OBJS =
543
PROGRAM_OBJS =
544 545
PROGRAMS =
SCRIPT_PERL =
546
SCRIPT_PYTHON =
547
SCRIPT_SH =
548
SCRIPT_LIB =
549
TEST_PROGRAMS_NEED_X =
550

551 552 553 554 555 556
# Having this variable in your environment would break pipelines because
# you cause "cd" to echo its destination to stdout.  It can also take
# scripts to unexpected places.  If you like CDPATH, define it for your
# interactive shell sessions without exporting it.
unexport CDPATH

557
SCRIPT_SH += git-bisect.sh
558
SCRIPT_SH += git-difftool--helper.sh
559 560 561 562 563 564 565
SCRIPT_SH += git-filter-branch.sh
SCRIPT_SH += git-merge-octopus.sh
SCRIPT_SH += git-merge-one-file.sh
SCRIPT_SH += git-merge-resolve.sh
SCRIPT_SH += git-mergetool.sh
SCRIPT_SH += git-quiltimport.sh
SCRIPT_SH += git-rebase.sh
566
SCRIPT_SH += git-remote-testgit.sh
567 568 569 570 571
SCRIPT_SH += git-request-pull.sh
SCRIPT_SH += git-stash.sh
SCRIPT_SH += git-submodule.sh
SCRIPT_SH += git-web--browse.sh

572 573
SCRIPT_LIB += git-mergetool--lib
SCRIPT_LIB += git-parse-remote
574 575 576
SCRIPT_LIB += git-rebase--am
SCRIPT_LIB += git-rebase--interactive
SCRIPT_LIB += git-rebase--merge
577
SCRIPT_LIB += git-sh-setup
578
SCRIPT_LIB += git-sh-i18n
579

580 581 582 583 584 585 586
SCRIPT_PERL += git-add--interactive.perl
SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
SCRIPT_PERL += git-cvsimport.perl
SCRIPT_PERL += git-cvsserver.perl
SCRIPT_PERL += git-send-email.perl
SCRIPT_PERL += git-svn.perl
587

Pete Wyckoff's avatar
Pete Wyckoff committed
588
SCRIPT_PYTHON += git-p4.py
589

590
NO_INSTALL += git-remote-testgit
591

592 593 594 595 596
# Generated files for scripts
SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))

597 598 599 600
SCRIPT_SH_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_SH_GEN))
SCRIPT_PERL_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PERL_GEN))
SCRIPT_PYTHON_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PYTHON_GEN))

601 602 603 604 605 606 607 608 609
# Individual rules to allow e.g.
# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
# from subdirectories like contrib/*/
.PHONY: build-perl-script build-sh-script build-python-script
build-perl-script: $(SCRIPT_PERL_GEN)
build-sh-script: $(SCRIPT_SH_GEN)
build-python-script: $(SCRIPT_PYTHON_GEN)

.PHONY: install-perl-script install-sh-script install-python-script
610
install-sh-script: $(SCRIPT_SH_INS)
Felipe Contreras's avatar
Felipe Contreras committed
611
	$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
612
install-perl-script: $(SCRIPT_PERL_INS)
Felipe Contreras's avatar
Felipe Contreras committed
613
	$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
614
install-python-script: $(SCRIPT_PYTHON_INS)
Felipe Contreras's avatar
Felipe Contreras committed
615
	$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
616 617 618 619 620 621 622 623 624

.PHONY: clean-perl-script clean-sh-script clean-python-script
clean-sh-script:
	$(RM) $(SCRIPT_SH_GEN)
clean-perl-script:
	$(RM) $(SCRIPT_PERL_GEN)
clean-python-script:
	$(RM) $(SCRIPT_PYTHON_GEN)

625 626 627
SCRIPTS = $(SCRIPT_SH_INS) \
	  $(SCRIPT_PERL_INS) \
	  $(SCRIPT_PYTHON_INS) \
628
	  git-instaweb
629

630 631
ETAGS_TARGET = TAGS

632 633
# Empty...
EXTRA_PROGRAMS =
634

635 636
# ... and all the rest that could be moved out of bindir to gitexecdir
PROGRAMS += $(EXTRA_PROGRAMS)
637

638
PROGRAM_OBJS += credential-store.o
639
PROGRAM_OBJS += daemon.o
640
PROGRAM_OBJS += fast-import.o
641
PROGRAM_OBJS += http-backend.o
642
PROGRAM_OBJS += imap-send.o
643
PROGRAM_OBJS += sh-i18n--envsubst.o
644 645 646
PROGRAM_OBJS += shell.o
PROGRAM_OBJS += show-index.o
PROGRAM_OBJS += upload-pack.o
647
PROGRAM_OBJS += remote-testsvn.o
648

649 650 651
# Binary suffix, set to .exe for Windows builds
X =

652
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
653

654 655
TEST_PROGRAMS_NEED_X += test-chmtime
TEST_PROGRAMS_NEED_X += test-ctype
656
TEST_PROGRAMS_NEED_X += test-config
657 658
TEST_PROGRAMS_NEED_X += test-date
TEST_PROGRAMS_NEED_X += test-delta
659
TEST_PROGRAMS_NEED_X += test-drop-caches
660
TEST_PROGRAMS_NEED_X += test-dump-cache-tree
661
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
662
TEST_PROGRAMS_NEED_X += test-dump-split-index
663
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
664
TEST_PROGRAMS_NEED_X += test-example-decorate
665
TEST_PROGRAMS_NEED_X += test-fake-ssh
666
TEST_PROGRAMS_NEED_X += test-genrandom
667
TEST_PROGRAMS_NEED_X += test-hashmap
668
TEST_PROGRAMS_NEED_X += test-index-version
669
TEST_PROGRAMS_NEED_X += test-lazy-init-name-hash
David Barr's avatar
David Barr committed
670
TEST_PROGRAMS_NEED_X += test-line-buffer
671
TEST_PROGRAMS_NEED_X += test-match-trees
672
TEST_PROGRAMS_NEED_X += test-mergesort
673
TEST_PROGRAMS_NEED_X += test-mktemp
674
TEST_PROGRAMS_NEED_X += test-online-cpus
675 676
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-path-utils
677
TEST_PROGRAMS_NEED_X += test-prio-queue
678
TEST_PROGRAMS_NEED_X += test-read-cache
679
TEST_PROGRAMS_NEED_X += test-write-cache
680
TEST_PROGRAMS_NEED_X += test-ref-store
681
TEST_PROGRAMS_NEED_X += test-regex
682
TEST_PROGRAMS_NEED_X += test-revision-walking
683
TEST_PROGRAMS_NEED_X += test-run-command
684
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
685
TEST_PROGRAMS_NEED_X += test-sha1
686
TEST_PROGRAMS_NEED_X += test-sha1-array
687
TEST_PROGRAMS_NEED_X += test-sigchain
688
TEST_PROGRAMS_NEED_X += test-strcmp-offset
689
TEST_PROGRAMS_NEED_X += test-string-list
690
TEST_PROGRAMS_NEED_X += test-submodule-config
691
TEST_PROGRAMS_NEED_X += test-subprocess
David Barr's avatar
David Barr committed
692
TEST_PROGRAMS_NEED_X += test-svn-fe
693
TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
Duy Nguyen's avatar
Duy Nguyen committed
694
TEST_PROGRAMS_NEED_X += test-wildmatch
695

696
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
697

Junio C Hamano's avatar
Junio C Hamano committed
698
# List built-in command $C whose implementation cmd_$C() is not in
699 700
# builtin/$C.o but is linked in as part of some other command.
BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
701 702

BUILT_INS += git-cherry$X
703
BUILT_INS += git-cherry-pick$X
704 705 706 707 708
BUILT_INS += git-format-patch$X
BUILT_INS += git-fsck-objects$X
BUILT_INS += git-init$X
BUILT_INS += git-merge-subtree$X
BUILT_INS += git-show$X
709
BUILT_INS += git-stage$X
710 711
BUILT_INS += git-status$X
BUILT_INS += git-whatchanged$X
Junio C Hamano's avatar
Junio C Hamano committed
712

713 714
# what 'all' will build and 'install' will install in gitexecdir,
# excluding programs for built-in commands
Junio C Hamano's avatar
Junio C Hamano committed
715
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
716

Eygene Ryabinkin's avatar
Eygene Ryabinkin committed
717
# what 'all' will build but not install in gitexecdir
718
OTHER_PROGRAMS = git$X
Eygene Ryabinkin's avatar
Eygene Ryabinkin committed
719

720 721 722 723 724 725 726 727 728
# what test wrappers are needed and 'install' will install, in bindir
BINDIR_PROGRAMS_NEED_X += git
BINDIR_PROGRAMS_NEED_X += git-upload-pack
BINDIR_PROGRAMS_NEED_X += git-receive-pack
BINDIR_PROGRAMS_NEED_X += git-upload-archive
BINDIR_PROGRAMS_NEED_X += git-shell

BINDIR_PROGRAMS_NO_X += git-cvsserver

729 730 731 732 733 734 735
# Set paths to tools early so that they can be used for version tests.
ifndef SHELL_PATH
	SHELL_PATH = /bin/sh
endif
ifndef PERL_PATH
	PERL_PATH = /usr/bin/perl
endif
736 737 738
ifndef PYTHON_PATH
	PYTHON_PATH = /usr/bin/python
endif
739

Luben Tuikov's avatar
Luben Tuikov committed
740
export PERL_PATH
741
export PYTHON_PATH
Luben Tuikov's avatar
Luben Tuikov committed
742

743 744
TEST_SHELL_PATH = $(SHELL_PATH)

745 746 747
LIB_FILE = libgit.a
XDIFF_LIB = xdiff/lib.a
VCSSVN_LIB = vcs-svn/lib.a
748

Jeff King's avatar
Jeff King committed
749
GENERATED_H += common-cmds.h
750

751 752 753 754 755
LIB_H = $(shell $(FIND) . \
	-name .git -prune -o \
	-name t -prune -o \
	-name Documentation -prune -o \
	-name '*.h' -print)
756

757
LIB_OBJS += abspath.o
758
LIB_OBJS += advice.o
759 760
LIB_OBJS += alias.o
LIB_OBJS += alloc.o
761
LIB_OBJS += apply.o
762 763 764
LIB_OBJS += archive.o
LIB_OBJS += archive-tar.o
LIB_OBJS += archive-zip.o
765
LIB_OBJS += argv-array.o
766 767
LIB_OBJS += attr.o
LIB_OBJS += base85.o
768
LIB_OBJS += bisect.o
769
LIB_OBJS += blame.o
770 771
LIB_OBJS += blob.o
LIB_OBJS += branch.o
772
LIB_OBJS += bulk-checkin.o
773 774
LIB_OBJS += bundle.o
LIB_OBJS += cache-tree.o
775
LIB_OBJS += checkout.o
776
LIB_OBJS += color.o
777
LIB_OBJS += column.o
778 779
LIB_OBJS += combine-diff.o
LIB_OBJS += commit.o
780
LIB_OBJS += compat/obstack.o
781
LIB_OBJS += compat/terminal.o
782 783
LIB_OBJS += config.o
LIB_OBJS += connect.o
784
LIB_OBJS += connected.o
785 786
LIB_OBJS += convert.o
LIB_OBJS += copy.o
Jeff King's avatar
Jeff King committed
787
LIB_OBJS += credential.o
788 789 790 791 792 793 794 795 796 797 798
LIB_OBJS += csum-file.o
LIB_OBJS += ctype.o
LIB_OBJS += date.o
LIB_OBJS += decorate.o
LIB_OBJS += diffcore-break.o
LIB_OBJS += diffcore-delta.o
LIB_OBJS += diffcore-order.o
LIB_OBJS += diffcore-pickaxe.o
LIB_OBJS += diffcore-rename.o
LIB_OBJS += diff-delta.o
LIB_OBJS += diff-lib.o
799
LIB_OBJS += diff-no-index.o
800 801
LIB_OBJS += diff.o
LIB_OBJS += dir.o
802
LIB_OBJS += dir-iterator.o
803
LIB_OBJS += editor.o
804 805
LIB_OBJS += entry.o
LIB_OBJS += environment.o
806 807 808 809
LIB_OBJS += ewah/bitmap.o
LIB_OBJS += ewah/ewah_bitmap.o
LIB_OBJS += ewah/ewah_io.o
LIB_OBJS += ewah/ewah_rlw.o
810
LIB_OBJS += exec_cmd.o
811
LIB_OBJS += fetch-object.o
812
LIB_OBJS += fetch-pack.o
813
LIB_OBJS += fsck.o
814
LIB_OBJS += fsmonitor.o
815
LIB_OBJS += gettext.o
816
LIB_OBJS += gpg-interface.o
Adam Simpkins's avatar
Adam Simpkins committed
817
LIB_OBJS += graph.o
818
LIB_OBJS += grep.o
819
LIB_OBJS += hashmap.o
820
LIB_OBJS += help.o
Linus Torvalds's avatar
Linus Torvalds committed
821
LIB_OBJS += hex.o
822
LIB_OBJS += ident.o
Fredrik K's avatar
Fredrik K committed
823
LIB_OBJS += kwset.o
824
LIB_OBJS += levenshtein.o
825
LIB_OBJS += line-log.o
Bo Yang's avatar
Bo Yang committed
826
LIB_OBJS += line-range.o
827
LIB_OBJS += list-objects.o
828 829
LIB_OBJS += list-objects-filter.o
LIB_OBJS += list-objects-filter-options.o
830 831 832
LIB_OBJS += ll-merge.o
LIB_OBJS += lockfile.o
LIB_OBJS += log-tree.o
Junio C Hamano's avatar
Junio C Hamano committed
833
LIB_OBJS += mailinfo.o
834 835
LIB_OBJS += mailmap.o
LIB_OBJS += match-trees.o
836
LIB_OBJS += merge.o
837
LIB_OBJS += merge-blobs.o
838
LIB_OBJS += merge-recursive.o
839
LIB_OBJS += mergesort.o
840
LIB_OBJS += name-hash.o
Johannes Schindelin's avatar
Johannes Schindelin committed
841
LIB_OBJS += notes.o
Jeff King's avatar
Jeff King committed
842
LIB_OBJS += notes-cache.o
843
LIB_OBJS += notes-merge.o
844
LIB_OBJS += notes-utils.o
845
LIB_OBJS += object.o
Jonathan Tan's avatar
Jonathan Tan committed
846
LIB_OBJS += oidmap.o
Jeff King's avatar
Jeff King committed
847
LIB_OBJS += oidset.o
848
LIB_OBJS += packfile.o
849
LIB_OBJS += pack-bitmap.o
850
LIB_OBJS += pack-bitmap-write.o
851
LIB_OBJS += pack-check.o
852
LIB_OBJS += pack-objects.o
853 854 855 856
LIB_OBJS += pack-revindex.o
LIB_OBJS += pack-write.o
LIB_OBJS += pager.o
LIB_OBJS += parse-options.o
857
LIB_OBJS += parse-options-cb.o
858 859 860
LIB_OBJS += patch-delta.o
LIB_OBJS += patch-ids.o
LIB_OBJS += path.o
861
LIB_OBJS += pathspec.o
862
LIB_OBJS += pkt-line.o
863
LIB_OBJS += preload-index.o
864
LIB_OBJS += pretty.o
865
LIB_OBJS += prio-queue.o
866
LIB_OBJS += progress.o
867
LIB_OBJS += prompt.o
868
LIB_OBJS += protocol.o
869 870 871 872 873
LIB_OBJS += quote.o
LIB_OBJS += reachable.o
LIB_OBJS += read-cache.o
LIB_OBJS += reflog-walk.o
LIB_OBJS += refs.o
874
LIB_OBJS += refs/files-backend.o
875
LIB_OBJS += refs/iterator.o
876
LIB_OBJS += refs/packed-backend.o
877
LIB_OBJS += refs/ref-cache.o
878
LIB_OBJS += ref-filter.o
879
LIB_OBJS += remote.o
880
LIB_OBJS += replace_object.o
881
LIB_OBJS += repository.o
882
LIB_OBJS += rerere.o
883
LIB_OBJS += resolve-undo.o
884 885
LIB_OBJS += revision.o
LIB_OBJS += run-command.o
886
LIB_OBJS += send-pack.o
887
LIB_OBJS += sequencer.o
888 889
LIB_OBJS += server-info.o
LIB_OBJS += setup.o
890
LIB_OBJS += sha1-array.o
891
LIB_OBJS += sha1-lookup.o
892
LIB_OBJS += sha1_file.o
893 894 895
LIB_OBJS += sha1_name.o
LIB_OBJS += shallow.o
LIB_OBJS += sideband.o
896
LIB_OBJS += sigchain.o
Duy Nguyen's avatar
Duy Nguyen committed
897
LIB_OBJS += split-index.o
898
LIB_OBJS += strbuf.o
899
LIB_OBJS += streaming.o
900
LIB_OBJS += string-list.o
901
LIB_OBJS += submodule.o
902
LIB_OBJS += submodule-config.o
903
LIB_OBJS += sub-process.o
904 905
LIB_OBJS += symlinks.o
LIB_OBJS += tag.o
906
LIB_OBJS += tempfile.o
907
LIB_OBJS += tmp-objdir.o
908
LIB_OBJS += trace.o
909
LIB_OBJS += trailer.o
910
LIB_OBJS += transport.o
911
LIB_OBJS += transport-helper.o
912 913 914 915
LIB_OBJS += tree-diff.o
LIB_OBJS += tree.o
LIB_OBJS += tree-walk.o
LIB_OBJS += unpack-trees.o
916
LIB_OBJS += url.o
917
LIB_OBJS += urlmatch.o
918
LIB_OBJS += usage.o
919
LIB_OBJS += userdiff.o
920
LIB_OBJS += utf8.o
921
LIB_OBJS += varint.o