Makefileon commit exec_cmd.c: replace hard-coded path list with one from <paths.h> (cb6a22c)
   1# The default target of this Makefile is...
   2all::
   3
   4# Define V=1 to have a more verbose compile.
   5#
   6# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
   7#
   8# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
   9# to PATH if your tools in /usr/bin are broken.
  10#
  11# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
  12# or vsnprintf() return -1 instead of number of characters which would
  13# have been written to the final string if enough space had been available.
  14#
  15# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
  16# when attempting to read from an fopen'ed directory.
  17#
  18# Define NO_OPENSSL environment variable if you do not have OpenSSL.
  19# This also implies BLK_SHA1.
  20#
  21# Define NO_CURL if you do not have libcurl installed.  git-http-pull and
  22# git-http-push are not built, and you cannot use http:// and https://
  23# transports.
  24#
  25# Define CURLDIR=/foo/bar if your curl header and library files are in
  26# /foo/bar/include and /foo/bar/lib directories.
  27#
  28# Define NO_EXPAT if you do not have expat installed.  git-http-push is
  29# not built, and you cannot push using http:// and https:// transports.
  30#
  31# Define EXPATDIR=/foo/bar if your expat header and library files are in
  32# /foo/bar/include and /foo/bar/lib directories.
  33#
  34# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
  35# it specifies.
  36#
  37# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
  38#
  39# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
  40# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
  41#
  42# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
  43# do not support the 'size specifiers' introduced by C99, namely ll, hh,
  44# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
  45# some C compilers supported these specifiers prior to C99 as an extension.
  46#
  47# Define NO_STRCASESTR if you don't have strcasestr.
  48#
  49# Define NO_MEMMEM if you don't have memmem.
  50#
  51# Define NO_STRLCPY if you don't have strlcpy.
  52#
  53# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
  54# If your compiler also does not support long long or does not have
  55# strtoull, define NO_STRTOULL.
  56#
  57# Define NO_SETENV if you don't have setenv in the C library.
  58#
  59# Define NO_UNSETENV if you don't have unsetenv in the C library.
  60#
  61# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
  62#
  63# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
  64#
  65# Define NO_LIBGEN_H if you don't have libgen.h.
  66#
  67# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
  68#
  69# Define NO_SYS_SELECT_H if you don't have sys/select.h.
  70#
  71# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
  72# Enable it on Windows.  By default, symrefs are still used.
  73#
  74# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
  75# tests.  These tests take up a significant amount of the total test time
  76# but are not needed unless you plan to talk to SVN repos.
  77#
  78# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
  79# installed in /sw, but don't want GIT to link against any libraries
  80# installed there.  If defined you may specify your own (or Fink's)
  81# include directories and library directories by defining CFLAGS
  82# and LDFLAGS appropriately.
  83#
  84# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
  85# have DarwinPorts installed in /opt/local, but don't want GIT to
  86# link against any libraries installed there.  If defined you may
  87# specify your own (or DarwinPort's) include directories and
  88# library directories by defining CFLAGS and LDFLAGS appropriately.
  89#
  90# Define BLK_SHA1 environment variable if you want the C version
  91# of the SHA1 that assumes you can do unaligned 32-bit loads and
  92# have a fast htonl() function.
  93#
  94# Define PPC_SHA1 environment variable when running make to make use of
  95# a bundled SHA1 routine optimized for PowerPC.
  96#
  97# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
  98#
  99# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
 100#
 101# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
 102#
 103# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
 104# Patrick Mauritz).
 105#
 106# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
 107# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
 108# inet_ntop and inet_pton additionally reside there.
 109#
 110# Define NO_MMAP if you want to avoid mmap.
 111#
 112# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
 113#
 114# Define NO_PREAD if you have a problem with pread() system call (e.g.
 115# cygwin.dll before v1.5.22).
 116#
 117# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
 118# generally faster on your platform than accessing the working directory.
 119#
 120# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
 121# the executable mode bit, but doesn't really do so.
 122#
 123# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
 124#
 125# Define NO_SOCKADDR_STORAGE if your platform does not have struct
 126# sockaddr_storage.
 127#
 128# Define NO_ICONV if your libc does not properly support iconv.
 129#
 130# Define OLD_ICONV if your library has an old iconv(), where the second
 131# (input buffer pointer) parameter is declared with type (const char **).
 132#
 133# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
 134#
 135# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
 136# that tells runtime paths to dynamic libraries;
 137# "-Wl,-rpath=/path/lib" is used instead.
 138#
 139# Define USE_NSEC below if you want git to care about sub-second file mtimes
 140# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
 141# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
 142# randomly break unless your underlying filesystem supports those sub-second
 143# times (my ext3 doesn't).
 144#
 145# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
 146# "st_ctim"
 147#
 148# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
 149# available.  This automatically turns USE_NSEC off.
 150#
 151# Define USE_STDEV below if you want git to care about the underlying device
 152# change being considered an inode change from the update-index perspective.
 153#
 154# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
 155# field that counts the on-disk footprint in 512-byte blocks.
 156#
 157# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
 158#
 159# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
 160# (not v1.73 or v1.71).
 161#
 162# Define ASCIIDOC_NO_ROFF if your DocBook XSL escapes raw roff directives
 163# (versions 1.72 and later and 1.68.1 and earlier).
 164#
 165# Define GNU_ROFF if your target system uses GNU groff.  This forces
 166# apostrophes to be ASCII so that cut&pasting examples to the shell
 167# will work.
 168#
 169# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
 170# MakeMaker (e.g. using ActiveState under Cygwin).
 171#
 172# Define NO_PERL if you do not want Perl scripts or libraries at all.
 173#
 174# Define NO_PYTHON if you do not want Python scripts or libraries at all.
 175#
 176# Define NO_TCLTK if you do not want Tcl/Tk GUI.
 177#
 178# The TCL_PATH variable governs the location of the Tcl interpreter
 179# used to optimize git-gui for your system.  Only used if NO_TCLTK
 180# is not set.  Defaults to the bare 'tclsh'.
 181#
 182# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
 183# If not set it defaults to the bare 'wish'. If it is set to the empty
 184# string then NO_TCLTK will be forced (this is used by configure script).
 185#
 186# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
 187# is a simplified version of the merge sort used in glibc. This is
 188# recommended if Git triggers O(n^2) behavior in your platform's qsort().
 189#
 190# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
 191# information on a not yet closed file that lstat would return for the same
 192# file after it was closed.
 193#
 194# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
 195# when hardlinking a file to another name and unlinking the original file right
 196# away (some NTFS drivers seem to zero the contents in that scenario).
 197#
 198# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
 199# programs as a tar, where bin/ and libexec/ might be on different file systems.
 200#
 201# Define USE_NED_ALLOCATOR if you want to replace the platforms default
 202# memory allocators with the nedmalloc allocator written by Niall Douglas.
 203#
 204# Define NO_REGEX if you have no or inferior regex support in your C library.
 205#
 206# Define JSMIN to point to JavaScript minifier that functions as
 207# a filter to have gitweb.js minified.
 208#
 209# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
 210# you want to use something different.  The value will be interpreted by the
 211# shell at runtime when it is used.
 212#
 213# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
 214# want to use something different.  The value will be interpreted by the shell
 215# if necessary when it is used.  Examples:
 216#
 217#   DEFAULT_EDITOR='~/bin/vi',
 218#   DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
 219#   DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
 220
 221GIT-VERSION-FILE: FORCE
 222        @$(SHELL_PATH) ./GIT-VERSION-GEN
 223-include GIT-VERSION-FILE
 224
 225uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
 226uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
 227uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
 228uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 229uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 230uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 231
 232ifdef MSVC
 233        # avoid the MingW and Cygwin configuration sections
 234        uname_S := Windows
 235        uname_O := Windows
 236endif
 237
 238# CFLAGS and LDFLAGS are for the users to override from the command line.
 239
 240CFLAGS = -g -O2 -Wall
 241LDFLAGS =
 242ALL_CFLAGS = $(CFLAGS)
 243ALL_LDFLAGS = $(LDFLAGS)
 244STRIP ?= strip
 245
 246# Among the variables below, these:
 247#   gitexecdir
 248#   template_dir
 249#   mandir
 250#   infodir
 251#   htmldir
 252#   ETC_GITCONFIG (but not sysconfdir)
 253# can be specified as a relative path some/where/else;
 254# this is interpreted as relative to $(prefix) and "git" at
 255# runtime figures out where they are based on the path to the executable.
 256# This can help installing the suite in a relocatable way.
 257
 258prefix = $(HOME)
 259bindir_relative = bin
 260bindir = $(prefix)/$(bindir_relative)
 261mandir = share/man
 262infodir = share/info
 263gitexecdir = libexec/git-core
 264sharedir = $(prefix)/share
 265template_dir = share/git-core/templates
 266htmldir = share/doc/git-doc
 267ifeq ($(prefix),/usr)
 268sysconfdir = /etc
 269ETC_GITCONFIG = $(sysconfdir)/gitconfig
 270else
 271sysconfdir = $(prefix)/etc
 272ETC_GITCONFIG = etc/gitconfig
 273endif
 274lib = lib
 275# DESTDIR=
 276pathsep = :
 277
 278# JavaScript minifier invocation that can function as filter
 279JSMIN =
 280
 281export prefix bindir sharedir sysconfdir
 282
 283CC = gcc
 284AR = ar
 285RM = rm -f
 286TAR = tar
 287FIND = find
 288INSTALL = install
 289RPMBUILD = rpmbuild
 290TCL_PATH = tclsh
 291TCLTK_PATH = wish
 292PTHREAD_LIBS = -lpthread
 293
 294export TCL_PATH TCLTK_PATH
 295
 296# sparse is architecture-neutral, which means that we need to tell it
 297# explicitly what architecture to check for. Fix this up for yours..
 298SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 299
 300
 301
 302### --- END CONFIGURATION SECTION ---
 303
 304# Those must not be GNU-specific; they are shared with perl/ which may
 305# be built by a different compiler. (Note that this is an artifact now
 306# but it still might be nice to keep that distinction.)
 307BASIC_CFLAGS =
 308BASIC_LDFLAGS =
 309
 310# Guard against environment variables
 311BUILTIN_OBJS =
 312BUILT_INS =
 313COMPAT_CFLAGS =
 314COMPAT_OBJS =
 315LIB_H =
 316LIB_OBJS =
 317PROGRAMS =
 318SCRIPT_PERL =
 319SCRIPT_PYTHON =
 320SCRIPT_SH =
 321TEST_PROGRAMS =
 322
 323# Having this variable in your environment would break pipelines because
 324# you cause "cd" to echo its destination to stdout.  It can also take
 325# scripts to unexpected places.  If you like CDPATH, define it for your
 326# interactive shell sessions without exporting it.
 327unexport CDPATH
 328
 329SCRIPT_SH += git-am.sh
 330SCRIPT_SH += git-bisect.sh
 331SCRIPT_SH += git-difftool--helper.sh
 332SCRIPT_SH += git-filter-branch.sh
 333SCRIPT_SH += git-lost-found.sh
 334SCRIPT_SH += git-merge-octopus.sh
 335SCRIPT_SH += git-merge-one-file.sh
 336SCRIPT_SH += git-merge-resolve.sh
 337SCRIPT_SH += git-mergetool.sh
 338SCRIPT_SH += git-mergetool--lib.sh
 339SCRIPT_SH += git-notes.sh
 340SCRIPT_SH += git-parse-remote.sh
 341SCRIPT_SH += git-pull.sh
 342SCRIPT_SH += git-quiltimport.sh
 343SCRIPT_SH += git-rebase--interactive.sh
 344SCRIPT_SH += git-rebase.sh
 345SCRIPT_SH += git-repack.sh
 346SCRIPT_SH += git-request-pull.sh
 347SCRIPT_SH += git-sh-setup.sh
 348SCRIPT_SH += git-stash.sh
 349SCRIPT_SH += git-submodule.sh
 350SCRIPT_SH += git-web--browse.sh
 351
 352SCRIPT_PERL += git-add--interactive.perl
 353SCRIPT_PERL += git-difftool.perl
 354SCRIPT_PERL += git-archimport.perl
 355SCRIPT_PERL += git-cvsexportcommit.perl
 356SCRIPT_PERL += git-cvsimport.perl
 357SCRIPT_PERL += git-cvsserver.perl
 358SCRIPT_PERL += git-relink.perl
 359SCRIPT_PERL += git-send-email.perl
 360SCRIPT_PERL += git-svn.perl
 361
 362SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
 363          $(patsubst %.perl,%,$(SCRIPT_PERL)) \
 364          $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
 365          git-instaweb
 366
 367# Empty...
 368EXTRA_PROGRAMS =
 369
 370# ... and all the rest that could be moved out of bindir to gitexecdir
 371PROGRAMS += $(EXTRA_PROGRAMS)
 372PROGRAMS += git-fast-import$X
 373PROGRAMS += git-imap-send$X
 374PROGRAMS += git-shell$X
 375PROGRAMS += git-show-index$X
 376PROGRAMS += git-upload-pack$X
 377PROGRAMS += git-http-backend$X
 378
 379# List built-in command $C whose implementation cmd_$C() is not in
 380# builtin-$C.o but is linked in as part of some other command.
 381BUILT_INS += $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
 382
 383BUILT_INS += git-cherry$X
 384BUILT_INS += git-cherry-pick$X
 385BUILT_INS += git-format-patch$X
 386BUILT_INS += git-fsck-objects$X
 387BUILT_INS += git-get-tar-commit-id$X
 388BUILT_INS += git-init$X
 389BUILT_INS += git-merge-subtree$X
 390BUILT_INS += git-peek-remote$X
 391BUILT_INS += git-repo-config$X
 392BUILT_INS += git-show$X
 393BUILT_INS += git-stage$X
 394BUILT_INS += git-status$X
 395BUILT_INS += git-whatchanged$X
 396
 397# what 'all' will build and 'install' will install in gitexecdir,
 398# excluding programs for built-in commands
 399ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
 400
 401# what 'all' will build but not install in gitexecdir
 402OTHER_PROGRAMS = git$X
 403
 404# what test wrappers are needed and 'install' will install, in bindir
 405BINDIR_PROGRAMS_NEED_X += git
 406BINDIR_PROGRAMS_NEED_X += git-upload-pack
 407BINDIR_PROGRAMS_NEED_X += git-receive-pack
 408BINDIR_PROGRAMS_NEED_X += git-upload-archive
 409BINDIR_PROGRAMS_NEED_X += git-shell
 410
 411BINDIR_PROGRAMS_NO_X += git-cvsserver
 412
 413# Set paths to tools early so that they can be used for version tests.
 414ifndef SHELL_PATH
 415        SHELL_PATH = /bin/sh
 416endif
 417ifndef PERL_PATH
 418        PERL_PATH = /usr/bin/perl
 419endif
 420ifndef PYTHON_PATH
 421        PYTHON_PATH = /usr/bin/python
 422endif
 423
 424export PERL_PATH
 425export PYTHON_PATH
 426
 427LIB_FILE=libgit.a
 428XDIFF_LIB=xdiff/lib.a
 429
 430LIB_H += advice.h
 431LIB_H += archive.h
 432LIB_H += attr.h
 433LIB_H += blob.h
 434LIB_H += builtin.h
 435LIB_H += cache.h
 436LIB_H += cache-tree.h
 437LIB_H += commit.h
 438LIB_H += compat/bswap.h
 439LIB_H += compat/cygwin.h
 440LIB_H += compat/mingw.h
 441LIB_H += compat/win32/pthread.h
 442LIB_H += csum-file.h
 443LIB_H += decorate.h
 444LIB_H += delta.h
 445LIB_H += diffcore.h
 446LIB_H += diff.h
 447LIB_H += dir.h
 448LIB_H += fsck.h
 449LIB_H += git-compat-util.h
 450LIB_H += graph.h
 451LIB_H += grep.h
 452LIB_H += hash.h
 453LIB_H += help.h
 454LIB_H += levenshtein.h
 455LIB_H += list-objects.h
 456LIB_H += ll-merge.h
 457LIB_H += log-tree.h
 458LIB_H += mailmap.h
 459LIB_H += merge-recursive.h
 460LIB_H += notes.h
 461LIB_H += object.h
 462LIB_H += pack.h
 463LIB_H += pack-refs.h
 464LIB_H += pack-revindex.h
 465LIB_H += parse-options.h
 466LIB_H += patch-ids.h
 467LIB_H += pkt-line.h
 468LIB_H += progress.h
 469LIB_H += quote.h
 470LIB_H += reflog-walk.h
 471LIB_H += refs.h
 472LIB_H += remote.h
 473LIB_H += rerere.h
 474LIB_H += resolve-undo.h
 475LIB_H += revision.h
 476LIB_H += run-command.h
 477LIB_H += sha1-lookup.h
 478LIB_H += sideband.h
 479LIB_H += sigchain.h
 480LIB_H += strbuf.h
 481LIB_H += string-list.h
 482LIB_H += submodule.h
 483LIB_H += tag.h
 484LIB_H += transport.h
 485LIB_H += tree.h
 486LIB_H += tree-walk.h
 487LIB_H += unpack-trees.h
 488LIB_H += userdiff.h
 489LIB_H += utf8.h
 490LIB_H += wt-status.h
 491
 492LIB_OBJS += abspath.o
 493LIB_OBJS += advice.o
 494LIB_OBJS += alias.o
 495LIB_OBJS += alloc.o
 496LIB_OBJS += archive.o
 497LIB_OBJS += archive-tar.o
 498LIB_OBJS += archive-zip.o
 499LIB_OBJS += attr.o
 500LIB_OBJS += base85.o
 501LIB_OBJS += bisect.o
 502LIB_OBJS += blob.o
 503LIB_OBJS += branch.o
 504LIB_OBJS += bundle.o
 505LIB_OBJS += cache-tree.o
 506LIB_OBJS += color.o
 507LIB_OBJS += combine-diff.o
 508LIB_OBJS += commit.o
 509LIB_OBJS += config.o
 510LIB_OBJS += connect.o
 511LIB_OBJS += convert.o
 512LIB_OBJS += copy.o
 513LIB_OBJS += csum-file.o
 514LIB_OBJS += ctype.o
 515LIB_OBJS += date.o
 516LIB_OBJS += decorate.o
 517LIB_OBJS += diffcore-break.o
 518LIB_OBJS += diffcore-delta.o
 519LIB_OBJS += diffcore-order.o
 520LIB_OBJS += diffcore-pickaxe.o
 521LIB_OBJS += diffcore-rename.o
 522LIB_OBJS += diff-delta.o
 523LIB_OBJS += diff-lib.o
 524LIB_OBJS += diff-no-index.o
 525LIB_OBJS += diff.o
 526LIB_OBJS += dir.o
 527LIB_OBJS += editor.o
 528LIB_OBJS += entry.o
 529LIB_OBJS += environment.o
 530LIB_OBJS += exec_cmd.o
 531LIB_OBJS += fsck.o
 532LIB_OBJS += graph.o
 533LIB_OBJS += grep.o
 534LIB_OBJS += hash.o
 535LIB_OBJS += help.o
 536LIB_OBJS += hex.o
 537LIB_OBJS += ident.o
 538LIB_OBJS += levenshtein.o
 539LIB_OBJS += list-objects.o
 540LIB_OBJS += ll-merge.o
 541LIB_OBJS += lockfile.o
 542LIB_OBJS += log-tree.o
 543LIB_OBJS += mailmap.o
 544LIB_OBJS += match-trees.o
 545LIB_OBJS += merge-file.o
 546LIB_OBJS += merge-recursive.o
 547LIB_OBJS += name-hash.o
 548LIB_OBJS += notes.o
 549LIB_OBJS += object.o
 550LIB_OBJS += pack-check.o
 551LIB_OBJS += pack-refs.o
 552LIB_OBJS += pack-revindex.o
 553LIB_OBJS += pack-write.o
 554LIB_OBJS += pager.o
 555LIB_OBJS += parse-options.o
 556LIB_OBJS += patch-delta.o
 557LIB_OBJS += patch-ids.o
 558LIB_OBJS += path.o
 559LIB_OBJS += pkt-line.o
 560LIB_OBJS += preload-index.o
 561LIB_OBJS += pretty.o
 562LIB_OBJS += progress.o
 563LIB_OBJS += quote.o
 564LIB_OBJS += reachable.o
 565LIB_OBJS += read-cache.o
 566LIB_OBJS += reflog-walk.o
 567LIB_OBJS += refs.o
 568LIB_OBJS += remote.o
 569LIB_OBJS += replace_object.o
 570LIB_OBJS += rerere.o
 571LIB_OBJS += resolve-undo.o
 572LIB_OBJS += revision.o
 573LIB_OBJS += run-command.o
 574LIB_OBJS += server-info.o
 575LIB_OBJS += setup.o
 576LIB_OBJS += sha1-lookup.o
 577LIB_OBJS += sha1_file.o
 578LIB_OBJS += sha1_name.o
 579LIB_OBJS += shallow.o
 580LIB_OBJS += sideband.o
 581LIB_OBJS += sigchain.o
 582LIB_OBJS += strbuf.o
 583LIB_OBJS += string-list.o
 584LIB_OBJS += submodule.o
 585LIB_OBJS += symlinks.o
 586LIB_OBJS += tag.o
 587LIB_OBJS += trace.o
 588LIB_OBJS += transport.o
 589LIB_OBJS += transport-helper.o
 590LIB_OBJS += tree-diff.o
 591LIB_OBJS += tree.o
 592LIB_OBJS += tree-walk.o
 593LIB_OBJS += unpack-trees.o
 594LIB_OBJS += usage.o
 595LIB_OBJS += userdiff.o
 596LIB_OBJS += utf8.o
 597LIB_OBJS += walker.o
 598LIB_OBJS += wrapper.o
 599LIB_OBJS += write_or_die.o
 600LIB_OBJS += ws.o
 601LIB_OBJS += wt-status.o
 602LIB_OBJS += xdiff-interface.o
 603
 604BUILTIN_OBJS += builtin-add.o
 605BUILTIN_OBJS += builtin-annotate.o
 606BUILTIN_OBJS += builtin-apply.o
 607BUILTIN_OBJS += builtin-archive.o
 608BUILTIN_OBJS += builtin-bisect--helper.o
 609BUILTIN_OBJS += builtin-blame.o
 610BUILTIN_OBJS += builtin-branch.o
 611BUILTIN_OBJS += builtin-bundle.o
 612BUILTIN_OBJS += builtin-cat-file.o
 613BUILTIN_OBJS += builtin-check-attr.o
 614BUILTIN_OBJS += builtin-check-ref-format.o
 615BUILTIN_OBJS += builtin-checkout-index.o
 616BUILTIN_OBJS += builtin-checkout.o
 617BUILTIN_OBJS += builtin-clean.o
 618BUILTIN_OBJS += builtin-clone.o
 619BUILTIN_OBJS += builtin-commit-tree.o
 620BUILTIN_OBJS += builtin-commit.o
 621BUILTIN_OBJS += builtin-config.o
 622BUILTIN_OBJS += builtin-count-objects.o
 623BUILTIN_OBJS += builtin-describe.o
 624BUILTIN_OBJS += builtin-diff-files.o
 625BUILTIN_OBJS += builtin-diff-index.o
 626BUILTIN_OBJS += builtin-diff-tree.o
 627BUILTIN_OBJS += builtin-diff.o
 628BUILTIN_OBJS += builtin-fast-export.o
 629BUILTIN_OBJS += builtin-fetch-pack.o
 630BUILTIN_OBJS += builtin-fetch.o
 631BUILTIN_OBJS += builtin-fmt-merge-msg.o
 632BUILTIN_OBJS += builtin-for-each-ref.o
 633BUILTIN_OBJS += builtin-fsck.o
 634BUILTIN_OBJS += builtin-gc.o
 635BUILTIN_OBJS += builtin-grep.o
 636BUILTIN_OBJS += builtin-hash-object.o
 637BUILTIN_OBJS += builtin-help.o
 638BUILTIN_OBJS += builtin-index-pack.o
 639BUILTIN_OBJS += builtin-init-db.o
 640BUILTIN_OBJS += builtin-log.o
 641BUILTIN_OBJS += builtin-ls-files.o
 642BUILTIN_OBJS += builtin-ls-remote.o
 643BUILTIN_OBJS += builtin-ls-tree.o
 644BUILTIN_OBJS += builtin-mailinfo.o
 645BUILTIN_OBJS += builtin-mailsplit.o
 646BUILTIN_OBJS += builtin-merge.o
 647BUILTIN_OBJS += builtin-merge-base.o
 648BUILTIN_OBJS += builtin-merge-file.o
 649BUILTIN_OBJS += builtin-merge-index.o
 650BUILTIN_OBJS += builtin-merge-ours.o
 651BUILTIN_OBJS += builtin-merge-recursive.o
 652BUILTIN_OBJS += builtin-merge-tree.o
 653BUILTIN_OBJS += builtin-mktag.o
 654BUILTIN_OBJS += builtin-mktree.o
 655BUILTIN_OBJS += builtin-mv.o
 656BUILTIN_OBJS += builtin-name-rev.o
 657BUILTIN_OBJS += builtin-pack-objects.o
 658BUILTIN_OBJS += builtin-pack-redundant.o
 659BUILTIN_OBJS += builtin-pack-refs.o
 660BUILTIN_OBJS += builtin-patch-id.o
 661BUILTIN_OBJS += builtin-prune-packed.o
 662BUILTIN_OBJS += builtin-prune.o
 663BUILTIN_OBJS += builtin-push.o
 664BUILTIN_OBJS += builtin-read-tree.o
 665BUILTIN_OBJS += builtin-receive-pack.o
 666BUILTIN_OBJS += builtin-reflog.o
 667BUILTIN_OBJS += builtin-remote.o
 668BUILTIN_OBJS += builtin-replace.o
 669BUILTIN_OBJS += builtin-rerere.o
 670BUILTIN_OBJS += builtin-reset.o
 671BUILTIN_OBJS += builtin-rev-list.o
 672BUILTIN_OBJS += builtin-rev-parse.o
 673BUILTIN_OBJS += builtin-revert.o
 674BUILTIN_OBJS += builtin-rm.o
 675BUILTIN_OBJS += builtin-send-pack.o
 676BUILTIN_OBJS += builtin-shortlog.o
 677BUILTIN_OBJS += builtin-show-branch.o
 678BUILTIN_OBJS += builtin-show-ref.o
 679BUILTIN_OBJS += builtin-stripspace.o
 680BUILTIN_OBJS += builtin-symbolic-ref.o
 681BUILTIN_OBJS += builtin-tag.o
 682BUILTIN_OBJS += builtin-tar-tree.o
 683BUILTIN_OBJS += builtin-unpack-file.o
 684BUILTIN_OBJS += builtin-unpack-objects.o
 685BUILTIN_OBJS += builtin-update-index.o
 686BUILTIN_OBJS += builtin-update-ref.o
 687BUILTIN_OBJS += builtin-update-server-info.o
 688BUILTIN_OBJS += builtin-upload-archive.o
 689BUILTIN_OBJS += builtin-var.o
 690BUILTIN_OBJS += builtin-verify-pack.o
 691BUILTIN_OBJS += builtin-verify-tag.o
 692BUILTIN_OBJS += builtin-write-tree.o
 693
 694GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
 695EXTLIBS =
 696
 697#
 698# Platform specific tweaks
 699#
 700
 701# We choose to avoid "if .. else if .. else .. endif endif"
 702# because maintaining the nesting to match is a pain.  If
 703# we had "elif" things would have been much nicer...
 704
 705ifeq ($(uname_S),Linux)
 706        NO_STRLCPY = YesPlease
 707        NO_MKSTEMPS = YesPlease
 708        HAVE_PATHS_H = YesPlease
 709endif
 710ifeq ($(uname_S),GNU/kFreeBSD)
 711        NO_STRLCPY = YesPlease
 712        NO_MKSTEMPS = YesPlease
 713        HAVE_PATHS_H = YesPlease
 714endif
 715ifeq ($(uname_S),UnixWare)
 716        CC = cc
 717        NEEDS_SOCKET = YesPlease
 718        NEEDS_NSL = YesPlease
 719        NEEDS_SSL_WITH_CRYPTO = YesPlease
 720        NEEDS_LIBICONV = YesPlease
 721        SHELL_PATH = /usr/local/bin/bash
 722        NO_IPV6 = YesPlease
 723        NO_HSTRERROR = YesPlease
 724        NO_MKSTEMPS = YesPlease
 725        BASIC_CFLAGS += -Kthread
 726        BASIC_CFLAGS += -I/usr/local/include
 727        BASIC_LDFLAGS += -L/usr/local/lib
 728        INSTALL = ginstall
 729        TAR = gtar
 730        NO_STRCASESTR = YesPlease
 731        NO_MEMMEM = YesPlease
 732endif
 733ifeq ($(uname_S),SCO_SV)
 734        ifeq ($(uname_R),3.2)
 735                CFLAGS = -O2
 736        endif
 737        ifeq ($(uname_R),5)
 738                CC = cc
 739                BASIC_CFLAGS += -Kthread
 740        endif
 741        NEEDS_SOCKET = YesPlease
 742        NEEDS_NSL = YesPlease
 743        NEEDS_SSL_WITH_CRYPTO = YesPlease
 744        NEEDS_LIBICONV = YesPlease
 745        SHELL_PATH = /usr/bin/bash
 746        NO_IPV6 = YesPlease
 747        NO_HSTRERROR = YesPlease
 748        NO_MKSTEMPS = YesPlease
 749        BASIC_CFLAGS += -I/usr/local/include
 750        BASIC_LDFLAGS += -L/usr/local/lib
 751        NO_STRCASESTR = YesPlease
 752        NO_MEMMEM = YesPlease
 753        INSTALL = ginstall
 754        TAR = gtar
 755endif
 756ifeq ($(uname_S),Darwin)
 757        NEEDS_CRYPTO_WITH_SSL = YesPlease
 758        NEEDS_SSL_WITH_CRYPTO = YesPlease
 759        NEEDS_LIBICONV = YesPlease
 760        ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
 761                OLD_ICONV = UnfortunatelyYes
 762        endif
 763        ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
 764                NO_STRLCPY = YesPlease
 765        endif
 766        NO_MEMMEM = YesPlease
 767        USE_ST_TIMESPEC = YesPlease
 768endif
 769ifeq ($(uname_S),SunOS)
 770        NEEDS_SOCKET = YesPlease
 771        NEEDS_NSL = YesPlease
 772        SHELL_PATH = /bin/bash
 773        SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
 774        NO_STRCASESTR = YesPlease
 775        NO_MEMMEM = YesPlease
 776        NO_MKDTEMP = YesPlease
 777        NO_MKSTEMPS = YesPlease
 778        NO_REGEX = YesPlease
 779        ifeq ($(uname_R),5.7)
 780                NEEDS_RESOLV = YesPlease
 781                NO_IPV6 = YesPlease
 782                NO_SOCKADDR_STORAGE = YesPlease
 783                NO_UNSETENV = YesPlease
 784                NO_SETENV = YesPlease
 785                NO_STRLCPY = YesPlease
 786                NO_C99_FORMAT = YesPlease
 787                NO_STRTOUMAX = YesPlease
 788        endif
 789        ifeq ($(uname_R),5.8)
 790                NO_UNSETENV = YesPlease
 791                NO_SETENV = YesPlease
 792                NO_C99_FORMAT = YesPlease
 793                NO_STRTOUMAX = YesPlease
 794        endif
 795        ifeq ($(uname_R),5.9)
 796                NO_UNSETENV = YesPlease
 797                NO_SETENV = YesPlease
 798                NO_C99_FORMAT = YesPlease
 799                NO_STRTOUMAX = YesPlease
 800        endif
 801        INSTALL = /usr/ucb/install
 802        TAR = gtar
 803        BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
 804endif
 805ifeq ($(uname_O),Cygwin)
 806        NO_D_TYPE_IN_DIRENT = YesPlease
 807        NO_D_INO_IN_DIRENT = YesPlease
 808        NO_STRCASESTR = YesPlease
 809        NO_MEMMEM = YesPlease
 810        NO_MKSTEMPS = YesPlease
 811        NO_SYMLINK_HEAD = YesPlease
 812        NEEDS_LIBICONV = YesPlease
 813        NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
 814        NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
 815        OLD_ICONV = UnfortunatelyYes
 816        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 817        # There are conflicting reports about this.
 818        # On some boxes NO_MMAP is needed, and not so elsewhere.
 819        # Try commenting this out if you suspect MMAP is more efficient
 820        NO_MMAP = YesPlease
 821        NO_IPV6 = YesPlease
 822        X = .exe
 823        COMPAT_OBJS += compat/cygwin.o
 824        UNRELIABLE_FSTAT = UnfortunatelyYes
 825endif
 826ifeq ($(uname_S),FreeBSD)
 827        NEEDS_LIBICONV = YesPlease
 828        OLD_ICONV = YesPlease
 829        NO_MEMMEM = YesPlease
 830        BASIC_CFLAGS += -I/usr/local/include
 831        BASIC_LDFLAGS += -L/usr/local/lib
 832        DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
 833        USE_ST_TIMESPEC = YesPlease
 834        ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
 835                PTHREAD_LIBS = -pthread
 836                NO_UINTMAX_T = YesPlease
 837                NO_STRTOUMAX = YesPlease
 838        endif
 839        PYTHON_PATH = /usr/local/bin/python
 840        HAVE_PATHS_H = YesPlease
 841endif
 842ifeq ($(uname_S),OpenBSD)
 843        NO_STRCASESTR = YesPlease
 844        NO_MEMMEM = YesPlease
 845        USE_ST_TIMESPEC = YesPlease
 846        NEEDS_LIBICONV = YesPlease
 847        BASIC_CFLAGS += -I/usr/local/include
 848        BASIC_LDFLAGS += -L/usr/local/lib
 849        HAVE_PATHS_H = YesPlease
 850endif
 851ifeq ($(uname_S),NetBSD)
 852        ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
 853                NEEDS_LIBICONV = YesPlease
 854        endif
 855        BASIC_CFLAGS += -I/usr/pkg/include
 856        BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
 857        USE_ST_TIMESPEC = YesPlease
 858        NO_MKSTEMPS = YesPlease
 859        HAVE_PATHS_H = YesPlease
 860endif
 861ifeq ($(uname_S),AIX)
 862        NO_STRCASESTR=YesPlease
 863        NO_MEMMEM = YesPlease
 864        NO_MKDTEMP = YesPlease
 865        NO_MKSTEMPS = YesPlease
 866        NO_STRLCPY = YesPlease
 867        NO_NSEC = YesPlease
 868        FREAD_READS_DIRECTORIES = UnfortunatelyYes
 869        INTERNAL_QSORT = UnfortunatelyYes
 870        NEEDS_LIBICONV=YesPlease
 871        BASIC_CFLAGS += -D_LARGE_FILES
 872        ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
 873                NO_PTHREADS = YesPlease
 874        endif
 875endif
 876ifeq ($(uname_S),GNU)
 877        # GNU/Hurd
 878        NO_STRLCPY=YesPlease
 879        NO_MKSTEMPS = YesPlease
 880        HAVE_PATHS_H = YesPlease
 881endif
 882ifeq ($(uname_S),IRIX)
 883        NO_SETENV = YesPlease
 884        NO_UNSETENV = YesPlease
 885        NO_STRCASESTR = YesPlease
 886        NO_MEMMEM = YesPlease
 887        NO_MKSTEMPS = YesPlease
 888        NO_MKDTEMP = YesPlease
 889        # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
 890        # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
 891        # git dies with a segmentation fault when trying to access the first
 892        # entry of a reflog.  The conservative choice is made to always set
 893        # NO_MMAP.  If you suspect that your compiler is not affected by this
 894        # issue, comment out the NO_MMAP statement.
 895        NO_MMAP = YesPlease
 896        SNPRINTF_RETURNS_BOGUS = YesPlease
 897        SHELL_PATH = /usr/gnu/bin/bash
 898        NEEDS_LIBGEN = YesPlease
 899        NEEDS_LIBICONV = YesPlease
 900endif
 901ifeq ($(uname_S),IRIX64)
 902        NO_SETENV=YesPlease
 903        NO_UNSETENV = YesPlease
 904        NO_STRCASESTR=YesPlease
 905        NO_MEMMEM = YesPlease
 906        NO_MKSTEMPS = YesPlease
 907        NO_MKDTEMP = YesPlease
 908        # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
 909        # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
 910        # git dies with a segmentation fault when trying to access the first
 911        # entry of a reflog.  The conservative choice is made to always set
 912        # NO_MMAP.  If you suspect that your compiler is not affected by this
 913        # issue, comment out the NO_MMAP statement.
 914        NO_MMAP = YesPlease
 915        SNPRINTF_RETURNS_BOGUS = YesPlease
 916        SHELL_PATH=/usr/gnu/bin/bash
 917        NEEDS_LIBGEN = YesPlease
 918        NEEDS_LIBICONV = YesPlease
 919endif
 920ifeq ($(uname_S),HP-UX)
 921        NO_IPV6=YesPlease
 922        NO_SETENV=YesPlease
 923        NO_STRCASESTR=YesPlease
 924        NO_MEMMEM = YesPlease
 925        NO_MKSTEMPS = YesPlease
 926        NO_STRLCPY = YesPlease
 927        NO_MKDTEMP = YesPlease
 928        NO_UNSETENV = YesPlease
 929        NO_HSTRERROR = YesPlease
 930        NO_SYS_SELECT_H = YesPlease
 931        SNPRINTF_RETURNS_BOGUS = YesPlease
 932endif
 933ifeq ($(uname_S),Windows)
 934        GIT_VERSION := $(GIT_VERSION).MSVC
 935        pathsep = ;
 936        NO_PREAD = YesPlease
 937        NEEDS_CRYPTO_WITH_SSL = YesPlease
 938        NO_LIBGEN_H = YesPlease
 939        NO_SYMLINK_HEAD = YesPlease
 940        NO_IPV6 = YesPlease
 941        NO_SETENV = YesPlease
 942        NO_UNSETENV = YesPlease
 943        NO_STRCASESTR = YesPlease
 944        NO_STRLCPY = YesPlease
 945        NO_MEMMEM = YesPlease
 946        # NEEDS_LIBICONV = YesPlease
 947        NO_ICONV = YesPlease
 948        NO_C99_FORMAT = YesPlease
 949        NO_STRTOUMAX = YesPlease
 950        NO_STRTOULL = YesPlease
 951        NO_MKDTEMP = YesPlease
 952        NO_MKSTEMPS = YesPlease
 953        SNPRINTF_RETURNS_BOGUS = YesPlease
 954        NO_SVN_TESTS = YesPlease
 955        NO_PERL_MAKEMAKER = YesPlease
 956        RUNTIME_PREFIX = YesPlease
 957        NO_POSIX_ONLY_PROGRAMS = YesPlease
 958        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 959        NO_NSEC = YesPlease
 960        USE_WIN32_MMAP = YesPlease
 961        # USE_NED_ALLOCATOR = YesPlease
 962        UNRELIABLE_FSTAT = UnfortunatelyYes
 963        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
 964        NO_REGEX = YesPlease
 965        NO_CURL = YesPlease
 966        NO_PYTHON = YesPlease
 967        BLK_SHA1 = YesPlease
 968
 969        CC = compat/vcbuild/scripts/clink.pl
 970        AR = compat/vcbuild/scripts/lib.pl
 971        CFLAGS =
 972        BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
 973        COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o
 974        COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 975        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
 976        EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
 977        PTHREAD_LIBS =
 978        lib =
 979ifndef DEBUG
 980        BASIC_CFLAGS += -GL -Os -MT
 981        BASIC_LDFLAGS += -LTCG
 982        AR += -LTCG
 983else
 984        BASIC_CFLAGS += -Zi -MTd
 985endif
 986        X = .exe
 987endif
 988ifneq (,$(findstring MINGW,$(uname_S)))
 989        pathsep = ;
 990        NO_PREAD = YesPlease
 991        NEEDS_CRYPTO_WITH_SSL = YesPlease
 992        NO_LIBGEN_H = YesPlease
 993        NO_SYMLINK_HEAD = YesPlease
 994        NO_SETENV = YesPlease
 995        NO_UNSETENV = YesPlease
 996        NO_STRCASESTR = YesPlease
 997        NO_STRLCPY = YesPlease
 998        NO_MEMMEM = YesPlease
 999        NEEDS_LIBICONV = YesPlease
