THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2636 lines
78KB

  1. # The default target of this Makefile is...
  2. all::
  3. # Define V=1 to have a more verbose compile.
  4. #
  5. # Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
  6. #
  7. # Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
  8. # to PATH if your tools in /usr/bin are broken.
  9. #
  10. # Define SOCKLEN_T to a suitable type (such as 'size_t') if your
  11. # system headers do not define a socklen_t type.
  12. #
  13. # Define INLINE to a suitable substitute (such as '__inline' or '') if git
  14. # fails to compile with errors about undefined inline functions or similar.
  15. #
  16. # Define SNPRINTF_RETURNS_BOGUS if you are on a system which snprintf()
  17. # or vsnprintf() return -1 instead of number of characters which would
  18. # have been written to the final string if enough space had been available.
  19. #
  20. # Define FREAD_READS_DIRECTORIES if you are on a system which succeeds
  21. # when attempting to read from an fopen'ed directory.
  22. #
  23. # Define NO_OPENSSL environment variable if you do not have OpenSSL.
  24. # This also implies BLK_SHA1.
  25. #
  26. # Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
  27. # able to use Perl-compatible regular expressions.
  28. #
  29. # Define LIBPCREDIR=/foo/bar if your libpcre header and library files are in
  30. # /foo/bar/include and /foo/bar/lib directories.
  31. #
  32. # Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
  33. #
  34. # Define NO_CURL if you do not have libcurl installed. git-http-fetch and
  35. # git-http-push are not built, and you cannot use http:// and https://
  36. # transports (neither smart nor dumb).
  37. #
  38. # Define CURLDIR=/foo/bar if your curl header and library files are in
  39. # /foo/bar/include and /foo/bar/lib directories.
  40. #
  41. # Define CURL_CONFIG to curl's configuration program that prints information
  42. # about the library (e.g., its version number). The default is 'curl-config'.
  43. #
  44. # Define NO_EXPAT if you do not have expat installed. git-http-push is
  45. # not built, and you cannot push using http:// and https:// transports (dumb).
  46. #
  47. # Define EXPATDIR=/foo/bar if your expat header and library files are in
  48. # /foo/bar/include and /foo/bar/lib directories.
  49. #
  50. # Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
  51. # 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
  52. #
  53. # Define NO_GETTEXT if you don't want Git output to be translated.
  54. # A translated Git requires GNU libintl or another gettext implementation,
  55. # plus libintl-perl at runtime.
  56. #
  57. # Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
  58. # the installed gettext translation of the shell scripts output.
  59. #
  60. # Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
  61. # trust the langinfo.h's nl_langinfo(CODESET) function to return the
  62. # current character set. GNU and Solaris have a nl_langinfo(CODESET),
  63. # FreeBSD can use either, but MinGW and some others need to use
  64. # libcharset.h's locale_charset() instead.
  65. #
  66. # Define CHARSET_LIB to the library you need to link with in order to
  67. # use locale_charset() function. On some platforms this needs to set to
  68. # -lcharset, on others to -liconv .
  69. #
  70. # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
  71. # need -lintl when linking.
  72. #
  73. # Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
  74. # doesn't support GNU extensions like --check and --statistics
  75. #
  76. # Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
  77. # it specifies.
  78. #
  79. # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
  80. # d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
  81. #
  82. # Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
  83. #
  84. # Define NO_STRCASESTR if you don't have strcasestr.
  85. #
  86. # Define NO_MEMMEM if you don't have memmem.
  87. #
  88. # Define NO_GETPAGESIZE if you don't have getpagesize.
  89. #
  90. # Define NO_STRLCPY if you don't have strlcpy.
  91. #
  92. # Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
  93. # C library. If your compiler also does not support long long or does not have
  94. # strtoull, define NO_STRTOULL.
  95. #
  96. # Define NO_SETENV if you don't have setenv in the C library.
  97. #
  98. # Define NO_UNSETENV if you don't have unsetenv in the C library.
  99. #
  100. # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
  101. #
  102. # Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
  103. #
  104. # Define NO_MKSTEMPS if you don't have mkstemps in the C library.
  105. #
  106. # Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
  107. # in the C library.
  108. #
  109. # Define NO_LIBGEN_H if you don't have libgen.h.
  110. #
  111. # Define NEEDS_LIBGEN if your libgen needs -lgen when linking
  112. #
  113. # Define NO_SYS_SELECT_H if you don't have sys/select.h.
  114. #
  115. # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
  116. # Enable it on Windows. By default, symrefs are still used.
  117. #
  118. # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
  119. # tests. These tests take up a significant amount of the total test time
  120. # but are not needed unless you plan to talk to SVN repos.
  121. #
  122. # Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
  123. # installed in /sw, but don't want GIT to link against any libraries
  124. # installed there. If defined you may specify your own (or Fink's)
  125. # include directories and library directories by defining CFLAGS
  126. # and LDFLAGS appropriately.
  127. #
  128. # Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
  129. # have DarwinPorts installed in /opt/local, but don't want GIT to
  130. # link against any libraries installed there. If defined you may
  131. # specify your own (or DarwinPort's) include directories and
  132. # library directories by defining CFLAGS and LDFLAGS appropriately.
  133. #
  134. # Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
  135. # and do not want to use Apple's CommonCrypto library. This allows you
  136. # to provide your own OpenSSL library, for example from MacPorts.
  137. #
  138. # Define BLK_SHA1 environment variable to make use of the bundled
  139. # optimized C SHA1 routine.
  140. #
  141. # Define PPC_SHA1 environment variable when running make to make use of
  142. # a bundled SHA1 routine optimized for PowerPC.
  143. #
  144. # Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
  145. # in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
  146. # wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
  147. #
  148. # Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
  149. #
  150. # Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
  151. #
  152. # Define NEEDS_SSL_WITH_CURL if you need -lssl with -lcurl (Minix).
  153. #
  154. # Define NEEDS_IDN_WITH_CURL if you need -lidn when using -lcurl (Minix).
  155. #
  156. # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
  157. #
  158. # Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
  159. #
  160. # Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
  161. #
  162. # Define NO_UINTMAX_T if you don't have uintmax_t.
  163. #
  164. # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
  165. # Patrick Mauritz).
  166. #
  167. # Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
  168. # Notably on Solaris hstrerror resides in libresolv and on Solaris 7
  169. # inet_ntop and inet_pton additionally reside there.
  170. #
  171. # Define NO_MMAP if you want to avoid mmap.
  172. #
  173. # Define NO_SYS_POLL_H if you don't have sys/poll.h.
  174. #
  175. # Define NO_POLL if you do not have or don't want to use poll().
  176. # This also implies NO_SYS_POLL_H.
  177. #
  178. # Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
  179. # *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
  180. # we want to know more about the issue.
  181. #
  182. # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
  183. #
  184. # Define NO_PREAD if you have a problem with pread() system call (e.g.
  185. # cygwin1.dll before v1.5.22).
  186. #
  187. # Define NO_SETITIMER if you don't have setitimer()
  188. #
  189. # Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
  190. # This also implies NO_SETITIMER
  191. #
  192. # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
  193. # generally faster on your platform than accessing the working directory.
  194. #
  195. # Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
  196. # the executable mode bit, but doesn't really do so.
  197. #
  198. # Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
  199. # bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
  200. # usual 0xF000).
  201. #
  202. # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
  203. #
  204. # Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
  205. #
  206. # Define NO_SOCKADDR_STORAGE if your platform does not have struct
  207. # sockaddr_storage.
  208. #
  209. # Define NO_ICONV if your libc does not properly support iconv.
  210. #
  211. # Define OLD_ICONV if your library has an old iconv(), where the second
  212. # (input buffer pointer) parameter is declared with type (const char **).
  213. #
  214. # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
  215. #
  216. # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
  217. # that tells runtime paths to dynamic libraries;
  218. # "-Wl,-rpath=/path/lib" is used instead.
  219. #
  220. # Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
  221. # as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
  222. #
  223. # Define USE_NSEC below if you want git to care about sub-second file mtimes
  224. # and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
  225. # Linux, kernel 2.6.11 or newer is required for reliable sub-second file times
  226. # on file systems with exactly 1 ns or 1 s resolution. If you intend to use Git
  227. # on other file systems (e.g. CEPH, CIFS, NTFS, UDF), don't enable USE_NSEC. See
  228. # Documentation/technical/racy-git.txt for details.
  229. #
  230. # Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
  231. # "st_ctim"
  232. #
  233. # Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
  234. # available. This automatically turns USE_NSEC off.
  235. #
  236. # Define USE_STDEV below if you want git to care about the underlying device
  237. # change being considered an inode change from the update-index perspective.
  238. #
  239. # Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
  240. # field that counts the on-disk footprint in 512-byte blocks.
  241. #
  242. # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
  243. # (not v1.73 or v1.71).
  244. #
  245. # Define ASCIIDOC_ROFF if your DocBook XSL does not escape raw roff directives
  246. # (versions 1.68.1 through v1.72).
  247. #
  248. # Define GNU_ROFF if your target system uses GNU groff. This forces
  249. # apostrophes to be ASCII so that cut&pasting examples to the shell
  250. # will work.
  251. #
  252. # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
  253. #
  254. # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
  255. # MakeMaker (e.g. using ActiveState under Cygwin).
  256. #
  257. # Define NO_PERL if you do not want Perl scripts or libraries at all.
  258. #
  259. # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
  260. # but /usr/bin/python2.7 on some platforms).
  261. #
  262. # Define NO_PYTHON if you do not want Python scripts or libraries at all.
  263. #
  264. # Define NO_TCLTK if you do not want Tcl/Tk GUI.
  265. #
  266. # Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
  267. # and egrep that are pickier when their input contains non-ASCII data.
  268. #
  269. # The TCL_PATH variable governs the location of the Tcl interpreter
  270. # used to optimize git-gui for your system. Only used if NO_TCLTK
  271. # is not set. Defaults to the bare 'tclsh'.
  272. #
  273. # The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
  274. # If not set it defaults to the bare 'wish'. If it is set to the empty
  275. # string then NO_TCLTK will be forced (this is used by configure script).
  276. #
  277. # Define INTERNAL_QSORT to use Git's implementation of qsort(), which
  278. # is a simplified version of the merge sort used in glibc. This is
  279. # recommended if Git triggers O(n^2) behavior in your platform's qsort().
  280. #
  281. # Define UNRELIABLE_FSTAT if your system's fstat does not return the same
  282. # information on a not yet closed file that lstat would return for the same
  283. # file after it was closed.
  284. #
  285. # Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
  286. # when hardlinking a file to another name and unlinking the original file right
  287. # away (some NTFS drivers seem to zero the contents in that scenario).
  288. #
  289. # Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
  290. # programs as a tar, where bin/ and libexec/ might be on different file systems.
  291. #
  292. # Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
  293. # copies to install built-in git commands e.g. git-cat-file.
  294. #
  295. # Define USE_NED_ALLOCATOR if you want to replace the platforms default
  296. # memory allocators with the nedmalloc allocator written by Niall Douglas.
  297. #
  298. # Define OVERRIDE_STRDUP to override the libc version of strdup(3).
  299. # This is necessary when using a custom allocator in order to avoid
  300. # crashes due to allocation and free working on different 'heaps'.
  301. # It's defined automatically if USE_NED_ALLOCATOR is set.
  302. #
  303. # Define NO_REGEX if your C library lacks regex support with REG_STARTEND
  304. # feature.
  305. #
  306. # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
  307. # user.
  308. #
  309. # Define GETTEXT_POISON if you are debugging the choice of strings marked
  310. # for translation. In a GETTEXT_POISON build, you can turn all strings marked
  311. # for translation into gibberish by setting the GIT_GETTEXT_POISON variable
  312. # (to any value) in your environment.
  313. #
  314. # Define JSMIN to point to JavaScript minifier that functions as
  315. # a filter to have gitweb.js minified.
  316. #
  317. # Define CSSMIN to point to a CSS minifier in order to generate a minified
  318. # version of gitweb.css
  319. #
  320. # Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
  321. # you want to use something different. The value will be interpreted by the
  322. # shell at runtime when it is used.
  323. #
  324. # Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
  325. # want to use something different. The value will be interpreted by the shell
  326. # if necessary when it is used. Examples:
  327. #
  328. # DEFAULT_EDITOR='~/bin/vi',
  329. # DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
  330. # DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
  331. #
  332. # Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
  333. # header files to be automatically computed, to avoid rebuilding objects when
  334. # an unrelated header file changes. Define it to "no" to use the hard-coded
  335. # dependency rules. The default is "auto", which means to use computed header
  336. # dependencies if your compiler is detected to support it.
  337. #
  338. # Define NATIVE_CRLF if your platform uses CRLF for line endings.
  339. #
  340. # Define XDL_FAST_HASH to use an alternative line-hashing method in
  341. # the diff algorithm. It gives a nice speedup if your processor has
  342. # fast unaligned word loads. Does NOT work on big-endian systems!
  343. # Enabled by default on x86_64.
  344. #
  345. # Define GIT_USER_AGENT if you want to change how git identifies itself during
  346. # network interactions. The default is "git/$(GIT_VERSION)".
  347. #
  348. # Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
  349. # (defaults to "man") if you want to have a different default when
  350. # "git help" is called without a parameter specifying the format.
  351. #
  352. # Define TEST_GIT_INDEX_VERSION to 2, 3 or 4 to run the test suite
  353. # with a different indexfile format version. If it isn't set the index
  354. # file format used is index-v[23].
  355. #
  356. # Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
  357. # return NULL when it receives a bogus time_t.
  358. #
  359. # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
  360. #
  361. # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
  362. #
  363. # Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
  364. # before 2.17) for clock_gettime and CLOCK_MONOTONIC.
  365. #
  366. # Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
  367. # compiles the following initialization:
  368. #
  369. # static const char s[] = ("FOO");
  370. #
  371. # and define it to "no" if you need to remove the parentheses () around the
  372. # constant. The default is "auto", which means to use parentheses if your
  373. # compiler is detected to support it.
  374. #
  375. # Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
  376. #
  377. # Define HAVE_GETDELIM if your system has the getdelim() function.
  378. #
  379. # Define PAGER_ENV to a SP separated VAR=VAL pairs to define
  380. # default environment variables to be passed when a pager is spawned, e.g.
  381. #
  382. # PAGER_ENV = LESS=FRX LV=-c
  383. #
  384. # to say "export LESS=FRX (and LV=-c) if the environment variable
  385. # LESS (and LV) is not set, respectively".
  386. GIT-VERSION-FILE: FORCE
  387. @$(SHELL_PATH) ./GIT-VERSION-GEN
  388. -include GIT-VERSION-FILE
  389. # CFLAGS and LDFLAGS are for the users to override from the command line.
  390. CFLAGS = -g -O2 -Wall
  391. DEVELOPER_CFLAGS = -Werror \
  392. -Wdeclaration-after-statement \
  393. -Wno-format-zero-length \
  394. -Wold-style-definition \
  395. -Woverflow \
  396. -Wpointer-arith \
  397. -Wstrict-prototypes \
  398. -Wunused \
  399. -Wvla
  400. LDFLAGS =
  401. ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
  402. ALL_LDFLAGS = $(LDFLAGS)
  403. STRIP ?= strip
  404. # Create as necessary, replace existing, make ranlib unneeded.
  405. ARFLAGS = rcs
  406. # Among the variables below, these:
  407. # gitexecdir
  408. # template_dir
  409. # sysconfdir
  410. # can be specified as a relative path some/where/else;
  411. # this is interpreted as relative to $(prefix) and "git" at
  412. # runtime figures out where they are based on the path to the executable.
  413. # Additionally, the following will be treated as relative by "git" if they
  414. # begin with "$(prefix)/":
  415. # mandir
  416. # infodir
  417. # htmldir
  418. # This can help installing the suite in a relocatable way.
  419. prefix = $(HOME)
  420. bindir_relative = bin
  421. bindir = $(prefix)/$(bindir_relative)
  422. mandir = $(prefix)/share/man
  423. infodir = $(prefix)/share/info
  424. gitexecdir = libexec/git-core
  425. mergetoolsdir = $(gitexecdir)/mergetools
  426. sharedir = $(prefix)/share
  427. gitwebdir = $(sharedir)/gitweb
  428. localedir = $(sharedir)/locale
  429. template_dir = share/git-core/templates
  430. htmldir = $(prefix)/share/doc/git-doc
  431. ETC_GITCONFIG = $(sysconfdir)/gitconfig
  432. ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
  433. lib = lib
  434. # DESTDIR =
  435. pathsep = :
  436. mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
  437. infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
  438. htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
  439. export prefix bindir sharedir sysconfdir gitwebdir localedir
  440. CC = cc
  441. AR = ar
  442. RM = rm -f
  443. DIFF = diff
  444. TAR = tar
  445. FIND = find
  446. INSTALL = install
  447. TCL_PATH = tclsh
  448. TCLTK_PATH = wish
  449. XGETTEXT = xgettext
  450. MSGFMT = msgfmt
  451. CURL_CONFIG = curl-config
  452. PTHREAD_LIBS = -lpthread
  453. PTHREAD_CFLAGS =
  454. GCOV = gcov
  455. SPATCH = spatch
  456. export TCL_PATH TCLTK_PATH
  457. SPARSE_FLAGS =
  458. ### --- END CONFIGURATION SECTION ---
  459. # Those must not be GNU-specific; they are shared with perl/ which may
  460. # be built by a different compiler. (Note that this is an artifact now
  461. # but it still might be nice to keep that distinction.)
  462. BASIC_CFLAGS = -I.
  463. BASIC_LDFLAGS =
  464. # Guard against environment variables
  465. BUILTIN_OBJS =
  466. BUILT_INS =
  467. COMPAT_CFLAGS =
  468. COMPAT_OBJS =
  469. XDIFF_OBJS =
  470. VCSSVN_OBJS =
  471. GENERATED_H =
  472. EXTRA_CPPFLAGS =
  473. LIB_OBJS =
  474. PROGRAM_OBJS =
  475. PROGRAMS =
  476. SCRIPT_PERL =
  477. SCRIPT_PYTHON =
  478. SCRIPT_SH =
  479. SCRIPT_LIB =
  480. TEST_PROGRAMS_NEED_X =
  481. # Having this variable in your environment would break pipelines because
  482. # you cause "cd" to echo its destination to stdout. It can also take
  483. # scripts to unexpected places. If you like CDPATH, define it for your
  484. # interactive shell sessions without exporting it.
  485. unexport CDPATH
  486. SCRIPT_SH += git-bisect.sh
  487. SCRIPT_SH += git-difftool--helper.sh
  488. SCRIPT_SH += git-filter-branch.sh
  489. SCRIPT_SH += git-merge-octopus.sh
  490. SCRIPT_SH += git-merge-one-file.sh
  491. SCRIPT_SH += git-merge-resolve.sh
  492. SCRIPT_SH += git-mergetool.sh
  493. SCRIPT_SH += git-quiltimport.sh
  494. SCRIPT_SH += git-rebase.sh
  495. SCRIPT_SH += git-remote-testgit.sh
  496. SCRIPT_SH += git-request-pull.sh
  497. SCRIPT_SH += git-stash.sh
  498. SCRIPT_SH += git-submodule.sh
  499. SCRIPT_SH += git-web--browse.sh
  500. SCRIPT_LIB += git-mergetool--lib
  501. SCRIPT_LIB += git-parse-remote
  502. SCRIPT_LIB += git-rebase--am
  503. SCRIPT_LIB += git-rebase--interactive
  504. SCRIPT_LIB += git-rebase--merge
  505. SCRIPT_LIB += git-sh-setup
  506. SCRIPT_LIB += git-sh-i18n
  507. SCRIPT_PERL += git-add--interactive.perl
  508. SCRIPT_PERL += git-difftool.perl
  509. SCRIPT_PERL += git-archimport.perl
  510. SCRIPT_PERL += git-cvsexportcommit.perl
  511. SCRIPT_PERL += git-cvsimport.perl
  512. SCRIPT_PERL += git-cvsserver.perl
  513. SCRIPT_PERL += git-relink.perl
  514. SCRIPT_PERL += git-send-email.perl
  515. SCRIPT_PERL += git-svn.perl
  516. SCRIPT_PYTHON += git-p4.py
  517. NO_INSTALL += git-remote-testgit
  518. # Generated files for scripts
  519. SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
  520. SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
  521. SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
  522. SCRIPT_SH_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_SH_GEN))
  523. SCRIPT_PERL_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PERL_GEN))
  524. SCRIPT_PYTHON_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PYTHON_GEN))
  525. # Individual rules to allow e.g.
  526. # "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
  527. # from subdirectories like contrib/*/
  528. .PHONY: build-perl-script build-sh-script build-python-script
  529. build-perl-script: $(SCRIPT_PERL_GEN)
  530. build-sh-script: $(SCRIPT_SH_GEN)
  531. build-python-script: $(SCRIPT_PYTHON_GEN)
  532. .PHONY: install-perl-script install-sh-script install-python-script
  533. install-sh-script: $(SCRIPT_SH_INS)
  534. $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  535. install-perl-script: $(SCRIPT_PERL_INS)
  536. $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  537. install-python-script: $(SCRIPT_PYTHON_INS)
  538. $(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  539. .PHONY: clean-perl-script clean-sh-script clean-python-script
  540. clean-sh-script:
  541. $(RM) $(SCRIPT_SH_GEN)
  542. clean-perl-script:
  543. $(RM) $(SCRIPT_PERL_GEN)
  544. clean-python-script:
  545. $(RM) $(SCRIPT_PYTHON_GEN)
  546. SCRIPTS = $(SCRIPT_SH_INS) \
  547. $(SCRIPT_PERL_INS) \
  548. $(SCRIPT_PYTHON_INS) \
  549. git-instaweb
  550. ETAGS_TARGET = TAGS
  551. # Empty...
  552. EXTRA_PROGRAMS =
  553. # ... and all the rest that could be moved out of bindir to gitexecdir
  554. PROGRAMS += $(EXTRA_PROGRAMS)
  555. PROGRAM_OBJS += credential-store.o
  556. PROGRAM_OBJS += daemon.o
  557. PROGRAM_OBJS += fast-import.o
  558. PROGRAM_OBJS += http-backend.o
  559. PROGRAM_OBJS += imap-send.o
  560. PROGRAM_OBJS += sh-i18n--envsubst.o
  561. PROGRAM_OBJS += shell.o
  562. PROGRAM_OBJS += show-index.o
  563. PROGRAM_OBJS += upload-pack.o
  564. PROGRAM_OBJS += remote-testsvn.o
  565. # Binary suffix, set to .exe for Windows builds
  566. X =
  567. PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
  568. TEST_PROGRAMS_NEED_X += test-chmtime
  569. TEST_PROGRAMS_NEED_X += test-ctype
  570. TEST_PROGRAMS_NEED_X += test-config
  571. TEST_PROGRAMS_NEED_X += test-date
  572. TEST_PROGRAMS_NEED_X += test-delta
  573. TEST_PROGRAMS_NEED_X += test-dump-cache-tree
  574. TEST_PROGRAMS_NEED_X += test-dump-split-index
  575. TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
  576. TEST_PROGRAMS_NEED_X += test-fake-ssh
  577. TEST_PROGRAMS_NEED_X += test-genrandom
  578. TEST_PROGRAMS_NEED_X += test-hashmap
  579. TEST_PROGRAMS_NEED_X += test-index-version
  580. TEST_PROGRAMS_NEED_X += test-line-buffer
  581. TEST_PROGRAMS_NEED_X += test-match-trees
  582. TEST_PROGRAMS_NEED_X += test-mergesort
  583. TEST_PROGRAMS_NEED_X += test-mktemp
  584. TEST_PROGRAMS_NEED_X += test-parse-options
  585. TEST_PROGRAMS_NEED_X += test-path-utils
  586. TEST_PROGRAMS_NEED_X += test-prio-queue
  587. TEST_PROGRAMS_NEED_X += test-read-cache
  588. TEST_PROGRAMS_NEED_X += test-regex
  589. TEST_PROGRAMS_NEED_X += test-revision-walking
  590. TEST_PROGRAMS_NEED_X += test-run-command
  591. TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
  592. TEST_PROGRAMS_NEED_X += test-sha1
  593. TEST_PROGRAMS_NEED_X += test-sha1-array
  594. TEST_PROGRAMS_NEED_X += test-sigchain
  595. TEST_PROGRAMS_NEED_X += test-string-list
  596. TEST_PROGRAMS_NEED_X += test-submodule-config
  597. TEST_PROGRAMS_NEED_X += test-subprocess
  598. TEST_PROGRAMS_NEED_X += test-svn-fe
  599. TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
  600. TEST_PROGRAMS_NEED_X += test-wildmatch
  601. TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
  602. # List built-in command $C whose implementation cmd_$C() is not in
  603. # builtin/$C.o but is linked in as part of some other command.
  604. BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
  605. BUILT_INS += git-cherry$X
  606. BUILT_INS += git-cherry-pick$X
  607. BUILT_INS += git-format-patch$X
  608. BUILT_INS += git-fsck-objects$X
  609. BUILT_INS += git-init$X
  610. BUILT_INS += git-merge-subtree$X
  611. BUILT_INS += git-show$X
  612. BUILT_INS += git-stage$X
  613. BUILT_INS += git-status$X
  614. BUILT_INS += git-whatchanged$X
  615. # what 'all' will build and 'install' will install in gitexecdir,
  616. # excluding programs for built-in commands
  617. ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
  618. # what 'all' will build but not install in gitexecdir
  619. OTHER_PROGRAMS = git$X
  620. # what test wrappers are needed and 'install' will install, in bindir
  621. BINDIR_PROGRAMS_NEED_X += git
  622. BINDIR_PROGRAMS_NEED_X += git-upload-pack
  623. BINDIR_PROGRAMS_NEED_X += git-receive-pack
  624. BINDIR_PROGRAMS_NEED_X += git-upload-archive
  625. BINDIR_PROGRAMS_NEED_X += git-shell
  626. BINDIR_PROGRAMS_NO_X += git-cvsserver
  627. # Set paths to tools early so that they can be used for version tests.
  628. ifndef SHELL_PATH
  629. SHELL_PATH = /bin/sh
  630. endif
  631. ifndef PERL_PATH
  632. PERL_PATH = /usr/bin/perl
  633. endif
  634. ifndef PYTHON_PATH
  635. PYTHON_PATH = /usr/bin/python
  636. endif
  637. export PERL_PATH
  638. export PYTHON_PATH
  639. LIB_FILE = libgit.a
  640. XDIFF_LIB = xdiff/lib.a
  641. VCSSVN_LIB = vcs-svn/lib.a
  642. GENERATED_H += common-cmds.h
  643. LIB_H = $(shell $(FIND) . \
  644. -name .git -prune -o \
  645. -name t -prune -o \
  646. -name Documentation -prune -o \
  647. -name '*.h' -print)
  648. LIB_OBJS += abspath.o
  649. LIB_OBJS += advice.o
  650. LIB_OBJS += alias.o
  651. LIB_OBJS += alloc.o
  652. LIB_OBJS += apply.o
  653. LIB_OBJS += archive.o
  654. LIB_OBJS += archive-tar.o
  655. LIB_OBJS += archive-zip.o
  656. LIB_OBJS += argv-array.o
  657. LIB_OBJS += attr.o
  658. LIB_OBJS += base85.o
  659. LIB_OBJS += bisect.o
  660. LIB_OBJS += blob.o
  661. LIB_OBJS += branch.o
  662. LIB_OBJS += bulk-checkin.o
  663. LIB_OBJS += bundle.o
  664. LIB_OBJS += cache-tree.o
  665. LIB_OBJS += color.o
  666. LIB_OBJS += column.o
  667. LIB_OBJS += combine-diff.o
  668. LIB_OBJS += commit.o
  669. LIB_OBJS += compat/obstack.o
  670. LIB_OBJS += compat/terminal.o
  671. LIB_OBJS += config.o
  672. LIB_OBJS += connect.o
  673. LIB_OBJS += connected.o
  674. LIB_OBJS += convert.o
  675. LIB_OBJS += copy.o
  676. LIB_OBJS += credential.o
  677. LIB_OBJS += csum-file.o
  678. LIB_OBJS += ctype.o
  679. LIB_OBJS += date.o
  680. LIB_OBJS += decorate.o
  681. LIB_OBJS += diffcore-break.o
  682. LIB_OBJS += diffcore-delta.o
  683. LIB_OBJS += diffcore-order.o
  684. LIB_OBJS += diffcore-pickaxe.o
  685. LIB_OBJS += diffcore-rename.o
  686. LIB_OBJS += diff-delta.o
  687. LIB_OBJS += diff-lib.o
  688. LIB_OBJS += diff-no-index.o
  689. LIB_OBJS += diff.o
  690. LIB_OBJS += dir.o
  691. LIB_OBJS += dir-iterator.o
  692. LIB_OBJS += editor.o
  693. LIB_OBJS += entry.o
  694. LIB_OBJS += environment.o
  695. LIB_OBJS += ewah/bitmap.o
  696. LIB_OBJS += ewah/ewah_bitmap.o
  697. LIB_OBJS += ewah/ewah_io.o
  698. LIB_OBJS += ewah/ewah_rlw.o
  699. LIB_OBJS += exec_cmd.o
  700. LIB_OBJS += fetch-pack.o
  701. LIB_OBJS += fsck.o
  702. LIB_OBJS += gettext.o
  703. LIB_OBJS += gpg-interface.o
  704. LIB_OBJS += graph.o
  705. LIB_OBJS += grep.o
  706. LIB_OBJS += hashmap.o
  707. LIB_OBJS += help.o
  708. LIB_OBJS += hex.o
  709. LIB_OBJS += ident.o
  710. LIB_OBJS += kwset.o
  711. LIB_OBJS += levenshtein.o
  712. LIB_OBJS += line-log.o
  713. LIB_OBJS += line-range.o
  714. LIB_OBJS += list-objects.o
  715. LIB_OBJS += ll-merge.o
  716. LIB_OBJS += lockfile.o
  717. LIB_OBJS += log-tree.o
  718. LIB_OBJS += mailinfo.o
  719. LIB_OBJS += mailmap.o
  720. LIB_OBJS += match-trees.o
  721. LIB_OBJS += merge.o
  722. LIB_OBJS += merge-blobs.o
  723. LIB_OBJS += merge-recursive.o
  724. LIB_OBJS += mergesort.o
  725. LIB_OBJS += mru.o
  726. LIB_OBJS += name-hash.o
  727. LIB_OBJS += notes.o
  728. LIB_OBJS += notes-cache.o
  729. LIB_OBJS += notes-merge.o
  730. LIB_OBJS += notes-utils.o
  731. LIB_OBJS += object.o
  732. LIB_OBJS += pack-bitmap.o
  733. LIB_OBJS += pack-bitmap-write.o
  734. LIB_OBJS += pack-check.o
  735. LIB_OBJS += pack-objects.o
  736. LIB_OBJS += pack-revindex.o
  737. LIB_OBJS += pack-write.o
  738. LIB_OBJS += pager.o
  739. LIB_OBJS += parse-options.o
  740. LIB_OBJS += parse-options-cb.o
  741. LIB_OBJS += patch-delta.o
  742. LIB_OBJS += patch-ids.o
  743. LIB_OBJS += path.o
  744. LIB_OBJS += pathspec.o
  745. LIB_OBJS += pkt-line.o
  746. LIB_OBJS += preload-index.o
  747. LIB_OBJS += pretty.o
  748. LIB_OBJS += prio-queue.o
  749. LIB_OBJS += progress.o
  750. LIB_OBJS += prompt.o
  751. LIB_OBJS += quote.o
  752. LIB_OBJS += reachable.o
  753. LIB_OBJS += read-cache.o
  754. LIB_OBJS += reflog-walk.o
  755. LIB_OBJS += refs.o
  756. LIB_OBJS += refs/files-backend.o
  757. LIB_OBJS += refs/iterator.o
  758. LIB_OBJS += ref-filter.o
  759. LIB_OBJS += remote.o
  760. LIB_OBJS += replace_object.o
  761. LIB_OBJS += rerere.o
  762. LIB_OBJS += resolve-undo.o
  763. LIB_OBJS += revision.o
  764. LIB_OBJS += run-command.o
  765. LIB_OBJS += send-pack.o
  766. LIB_OBJS += sequencer.o
  767. LIB_OBJS += server-info.o
  768. LIB_OBJS += setup.o
  769. LIB_OBJS += sha1-array.o
  770. LIB_OBJS += sha1-lookup.o
  771. LIB_OBJS += sha1_file.o
  772. LIB_OBJS += sha1_name.o
  773. LIB_OBJS += shallow.o
  774. LIB_OBJS += sideband.o
  775. LIB_OBJS += sigchain.o
  776. LIB_OBJS += split-index.o
  777. LIB_OBJS += strbuf.o
  778. LIB_OBJS += streaming.o
  779. LIB_OBJS += string-list.o
  780. LIB_OBJS += submodule.o
  781. LIB_OBJS += submodule-config.o
  782. LIB_OBJS += symlinks.o
  783. LIB_OBJS += tag.o
  784. LIB_OBJS += tempfile.o
  785. LIB_OBJS += tmp-objdir.o
  786. LIB_OBJS += trace.o
  787. LIB_OBJS += trailer.o
  788. LIB_OBJS += transport.o
  789. LIB_OBJS += transport-helper.o
  790. LIB_OBJS += tree-diff.o
  791. LIB_OBJS += tree.o
  792. LIB_OBJS += tree-walk.o
  793. LIB_OBJS += unpack-trees.o
  794. LIB_OBJS += url.o
  795. LIB_OBJS += urlmatch.o
  796. LIB_OBJS += usage.o
  797. LIB_OBJS += userdiff.o
  798. LIB_OBJS += utf8.o
  799. LIB_OBJS += varint.o
  800. LIB_OBJS += version.o
  801. LIB_OBJS += versioncmp.o
  802. LIB_OBJS += walker.o
  803. LIB_OBJS += wildmatch.o
  804. LIB_OBJS += worktree.o
  805. LIB_OBJS += wrapper.o
  806. LIB_OBJS += write_or_die.o
  807. LIB_OBJS += ws.o
  808. LIB_OBJS += wt-status.o
  809. LIB_OBJS += xdiff-interface.o
  810. LIB_OBJS += zlib.o
  811. BUILTIN_OBJS += builtin/add.o
  812. BUILTIN_OBJS += builtin/am.o
  813. BUILTIN_OBJS += builtin/annotate.o
  814. BUILTIN_OBJS += builtin/apply.o
  815. BUILTIN_OBJS += builtin/archive.o
  816. BUILTIN_OBJS += builtin/bisect--helper.o
  817. BUILTIN_OBJS += builtin/blame.o
  818. BUILTIN_OBJS += builtin/branch.o
  819. BUILTIN_OBJS += builtin/bundle.o
  820. BUILTIN_OBJS += builtin/cat-file.o
  821. BUILTIN_OBJS += builtin/check-attr.o
  822. BUILTIN_OBJS += builtin/check-ignore.o
  823. BUILTIN_OBJS += builtin/check-mailmap.o
  824. BUILTIN_OBJS += builtin/check-ref-format.o
  825. BUILTIN_OBJS += builtin/checkout-index.o
  826. BUILTIN_OBJS += builtin/checkout.o
  827. BUILTIN_OBJS += builtin/clean.o
  828. BUILTIN_OBJS += builtin/clone.o
  829. BUILTIN_OBJS += builtin/column.o
  830. BUILTIN_OBJS += builtin/commit-tree.o
  831. BUILTIN_OBJS += builtin/commit.o
  832. BUILTIN_OBJS += builtin/config.o
  833. BUILTIN_OBJS += builtin/count-objects.o
  834. BUILTIN_OBJS += builtin/credential.o
  835. BUILTIN_OBJS += builtin/describe.o
  836. BUILTIN_OBJS += builtin/diff-files.o
  837. BUILTIN_OBJS += builtin/diff-index.o
  838. BUILTIN_OBJS += builtin/diff-tree.o
  839. BUILTIN_OBJS += builtin/diff.o
  840. BUILTIN_OBJS += builtin/fast-export.o
  841. BUILTIN_OBJS += builtin/fetch-pack.o
  842. BUILTIN_OBJS += builtin/fetch.o
  843. BUILTIN_OBJS += builtin/fmt-merge-msg.o
  844. BUILTIN_OBJS += builtin/for-each-ref.o
  845. BUILTIN_OBJS += builtin/fsck.o
  846. BUILTIN_OBJS += builtin/gc.o
  847. BUILTIN_OBJS += builtin/get-tar-commit-id.o
  848. BUILTIN_OBJS += builtin/grep.o
  849. BUILTIN_OBJS += builtin/hash-object.o
  850. BUILTIN_OBJS += builtin/help.o
  851. BUILTIN_OBJS += builtin/index-pack.o
  852. BUILTIN_OBJS += builtin/init-db.o
  853. BUILTIN_OBJS += builtin/interpret-trailers.o
  854. BUILTIN_OBJS += builtin/log.o
  855. BUILTIN_OBJS += builtin/ls-files.o
  856. BUILTIN_OBJS += builtin/ls-remote.o
  857. BUILTIN_OBJS += builtin/ls-tree.o
  858. BUILTIN_OBJS += builtin/mailinfo.o
  859. BUILTIN_OBJS += builtin/mailsplit.o
  860. BUILTIN_OBJS += builtin/merge.o
  861. BUILTIN_OBJS += builtin/merge-base.o
  862. BUILTIN_OBJS += builtin/merge-file.o
  863. BUILTIN_OBJS += builtin/merge-index.o
  864. BUILTIN_OBJS += builtin/merge-ours.o
  865. BUILTIN_OBJS += builtin/merge-recursive.o
  866. BUILTIN_OBJS += builtin/merge-tree.o
  867. BUILTIN_OBJS += builtin/mktag.o
  868. BUILTIN_OBJS += builtin/mktree.o
  869. BUILTIN_OBJS += builtin/mv.o
  870. BUILTIN_OBJS += builtin/name-rev.o
  871. BUILTIN_OBJS += builtin/notes.o
  872. BUILTIN_OBJS += builtin/pack-objects.o
  873. BUILTIN_OBJS += builtin/pack-redundant.o
  874. BUILTIN_OBJS += builtin/pack-refs.o
  875. BUILTIN_OBJS += builtin/patch-id.o
  876. BUILTIN_OBJS += builtin/prune-packed.o
  877. BUILTIN_OBJS += builtin/prune.o
  878. BUILTIN_OBJS += builtin/pull.o
  879. BUILTIN_OBJS += builtin/push.o
  880. BUILTIN_OBJS += builtin/read-tree.o
  881. BUILTIN_OBJS += builtin/receive-pack.o
  882. BUILTIN_OBJS += builtin/reflog.o
  883. BUILTIN_OBJS += builtin/remote.o
  884. BUILTIN_OBJS += builtin/remote-ext.o
  885. BUILTIN_OBJS += builtin/remote-fd.o
  886. BUILTIN_OBJS += builtin/repack.o
  887. BUILTIN_OBJS += builtin/replace.o
  888. BUILTIN_OBJS += builtin/rerere.o
  889. BUILTIN_OBJS += builtin/reset.o
  890. BUILTIN_OBJS += builtin/rev-list.o
  891. BUILTIN_OBJS += builtin/rev-parse.o
  892. BUILTIN_OBJS += builtin/revert.o
  893. BUILTIN_OBJS += builtin/rm.o
  894. BUILTIN_OBJS += builtin/send-pack.o
  895. BUILTIN_OBJS += builtin/shortlog.o
  896. BUILTIN_OBJS += builtin/show-branch.o
  897. BUILTIN_OBJS += builtin/show-ref.o
  898. BUILTIN_OBJS += builtin/stripspace.o
  899. BUILTIN_OBJS += builtin/submodule--helper.o
  900. BUILTIN_OBJS += builtin/symbolic-ref.o
  901. BUILTIN_OBJS += builtin/tag.o
  902. BUILTIN_OBJS += builtin/unpack-file.o
  903. BUILTIN_OBJS += builtin/unpack-objects.o
  904. BUILTIN_OBJS += builtin/update-index.o
  905. BUILTIN_OBJS += builtin/update-ref.o
  906. BUILTIN_OBJS += builtin/update-server-info.o
  907. BUILTIN_OBJS += builtin/upload-archive.o
  908. BUILTIN_OBJS += builtin/var.o
  909. BUILTIN_OBJS += builtin/verify-commit.o
  910. BUILTIN_OBJS += builtin/verify-pack.o
  911. BUILTIN_OBJS += builtin/verify-tag.o
  912. BUILTIN_OBJS += builtin/worktree.o
  913. BUILTIN_OBJS += builtin/write-tree.o
  914. GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
  915. EXTLIBS =
  916. GIT_USER_AGENT = git/$(GIT_VERSION)
  917. include config.mak.uname
  918. -include config.mak.autogen
  919. -include config.mak
  920. ifdef DEVELOPER
  921. CFLAGS += $(DEVELOPER_CFLAGS)
  922. endif
  923. ifndef sysconfdir
  924. ifeq ($(prefix),/usr)
  925. sysconfdir = /etc
  926. else
  927. sysconfdir = etc
  928. endif
  929. endif
  930. ifndef COMPUTE_HEADER_DEPENDENCIES
  931. COMPUTE_HEADER_DEPENDENCIES = auto
  932. endif
  933. ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
  934. dep_check = $(shell $(CC) $(ALL_CFLAGS) \
  935. -c -MF /dev/null -MQ /dev/null -MMD -MP \
  936. -x c /dev/null -o /dev/null 2>&1; \
  937. echo $$?)
  938. ifeq ($(dep_check),0)
  939. override COMPUTE_HEADER_DEPENDENCIES = yes
  940. else
  941. override COMPUTE_HEADER_DEPENDENCIES = no
  942. endif
  943. endif
  944. ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
  945. USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
  946. else
  947. ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
  948. $(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
  949. (not "$(COMPUTE_HEADER_DEPENDENCIES)"))
  950. endif
  951. endif
  952. ifdef SANE_TOOL_PATH
  953. SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
  954. BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
  955. PATH := $(SANE_TOOL_PATH):${PATH}
  956. else
  957. BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
  958. endif
  959. ifneq (,$(INLINE))
  960. BASIC_CFLAGS += -Dinline=$(INLINE)
  961. endif
  962. ifneq (,$(SOCKLEN_T))
  963. BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
  964. endif
  965. ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
  966. BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
  967. else
  968. ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
  969. BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
  970. endif
  971. endif
  972. ifeq ($(uname_S),Darwin)
  973. ifndef NO_FINK
  974. ifeq ($(shell test -d /sw/lib && echo y),y)
  975. BASIC_CFLAGS += -I/sw/include
  976. BASIC_LDFLAGS += -L/sw/lib
  977. endif
  978. endif
  979. ifndef NO_DARWIN_PORTS
  980. ifeq ($(shell test -d /opt/local/lib && echo y),y)
  981. BASIC_CFLAGS += -I/opt/local/include
  982. BASIC_LDFLAGS += -L/opt/local/lib
  983. endif
  984. endif
  985. ifndef NO_APPLE_COMMON_CRYPTO
  986. APPLE_COMMON_CRYPTO = YesPlease
  987. COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
  988. endif
  989. NO_REGEX = YesPlease
  990. PTHREAD_LIBS =
  991. endif
  992. ifndef CC_LD_DYNPATH
  993. ifdef NO_R_TO_GCC_LINKER
  994. # Some gcc does not accept and pass -R to the linker to specify
  995. # the runtime dynamic library path.
  996. CC_LD_DYNPATH = -Wl,-rpath,
  997. else
  998. CC_LD_DYNPATH = -R
  999. endif
  1000. endif
  1001. ifdef NO_LIBGEN_H
  1002. COMPAT_CFLAGS += -DNO_LIBGEN_H
  1003. COMPAT_OBJS += compat/basename.o
  1004. endif
  1005. ifdef USE_LIBPCRE
  1006. BASIC_CFLAGS += -DUSE_LIBPCRE
  1007. ifdef LIBPCREDIR
  1008. BASIC_CFLAGS += -I$(LIBPCREDIR)/include
  1009. EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
  1010. endif
  1011. EXTLIBS += -lpcre
  1012. endif
  1013. ifdef HAVE_ALLOCA_H
  1014. BASIC_CFLAGS += -DHAVE_ALLOCA_H
  1015. endif
  1016. IMAP_SEND_BUILDDEPS =
  1017. IMAP_SEND_LDFLAGS =
  1018. ifdef NO_CURL
  1019. BASIC_CFLAGS += -DNO_CURL
  1020. REMOTE_CURL_PRIMARY =
  1021. REMOTE_CURL_ALIASES =
  1022. REMOTE_CURL_NAMES =
  1023. else
  1024. ifdef CURLDIR
  1025. # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
  1026. BASIC_CFLAGS += -I$(CURLDIR)/include
  1027. CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
  1028. else
  1029. CURL_LIBCURL = -lcurl
  1030. endif
  1031. ifdef NEEDS_SSL_WITH_CURL
  1032. CURL_LIBCURL += -lssl
  1033. ifdef NEEDS_CRYPTO_WITH_SSL
  1034. CURL_LIBCURL += -lcrypto
  1035. endif
  1036. endif
  1037. ifdef NEEDS_IDN_WITH_CURL
  1038. CURL_LIBCURL += -lidn
  1039. endif
  1040. REMOTE_CURL_PRIMARY = git-remote-http$X
  1041. REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
  1042. REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
  1043. PROGRAM_OBJS += http-fetch.o
  1044. PROGRAMS += $(REMOTE_CURL_NAMES)
  1045. curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
  1046. ifeq "$(curl_check)" "070908"
  1047. ifndef NO_EXPAT
  1048. PROGRAM_OBJS += http-push.o
  1049. endif
  1050. endif
  1051. curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
  1052. ifeq "$(curl_check)" "072200"
  1053. USE_CURL_FOR_IMAP_SEND = YesPlease
  1054. endif
  1055. ifdef USE_CURL_FOR_IMAP_SEND
  1056. BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
  1057. IMAP_SEND_BUILDDEPS = http.o
  1058. IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
  1059. endif
  1060. ifndef NO_EXPAT
  1061. ifdef EXPATDIR
  1062. BASIC_CFLAGS += -I$(EXPATDIR)/include
  1063. EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
  1064. else
  1065. EXPAT_LIBEXPAT = -lexpat
  1066. endif
  1067. ifdef EXPAT_NEEDS_XMLPARSE_H
  1068. BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
  1069. endif
  1070. endif
  1071. endif
  1072. IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
  1073. ifdef ZLIB_PATH
  1074. BASIC_CFLAGS += -I$(ZLIB_PATH)/include
  1075. EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
  1076. endif
  1077. EXTLIBS += -lz
  1078. ifndef NO_OPENSSL
  1079. OPENSSL_LIBSSL = -lssl
  1080. ifdef OPENSSLDIR
  1081. BASIC_CFLAGS += -I$(OPENSSLDIR)/include
  1082. OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
  1083. else
  1084. OPENSSL_LINK =
  1085. endif
  1086. ifdef NEEDS_CRYPTO_WITH_SSL
  1087. OPENSSL_LIBSSL += -lcrypto
  1088. endif
  1089. else
  1090. BASIC_CFLAGS += -DNO_OPENSSL
  1091. BLK_SHA1 = 1
  1092. OPENSSL_LIBSSL =
  1093. endif
  1094. ifdef NO_OPENSSL
  1095. LIB_4_CRYPTO =
  1096. else
  1097. ifdef NEEDS_SSL_WITH_CRYPTO
  1098. LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
  1099. else
  1100. LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
  1101. endif
  1102. ifdef APPLE_COMMON_CRYPTO
  1103. LIB_4_CRYPTO += -framework Security -framework CoreFoundation
  1104. endif
  1105. endif
  1106. ifdef NEEDS_LIBICONV
  1107. ifdef ICONVDIR
  1108. BASIC_CFLAGS += -I$(ICONVDIR)/include
  1109. ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
  1110. else
  1111. ICONV_LINK =
  1112. endif
  1113. ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
  1114. ICONV_LINK += -lintl
  1115. endif
  1116. EXTLIBS += $(ICONV_LINK) -liconv
  1117. endif
  1118. ifdef NEEDS_LIBGEN
  1119. EXTLIBS += -lgen
  1120. endif
  1121. ifndef NO_GETTEXT
  1122. ifndef LIBC_CONTAINS_LIBINTL
  1123. EXTLIBS += -lintl
  1124. endif
  1125. endif
  1126. ifdef NEEDS_SOCKET
  1127. EXTLIBS += -lsocket
  1128. endif
  1129. ifdef NEEDS_NSL
  1130. EXTLIBS += -lnsl
  1131. endif
  1132. ifdef NEEDS_RESOLV
  1133. EXTLIBS += -lresolv
  1134. endif
  1135. ifdef NO_D_TYPE_IN_DIRENT
  1136. BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
  1137. endif
  1138. ifdef NO_GECOS_IN_PWENT
  1139. BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
  1140. endif
  1141. ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
  1142. BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
  1143. endif
  1144. ifdef USE_NSEC
  1145. BASIC_CFLAGS += -DUSE_NSEC
  1146. endif
  1147. ifdef USE_ST_TIMESPEC
  1148. BASIC_CFLAGS += -DUSE_ST_TIMESPEC
  1149. endif
  1150. ifdef NO_NORETURN
  1151. BASIC_CFLAGS += -DNO_NORETURN
  1152. endif
  1153. ifdef NO_NSEC
  1154. BASIC_CFLAGS += -DNO_NSEC
  1155. endif
  1156. ifdef SNPRINTF_RETURNS_BOGUS
  1157. COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
  1158. COMPAT_OBJS += compat/snprintf.o
  1159. endif
  1160. ifdef FREAD_READS_DIRECTORIES
  1161. COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
  1162. COMPAT_OBJS += compat/fopen.o
  1163. endif
  1164. ifdef NO_SYMLINK_HEAD
  1165. BASIC_CFLAGS += -DNO_SYMLINK_HEAD
  1166. endif
  1167. ifdef GETTEXT_POISON
  1168. BASIC_CFLAGS += -DGETTEXT_POISON
  1169. endif
  1170. ifdef NO_GETTEXT
  1171. BASIC_CFLAGS += -DNO_GETTEXT
  1172. USE_GETTEXT_SCHEME ?= fallthrough
  1173. endif
  1174. ifdef NO_POLL
  1175. NO_SYS_POLL_H = YesPlease
  1176. COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
  1177. COMPAT_OBJS += compat/poll/poll.o
  1178. endif
  1179. ifdef NO_STRCASESTR
  1180. COMPAT_CFLAGS += -DNO_STRCASESTR
  1181. COMPAT_OBJS += compat/strcasestr.o
  1182. endif
  1183. ifdef NO_STRLCPY
  1184. COMPAT_CFLAGS += -DNO_STRLCPY
  1185. COMPAT_OBJS += compat/strlcpy.o
  1186. endif
  1187. ifdef NO_STRTOUMAX
  1188. COMPAT_CFLAGS += -DNO_STRTOUMAX
  1189. COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
  1190. endif
  1191. ifdef NO_STRTOULL
  1192. COMPAT_CFLAGS += -DNO_STRTOULL
  1193. endif
  1194. ifdef NO_SETENV
  1195. COMPAT_CFLAGS += -DNO_SETENV
  1196. COMPAT_OBJS += compat/setenv.o
  1197. endif
  1198. ifdef NO_MKDTEMP
  1199. COMPAT_CFLAGS += -DNO_MKDTEMP
  1200. COMPAT_OBJS += compat/mkdtemp.o
  1201. endif
  1202. ifdef MKDIR_WO_TRAILING_SLASH
  1203. COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
  1204. COMPAT_OBJS += compat/mkdir.o
  1205. endif
  1206. ifdef NO_MKSTEMPS
  1207. COMPAT_CFLAGS += -DNO_MKSTEMPS
  1208. endif
  1209. ifdef NO_UNSETENV
  1210. COMPAT_CFLAGS += -DNO_UNSETENV
  1211. COMPAT_OBJS += compat/unsetenv.o
  1212. endif
  1213. ifdef NO_SYS_SELECT_H
  1214. BASIC_CFLAGS += -DNO_SYS_SELECT_H
  1215. endif
  1216. ifdef NO_SYS_POLL_H
  1217. BASIC_CFLAGS += -DNO_SYS_POLL_H
  1218. endif
  1219. ifdef NEEDS_SYS_PARAM_H
  1220. BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
  1221. endif
  1222. ifdef NO_INTTYPES_H
  1223. BASIC_CFLAGS += -DNO_INTTYPES_H
  1224. endif
  1225. ifdef NO_INITGROUPS
  1226. BASIC_CFLAGS += -DNO_INITGROUPS
  1227. endif
  1228. ifdef NO_MMAP
  1229. COMPAT_CFLAGS += -DNO_MMAP
  1230. COMPAT_OBJS += compat/mmap.o
  1231. else
  1232. ifdef USE_WIN32_MMAP
  1233. COMPAT_CFLAGS += -DUSE_WIN32_MMAP
  1234. COMPAT_OBJS += compat/win32mmap.o
  1235. endif
  1236. endif
  1237. ifdef OBJECT_CREATION_USES_RENAMES
  1238. COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
  1239. endif
  1240. ifdef NO_STRUCT_ITIMERVAL
  1241. COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
  1242. NO_SETITIMER = YesPlease
  1243. endif
  1244. ifdef NO_SETITIMER
  1245. COMPAT_CFLAGS += -DNO_SETITIMER
  1246. endif
  1247. ifdef NO_PREAD
  1248. COMPAT_CFLAGS += -DNO_PREAD
  1249. COMPAT_OBJS += compat/pread.o
  1250. endif
  1251. ifdef NO_FAST_WORKING_DIRECTORY
  1252. BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
  1253. endif
  1254. ifdef NO_TRUSTABLE_FILEMODE
  1255. BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
  1256. endif
  1257. ifdef NEEDS_MODE_TRANSLATION
  1258. COMPAT_CFLAGS += -DNEEDS_MODE_TRANSLATION
  1259. COMPAT_OBJS += compat/stat.o
  1260. endif
  1261. ifdef NO_IPV6
  1262. BASIC_CFLAGS += -DNO_IPV6
  1263. endif
  1264. ifdef NO_INTPTR_T
  1265. COMPAT_CFLAGS += -DNO_INTPTR_T
  1266. endif
  1267. ifdef NO_UINTMAX_T
  1268. BASIC_CFLAGS += -Duintmax_t=uint32_t
  1269. endif
  1270. ifdef NO_SOCKADDR_STORAGE
  1271. ifdef NO_IPV6
  1272. BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
  1273. else
  1274. BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
  1275. endif
  1276. endif
  1277. ifdef NO_INET_NTOP
  1278. LIB_OBJS += compat/inet_ntop.o
  1279. BASIC_CFLAGS += -DNO_INET_NTOP
  1280. endif
  1281. ifdef NO_INET_PTON
  1282. LIB_OBJS += compat/inet_pton.o
  1283. BASIC_CFLAGS += -DNO_INET_PTON
  1284. endif
  1285. ifndef NO_UNIX_SOCKETS
  1286. LIB_OBJS += unix-socket.o
  1287. PROGRAM_OBJS += credential-cache.o
  1288. PROGRAM_OBJS += credential-cache--daemon.o
  1289. endif
  1290. ifdef NO_ICONV
  1291. BASIC_CFLAGS += -DNO_ICONV
  1292. endif
  1293. ifdef OLD_ICONV
  1294. BASIC_CFLAGS += -DOLD_ICONV
  1295. endif
  1296. ifdef NO_DEFLATE_BOUND
  1297. BASIC_CFLAGS += -DNO_DEFLATE_BOUND
  1298. endif
  1299. ifdef NO_POSIX_GOODIES
  1300. BASIC_CFLAGS += -DNO_POSIX_GOODIES
  1301. endif
  1302. ifdef APPLE_COMMON_CRYPTO
  1303. # Apple CommonCrypto requires chunking
  1304. SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
  1305. endif
  1306. ifdef BLK_SHA1
  1307. SHA1_HEADER = "block-sha1/sha1.h"
  1308. LIB_OBJS += block-sha1/sha1.o
  1309. else
  1310. ifdef PPC_SHA1
  1311. SHA1_HEADER = "ppc/sha1.h"
  1312. LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
  1313. else
  1314. ifdef APPLE_COMMON_CRYPTO
  1315. COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
  1316. SHA1_HEADER = <CommonCrypto/CommonDigest.h>
  1317. else
  1318. SHA1_HEADER = <openssl/sha.h>
  1319. EXTLIBS += $(LIB_4_CRYPTO)
  1320. endif
  1321. endif
  1322. endif
  1323. ifdef SHA1_MAX_BLOCK_SIZE
  1324. LIB_OBJS += compat/sha1-chunked.o
  1325. BASIC_CFLAGS += -DSHA1_MAX_BLOCK_SIZE="$(SHA1_MAX_BLOCK_SIZE)"
  1326. endif
  1327. ifdef NO_PERL_MAKEMAKER
  1328. export NO_PERL_MAKEMAKER
  1329. endif
  1330. ifdef NO_HSTRERROR
  1331. COMPAT_CFLAGS += -DNO_HSTRERROR
  1332. COMPAT_OBJS += compat/hstrerror.o
  1333. endif
  1334. ifdef NO_MEMMEM
  1335. COMPAT_CFLAGS += -DNO_MEMMEM
  1336. COMPAT_OBJS += compat/memmem.o
  1337. endif
  1338. ifdef NO_GETPAGESIZE
  1339. COMPAT_CFLAGS += -DNO_GETPAGESIZE
  1340. endif
  1341. ifdef INTERNAL_QSORT
  1342. COMPAT_CFLAGS += -DINTERNAL_QSORT
  1343. COMPAT_OBJS += compat/qsort.o
  1344. endif
  1345. ifdef RUNTIME_PREFIX
  1346. COMPAT_CFLAGS += -DRUNTIME_PREFIX
  1347. endif
  1348. ifdef NO_PTHREADS
  1349. BASIC_CFLAGS += -DNO_PTHREADS
  1350. else
  1351. BASIC_CFLAGS += $(PTHREAD_CFLAGS)
  1352. EXTLIBS += $(PTHREAD_LIBS)
  1353. LIB_OBJS += thread-utils.o
  1354. endif
  1355. ifdef HAVE_PATHS_H
  1356. BASIC_CFLAGS += -DHAVE_PATHS_H
  1357. endif
  1358. ifdef HAVE_LIBCHARSET_H
  1359. BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
  1360. EXTLIBS += $(CHARSET_LIB)
  1361. endif
  1362. ifdef HAVE_STRINGS_H
  1363. BASIC_CFLAGS += -DHAVE_STRINGS_H
  1364. endif
  1365. ifdef HAVE_DEV_TTY
  1366. BASIC_CFLAGS += -DHAVE_DEV_TTY
  1367. endif
  1368. ifdef DIR_HAS_BSD_GROUP_SEMANTICS
  1369. COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
  1370. endif
  1371. ifdef UNRELIABLE_FSTAT
  1372. BASIC_CFLAGS += -DUNRELIABLE_FSTAT
  1373. endif
  1374. ifdef NO_REGEX
  1375. COMPAT_CFLAGS += -Icompat/regex
  1376. COMPAT_OBJS += compat/regex/regex.o
  1377. endif
  1378. ifdef NATIVE_CRLF
  1379. BASIC_CFLAGS += -DNATIVE_CRLF
  1380. endif
  1381. ifdef USE_NED_ALLOCATOR
  1382. COMPAT_CFLAGS += -Icompat/nedmalloc
  1383. COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
  1384. OVERRIDE_STRDUP = YesPlease
  1385. endif
  1386. ifdef OVERRIDE_STRDUP
  1387. COMPAT_CFLAGS += -DOVERRIDE_STRDUP
  1388. COMPAT_OBJS += compat/strdup.o
  1389. endif
  1390. ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
  1391. export GIT_TEST_CMP_USE_COPIED_CONTEXT
  1392. endif
  1393. ifndef NO_MSGFMT_EXTENDED_OPTIONS
  1394. MSGFMT += --check --statistics
  1395. endif
  1396. ifneq (,$(XDL_FAST_HASH))
  1397. BASIC_CFLAGS += -DXDL_FAST_HASH
  1398. endif
  1399. ifdef GMTIME_UNRELIABLE_ERRORS
  1400. COMPAT_OBJS += compat/gmtime.o
  1401. BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
  1402. endif
  1403. ifdef HAVE_CLOCK_GETTIME
  1404. BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
  1405. endif
  1406. ifdef HAVE_CLOCK_MONOTONIC
  1407. BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
  1408. endif
  1409. ifdef NEEDS_LIBRT
  1410. EXTLIBS += -lrt
  1411. endif
  1412. ifdef HAVE_BSD_SYSCTL
  1413. BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
  1414. endif
  1415. ifdef HAVE_GETDELIM
  1416. BASIC_CFLAGS += -DHAVE_GETDELIM
  1417. endif
  1418. ifeq ($(TCLTK_PATH),)
  1419. NO_TCLTK = NoThanks
  1420. endif
  1421. ifeq ($(PERL_PATH),)
  1422. NO_PERL = NoThanks
  1423. endif
  1424. ifeq ($(PYTHON_PATH),)
  1425. NO_PYTHON = NoThanks
  1426. endif
  1427. ifndef PAGER_ENV
  1428. PAGER_ENV = LESS=FRX LV=-c
  1429. endif
  1430. QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
  1431. QUIET_SUBDIR1 =
  1432. ifneq ($(findstring w,$(MAKEFLAGS)),w)
  1433. PRINT_DIR = --no-print-directory
  1434. else # "make -w"
  1435. NO_SUBDIR = :
  1436. endif
  1437. ifneq ($(findstring s,$(MAKEFLAGS)),s)
  1438. ifndef V
  1439. QUIET_CC = @echo ' ' CC $@;
  1440. QUIET_AR = @echo ' ' AR $@;
  1441. QUIET_LINK = @echo ' ' LINK $@;
  1442. QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
  1443. QUIET_GEN = @echo ' ' GEN $@;
  1444. QUIET_LNCP = @echo ' ' LN/CP $@;
  1445. QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
  1446. QUIET_MSGFMT = @echo ' ' MSGFMT $@;
  1447. QUIET_GCOV = @echo ' ' GCOV $@;
  1448. QUIET_SP = @echo ' ' SP $<;
  1449. QUIET_RC = @echo ' ' RC $@;
  1450. QUIET_SUBDIR0 = +@subdir=
  1451. QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
  1452. $(MAKE) $(PRINT_DIR) -C $$subdir
  1453. export V
  1454. export QUIET_GEN
  1455. export QUIET_BUILT_IN
  1456. endif
  1457. endif
  1458. ifdef NO_INSTALL_HARDLINKS
  1459. export NO_INSTALL_HARDLINKS
  1460. endif
  1461. ### profile feedback build
  1462. #
  1463. # Can adjust this to be a global directory if you want to do extended
  1464. # data gathering
  1465. PROFILE_DIR := $(CURDIR)
  1466. ifeq ("$(PROFILE)","GEN")
  1467. BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
  1468. EXTLIBS += -lgcov
  1469. export CCACHE_DISABLE = t
  1470. V = 1
  1471. else
  1472. ifneq ("$(PROFILE)","")
  1473. BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
  1474. export CCACHE_DISABLE = t
  1475. V = 1
  1476. endif
  1477. endif
  1478. # Shell quote (do not use $(call) to accommodate ancient setups);
  1479. SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
  1480. ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
  1481. ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
  1482. DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
  1483. bindir_SQ = $(subst ','\'',$(bindir))
  1484. bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
  1485. mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
  1486. infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
  1487. localedir_SQ = $(subst ','\'',$(localedir))
  1488. gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
  1489. template_dir_SQ = $(subst ','\'',$(template_dir))
  1490. htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
  1491. prefix_SQ = $(subst ','\'',$(prefix))
  1492. gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
  1493. SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
  1494. PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
  1495. PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
  1496. TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
  1497. DIFF_SQ = $(subst ','\'',$(DIFF))
  1498. PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
  1499. # We must filter out any object files from $(GITLIBS),
  1500. # as it is typically used like:
  1501. #
  1502. # foo: foo.o $(GITLIBS)
  1503. # $(CC) $(filter %.o,$^) $(LIBS)
  1504. #
  1505. # where we use it as a dependency. Since we also pull object files
  1506. # from the dependency list, that would make each entry appear twice.
  1507. LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
  1508. BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
  1509. $(COMPAT_CFLAGS)
  1510. LIB_OBJS += $(COMPAT_OBJS)
  1511. # Quote for C
  1512. ifdef DEFAULT_EDITOR
  1513. DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
  1514. DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
  1515. BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
  1516. endif
  1517. ifdef DEFAULT_PAGER
  1518. DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
  1519. DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
  1520. BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
  1521. endif
  1522. ifdef SHELL_PATH
  1523. SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
  1524. SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
  1525. BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
  1526. endif
  1527. GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
  1528. GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
  1529. GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
  1530. GIT-USER-AGENT: FORCE
  1531. @if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
  1532. echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
  1533. fi
  1534. ifdef DEFAULT_HELP_FORMAT
  1535. BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
  1536. endif
  1537. PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
  1538. PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
  1539. PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
  1540. BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
  1541. ALL_CFLAGS += $(BASIC_CFLAGS)
  1542. ALL_LDFLAGS += $(BASIC_LDFLAGS)
  1543. export DIFF TAR INSTALL DESTDIR SHELL_PATH
  1544. ### Build rules
  1545. SHELL = $(SHELL_PATH)
  1546. all:: shell_compatibility_test
  1547. ifeq "$(PROFILE)" "BUILD"
  1548. all:: profile
  1549. endif
  1550. profile:: profile-clean
  1551. $(MAKE) PROFILE=GEN all
  1552. $(MAKE) PROFILE=GEN -j1 test
  1553. @if test -n "$$GIT_PERF_REPO" || test -d .git; then \
  1554. $(MAKE) PROFILE=GEN -j1 perf; \
  1555. else \
  1556. echo "Skipping profile of perf tests..."; \
  1557. fi
  1558. $(MAKE) PROFILE=USE all
  1559. profile-fast: profile-clean
  1560. $(MAKE) PROFILE=GEN all
  1561. $(MAKE) PROFILE=GEN -j1 perf
  1562. $(MAKE) PROFILE=USE all
  1563. all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
  1564. ifneq (,$X)
  1565. $(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';)
  1566. endif
  1567. all::
  1568. ifndef NO_TCLTK
  1569. $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
  1570. $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
  1571. endif
  1572. ifndef NO_PERL
  1573. $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all
  1574. endif
  1575. $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
  1576. please_set_SHELL_PATH_to_a_more_modern_shell:
  1577. @$$(:)
  1578. shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
  1579. strip: $(PROGRAMS) git$X
  1580. $(STRIP) $(STRIP_OPTS) $^
  1581. ### Target-specific flags and dependencies
  1582. # The generic compilation pattern rule and automatically
  1583. # computed header dependencies (falling back to a dependency on
  1584. # LIB_H) are enough to describe how most targets should be built,
  1585. # but some targets are special enough to need something a little
  1586. # different.
  1587. #
  1588. # - When a source file "foo.c" #includes a generated header file,
  1589. # we need to list that dependency for the "foo.o" target.
  1590. #
  1591. # We also list it from other targets that are built from foo.c
  1592. # like "foo.sp" and "foo.s", even though that is easy to forget
  1593. # to do because the generated header is already present around
  1594. # after a regular build attempt.
  1595. #
  1596. # - Some code depends on configuration kept in makefile
  1597. # variables. The target-specific variable EXTRA_CPPFLAGS can
  1598. # be used to convey that information to the C preprocessor
  1599. # using -D options.
  1600. #
  1601. # The "foo.o" target should have a corresponding dependency on
  1602. # a file that changes when the value of the makefile variable
  1603. # changes. For example, targets making use of the
  1604. # $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
  1605. #
  1606. # Technically the ".sp" and ".s" targets do not need this
  1607. # dependency because they are force-built, but they get the
  1608. # same dependency for consistency. This way, you do not have to
  1609. # know how each target is implemented. And it means the
  1610. # dependencies here will not need to change if the force-build
  1611. # details change some day.
  1612. git.sp git.s git.o: GIT-PREFIX
  1613. git.sp git.s git.o: EXTRA_CPPFLAGS = \
  1614. '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
  1615. '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
  1616. '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
  1617. git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
  1618. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
  1619. $(filter %.o,$^) $(LIBS)
  1620. help.sp help.s help.o: common-cmds.h
  1621. builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX
  1622. builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
  1623. '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
  1624. '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
  1625. '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
  1626. version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
  1627. version.sp version.s version.o: EXTRA_CPPFLAGS = \
  1628. '-DGIT_VERSION="$(GIT_VERSION)"' \
  1629. '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
  1630. $(BUILT_INS): git$X
  1631. $(QUIET_BUILT_IN)$(RM) $@ && \
  1632. ln $< $@ 2>/dev/null || \
  1633. ln -s $< $@ 2>/dev/null || \
  1634. cp $< $@
  1635. common-cmds.h: generate-cmdlist.sh command-list.txt
  1636. common-cmds.h: $(wildcard Documentation/git-*.txt)
  1637. $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@
  1638. SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
  1639. $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
  1640. $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV)
  1641. define cmd_munge_script
  1642. $(RM) $@ $@+ && \
  1643. sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  1644. -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
  1645. -e 's|@@DIFF@@|$(DIFF_SQ)|' \
  1646. -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
  1647. -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
  1648. -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
  1649. -e $(BROKEN_PATH_FIX) \
  1650. -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
  1651. -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
  1652. -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
  1653. -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
  1654. $@.sh >$@+
  1655. endef
  1656. GIT-SCRIPT-DEFINES: FORCE
  1657. @FLAGS='$(SCRIPT_DEFINES)'; \
  1658. if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
  1659. echo >&2 " * new script parameters"; \
  1660. echo "$$FLAGS" >$@; \
  1661. fi
  1662. $(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
  1663. $(QUIET_GEN)$(cmd_munge_script) && \
  1664. chmod +x $@+ && \
  1665. mv $@+ $@
  1666. $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
  1667. $(QUIET_GEN)$(cmd_munge_script) && \
  1668. mv $@+ $@
  1669. git.res: git.rc GIT-VERSION-FILE
  1670. $(QUIET_RC)$(RC) \
  1671. $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \
  1672. -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
  1673. # This makes sure we depend on the NO_PERL setting itself.
  1674. $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
  1675. ifndef NO_PERL
  1676. $(SCRIPT_PERL_GEN): perl/perl.mak
  1677. perl/perl.mak: perl/PM.stamp
  1678. perl/PM.stamp: FORCE
  1679. @$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
  1680. { cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
  1681. $(RM) $@+
  1682. perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL
  1683. $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
  1684. PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)
  1685. $(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE
  1686. $(QUIET_GEN)$(RM) $@ $@+ && \
  1687. INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
  1688. INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
  1689. INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
  1690. sed -e '1{' \
  1691. -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
  1692. -e ' h' \
  1693. -e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
  1694. -e ' H' \
  1695. -e ' x' \
  1696. -e '}' \
  1697. -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
  1698. $< >$@+ && \
  1699. chmod +x $@+ && \
  1700. mv $@+ $@
  1701. GIT-PERL-DEFINES: FORCE
  1702. @FLAGS='$(PERL_DEFINES)'; \
  1703. if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
  1704. echo >&2 " * new perl-specific parameters"; \
  1705. echo "$$FLAGS" >$@; \
  1706. fi
  1707. .PHONY: gitweb
  1708. gitweb:
  1709. $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
  1710. git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
  1711. $(QUIET_GEN)$(cmd_munge_script) && \
  1712. chmod +x $@+ && \
  1713. mv $@+ $@
  1714. else # NO_PERL
  1715. $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
  1716. $(QUIET_GEN)$(RM) $@ $@+ && \
  1717. sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  1718. -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
  1719. unimplemented.sh >$@+ && \
  1720. chmod +x $@+ && \
  1721. mv $@+ $@
  1722. endif # NO_PERL
  1723. # This makes sure we depend on the NO_PYTHON setting itself.
  1724. $(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
  1725. ifndef NO_PYTHON
  1726. $(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
  1727. $(SCRIPT_PYTHON_GEN): % : %.py
  1728. $(QUIET_GEN)$(RM) $@ $@+ && \
  1729. sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
  1730. $< >$@+ && \
  1731. chmod +x $@+ && \
  1732. mv $@+ $@
  1733. else # NO_PYTHON
  1734. $(SCRIPT_PYTHON_GEN): % : unimplemented.sh
  1735. $(QUIET_GEN)$(RM) $@ $@+ && \
  1736. sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  1737. -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
  1738. unimplemented.sh >$@+ && \
  1739. chmod +x $@+ && \
  1740. mv $@+ $@
  1741. endif # NO_PYTHON
  1742. CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
  1743. sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
  1744. configure.ac >configure.ac+ && \
  1745. autoconf -o configure configure.ac+ && \
  1746. $(RM) configure.ac+
  1747. configure: configure.ac GIT-VERSION-FILE
  1748. $(QUIET_GEN)$(CONFIGURE_RECIPE)
  1749. ifdef AUTOCONFIGURED
  1750. # We avoid depending on 'configure' here, because it gets rebuilt
  1751. # every time GIT-VERSION-FILE is modified, only to update the embedded
  1752. # version number string, which config.status does not care about. We
  1753. # do want to recheck when the platform/environment detection logic
  1754. # changes, hence this depends on configure.ac.
  1755. config.status: configure.ac
  1756. $(QUIET_GEN)$(CONFIGURE_RECIPE) && \
  1757. if test -f config.status; then \
  1758. ./config.status --recheck; \
  1759. else \
  1760. ./configure; \
  1761. fi
  1762. reconfigure config.mak.autogen: config.status
  1763. $(QUIET_GEN)./config.status
  1764. .PHONY: reconfigure # This is a convenience target.
  1765. endif
  1766. XDIFF_OBJS += xdiff/xdiffi.o
  1767. XDIFF_OBJS += xdiff/xprepare.o
  1768. XDIFF_OBJS += xdiff/xutils.o
  1769. XDIFF_OBJS += xdiff/xemit.o
  1770. XDIFF_OBJS += xdiff/xmerge.o
  1771. XDIFF_OBJS += xdiff/xpatience.o
  1772. XDIFF_OBJS += xdiff/xhistogram.o
  1773. VCSSVN_OBJS += vcs-svn/line_buffer.o
  1774. VCSSVN_OBJS += vcs-svn/sliding_window.o
  1775. VCSSVN_OBJS += vcs-svn/repo_tree.o
  1776. VCSSVN_OBJS += vcs-svn/fast_export.o
  1777. VCSSVN_OBJS += vcs-svn/svndiff.o
  1778. VCSSVN_OBJS += vcs-svn/svndump.o
  1779. TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS))
  1780. OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
  1781. $(XDIFF_OBJS) \
  1782. $(VCSSVN_OBJS) \
  1783. common-main.o \
  1784. git.o
  1785. ifndef NO_CURL
  1786. OBJECTS += http.o http-walker.o remote-curl.o
  1787. endif
  1788. dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
  1789. dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
  1790. ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
  1791. $(dep_dirs):
  1792. @mkdir -p $@
  1793. missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
  1794. dep_file = $(dir $@).depend/$(notdir $@).d
  1795. dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
  1796. endif
  1797. ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
  1798. dep_dirs =
  1799. missing_dep_dirs =
  1800. dep_args =
  1801. endif
  1802. ASM_SRC := $(wildcard $(OBJECTS:o=S))
  1803. ASM_OBJ := $(ASM_SRC:S=o)
  1804. C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
  1805. .SUFFIXES:
  1806. $(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
  1807. $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
  1808. $(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
  1809. $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
  1810. %.s: %.c GIT-CFLAGS FORCE
  1811. $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
  1812. ifdef USE_COMPUTED_HEADER_DEPENDENCIES
  1813. # Take advantage of gcc's on-the-fly dependency generation
  1814. # See <http://gcc.gnu.org/gcc-3.0/features.html>.
  1815. dep_files_present := $(wildcard $(dep_files))
  1816. ifneq ($(dep_files_present),)
  1817. include $(dep_files_present)
  1818. endif
  1819. else
  1820. # Dependencies on header files, for platforms that do not support
  1821. # the gcc -MMD option.
  1822. #
  1823. # Dependencies on automatically generated headers such as common-cmds.h
  1824. # should _not_ be included here, since they are necessary even when
  1825. # building an object for the first time.
  1826. $(OBJECTS): $(LIB_H)
  1827. endif
  1828. exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX
  1829. exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
  1830. '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
  1831. '-DBINDIR="$(bindir_relative_SQ)"' \
  1832. '-DPREFIX="$(prefix_SQ)"'
  1833. builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
  1834. builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
  1835. -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
  1836. config.sp config.s config.o: GIT-PREFIX
  1837. config.sp config.s config.o: EXTRA_CPPFLAGS = \
  1838. -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
  1839. attr.sp attr.s attr.o: GIT-PREFIX
  1840. attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
  1841. -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
  1842. gettext.sp gettext.s gettext.o: GIT-PREFIX
  1843. gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
  1844. -DGIT_LOCALE_PATH='"$(localedir_SQ)"'
  1845. http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SPARSE_FLAGS += \
  1846. -DCURL_DISABLE_TYPECHECK
  1847. ifdef NO_EXPAT
  1848. http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
  1849. endif
  1850. ifdef NO_REGEX
  1851. compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
  1852. -DGAWK -DNO_MBSUPPORT
  1853. endif
  1854. ifdef USE_NED_ALLOCATOR
  1855. compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
  1856. -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
  1857. compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null
  1858. endif
  1859. git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
  1860. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
  1861. git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
  1862. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
  1863. $(LIBS) $(IMAP_SEND_LDFLAGS)
  1864. git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
  1865. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
  1866. $(CURL_LIBCURL) $(LIBS)
  1867. git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
  1868. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
  1869. $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
  1870. git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
  1871. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
  1872. $(VCSSVN_LIB)
  1873. $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
  1874. $(QUIET_LNCP)$(RM) $@ && \
  1875. ln $< $@ 2>/dev/null || \
  1876. ln -s $< $@ 2>/dev/null || \
  1877. cp $< $@
  1878. $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
  1879. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
  1880. $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
  1881. $(LIB_FILE): $(LIB_OBJS)
  1882. $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
  1883. $(XDIFF_LIB): $(XDIFF_OBJS)
  1884. $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
  1885. $(VCSSVN_LIB): $(VCSSVN_OBJS)
  1886. $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
  1887. export DEFAULT_EDITOR DEFAULT_PAGER
  1888. .PHONY: doc man html info pdf
  1889. doc:
  1890. $(MAKE) -C Documentation all
  1891. man:
  1892. $(MAKE) -C Documentation man
  1893. html:
  1894. $(MAKE) -C Documentation html
  1895. info:
  1896. $(MAKE) -C Documentation info
  1897. pdf:
  1898. $(MAKE) -C Documentation pdf
  1899. XGETTEXT_FLAGS = \
  1900. --force-po \
  1901. --add-comments=TRANSLATORS: \
  1902. --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
  1903. --from-code=UTF-8
  1904. XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
  1905. --keyword=_ --keyword=N_ --keyword="Q_:1,2"
  1906. XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
  1907. --keyword=gettextln --keyword=eval_gettextln
  1908. XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
  1909. LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
  1910. LOCALIZED_SH = $(SCRIPT_SH)
  1911. LOCALIZED_SH += git-parse-remote.sh
  1912. LOCALIZED_SH += git-rebase--interactive.sh
  1913. LOCALIZED_SH += git-sh-setup.sh
  1914. LOCALIZED_PERL = $(SCRIPT_PERL)
  1915. ifdef XGETTEXT_INCLUDE_TESTS
  1916. LOCALIZED_C += t/t0200/test.c
  1917. LOCALIZED_SH += t/t0200/test.sh
  1918. LOCALIZED_PERL += t/t0200/test.perl
  1919. endif
  1920. po/git.pot: $(GENERATED_H) FORCE
  1921. $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
  1922. $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
  1923. $(LOCALIZED_SH)
  1924. $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
  1925. $(LOCALIZED_PERL)
  1926. mv $@+ $@
  1927. .PHONY: pot
  1928. pot: po/git.pot
  1929. POFILES := $(wildcard po/*.po)
  1930. MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
  1931. ifndef NO_GETTEXT
  1932. all:: $(MOFILES)
  1933. endif
  1934. po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
  1935. $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
  1936. FIND_SOURCE_FILES = ( git ls-files '*.[hcS]' 2>/dev/null || \
  1937. $(FIND) . \( -name .git -type d -prune \) \
  1938. -o \( -name '*.[hcS]' -type f -print \) )
  1939. $(ETAGS_TARGET): FORCE
  1940. $(RM) $(ETAGS_TARGET)
  1941. $(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
  1942. tags: FORCE
  1943. $(RM) tags
  1944. $(FIND_SOURCE_FILES) | xargs ctags -a
  1945. cscope:
  1946. $(RM) cscope*
  1947. $(FIND_SOURCE_FILES) | xargs cscope -b
  1948. ### Detect prefix changes
  1949. TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
  1950. $(localedir_SQ)
  1951. GIT-PREFIX: FORCE
  1952. @FLAGS='$(TRACK_PREFIX)'; \
  1953. if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
  1954. echo >&2 " * new prefix flags"; \
  1955. echo "$$FLAGS" >GIT-PREFIX; \
  1956. fi
  1957. TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
  1958. GIT-CFLAGS: FORCE
  1959. @FLAGS='$(TRACK_CFLAGS)'; \
  1960. if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
  1961. echo >&2 " * new build flags"; \
  1962. echo "$$FLAGS" >GIT-CFLAGS; \
  1963. fi
  1964. TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
  1965. GIT-LDFLAGS: FORCE
  1966. @FLAGS='$(TRACK_LDFLAGS)'; \
  1967. if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
  1968. echo >&2 " * new link flags"; \
  1969. echo "$$FLAGS" >GIT-LDFLAGS; \
  1970. fi
  1971. # We need to apply sq twice, once to protect from the shell
  1972. # that runs GIT-BUILD-OPTIONS, and then again to protect it
  1973. # and the first level quoting from the shell that runs "echo".
  1974. GIT-BUILD-OPTIONS: FORCE
  1975. @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
  1976. @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
  1977. @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
  1978. @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
  1979. @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
  1980. @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
  1981. @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
  1982. @echo USE_LIBPCRE=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE)))'\' >>$@+
  1983. @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
  1984. @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
  1985. @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
  1986. @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
  1987. ifdef TEST_OUTPUT_DIRECTORY
  1988. @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
  1989. endif
  1990. ifdef GIT_TEST_OPTS
  1991. @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
  1992. endif
  1993. ifdef GIT_TEST_CMP
  1994. @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
  1995. endif
  1996. ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
  1997. @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
  1998. endif
  1999. @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
  2000. @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@+
  2001. ifdef GIT_PERF_REPEAT_COUNT
  2002. @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
  2003. endif
  2004. ifdef GIT_PERF_REPO
  2005. @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
  2006. endif
  2007. ifdef GIT_PERF_LARGE_REPO
  2008. @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
  2009. endif
  2010. ifdef GIT_PERF_MAKE_OPTS
  2011. @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
  2012. endif
  2013. ifdef TEST_GIT_INDEX_VERSION
  2014. @echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
  2015. endif
  2016. @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
  2017. ### Detect Python interpreter path changes
  2018. ifndef NO_PYTHON
  2019. TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
  2020. GIT-PYTHON-VARS: FORCE
  2021. @VARS='$(TRACK_PYTHON)'; \
  2022. if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
  2023. echo >&2 " * new Python interpreter location"; \
  2024. echo "$$VARS" >$@; \
  2025. fi
  2026. endif
  2027. test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
  2028. all:: $(TEST_PROGRAMS) $(test_bindir_programs)
  2029. all:: $(NO_INSTALL)
  2030. bin-wrappers/%: wrap-for-bin.sh
  2031. @mkdir -p bin-wrappers
  2032. $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  2033. -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
  2034. -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
  2035. chmod +x $@
  2036. # GNU make supports exporting all variables by "export" without parameters.
  2037. # However, the environment gets quite big, and some programs have problems
  2038. # with that.
  2039. export NO_SVN_TESTS
  2040. export TEST_NO_MALLOC_CHECK
  2041. ### Testing rules
  2042. test: all
  2043. $(MAKE) -C t/ all
  2044. perf: all
  2045. $(MAKE) -C t/perf/ all
  2046. .PHONY: test perf
  2047. t/helper/test-line-buffer$X: $(VCSSVN_LIB)
  2048. t/helper/test-svn-fe$X: $(VCSSVN_LIB)
  2049. .PRECIOUS: $(TEST_OBJS)
  2050. t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
  2051. $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
  2052. check-sha1:: t/helper/test-sha1$X
  2053. t/helper/test-sha1.sh
  2054. SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
  2055. $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
  2056. $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
  2057. $(SPARSE_FLAGS) $<
  2058. .PHONY: sparse $(SP_OBJ)
  2059. sparse: $(SP_OBJ)
  2060. check: common-cmds.h
  2061. @if sparse; \
  2062. then \
  2063. echo >&2 "Use 'make sparse' instead"; \
  2064. $(MAKE) --no-print-directory sparse; \
  2065. else \
  2066. echo >&2 "Did you mean 'make test'?"; \
  2067. exit 1; \
  2068. fi
  2069. C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
  2070. %.cocci.patch: %.cocci $(C_SOURCES)
  2071. @echo ' ' SPATCH $<; \
  2072. for f in $(C_SOURCES); do \
  2073. $(SPATCH) --sp-file $< $$f; \
  2074. done >$@ 2>$@.log; \
  2075. if test -s $@; \
  2076. then \
  2077. echo ' ' SPATCH result: $@; \
  2078. fi
  2079. coccicheck: $(patsubst %.cocci,%.cocci.patch,$(wildcard contrib/coccinelle/*.cocci))
  2080. ### Installation rules
  2081. ifneq ($(filter /%,$(firstword $(template_dir))),)
  2082. template_instdir = $(template_dir)
  2083. else
  2084. template_instdir = $(prefix)/$(template_dir)
  2085. endif
  2086. export template_instdir
  2087. ifneq ($(filter /%,$(firstword $(gitexecdir))),)
  2088. gitexec_instdir = $(gitexecdir)
  2089. else
  2090. gitexec_instdir = $(prefix)/$(gitexecdir)
  2091. endif
  2092. gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
  2093. export gitexec_instdir
  2094. ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
  2095. mergetools_instdir = $(mergetoolsdir)
  2096. else
  2097. mergetools_instdir = $(prefix)/$(mergetoolsdir)
  2098. endif
  2099. mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
  2100. install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
  2101. .PHONY: profile-install profile-fast-install
  2102. profile-install: profile
  2103. $(MAKE) install
  2104. profile-fast-install: profile-fast
  2105. $(MAKE) install
  2106. install: all
  2107. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
  2108. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  2109. $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  2110. $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
  2111. $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
  2112. $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
  2113. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
  2114. $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
  2115. ifndef NO_GETTEXT
  2116. $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
  2117. (cd po/build/locale && $(TAR) cf - .) | \
  2118. (cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
  2119. endif
  2120. ifndef NO_PERL
  2121. $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
  2122. $(MAKE) -C gitweb install
  2123. endif
  2124. ifndef NO_TCLTK
  2125. $(MAKE) -C gitk-git install
  2126. $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
  2127. endif
  2128. ifneq (,$X)
  2129. $(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';)
  2130. endif
  2131. bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
  2132. execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
  2133. { test "$$bindir/" = "$$execdir/" || \
  2134. for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
  2135. $(RM) "$$execdir/$$p" && \
  2136. test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
  2137. ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
  2138. cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
  2139. done; \
  2140. } && \
  2141. for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
  2142. $(RM) "$$bindir/$$p" && \
  2143. test -z "$(NO_INSTALL_HARDLINKS)" && \
  2144. ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
  2145. ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
  2146. cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
  2147. done && \
  2148. for p in $(BUILT_INS); do \
  2149. $(RM) "$$execdir/$$p" && \
  2150. test -z "$(NO_INSTALL_HARDLINKS)" && \
  2151. ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
  2152. ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
  2153. cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
  2154. done && \
  2155. remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
  2156. for p in $$remote_curl_aliases; do \
  2157. $(RM) "$$execdir/$$p" && \
  2158. test -z "$(NO_INSTALL_HARDLINKS)" && \
  2159. ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
  2160. ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
  2161. cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
  2162. done && \
  2163. ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
  2164. .PHONY: install-gitweb install-doc install-man install-html install-info install-pdf
  2165. .PHONY: quick-install-doc quick-install-man quick-install-html
  2166. install-gitweb:
  2167. $(MAKE) -C gitweb install
  2168. install-doc:
  2169. $(MAKE) -C Documentation install
  2170. install-man:
  2171. $(MAKE) -C Documentation install-man
  2172. install-html:
  2173. $(MAKE) -C Documentation install-html
  2174. install-info:
  2175. $(MAKE) -C Documentation install-info
  2176. install-pdf:
  2177. $(MAKE) -C Documentation install-pdf
  2178. quick-install-doc:
  2179. $(MAKE) -C Documentation quick-install
  2180. quick-install-man:
  2181. $(MAKE) -C Documentation quick-install-man
  2182. quick-install-html:
  2183. $(MAKE) -C Documentation quick-install-html
  2184. ### Maintainer's dist rules
  2185. GIT_TARNAME = git-$(GIT_VERSION)
  2186. dist: git-archive$(X) configure
  2187. ./git-archive --format=tar \
  2188. --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
  2189. @mkdir -p $(GIT_TARNAME)
  2190. @cp configure $(GIT_TARNAME)
  2191. @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
  2192. @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
  2193. $(TAR) rf $(GIT_TARNAME).tar \
  2194. $(GIT_TARNAME)/configure \
  2195. $(GIT_TARNAME)/version \
  2196. $(GIT_TARNAME)/git-gui/version
  2197. @$(RM) -r $(GIT_TARNAME)
  2198. gzip -f -9 $(GIT_TARNAME).tar
  2199. rpm::
  2200. @echo >&2 "Use distro packaged sources to run rpmbuild"
  2201. @false
  2202. .PHONY: rpm
  2203. htmldocs = git-htmldocs-$(GIT_VERSION)
  2204. manpages = git-manpages-$(GIT_VERSION)
  2205. .PHONY: dist-doc distclean
  2206. dist-doc:
  2207. $(RM) -r .doc-tmp-dir
  2208. mkdir .doc-tmp-dir
  2209. $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
  2210. cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
  2211. gzip -n -9 -f $(htmldocs).tar
  2212. :
  2213. $(RM) -r .doc-tmp-dir
  2214. mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
  2215. $(MAKE) -C Documentation DESTDIR=./ \
  2216. man1dir=../.doc-tmp-dir/man1 \
  2217. man5dir=../.doc-tmp-dir/man5 \
  2218. man7dir=../.doc-tmp-dir/man7 \
  2219. install
  2220. cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
  2221. gzip -n -9 -f $(manpages).tar
  2222. $(RM) -r .doc-tmp-dir
  2223. ### Cleaning rules
  2224. distclean: clean
  2225. $(RM) configure
  2226. $(RM) config.log config.status config.cache
  2227. $(RM) config.mak.autogen config.mak.append
  2228. $(RM) -r autom4te.cache
  2229. profile-clean:
  2230. $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
  2231. $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
  2232. clean: profile-clean coverage-clean
  2233. $(RM) *.res
  2234. $(RM) $(OBJECTS)
  2235. $(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
  2236. $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
  2237. $(RM) $(TEST_PROGRAMS) $(NO_INSTALL)
  2238. $(RM) -r bin-wrappers $(dep_dirs)
  2239. $(RM) -r po/build/
  2240. $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
  2241. $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
  2242. $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
  2243. $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
  2244. $(RM) contrib/coccinelle/*.cocci.patch*
  2245. $(MAKE) -C Documentation/ clean
  2246. ifndef NO_PERL
  2247. $(MAKE) -C gitweb clean
  2248. $(MAKE) -C perl clean
  2249. endif
  2250. $(MAKE) -C templates/ clean
  2251. $(MAKE) -C t/ clean
  2252. ifndef NO_TCLTK
  2253. $(MAKE) -C gitk-git clean
  2254. $(MAKE) -C git-gui clean
  2255. endif
  2256. $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
  2257. $(RM) GIT-USER-AGENT GIT-PREFIX
  2258. $(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PYTHON-VARS
  2259. .PHONY: all install profile-clean clean strip
  2260. .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
  2261. .PHONY: FORCE cscope
  2262. ### Check documentation
  2263. #
  2264. ALL_COMMANDS = $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS)
  2265. ALL_COMMANDS += git
  2266. ALL_COMMANDS += gitk
  2267. ALL_COMMANDS += gitweb
  2268. ALL_COMMANDS += git-gui git-citool
  2269. .PHONY: check-docs
  2270. check-docs::
  2271. $(MAKE) -C Documentation lint-docs
  2272. @(for v in $(ALL_COMMANDS); \
  2273. do \
  2274. case "$$v" in \
  2275. git-merge-octopus | git-merge-ours | git-merge-recursive | \
  2276. git-merge-resolve | git-merge-subtree | \
  2277. git-fsck-objects | git-init-db | \
  2278. git-remote-* | git-stage | \
  2279. git-?*--?* ) continue ;; \
  2280. esac ; \
  2281. test -f "Documentation/$$v.txt" || \
  2282. echo "no doc: $$v"; \
  2283. sed -e '1,/^### command list/d' -e '/^#/d' command-list.txt | \
  2284. grep -q "^$$v[ ]" || \
  2285. case "$$v" in \
  2286. git) ;; \
  2287. *) echo "no link: $$v";; \
  2288. esac ; \
  2289. done; \
  2290. ( \
  2291. sed -e '1,/^### command list/d' \
  2292. -e '/^#/d' \
  2293. -e 's/[ ].*//' \
  2294. -e 's/^/listed /' command-list.txt; \
  2295. $(MAKE) -C Documentation print-man1 | \
  2296. grep '\.txt$$' | \
  2297. sed -e 's|Documentation/|documented |' \
  2298. -e 's/\.txt//'; \
  2299. ) | while read how cmd; \
  2300. do \
  2301. case " $(ALL_COMMANDS) " in \
  2302. *" $$cmd "*) ;; \
  2303. *) echo "removed but $$how: $$cmd" ;; \
  2304. esac; \
  2305. done ) | sort
  2306. ### Make sure built-ins do not have dups and listed in git.c
  2307. #
  2308. check-builtins::
  2309. ./check-builtins.sh
  2310. ### Test suite coverage testing
  2311. #
  2312. .PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
  2313. .PHONY: coverage-untested-functions cover_db cover_db_html
  2314. .PHONY: coverage-clean-results
  2315. coverage:
  2316. $(MAKE) coverage-test
  2317. $(MAKE) coverage-untested-functions
  2318. object_dirs := $(sort $(dir $(OBJECTS)))
  2319. coverage-clean-results:
  2320. $(RM) $(addsuffix *.gcov,$(object_dirs))
  2321. $(RM) $(addsuffix *.gcda,$(object_dirs))
  2322. $(RM) coverage-untested-functions
  2323. $(RM) -r cover_db/
  2324. $(RM) -r cover_db_html/
  2325. coverage-clean: coverage-clean-results
  2326. $(RM) $(addsuffix *.gcno,$(object_dirs))
  2327. COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
  2328. COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
  2329. GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
  2330. coverage-compile:
  2331. $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
  2332. coverage-test: coverage-clean-results coverage-compile
  2333. $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
  2334. DEFAULT_TEST_TARGET=test -j1 test
  2335. coverage-report:
  2336. $(QUIET_GCOV)for dir in $(object_dirs); do \
  2337. $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
  2338. done
  2339. coverage-untested-functions: coverage-report
  2340. grep '^function.*called 0 ' *.c.gcov \
  2341. | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
  2342. > coverage-untested-functions
  2343. cover_db: coverage-report
  2344. gcov2perl -db cover_db *.gcov
  2345. cover_db_html: cover_db
  2346. cover -report html -outputdir cover_db_html cover_db