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