1000        OLD_ICONV = YesPlease
1001        NO_C99_FORMAT = YesPlease
1002        NO_STRTOUMAX = YesPlease
1003        NO_MKDTEMP = YesPlease
1004        NO_MKSTEMPS = YesPlease
1005        SNPRINTF_RETURNS_BOGUS = YesPlease
1006        NO_SVN_TESTS = YesPlease
1007        NO_PERL_MAKEMAKER = YesPlease
1008        RUNTIME_PREFIX = YesPlease
1009        NO_POSIX_ONLY_PROGRAMS = YesPlease
1010        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
1011        NO_NSEC = YesPlease
1012        USE_WIN32_MMAP = YesPlease
1013        USE_NED_ALLOCATOR = YesPlease
1014        UNRELIABLE_FSTAT = UnfortunatelyYes
1015        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
1016        NO_REGEX = YesPlease
1017        NO_PYTHON = YesPlease
1018        BLK_SHA1 = YesPlease
1019        COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
1020        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
1021        COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
1022                compat/win32/pthread.o
1023        EXTLIBS += -lws2_32
1024        PTHREAD_LIBS =
1025        X = .exe
1026ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
1027        htmldir=doc/git/html/
1028        prefix =
1029        INSTALL = /bin/install
1030        EXTLIBS += /mingw/lib/libz.a
1031        NO_R_TO_GCC_LINKER = YesPlease
1032        INTERNAL_QSORT = YesPlease
1033else
1034        NO_CURL = YesPlease
1035endif
1036endif
1037
1038-include config.mak.autogen
1039-include config.mak
1040
1041ifdef SANE_TOOL_PATH
1042SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
1043BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
1044PATH := $(SANE_TOOL_PATH):${PATH}
1045else
1046BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
1047endif
1048
1049ifeq ($(uname_S),Darwin)
1050        ifndef NO_FINK
1051                ifeq ($(shell test -d /sw/lib && echo y),y)
1052                        BASIC_CFLAGS += -I/sw/include
1053                        BASIC_LDFLAGS += -L/sw/lib
1054                endif
1055        endif
1056        ifndef NO_DARWIN_PORTS
1057                ifeq ($(shell test -d /opt/local/lib && echo y),y)
1058                        BASIC_CFLAGS += -I/opt/local/include
1059                        BASIC_LDFLAGS += -L/opt/local/lib
1060                endif
1061        endif
1062        PTHREAD_LIBS =
1063endif
1064
1065ifndef CC_LD_DYNPATH
1066        ifdef NO_R_TO_GCC_LINKER
1067                # Some gcc does not accept and pass -R to the linker to specify
1068                # the runtime dynamic library path.
1069                CC_LD_DYNPATH = -Wl,-rpath,
1070        else
1071                CC_LD_DYNPATH = -R
1072        endif
1073endif
1074
1075ifdef NO_LIBGEN_H
1076        COMPAT_CFLAGS += -DNO_LIBGEN_H
1077        COMPAT_OBJS += compat/basename.o
1078endif
1079
1080ifdef NO_CURL
1081        BASIC_CFLAGS += -DNO_CURL
1082        REMOTE_CURL_PRIMARY =
1083        REMOTE_CURL_ALIASES =
1084        REMOTE_CURL_NAMES =
1085else
1086        ifdef CURLDIR
1087                # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
1088                BASIC_CFLAGS += -I$(CURLDIR)/include
1089                CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
1090        else
1091                CURL_LIBCURL = -lcurl
1092        endif
1093        REMOTE_CURL_PRIMARY = git-remote-http$X
1094        REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1095        REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
1096        PROGRAMS += $(REMOTE_CURL_NAMES) git-http-fetch$X
1097        curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
1098        ifeq "$(curl_check)" "070908"
1099                ifndef NO_EXPAT
1100                        PROGRAMS += git-http-push$X
1101                endif
1102        endif
1103        ifndef NO_EXPAT
1104                ifdef EXPATDIR
1105                        BASIC_CFLAGS += -I$(EXPATDIR)/include
1106                        EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1107                else
1108                        EXPAT_LIBEXPAT = -lexpat
1109                endif
1110        endif
1111endif
1112
1113ifdef ZLIB_PATH
1114        BASIC_CFLAGS += -I$(ZLIB_PATH)/include
1115        EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
1116endif
1117EXTLIBS += -lz
1118
1119ifndef NO_POSIX_ONLY_PROGRAMS
1120        PROGRAMS += git-daemon$X
1121endif
1122ifndef NO_OPENSSL
1123        OPENSSL_LIBSSL = -lssl
1124        ifdef OPENSSLDIR
1125                BASIC_CFLAGS += -I$(OPENSSLDIR)/include
1126                OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
1127        else
1128                OPENSSL_LINK =
1129        endif
1130        ifdef NEEDS_CRYPTO_WITH_SSL
1131                OPENSSL_LINK += -lcrypto
1132        endif
1133else
1134        BASIC_CFLAGS += -DNO_OPENSSL
1135        BLK_SHA1 = 1
1136        OPENSSL_LIBSSL =
1137endif
1138ifdef NEEDS_SSL_WITH_CRYPTO
1139        LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
1140else
1141        LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
1142endif
1143ifdef NEEDS_LIBICONV
1144        ifdef ICONVDIR
1145                BASIC_CFLAGS += -I$(ICONVDIR)/include
1146                ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1147        else
1148                ICONV_LINK =
1149        endif
1150        EXTLIBS += $(ICONV_LINK) -liconv
1151endif
1152ifdef NEEDS_LIBGEN
1153        EXTLIBS += -lgen
1154endif
1155ifdef NEEDS_SOCKET
1156        EXTLIBS += -lsocket
1157endif
1158ifdef NEEDS_NSL
1159        EXTLIBS += -lnsl
1160endif
1161ifdef NEEDS_RESOLV
1162        EXTLIBS += -lresolv
1163endif
1164ifdef NO_D_TYPE_IN_DIRENT
1165        BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
1166endif
1167ifdef NO_D_INO_IN_DIRENT
1168        BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
1169endif
1170ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1171        BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1172endif
1173ifdef USE_NSEC
1174        BASIC_CFLAGS += -DUSE_NSEC
1175endif
1176ifdef USE_ST_TIMESPEC
1177        BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1178endif
1179ifdef NO_NSEC
1180        BASIC_CFLAGS += -DNO_NSEC
1181endif
1182ifdef NO_C99_FORMAT
1183        BASIC_CFLAGS += -DNO_C99_FORMAT
1184endif
1185ifdef SNPRINTF_RETURNS_BOGUS
1186        COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1187        COMPAT_OBJS += compat/snprintf.o
1188endif
1189ifdef FREAD_READS_DIRECTORIES
1190        COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1191        COMPAT_OBJS += compat/fopen.o
1192endif
1193ifdef NO_SYMLINK_HEAD
1194        BASIC_CFLAGS += -DNO_SYMLINK_HEAD
1195endif
1196ifdef NO_STRCASESTR
1197        COMPAT_CFLAGS += -DNO_STRCASESTR
1198        COMPAT_OBJS += compat/strcasestr.o
1199endif
1200ifdef NO_STRLCPY
1201        COMPAT_CFLAGS += -DNO_STRLCPY
1202        COMPAT_OBJS += compat/strlcpy.o
1203endif
1204ifdef NO_STRTOUMAX
1205        COMPAT_CFLAGS += -DNO_STRTOUMAX
1206        COMPAT_OBJS += compat/strtoumax.o
1207endif
1208ifdef NO_STRTOULL
1209        COMPAT_CFLAGS += -DNO_STRTOULL
1210endif
1211ifdef NO_SETENV
1212        COMPAT_CFLAGS += -DNO_SETENV
1213        COMPAT_OBJS += compat/setenv.o
1214endif
1215ifdef NO_MKDTEMP
1216        COMPAT_CFLAGS += -DNO_MKDTEMP
1217        COMPAT_OBJS += compat/mkdtemp.o
1218endif
1219ifdef NO_MKSTEMPS
1220        COMPAT_CFLAGS += -DNO_MKSTEMPS
1221endif
1222ifdef NO_UNSETENV
1223        COMPAT_CFLAGS += -DNO_UNSETENV
1224        COMPAT_OBJS += compat/unsetenv.o
1225endif
1226ifdef NO_SYS_SELECT_H
1227        BASIC_CFLAGS += -DNO_SYS_SELECT_H
1228endif
1229ifdef NO_MMAP
1230        COMPAT_CFLAGS += -DNO_MMAP
1231        COMPAT_OBJS += compat/mmap.o
1232else
1233        ifdef USE_WIN32_MMAP
1234                COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1235                COMPAT_OBJS += compat/win32mmap.o
1236        endif
1237endif
1238ifdef OBJECT_CREATION_USES_RENAMES
1239        COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
1240endif
1241ifdef NO_PREAD
1242        COMPAT_CFLAGS += -DNO_PREAD
1243        COMPAT_OBJS += compat/pread.o
1244endif
1245ifdef NO_FAST_WORKING_DIRECTORY
1246        BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1247endif
1248ifdef NO_TRUSTABLE_FILEMODE
1249        BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1250endif
1251ifdef NO_IPV6
1252        BASIC_CFLAGS += -DNO_IPV6
1253endif
1254ifdef NO_UINTMAX_T
1255        BASIC_CFLAGS += -Duintmax_t=uint32_t
1256endif
1257ifdef NO_SOCKADDR_STORAGE
1258ifdef NO_IPV6
1259        BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
1260else
1261        BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
1262endif
1263endif
1264ifdef NO_INET_NTOP
1265        LIB_OBJS += compat/inet_ntop.o
1266endif
1267ifdef NO_INET_PTON
1268        LIB_OBJS += compat/inet_pton.o
1269endif
1270
1271ifdef NO_ICONV
1272        BASIC_CFLAGS += -DNO_ICONV
1273endif
1274
1275ifdef OLD_ICONV
1276        BASIC_CFLAGS += -DOLD_ICONV
1277endif
1278
1279ifdef NO_DEFLATE_BOUND
1280        BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1281endif
1282
1283ifdef BLK_SHA1
1284        SHA1_HEADER = "block-sha1/sha1.h"
1285        LIB_OBJS += block-sha1/sha1.o
1286else
1287ifdef PPC_SHA1
1288        SHA1_HEADER = "ppc/sha1.h"
1289        LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
1290else
1291        SHA1_HEADER = <openssl/sha.h>
1292        EXTLIBS += $(LIB_4_CRYPTO)
1293endif
1294endif
1295ifdef NO_PERL_MAKEMAKER
1296        export NO_PERL_MAKEMAKER
1297endif
1298ifdef NO_HSTRERROR
1299        COMPAT_CFLAGS += -DNO_HSTRERROR
1300        COMPAT_OBJS += compat/hstrerror.o
1301endif
1302ifdef NO_MEMMEM
1303        COMPAT_CFLAGS += -DNO_MEMMEM
1304        COMPAT_OBJS += compat/memmem.o
1305endif
1306ifdef INTERNAL_QSORT
1307        COMPAT_CFLAGS += -DINTERNAL_QSORT
1308        COMPAT_OBJS += compat/qsort.o
1309endif
1310ifdef RUNTIME_PREFIX
1311        COMPAT_CFLAGS += -DRUNTIME_PREFIX
1312endif
1313
1314ifdef NO_PTHREADS
1315        BASIC_CFLAGS += -DNO_PTHREADS
1316else
1317        EXTLIBS += $(PTHREAD_LIBS)
1318        LIB_OBJS += thread-utils.o
1319endif
1320
1321ifdef HAVE_PATHS_H
1322        BASIC_CFLAGS += -DHAVE_PATHS_H
1323endif
1324
1325ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1326        COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1327endif
1328ifdef UNRELIABLE_FSTAT
1329        BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1330endif
1331ifdef NO_REGEX
1332        COMPAT_CFLAGS += -Icompat/regex
1333        COMPAT_OBJS += compat/regex/regex.o
1334endif
1335
1336ifdef USE_NED_ALLOCATOR
1337       COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
1338       COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1339endif
1340
1341ifeq ($(TCLTK_PATH),)
1342NO_TCLTK=NoThanks
1343endif
1344
1345ifeq ($(PERL_PATH),)
1346NO_PERL=NoThanks
1347endif
1348
1349ifeq ($(PYTHON_PATH),)
1350NO_PYTHON=NoThanks
1351endif
1352
1353QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
1354QUIET_SUBDIR1  =
1355
1356ifneq ($(findstring $(MAKEFLAGS),w),w)
1357PRINT_DIR = --no-print-directory
1358else # "make -w"
1359NO_SUBDIR = :
1360endif
1361
1362ifneq ($(findstring $(MAKEFLAGS),s),s)
1363ifndef V
1364        QUIET_CC       = @echo '   ' CC $@;
1365        QUIET_AR       = @echo '   ' AR $@;
1366        QUIET_LINK     = @echo '   ' LINK $@;
1367        QUIET_BUILT_IN = @echo '   ' BUILTIN $@;
1368        QUIET_GEN      = @echo '   ' GEN $@;
1369        QUIET_LNCP     = @echo '   ' LN/CP $@;
1370        QUIET_SUBDIR0  = +@subdir=
1371        QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
1372                         $(MAKE) $(PRINT_DIR) -C $$subdir
1373        export V
1374        export QUIET_GEN
1375        export QUIET_BUILT_IN
1376endif
1377endif
1378
1379ifdef ASCIIDOC8
1380        export ASCIIDOC8
1381endif
1382
1383# Shell quote (do not use $(call) to accommodate ancient setups);
1384
1385SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
1386ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
1387
1388DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1389bindir_SQ = $(subst ','\'',$(bindir))
1390bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
1391mandir_SQ = $(subst ','\'',$(mandir))
1392infodir_SQ = $(subst ','\'',$(infodir))
1393gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
1394template_dir_SQ = $(subst ','\'',$(template_dir))
1395htmldir_SQ = $(subst ','\'',$(htmldir))
1396prefix_SQ = $(subst ','\'',$(prefix))
1397
1398SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
1399PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
1400PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
1401TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
1402
1403LIBS = $(GITLIBS) $(EXTLIBS)
1404
1405BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
1406        $(COMPAT_CFLAGS)
1407LIB_OBJS += $(COMPAT_OBJS)
1408
1409# Quote for C
1410
1411ifdef DEFAULT_EDITOR
1412DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
1413DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
1414
1415BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
1416endif
1417
1418ifdef DEFAULT_PAGER
1419DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
1420DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
1421
1422BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
1423endif
1424
1425ALL_CFLAGS += $(BASIC_CFLAGS)
1426ALL_LDFLAGS += $(BASIC_LDFLAGS)
1427
1428export TAR INSTALL DESTDIR SHELL_PATH
1429
1430
1431### Build rules
1432
1433SHELL = $(SHELL_PATH)
1434
1435all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
1436ifneq (,$X)
1437        $(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';)
1438endif
1439
1440all::
1441ifndef NO_TCLTK
1442        $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
1443        $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
1444endif
1445ifndef NO_PERL
1446        $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
1447endif
1448ifndef NO_PYTHON
1449        $(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
1450endif
1451        $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
1452
1453please_set_SHELL_PATH_to_a_more_modern_shell:
1454        @$$(:)
1455
1456shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
1457
1458strip: $(PROGRAMS) git$X
1459        $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
1460
1461git.o: common-cmds.h
1462git.s git.o: ALL_CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' \
1463        '-DGIT_HTML_PATH="$(htmldir_SQ)"'
1464
1465git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
1466        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
1467                $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
1468
1469builtin-help.o: common-cmds.h
1470builtin-help.s builtin-help.o: ALL_CFLAGS += \
1471        '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
1472        '-DGIT_MAN_PATH="$(mandir_SQ)"' \
1473        '-DGIT_INFO_PATH="$(infodir_SQ)"'
1474
1475$(BUILT_INS): git$X
1476        $(QUIET_BUILT_IN)$(RM) $@ && \
1477        ln git$X $@ 2>/dev/null || \
1478        ln -s git$X $@ 2>/dev/null || \
1479        cp git$X $@
1480
1481common-cmds.h: ./generate-cmdlist.sh command-list.txt
1482
1483common-cmds.h: $(wildcard Documentation/git-*.txt)
1484        $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
1485
1486$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
1487        $(QUIET_GEN)$(RM) $@ $@+ && \
1488        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1489            -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1490            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1491            -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1492            -e $(BROKEN_PATH_FIX) \
1493            $@.sh >$@+ && \
1494        chmod +x $@+ && \
1495        mv $@+ $@
1496
1497ifndef NO_PERL
1498$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
1499
1500perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
1501        $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
1502
1503$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
1504        $(QUIET_GEN)$(RM) $@ $@+ && \
1505        INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
1506        sed -e '1{' \
1507            -e '        s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1508            -e '        h' \
1509            -e '        s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
1510            -e '        H' \
1511            -e '        x' \
1512            -e '}' \
1513            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
1514            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1515            $@.perl >$@+ && \
1516        chmod +x $@+ && \
1517        mv $@+ $@
1518
1519
1520.PHONY: gitweb
1521gitweb:
1522        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
1523
1524ifdef JSMIN
1525OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js
1526gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js
1527else
1528OTHER_PROGRAMS += gitweb/gitweb.cgi
1529gitweb/gitweb.cgi: gitweb/gitweb.perl
1530endif
1531        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1532
1533ifdef JSMIN
1534gitweb/gitweb.min.js: gitweb/gitweb.js
1535        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1536endif # JSMIN
1537
1538
1539git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
1540        $(QUIET_GEN)$(RM) $@ $@+ && \
1541        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1542            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1543            -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1544            -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
1545            -e '/@@GITWEB_CGI@@/d' \
1546            -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
1547            -e '/@@GITWEB_CSS@@/d' \
1548            -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \
1549            -e '/@@GITWEB_JS@@/d' \
1550            -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
1551            $@.sh > $@+ && \
1552        chmod +x $@+ && \
1553        mv $@+ $@
1554else # NO_PERL
1555$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
1556        $(QUIET_GEN)$(RM) $@ $@+ && \
1557        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1558            -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
1559            unimplemented.sh >$@+ && \
1560        chmod +x $@+ && \
1561        mv $@+ $@
1562endif # NO_PERL
1563
1564ifndef NO_PYTHON
1565$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
1566$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
1567        $(QUIET_GEN)$(RM) $@ $@+ && \
1568        INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
1569                --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
1570                instlibdir` && \
1571        sed -e '1{' \
1572            -e '        s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
1573            -e '}' \
1574            -e 's|^import sys.*|&; \\\
1575                   import os; \\\
1576                   sys.path[0] = os.environ.has_key("GITPYTHONLIB") and \\\
1577                                 os.environ["GITPYTHONLIB"] or \\\
1578                                 "@@INSTLIBDIR@@"|' \
1579            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
1580            $@.py >$@+ && \
1581        chmod +x $@+ && \
1582        mv $@+ $@
1583else # NO_PYTHON
1584$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh
1585        $(QUIET_GEN)$(RM) $@ $@+ && \
1586        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1587            -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
1588            unimplemented.sh >$@+ && \
1589        chmod +x $@+ && \
1590        mv $@+ $@
1591endif # NO_PYTHON
1592
1593configure: configure.ac
1594        $(QUIET_GEN)$(RM) $@ $<+ && \
1595        sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1596            $< > $<+ && \
1597        autoconf -o $@ $<+ && \
1598        $(RM) $<+
1599
1600# These can record GIT_VERSION
1601git.o git.spec \
1602        $(patsubst %.sh,%,$(SCRIPT_SH)) \
1603        $(patsubst %.perl,%,$(SCRIPT_PERL)) \
1604        : GIT-VERSION-FILE
1605
1606%.o: %.c GIT-CFLAGS
1607        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1608%.s: %.c GIT-CFLAGS FORCE
1609        $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
1610%.o: %.S GIT-CFLAGS
1611        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1612
1613exec_cmd.s exec_cmd.o: ALL_CFLAGS += \
1614        '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
1615        '-DBINDIR="$(bindir_relative_SQ)"' \
1616        '-DPREFIX="$(prefix_SQ)"'
1617
1618builtin-init-db.s builtin-init-db.o: ALL_CFLAGS += \
1619        -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
1620
1621config.s config.o: ALL_CFLAGS += -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
1622
1623http.s http.o: ALL_CFLAGS += -DGIT_USER_AGENT='"git/$(GIT_VERSION)"'
1624
1625ifdef NO_EXPAT
1626http-walker.o: http.h
1627http-walker.s http-walker.o: ALL_CFLAGS += -DNO_EXPAT
1628endif
1629
1630git-%$X: %.o $(GITLIBS)
1631        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1632
1633git-imap-send$X: imap-send.o $(GITLIBS)
1634        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1635                $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
1636
1637http.o http-walker.o http-push.o: http.h
1638
1639http.o http-walker.o: $(LIB_H)
1640
1641git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
1642        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1643                $(LIBS) $(CURL_LIBCURL)
1644git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
1645        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1646                $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1647
1648$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
1649        $(QUIET_LNCP)$(RM) $@ && \
1650        ln $< $@ 2>/dev/null || \
1651        ln -s $< $@ 2>/dev/null || \
1652        cp $< $@
1653
1654$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
1655        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1656                $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1657
1658$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
1659$(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
1660builtin-revert.o wt-status.o: wt-status.h
1661
1662$(LIB_FILE): $(LIB_OBJS)
1663        $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
1664
1665XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1666        xdiff/xmerge.o xdiff/xpatience.o
1667$(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1668        xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
1669
1670$(XDIFF_LIB): $(XDIFF_OBJS)
1671        $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
1672
1673
1674doc:
1675        $(MAKE) -C Documentation all
1676
1677man:
1678        $(MAKE) -C Documentation man
1679
1680html:
1681        $(MAKE) -C Documentation html
1682
1683info:
1684        $(MAKE) -C Documentation info
1685
1686pdf:
1687        $(MAKE) -C Documentation pdf
1688
1689TAGS:
1690        $(RM) TAGS
1691        $(FIND) . -name '*.[hcS]' -print | xargs etags -a
1692
1693tags:
1694        $(RM) tags
1695        $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
1696
1697cscope:
1698        $(RM) cscope*
1699        $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
1700
1701### Detect prefix changes
1702TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
1703             $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
1704
1705GIT-CFLAGS: FORCE
1706        @FLAGS='$(TRACK_CFLAGS)'; \
1707            if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
1708                echo 1>&2 "    * new build flags or prefix"; \
1709                echo "$$FLAGS" >GIT-CFLAGS; \
1710            fi
1711
1712# We need to apply sq twice, once to protect from the shell
1713# that runs GIT-BUILD-OPTIONS, and then again to protect it
1714# and the first level quoting from the shell that runs "echo".
1715GIT-BUILD-OPTIONS: FORCE
1716        @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
1717        @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
1718        @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
1719        @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
1720        @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
1721        @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
1722
1723### Detect Tck/Tk interpreter path changes
1724ifndef NO_TCLTK
1725TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
1726
1727GIT-GUI-VARS: FORCE
1728        @VARS='$(TRACK_VARS)'; \
1729            if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
1730                echo 1>&2 "    * new Tcl/Tk interpreter location"; \
1731                echo "$$VARS" >$@; \
1732            fi
1733endif
1734
1735### Testing rules
1736
1737TEST_PROGRAMS_NEED_X += test-chmtime
1738TEST_PROGRAMS_NEED_X += test-ctype
1739TEST_PROGRAMS_NEED_X += test-date
1740TEST_PROGRAMS_NEED_X += test-delta
1741TEST_PROGRAMS_NEED_X += test-dump-cache-tree
1742TEST_PROGRAMS_NEED_X += test-genrandom
1743TEST_PROGRAMS_NEED_X += test-match-trees
1744TEST_PROGRAMS_NEED_X += test-parse-options
1745TEST_PROGRAMS_NEED_X += test-path-utils
1746TEST_PROGRAMS_NEED_X += test-run-command
1747TEST_PROGRAMS_NEED_X += test-sha1
1748TEST_PROGRAMS_NEED_X += test-sigchain
1749TEST_PROGRAMS_NEED_X += test-index-version
1750
1751TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
1752
1753test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
1754
1755all:: $(TEST_PROGRAMS) $(test_bindir_programs)
1756
1757bin-wrappers/%: wrap-for-bin.sh
1758        @mkdir -p bin-wrappers
1759        $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1760             -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
1761             -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
1762        chmod +x $@
1763
1764# GNU make supports exporting all variables by "export" without parameters.
1765# However, the environment gets quite big, and some programs have problems
1766# with that.
1767
1768export NO_SVN_TESTS
1769
1770test: all
1771        $(MAKE) -C t/ all
1772
1773test-ctype$X: ctype.o
1774
1775test-date$X: date.o ctype.o
1776
1777test-delta$X: diff-delta.o patch-delta.o
1778
1779test-parse-options$X: parse-options.o
1780
1781test-parse-options.o: parse-options.h
1782
1783.PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
1784
1785test-%$X: test-%.o $(GITLIBS)
1786        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1787
1788check-sha1:: test-sha1$X
1789        ./test-sha1.sh
1790
1791check: common-cmds.h
1792        if sparse; \
1793        then \
1794                for i in *.c; \
1795                do \
1796                        sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
1797                done; \
1798        else \
1799                echo 2>&1 "Did you mean 'make test'?"; \
1800                exit 1; \
1801        fi
1802
1803remove-dashes:
1804        ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
1805
1806### Installation rules
1807
1808ifneq ($(filter /%,$(firstword $(template_dir))),)
1809template_instdir = $(template_dir)
1810else
1811template_instdir = $(prefix)/$(template_dir)
1812endif
1813export template_instdir
1814
1815ifneq ($(filter /%,$(firstword $(gitexecdir))),)
1816gitexec_instdir = $(gitexecdir)
1817else
1818gitexec_instdir = $(prefix)/$(gitexecdir)
1819endif
1820gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
1821export gitexec_instdir
1822
1823install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
1824
1825install: all
1826        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
1827        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1828        $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1829        $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
1830        $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
1831ifndef NO_PERL
1832        $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
1833endif
1834ifndef NO_PYTHON
1835        $(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
1836endif
1837ifndef NO_TCLTK
1838        $(MAKE) -C gitk-git install
1839        $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
1840endif
1841ifneq (,$X)
1842        $(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';)
1843endif
1844
1845        bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
1846        execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
1847        { test "$$bindir/" = "$$execdir/" || \
1848                { $(RM) "$$execdir/git$X" && \
1849                test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
1850                ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
1851                cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
1852        { for p in $(BUILT_INS); do \
1853                $(RM) "$$execdir/$$p" && \
1854                ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
1855                ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
1856                cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
1857          done; } && \
1858        { for p in $(REMOTE_CURL_ALIASES); do \
1859                $(RM) "$$execdir/$$p" && \
1860                ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1861                ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1862                cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
1863          done; } && \
1864        ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
1865
1866install-doc:
1867        $(MAKE) -C Documentation install
1868
1869install-man:
1870        $(MAKE) -C Documentation install-man
1871
1872install-html:
1873        $(MAKE) -C Documentation install-html
1874
1875install-info:
1876        $(MAKE) -C Documentation install-info
1877
1878install-pdf:
1879        $(MAKE) -C Documentation install-pdf
1880
1881quick-install-doc:
1882        $(MAKE) -C Documentation quick-install
1883
1884quick-install-man:
1885        $(MAKE) -C Documentation quick-install-man
1886
1887quick-install-html:
1888        $(MAKE) -C Documentation quick-install-html
1889
1890
1891
1892### Maintainer's dist rules
1893
1894git.spec: git.spec.in
1895        sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
1896        mv $@+ $@
1897
1898GIT_TARNAME=git-$(GIT_VERSION)
1899dist: git.spec git-archive$(X) configure
1900        ./git-archive --format=tar \
1901                --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
1902        @mkdir -p $(GIT_TARNAME)
1903        @cp git.spec configure $(GIT_TARNAME)
1904        @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
1905        @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
1906        $(TAR) rf $(GIT_TARNAME).tar \
1907                $(GIT_TARNAME)/git.spec \
1908                $(GIT_TARNAME)/configure \
1909                $(GIT_TARNAME)/version \
1910                $(GIT_TARNAME)/git-gui/version
1911        @$(RM) -r $(GIT_TARNAME)
1912        gzip -f -9 $(GIT_TARNAME).tar
1913
1914rpm: dist
1915        $(RPMBUILD) \
1916                --define "_source_filedigest_algorithm md5" \
1917                --define "_binary_filedigest_algorithm md5" \
1918                -ta $(GIT_TARNAME).tar.gz
1919
1920htmldocs = git-htmldocs-$(GIT_VERSION)
1921manpages = git-manpages-$(GIT_VERSION)
1922dist-doc:
1923        $(RM) -r .doc-tmp-dir
1924        mkdir .doc-tmp-dir
1925        $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
1926        cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
1927        gzip -n -9 -f $(htmldocs).tar
1928        :
1929        $(RM) -r .doc-tmp-dir
1930        mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
1931        $(MAKE) -C Documentation DESTDIR=./ \
1932                man1dir=../.doc-tmp-dir/man1 \
1933                man5dir=../.doc-tmp-dir/man5 \
1934                man7dir=../.doc-tmp-dir/man7 \
1935                install
1936        cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
1937        gzip -n -9 -f $(manpages).tar
1938        $(RM) -r .doc-tmp-dir
1939
1940### Cleaning rules
1941
1942distclean: clean
1943        $(RM) configure
1944
1945clean:
1946        $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
1947                $(LIB_FILE) $(XDIFF_LIB)
1948        $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1949        $(RM) $(TEST_PROGRAMS)
1950        $(RM) -r bin-wrappers
1951        $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
1952        $(RM) -r autom4te.cache
1953        $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
1954        $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
1955        $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
1956        $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
1957        $(MAKE) -C Documentation/ clean
1958ifndef NO_PERL
1959        $(RM) gitweb/gitweb.cgi
1960        $(MAKE) -C perl clean
1961endif
1962ifndef NO_PYTHON
1963        $(MAKE) -C git_remote_helpers clean
1964endif
1965        $(MAKE) -C templates/ clean
1966        $(MAKE) -C t/ clean
1967ifndef NO_TCLTK
1968        $(MAKE) -C gitk-git clean
1969        $(MAKE) -C git-gui clean
1970endif
1971        $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
1972
1973.PHONY: all install clean strip
1974.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
1975.PHONY: FORCE TAGS tags cscope
1976
1977### Check documentation
1978#
1979check-docs::
1980        @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
1981        do \
1982                case "$$v" in \
1983                git-merge-octopus | git-merge-ours | git-merge-recursive | \
1984                git-merge-resolve | git-merge-subtree | \
1985                git-fsck-objects | git-init-db | \
1986                git-?*--?* ) continue ;; \
1987                esac ; \
1988                test -f "Documentation/$$v.txt" || \
1989                echo "no doc: $$v"; \
1990                sed -e '/^#/d' command-list.txt | \
1991                grep -q "^$$v[  ]" || \
1992                case "$$v" in \
1993                git) ;; \
1994                *) echo "no link: $$v";; \
1995                esac ; \
1996        done; \
1997        ( \
1998                sed -e '/^#/d' \
1999                    -e 's/[     ].*//' \
2000                    -e 's/^/listed /' command-list.txt; \
2001                ls -1 Documentation/git*txt | \
2002                sed -e 's|Documentation/|documented |' \
2003                    -e 's/\.txt//'; \
2004        ) | while read how cmd; \
2005        do \
2006                case "$$how,$$cmd" in \
2007                *,git-citool | \
2008                *,git-gui | \
2009                *,git-help | \
2010                documented,gitattributes | \
2011                documented,gitignore | \
2012                documented,gitmodules | \
2013                documented,gitcli | \
2014                documented,git-tools | \
2015                documented,gitcore-tutorial | \
2016                documented,gitcvs-migration | \
2017                documented,gitdiffcore | \
2018                documented,gitglossary | \
2019                documented,githooks | \
2020                documented,gitrepository-layout | \
2021                documented,gittutorial | \
2022                documented,gittutorial-2 | \
2023                sentinel,not,matching,is,ok ) continue ;; \
2024                esac; \
2025                case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
2026                *" $$cmd "*)    ;; \
2027                *) echo "removed but $$how: $$cmd" ;; \
2028                esac; \
2029        done ) | sort
2030
2031### Make sure built-ins do not have dups and listed in git.c
2032#
2033check-builtins::
2034        ./check-builtins.sh
2035
2036### Test suite coverage testing
2037#
2038.PHONY: coverage coverage-clean coverage-build coverage-report
2039
2040coverage:
2041        $(MAKE) coverage-build
2042        $(MAKE) coverage-report
2043
2044coverage-clean:
2045        rm -f *.gcda *.gcno
2046
2047COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
2048COVERAGE_LDFLAGS = $(CFLAGS)  -O0 -lgcov
2049
2050coverage-build: coverage-clean
2051        $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
2052        $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
2053                -j1 test
2054
2055coverage-report:
2056        gcov -b *.c
2057        grep '^function.*called 0 ' *.c.gcov \
2058                | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
2059                | tee coverage-untested-functions