Makefileon commit ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd (590e081)
   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 NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
  35#
  36# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
  37# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
  38#
  39# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
  40# do not support the 'size specifiers' introduced by C99, namely ll, hh,
  41# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
  42# some C compilers supported these specifiers prior to C99 as an extension.
  43#
  44# Define NO_STRCASESTR if you don't have strcasestr.
  45#
  46# Define NO_MEMMEM if you don't have memmem.
  47#
  48# Define NO_STRLCPY if you don't have strlcpy.
  49#
  50# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
  51# If your compiler also does not support long long or does not have
  52# strtoull, define NO_STRTOULL.
  53#
  54# Define NO_SETENV if you don't have setenv in the C library.
  55#
  56# Define NO_UNSETENV if you don't have unsetenv in the C library.
  57#
  58# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
  59#
  60# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
  61#
  62# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
  63# 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
 708endif
 709ifeq ($(uname_S),GNU/kFreeBSD)
 710        NO_STRLCPY = YesPlease
 711        NO_MKSTEMPS = YesPlease
 712endif
 713ifeq ($(uname_S),UnixWare)
 714        CC = cc
 715        NEEDS_SOCKET = YesPlease
 716        NEEDS_NSL = YesPlease
 717        NEEDS_SSL_WITH_CRYPTO = YesPlease
 718        NEEDS_LIBICONV = YesPlease
 719        SHELL_PATH = /usr/local/bin/bash
 720        NO_IPV6 = YesPlease
 721        NO_HSTRERROR = YesPlease
 722        NO_MKSTEMPS = YesPlease
 723        BASIC_CFLAGS += -Kthread
 724        BASIC_CFLAGS += -I/usr/local/include
 725        BASIC_LDFLAGS += -L/usr/local/lib
 726        INSTALL = ginstall
 727        TAR = gtar
 728        NO_STRCASESTR = YesPlease
 729        NO_MEMMEM = YesPlease
 730endif
 731ifeq ($(uname_S),SCO_SV)
 732        ifeq ($(uname_R),3.2)
 733                CFLAGS = -O2
 734        endif
 735        ifeq ($(uname_R),5)
 736                CC = cc
 737                BASIC_CFLAGS += -Kthread
 738        endif
 739        NEEDS_SOCKET = YesPlease
 740        NEEDS_NSL = YesPlease
 741        NEEDS_SSL_WITH_CRYPTO = YesPlease
 742        NEEDS_LIBICONV = YesPlease
 743        SHELL_PATH = /usr/bin/bash
 744        NO_IPV6 = YesPlease
 745        NO_HSTRERROR = YesPlease
 746        NO_MKSTEMPS = YesPlease
 747        BASIC_CFLAGS += -I/usr/local/include
 748        BASIC_LDFLAGS += -L/usr/local/lib
 749        NO_STRCASESTR = YesPlease
 750        NO_MEMMEM = YesPlease
 751        INSTALL = ginstall
 752        TAR = gtar
 753endif
 754ifeq ($(uname_S),Darwin)
 755        NEEDS_CRYPTO_WITH_SSL = YesPlease
 756        NEEDS_SSL_WITH_CRYPTO = YesPlease
 757        NEEDS_LIBICONV = YesPlease
 758        ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
 759                OLD_ICONV = UnfortunatelyYes
 760        endif
 761        ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
 762                NO_STRLCPY = YesPlease
 763        endif
 764        NO_MEMMEM = YesPlease
 765        USE_ST_TIMESPEC = YesPlease
 766endif
 767ifeq ($(uname_S),SunOS)
 768        NEEDS_SOCKET = YesPlease
 769        NEEDS_NSL = YesPlease
 770        SHELL_PATH = /bin/bash
 771        SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
 772        NO_STRCASESTR = YesPlease
 773        NO_MEMMEM = YesPlease
 774        NO_MKDTEMP = YesPlease
 775        NO_MKSTEMPS = YesPlease
 776        NO_REGEX = YesPlease
 777        ifeq ($(uname_R),5.7)
 778                NEEDS_RESOLV = YesPlease
 779                NO_IPV6 = YesPlease
 780                NO_SOCKADDR_STORAGE = YesPlease
 781                NO_UNSETENV = YesPlease
 782                NO_SETENV = YesPlease
 783                NO_STRLCPY = YesPlease
 784                NO_C99_FORMAT = YesPlease
 785                NO_STRTOUMAX = YesPlease
 786        endif
 787        ifeq ($(uname_R),5.8)
 788                NO_UNSETENV = YesPlease
 789                NO_SETENV = YesPlease
 790                NO_C99_FORMAT = YesPlease
 791                NO_STRTOUMAX = YesPlease
 792        endif
 793        ifeq ($(uname_R),5.9)
 794                NO_UNSETENV = YesPlease
 795                NO_SETENV = YesPlease
 796                NO_C99_FORMAT = YesPlease
 797                NO_STRTOUMAX = YesPlease
 798        endif
 799        INSTALL = /usr/ucb/install
 800        TAR = gtar
 801        BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
 802endif
 803ifeq ($(uname_O),Cygwin)
 804        NO_D_TYPE_IN_DIRENT = YesPlease
 805        NO_D_INO_IN_DIRENT = YesPlease
 806        NO_STRCASESTR = YesPlease
 807        NO_MEMMEM = YesPlease
 808        NO_MKSTEMPS = YesPlease
 809        NO_SYMLINK_HEAD = YesPlease
 810        NEEDS_LIBICONV = YesPlease
 811        NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
 812        NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
 813        OLD_ICONV = UnfortunatelyYes
 814        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 815        # There are conflicting reports about this.
 816        # On some boxes NO_MMAP is needed, and not so elsewhere.
 817        # Try commenting this out if you suspect MMAP is more efficient
 818        NO_MMAP = YesPlease
 819        NO_IPV6 = YesPlease
 820        X = .exe
 821        COMPAT_OBJS += compat/cygwin.o
 822        UNRELIABLE_FSTAT = UnfortunatelyYes
 823endif
 824ifeq ($(uname_S),FreeBSD)
 825        NEEDS_LIBICONV = YesPlease
 826        OLD_ICONV = YesPlease
 827        NO_MEMMEM = YesPlease
 828        BASIC_CFLAGS += -I/usr/local/include
 829        BASIC_LDFLAGS += -L/usr/local/lib
 830        DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
 831        USE_ST_TIMESPEC = YesPlease
 832        ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
 833                PTHREAD_LIBS = -pthread
 834                NO_UINTMAX_T = YesPlease
 835                NO_STRTOUMAX = YesPlease
 836        endif
 837        PYTHON_PATH = /usr/local/bin/python
 838endif
 839ifeq ($(uname_S),OpenBSD)
 840        NO_STRCASESTR = YesPlease
 841        NO_MEMMEM = YesPlease
 842        USE_ST_TIMESPEC = YesPlease
 843        NEEDS_LIBICONV = YesPlease
 844        BASIC_CFLAGS += -I/usr/local/include
 845        BASIC_LDFLAGS += -L/usr/local/lib
 846endif
 847ifeq ($(uname_S),NetBSD)
 848        ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
 849                NEEDS_LIBICONV = YesPlease
 850        endif
 851        BASIC_CFLAGS += -I/usr/pkg/include
 852        BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
 853        USE_ST_TIMESPEC = YesPlease
 854        NO_MKSTEMPS = YesPlease
 855endif
 856ifeq ($(uname_S),AIX)
 857        NO_STRCASESTR=YesPlease
 858        NO_MEMMEM = YesPlease
 859        NO_MKDTEMP = YesPlease
 860        NO_MKSTEMPS = YesPlease
 861        NO_STRLCPY = YesPlease
 862        NO_NSEC = YesPlease
 863        FREAD_READS_DIRECTORIES = UnfortunatelyYes
 864        INTERNAL_QSORT = UnfortunatelyYes
 865        NEEDS_LIBICONV=YesPlease
 866        BASIC_CFLAGS += -D_LARGE_FILES
 867        ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
 868                NO_PTHREADS = YesPlease
 869        endif
 870endif
 871ifeq ($(uname_S),GNU)
 872        # GNU/Hurd
 873        NO_STRLCPY=YesPlease
 874        NO_MKSTEMPS = YesPlease
 875endif
 876ifeq ($(uname_S),IRIX)
 877        NO_SETENV = YesPlease
 878        NO_UNSETENV = YesPlease
 879        NO_STRCASESTR = YesPlease
 880        NO_MEMMEM = YesPlease
 881        NO_MKSTEMPS = YesPlease
 882        NO_MKDTEMP = YesPlease
 883        # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
 884        # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
 885        # git dies with a segmentation fault when trying to access the first
 886        # entry of a reflog.  The conservative choice is made to always set
 887        # NO_MMAP.  If you suspect that your compiler is not affected by this
 888        # issue, comment out the NO_MMAP statement.
 889        NO_MMAP = YesPlease
 890        SNPRINTF_RETURNS_BOGUS = YesPlease
 891        SHELL_PATH = /usr/gnu/bin/bash
 892        NEEDS_LIBGEN = YesPlease
 893        NEEDS_LIBICONV = YesPlease
 894endif
 895ifeq ($(uname_S),IRIX64)
 896        NO_SETENV=YesPlease
 897        NO_UNSETENV = YesPlease
 898        NO_STRCASESTR=YesPlease
 899        NO_MEMMEM = YesPlease
 900        NO_MKSTEMPS = YesPlease
 901        NO_MKDTEMP = YesPlease
 902        # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
 903        # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
 904        # git dies with a segmentation fault when trying to access the first
 905        # entry of a reflog.  The conservative choice is made to always set
 906        # NO_MMAP.  If you suspect that your compiler is not affected by this
 907        # issue, comment out the NO_MMAP statement.
 908        NO_MMAP = YesPlease
 909        SNPRINTF_RETURNS_BOGUS = YesPlease
 910        SHELL_PATH=/usr/gnu/bin/bash
 911        NEEDS_LIBGEN = YesPlease
 912        NEEDS_LIBICONV = YesPlease
 913endif
 914ifeq ($(uname_S),HP-UX)
 915        NO_IPV6=YesPlease
 916        NO_SETENV=YesPlease
 917        NO_STRCASESTR=YesPlease
 918        NO_MEMMEM = YesPlease
 919        NO_MKSTEMPS = YesPlease
 920        NO_STRLCPY = YesPlease
 921        NO_MKDTEMP = YesPlease
 922        NO_UNSETENV = YesPlease
 923        NO_HSTRERROR = YesPlease
 924        NO_SYS_SELECT_H = YesPlease
 925        SNPRINTF_RETURNS_BOGUS = YesPlease
 926endif
 927ifeq ($(uname_S),Windows)
 928        GIT_VERSION := $(GIT_VERSION).MSVC
 929        pathsep = ;
 930        NO_PREAD = YesPlease
 931        NEEDS_CRYPTO_WITH_SSL = YesPlease
 932        NO_LIBGEN_H = YesPlease
 933        NO_SYMLINK_HEAD = YesPlease
 934        NO_IPV6 = YesPlease
 935        NO_SETENV = YesPlease
 936        NO_UNSETENV = YesPlease
 937        NO_STRCASESTR = YesPlease
 938        NO_STRLCPY = YesPlease
 939        NO_MEMMEM = YesPlease
 940        # NEEDS_LIBICONV = YesPlease
 941        NO_ICONV = YesPlease
 942        NO_C99_FORMAT = YesPlease
 943        NO_STRTOUMAX = YesPlease
 944        NO_STRTOULL = YesPlease
 945        NO_MKDTEMP = YesPlease
 946        NO_MKSTEMPS = YesPlease
 947        SNPRINTF_RETURNS_BOGUS = YesPlease
 948        NO_SVN_TESTS = YesPlease
 949        NO_PERL_MAKEMAKER = YesPlease
 950        RUNTIME_PREFIX = YesPlease
 951        NO_POSIX_ONLY_PROGRAMS = YesPlease
 952        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 953        NO_NSEC = YesPlease
 954        USE_WIN32_MMAP = YesPlease
 955        # USE_NED_ALLOCATOR = YesPlease
 956        UNRELIABLE_FSTAT = UnfortunatelyYes
 957        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
 958        NO_REGEX = YesPlease
 959        NO_CURL = YesPlease
 960        NO_PYTHON = YesPlease
 961        BLK_SHA1 = YesPlease
 962
 963        CC = compat/vcbuild/scripts/clink.pl
 964        AR = compat/vcbuild/scripts/lib.pl
 965        CFLAGS =
 966        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
 967        COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o
 968        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\"
 969        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
 970        EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
 971        PTHREAD_LIBS =
 972        lib =
 973ifndef DEBUG
 974        BASIC_CFLAGS += -GL -Os -MT
 975        BASIC_LDFLAGS += -LTCG
 976        AR += -LTCG
 977else
 978        BASIC_CFLAGS += -Zi -MTd
 979endif
 980        X = .exe
 981endif
 982ifneq (,$(findstring MINGW,$(uname_S)))
 983        pathsep = ;
 984        NO_PREAD = YesPlease
 985        NEEDS_CRYPTO_WITH_SSL = YesPlease
 986        NO_LIBGEN_H = YesPlease
 987        NO_SYMLINK_HEAD = YesPlease
 988        NO_SETENV = YesPlease
 989        NO_UNSETENV = YesPlease
 990        NO_STRCASESTR = YesPlease
 991        NO_STRLCPY = YesPlease
 992        NO_MEMMEM = YesPlease
 993        NEEDS_LIBICONV = YesPlease
 994        OLD_ICONV = YesPlease
 995        NO_C99_FORMAT = YesPlease
 996        NO_STRTOUMAX = YesPlease
 997        NO_MKDTEMP = YesPlease
 998        NO_MKSTEMPS = YesPlease
 999        SNPRINTF_RETURNS_BOGUS = YesPlease
1000        NO_SVN_TESTS = YesPlease
1001        NO_PERL_MAKEMAKER = YesPlease
1002        RUNTIME_PREFIX = YesPlease
1003        NO_POSIX_ONLY_PROGRAMS = YesPlease
1004        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
1005        NO_NSEC = YesPlease
1006        USE_WIN32_MMAP = YesPlease
1007        USE_NED_ALLOCATOR = YesPlease
1008        UNRELIABLE_FSTAT = UnfortunatelyYes
1009        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
1010        NO_REGEX = YesPlease
1011        NO_PYTHON = YesPlease
1012        BLK_SHA1 = YesPlease
1013        COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
1014        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
1015        COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
1016                compat/win32/pthread.o
1017        EXTLIBS += -lws2_32
1018        PTHREAD_LIBS =
1019        X = .exe
1020ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
1021        htmldir=doc/git/html/
1022        prefix =
1023        INSTALL = /bin/install
1024        EXTLIBS += /mingw/lib/libz.a
1025        NO_R_TO_GCC_LINKER = YesPlease
1026        INTERNAL_QSORT = YesPlease
1027else
1028        NO_CURL = YesPlease
1029endif
1030endif
1031
1032-include config.mak.autogen
1033-include config.mak
1034
1035ifdef SANE_TOOL_PATH
1036SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
1037BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
1038PATH := $(SANE_TOOL_PATH):${PATH}
1039else
1040BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
1041endif
1042
1043ifeq ($(uname_S),Darwin)
1044        ifndef NO_FINK
1045                ifeq ($(shell test -d /sw/lib && echo y),y)
1046                        BASIC_CFLAGS += -I/sw/include
1047                        BASIC_LDFLAGS += -L/sw/lib
1048                endif
1049        endif
1050        ifndef NO_DARWIN_PORTS
1051                ifeq ($(shell test -d /opt/local/lib && echo y),y)
1052                        BASIC_CFLAGS += -I/opt/local/include
1053                        BASIC_LDFLAGS += -L/opt/local/lib
1054                endif
1055        endif
1056        PTHREAD_LIBS =
1057endif
1058
1059ifndef CC_LD_DYNPATH
1060        ifdef NO_R_TO_GCC_LINKER
1061                # Some gcc does not accept and pass -R to the linker to specify
1062                # the runtime dynamic library path.
1063                CC_LD_DYNPATH = -Wl,-rpath,
1064        else
1065                CC_LD_DYNPATH = -R
1066        endif
1067endif
1068
1069ifdef NO_LIBGEN_H
1070        COMPAT_CFLAGS += -DNO_LIBGEN_H
1071        COMPAT_OBJS += compat/basename.o
1072endif
1073
1074ifdef NO_CURL
1075        BASIC_CFLAGS += -DNO_CURL
1076        REMOTE_CURL_PRIMARY =
1077        REMOTE_CURL_ALIASES =
1078        REMOTE_CURL_NAMES =
1079else
1080        ifdef CURLDIR
1081                # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
1082                BASIC_CFLAGS += -I$(CURLDIR)/include
1083                CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
1084        else
1085                CURL_LIBCURL = -lcurl
1086        endif
1087        REMOTE_CURL_PRIMARY = git-remote-http$X
1088        REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1089        REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
1090        PROGRAMS += $(REMOTE_CURL_NAMES) git-http-fetch$X
1091        curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
1092        ifeq "$(curl_check)" "070908"
1093                ifndef NO_EXPAT
1094                        PROGRAMS += git-http-push$X
1095                endif
1096        endif
1097        ifndef NO_EXPAT
1098                ifdef EXPATDIR
1099                        BASIC_CFLAGS += -I$(EXPATDIR)/include
1100                        EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1101                else
1102                        EXPAT_LIBEXPAT = -lexpat
1103                endif
1104        endif
1105endif
1106
1107ifdef ZLIB_PATH
1108        BASIC_CFLAGS += -I$(ZLIB_PATH)/include
1109        EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
1110endif
1111EXTLIBS += -lz
1112
1113ifndef NO_POSIX_ONLY_PROGRAMS
1114        PROGRAMS += git-daemon$X
1115endif
1116ifndef NO_OPENSSL
1117        OPENSSL_LIBSSL = -lssl
1118        ifdef OPENSSLDIR
1119                BASIC_CFLAGS += -I$(OPENSSLDIR)/include
1120                OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
1121        else
1122                OPENSSL_LINK =
1123        endif
1124        ifdef NEEDS_CRYPTO_WITH_SSL
1125                OPENSSL_LINK += -lcrypto
1126        endif
1127else
1128        BASIC_CFLAGS += -DNO_OPENSSL
1129        BLK_SHA1 = 1
1130        OPENSSL_LIBSSL =
1131endif
1132ifdef NEEDS_SSL_WITH_CRYPTO
1133        LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
1134else
1135        LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
1136endif
1137ifdef NEEDS_LIBICONV
1138        ifdef ICONVDIR
1139                BASIC_CFLAGS += -I$(ICONVDIR)/include
1140                ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1141        else
1142                ICONV_LINK =
1143        endif
1144        EXTLIBS += $(ICONV_LINK) -liconv
1145endif
1146ifdef NEEDS_LIBGEN
1147        EXTLIBS += -lgen
1148endif
1149ifdef NEEDS_SOCKET
1150        EXTLIBS += -lsocket
1151endif
1152ifdef NEEDS_NSL
1153        EXTLIBS += -lnsl
1154endif
1155ifdef NEEDS_RESOLV
1156        EXTLIBS += -lresolv
1157endif
1158ifdef NO_D_TYPE_IN_DIRENT
1159        BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
1160endif
1161ifdef NO_D_INO_IN_DIRENT
1162        BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
1163endif
1164ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1165        BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1166endif
1167ifdef USE_NSEC
1168        BASIC_CFLAGS += -DUSE_NSEC
1169endif
1170ifdef USE_ST_TIMESPEC
1171        BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1172endif
1173ifdef NO_NSEC
1174        BASIC_CFLAGS += -DNO_NSEC
1175endif
1176ifdef NO_C99_FORMAT
1177        BASIC_CFLAGS += -DNO_C99_FORMAT
1178endif
1179ifdef SNPRINTF_RETURNS_BOGUS
1180        COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1181        COMPAT_OBJS += compat/snprintf.o
1182endif
1183ifdef FREAD_READS_DIRECTORIES
1184        COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1185        COMPAT_OBJS += compat/fopen.o
1186endif
1187ifdef NO_SYMLINK_HEAD
1188        BASIC_CFLAGS += -DNO_SYMLINK_HEAD
1189endif
1190ifdef NO_STRCASESTR
1191        COMPAT_CFLAGS += -DNO_STRCASESTR
1192        COMPAT_OBJS += compat/strcasestr.o
1193endif
1194ifdef NO_STRLCPY
1195        COMPAT_CFLAGS += -DNO_STRLCPY
1196        COMPAT_OBJS += compat/strlcpy.o
1197endif
1198ifdef NO_STRTOUMAX
1199        COMPAT_CFLAGS += -DNO_STRTOUMAX
1200        COMPAT_OBJS += compat/strtoumax.o
1201endif
1202ifdef NO_STRTOULL
1203        COMPAT_CFLAGS += -DNO_STRTOULL
1204endif
1205ifdef NO_SETENV
1206        COMPAT_CFLAGS += -DNO_SETENV
1207        COMPAT_OBJS += compat/setenv.o
1208endif
1209ifdef NO_MKDTEMP
1210        COMPAT_CFLAGS += -DNO_MKDTEMP
1211        COMPAT_OBJS += compat/mkdtemp.o
1212endif
1213ifdef NO_MKSTEMPS
1214        COMPAT_CFLAGS += -DNO_MKSTEMPS
1215endif
1216ifdef NO_UNSETENV
1217        COMPAT_CFLAGS += -DNO_UNSETENV
1218        COMPAT_OBJS += compat/unsetenv.o
1219endif
1220ifdef NO_SYS_SELECT_H
1221        BASIC_CFLAGS += -DNO_SYS_SELECT_H
1222endif
1223ifdef NO_MMAP
1224        COMPAT_CFLAGS += -DNO_MMAP
1225        COMPAT_OBJS += compat/mmap.o
1226else
1227        ifdef USE_WIN32_MMAP
1228                COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1229                COMPAT_OBJS += compat/win32mmap.o
1230        endif
1231endif
1232ifdef OBJECT_CREATION_USES_RENAMES
1233        COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
1234endif
1235ifdef NO_PREAD
1236        COMPAT_CFLAGS += -DNO_PREAD
1237        COMPAT_OBJS += compat/pread.o
1238endif
1239ifdef NO_FAST_WORKING_DIRECTORY
1240        BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1241endif
1242ifdef NO_TRUSTABLE_FILEMODE
1243        BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1244endif
1245ifdef NO_IPV6
1246        BASIC_CFLAGS += -DNO_IPV6
1247endif
1248ifdef NO_UINTMAX_T
1249        BASIC_CFLAGS += -Duintmax_t=uint32_t
1250endif
1251ifdef NO_SOCKADDR_STORAGE
1252ifdef NO_IPV6
1253        BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
1254else
1255        BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
1256endif
1257endif
1258ifdef NO_INET_NTOP
1259        LIB_OBJS += compat/inet_ntop.o
1260endif
1261ifdef NO_INET_PTON
1262        LIB_OBJS += compat/inet_pton.o
1263endif
1264
1265ifdef NO_ICONV
1266        BASIC_CFLAGS += -DNO_ICONV
1267endif
1268
1269ifdef OLD_ICONV
1270        BASIC_CFLAGS += -DOLD_ICONV
1271endif
1272
1273ifdef NO_DEFLATE_BOUND
1274        BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1275endif
1276
1277ifdef BLK_SHA1
1278        SHA1_HEADER = "block-sha1/sha1.h"
1279        LIB_OBJS += block-sha1/sha1.o
1280else
1281ifdef PPC_SHA1
1282        SHA1_HEADER = "ppc/sha1.h"
1283        LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
1284else
1285        SHA1_HEADER = <openssl/sha.h>
1286        EXTLIBS += $(LIB_4_CRYPTO)
1287endif
1288endif
1289ifdef NO_PERL_MAKEMAKER
1290        export NO_PERL_MAKEMAKER
1291endif
1292ifdef NO_HSTRERROR
1293        COMPAT_CFLAGS += -DNO_HSTRERROR
1294        COMPAT_OBJS += compat/hstrerror.o
1295endif
1296ifdef NO_MEMMEM
1297        COMPAT_CFLAGS += -DNO_MEMMEM
1298        COMPAT_OBJS += compat/memmem.o
1299endif
1300ifdef INTERNAL_QSORT
1301        COMPAT_CFLAGS += -DINTERNAL_QSORT
1302        COMPAT_OBJS += compat/qsort.o
1303endif
1304ifdef RUNTIME_PREFIX
1305        COMPAT_CFLAGS += -DRUNTIME_PREFIX
1306endif
1307
1308ifdef NO_PTHREADS
1309        BASIC_CFLAGS += -DNO_PTHREADS
1310else
1311        EXTLIBS += $(PTHREAD_LIBS)
1312        LIB_OBJS += thread-utils.o
1313endif
1314
1315ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1316        COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1317endif
1318ifdef UNRELIABLE_FSTAT
1319        BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1320endif
1321ifdef NO_REGEX
1322        COMPAT_CFLAGS += -Icompat/regex
1323        COMPAT_OBJS += compat/regex/regex.o
1324endif
1325
1326ifdef USE_NED_ALLOCATOR
1327       COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
1328       COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1329endif
1330
1331ifeq ($(TCLTK_PATH),)
1332NO_TCLTK=NoThanks
1333endif
1334
1335ifeq ($(PERL_PATH),)
1336NO_PERL=NoThanks
1337endif
1338
1339ifeq ($(PYTHON_PATH),)
1340NO_PYTHON=NoThanks
1341endif
1342
1343QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
1344QUIET_SUBDIR1  =
1345
1346ifneq ($(findstring $(MAKEFLAGS),w),w)
1347PRINT_DIR = --no-print-directory
1348else # "make -w"
1349NO_SUBDIR = :
1350endif
1351
1352ifneq ($(findstring $(MAKEFLAGS),s),s)
1353ifndef V
1354        QUIET_CC       = @echo '   ' CC $@;
1355        QUIET_AR       = @echo '   ' AR $@;
1356        QUIET_LINK     = @echo '   ' LINK $@;
1357        QUIET_BUILT_IN = @echo '   ' BUILTIN $@;
1358        QUIET_GEN      = @echo '   ' GEN $@;
1359        QUIET_LNCP     = @echo '   ' LN/CP $@;
1360        QUIET_SUBDIR0  = +@subdir=
1361        QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
1362                         $(MAKE) $(PRINT_DIR) -C $$subdir
1363        export V
1364        export QUIET_GEN
1365        export QUIET_BUILT_IN
1366endif
1367endif
1368
1369ifdef ASCIIDOC8
1370        export ASCIIDOC8
1371endif
1372
1373# Shell quote (do not use $(call) to accommodate ancient setups);
1374
1375SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
1376ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
1377
1378DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1379bindir_SQ = $(subst ','\'',$(bindir))
1380bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
1381mandir_SQ = $(subst ','\'',$(mandir))
1382infodir_SQ = $(subst ','\'',$(infodir))
1383gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
1384template_dir_SQ = $(subst ','\'',$(template_dir))
1385htmldir_SQ = $(subst ','\'',$(htmldir))
1386prefix_SQ = $(subst ','\'',$(prefix))
1387
1388SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
1389PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
1390PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
1391TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
1392
1393LIBS = $(GITLIBS) $(EXTLIBS)
1394
1395BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
1396        $(COMPAT_CFLAGS)
1397LIB_OBJS += $(COMPAT_OBJS)
1398
1399# Quote for C
1400
1401ifdef DEFAULT_EDITOR
1402DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
1403DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
1404
1405BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
1406endif
1407
1408ifdef DEFAULT_PAGER
1409DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
1410DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
1411
1412BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
1413endif
1414
1415ALL_CFLAGS += $(BASIC_CFLAGS)
1416ALL_LDFLAGS += $(BASIC_LDFLAGS)
1417
1418export TAR INSTALL DESTDIR SHELL_PATH
1419
1420
1421### Build rules
1422
1423SHELL = $(SHELL_PATH)
1424
1425all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
1426ifneq (,$X)
1427        $(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';)
1428endif
1429
1430all::
1431ifndef NO_TCLTK
1432        $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
1433        $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
1434endif
1435ifndef NO_PERL
1436        $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
1437endif
1438ifndef NO_PYTHON
1439        $(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
1440endif
1441        $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
1442
1443please_set_SHELL_PATH_to_a_more_modern_shell:
1444        @$$(:)
1445
1446shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
1447
1448strip: $(PROGRAMS) git$X
1449        $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
1450
1451git.o: common-cmds.h
1452git.s git.o: ALL_CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' \
1453        '-DGIT_HTML_PATH="$(htmldir_SQ)"'
1454
1455git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
1456        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
1457                $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
1458
1459builtin-help.o: common-cmds.h
1460builtin-help.s builtin-help.o: ALL_CFLAGS += \
1461        '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
1462        '-DGIT_MAN_PATH="$(mandir_SQ)"' \
1463        '-DGIT_INFO_PATH="$(infodir_SQ)"'
1464
1465$(BUILT_INS): git$X
1466        $(QUIET_BUILT_IN)$(RM) $@ && \
1467        ln git$X $@ 2>/dev/null || \
1468        ln -s git$X $@ 2>/dev/null || \
1469        cp git$X $@
1470
1471common-cmds.h: ./generate-cmdlist.sh command-list.txt
1472
1473common-cmds.h: $(wildcard Documentation/git-*.txt)
1474        $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
1475
1476$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
1477        $(QUIET_GEN)$(RM) $@ $@+ && \
1478        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1479            -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1480            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1481            -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1482            -e $(BROKEN_PATH_FIX) \
1483            $@.sh >$@+ && \
1484        chmod +x $@+ && \
1485        mv $@+ $@
1486
1487ifndef NO_PERL
1488$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
1489
1490perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
1491        $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
1492
1493$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
1494        $(QUIET_GEN)$(RM) $@ $@+ && \
1495        INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
1496        sed -e '1{' \
1497            -e '        s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1498            -e '        h' \
1499            -e '        s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
1500            -e '        H' \
1501            -e '        x' \
1502            -e '}' \
1503            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
1504            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1505            $@.perl >$@+ && \
1506        chmod +x $@+ && \
1507        mv $@+ $@
1508
1509
1510.PHONY: gitweb
1511gitweb:
1512        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
1513
1514ifdef JSMIN
1515OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js
1516gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js
1517else
1518OTHER_PROGRAMS += gitweb/gitweb.cgi
1519gitweb/gitweb.cgi: gitweb/gitweb.perl
1520endif
1521        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1522
1523ifdef JSMIN
1524gitweb/gitweb.min.js: gitweb/gitweb.js
1525        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1526endif # JSMIN
1527
1528
1529git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
1530        $(QUIET_GEN)$(RM) $@ $@+ && \
1531        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1532            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1533            -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1534            -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
1535            -e '/@@GITWEB_CGI@@/d' \
1536            -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
1537            -e '/@@GITWEB_CSS@@/d' \
1538            -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \
1539            -e '/@@GITWEB_JS@@/d' \
1540            -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
1541            $@.sh > $@+ && \
1542        chmod +x $@+ && \
1543        mv $@+ $@
1544else # NO_PERL
1545$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
1546        $(QUIET_GEN)$(RM) $@ $@+ && \
1547        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1548            -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
1549            unimplemented.sh >$@+ && \
1550        chmod +x $@+ && \
1551        mv $@+ $@
1552endif # NO_PERL
1553
1554ifndef NO_PYTHON
1555$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
1556$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
1557        $(QUIET_GEN)$(RM) $@ $@+ && \
1558        INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
1559                --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
1560                instlibdir` && \
1561        sed -e '1{' \
1562            -e '        s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
1563            -e '}' \
1564            -e 's|^import sys.*|&; \\\
1565                   import os; \\\
1566                   sys.path.insert(0, os.getenv("GITPYTHONLIB",\
1567                                                "@@INSTLIBDIR@@"));|' \
1568            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
1569            $@.py >$@+ && \
1570        chmod +x $@+ && \
1571        mv $@+ $@
1572else # NO_PYTHON
1573$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh
1574        $(QUIET_GEN)$(RM) $@ $@+ && \
1575        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1576            -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
1577            unimplemented.sh >$@+ && \
1578        chmod +x $@+ && \
1579        mv $@+ $@
1580endif # NO_PYTHON
1581
1582configure: configure.ac
1583        $(QUIET_GEN)$(RM) $@ $<+ && \
1584        sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1585            $< > $<+ && \
1586        autoconf -o $@ $<+ && \
1587        $(RM) $<+
1588
1589# These can record GIT_VERSION
1590git.o git.spec \
1591        $(patsubst %.sh,%,$(SCRIPT_SH)) \
1592        $(patsubst %.perl,%,$(SCRIPT_PERL)) \
1593        : GIT-VERSION-FILE
1594
1595%.o: %.c GIT-CFLAGS
1596        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1597%.s: %.c GIT-CFLAGS FORCE
1598        $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
1599%.o: %.S GIT-CFLAGS
1600        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1601
1602exec_cmd.s exec_cmd.o: ALL_CFLAGS += \
1603        '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
1604        '-DBINDIR="$(bindir_relative_SQ)"' \
1605        '-DPREFIX="$(prefix_SQ)"'
1606
1607builtin-init-db.s builtin-init-db.o: ALL_CFLAGS += \
1608        -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
1609
1610config.s config.o: ALL_CFLAGS += -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
1611
1612http.s http.o: ALL_CFLAGS += -DGIT_USER_AGENT='"git/$(GIT_VERSION)"'
1613
1614ifdef NO_EXPAT
1615http-walker.o: http.h
1616http-walker.s http-walker.o: ALL_CFLAGS += -DNO_EXPAT
1617endif
1618
1619git-%$X: %.o $(GITLIBS)
1620        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1621
1622git-imap-send$X: imap-send.o $(GITLIBS)
1623        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1624                $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
1625
1626http.o http-walker.o http-push.o: http.h
1627
1628http.o http-walker.o: $(LIB_H)
1629
1630git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
1631        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1632                $(LIBS) $(CURL_LIBCURL)
1633git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
1634        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1635                $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1636
1637$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
1638        $(QUIET_LNCP)$(RM) $@ && \
1639        ln $< $@ 2>/dev/null || \
1640        ln -s $< $@ 2>/dev/null || \
1641        cp $< $@
1642
1643$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
1644        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1645                $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1646
1647$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
1648$(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
1649builtin-revert.o wt-status.o: wt-status.h
1650
1651$(LIB_FILE): $(LIB_OBJS)
1652        $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
1653
1654XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1655        xdiff/xmerge.o xdiff/xpatience.o
1656$(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1657        xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
1658
1659$(XDIFF_LIB): $(XDIFF_OBJS)
1660        $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
1661
1662
1663doc:
1664        $(MAKE) -C Documentation all
1665
1666man:
1667        $(MAKE) -C Documentation man
1668
1669html:
1670        $(MAKE) -C Documentation html
1671
1672info:
1673        $(MAKE) -C Documentation info
1674
1675pdf:
1676        $(MAKE) -C Documentation pdf
1677
1678TAGS:
1679        $(RM) TAGS
1680        $(FIND) . -name '*.[hcS]' -print | xargs etags -a
1681
1682tags:
1683        $(RM) tags
1684        $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
1685
1686cscope:
1687        $(RM) cscope*
1688        $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
1689
1690### Detect prefix changes
1691TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
1692             $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
1693
1694GIT-CFLAGS: FORCE
1695        @FLAGS='$(TRACK_CFLAGS)'; \
1696            if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
1697                echo 1>&2 "    * new build flags or prefix"; \
1698                echo "$$FLAGS" >GIT-CFLAGS; \
1699            fi
1700
1701# We need to apply sq twice, once to protect from the shell
1702# that runs GIT-BUILD-OPTIONS, and then again to protect it
1703# and the first level quoting from the shell that runs "echo".
1704GIT-BUILD-OPTIONS: FORCE
1705        @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
1706        @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
1707        @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
1708        @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
1709        @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
1710        @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
1711
1712### Detect Tck/Tk interpreter path changes
1713ifndef NO_TCLTK
1714TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
1715
1716GIT-GUI-VARS: FORCE
1717        @VARS='$(TRACK_VARS)'; \
1718            if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
1719                echo 1>&2 "    * new Tcl/Tk interpreter location"; \
1720                echo "$$VARS" >$@; \
1721            fi
1722endif
1723
1724### Testing rules
1725
1726TEST_PROGRAMS_NEED_X += test-chmtime
1727TEST_PROGRAMS_NEED_X += test-ctype
1728TEST_PROGRAMS_NEED_X += test-date
1729TEST_PROGRAMS_NEED_X += test-delta
1730TEST_PROGRAMS_NEED_X += test-dump-cache-tree
1731TEST_PROGRAMS_NEED_X += test-genrandom
1732TEST_PROGRAMS_NEED_X += test-match-trees
1733TEST_PROGRAMS_NEED_X += test-parse-options
1734TEST_PROGRAMS_NEED_X += test-path-utils
1735TEST_PROGRAMS_NEED_X += test-run-command
1736TEST_PROGRAMS_NEED_X += test-sha1
1737TEST_PROGRAMS_NEED_X += test-sigchain
1738TEST_PROGRAMS_NEED_X += test-index-version
1739
1740TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
1741
1742test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
1743
1744all:: $(TEST_PROGRAMS) $(test_bindir_programs)
1745
1746bin-wrappers/%: wrap-for-bin.sh
1747        @mkdir -p bin-wrappers
1748        $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1749             -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
1750             -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
1751        chmod +x $@
1752
1753# GNU make supports exporting all variables by "export" without parameters.
1754# However, the environment gets quite big, and some programs have problems
1755# with that.
1756
1757export NO_SVN_TESTS
1758
1759test: all
1760        $(MAKE) -C t/ all
1761
1762test-ctype$X: ctype.o
1763
1764test-date$X: date.o ctype.o
1765
1766test-delta$X: diff-delta.o patch-delta.o
1767
1768test-parse-options$X: parse-options.o
1769
1770test-parse-options.o: parse-options.h
1771
1772.PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
1773
1774test-%$X: test-%.o $(GITLIBS)
1775        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1776
1777check-sha1:: test-sha1$X
1778        ./test-sha1.sh
1779
1780check: common-cmds.h
1781        if sparse; \
1782        then \
1783                for i in *.c; \
1784                do \
1785                        sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
1786                done; \
1787        else \
1788                echo 2>&1 "Did you mean 'make test'?"; \
1789                exit 1; \
1790        fi
1791
1792remove-dashes:
1793        ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
1794
1795### Installation rules
1796
1797ifneq ($(filter /%,$(firstword $(template_dir))),)
1798template_instdir = $(template_dir)
1799else
1800template_instdir = $(prefix)/$(template_dir)
1801endif
1802export template_instdir
1803
1804ifneq ($(filter /%,$(firstword $(gitexecdir))),)
1805gitexec_instdir = $(gitexecdir)
1806else
1807gitexec_instdir = $(prefix)/$(gitexecdir)
1808endif
1809gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
1810export gitexec_instdir
1811
1812install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
1813
1814install: all
1815        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
1816        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1817        $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1818        $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
1819        $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
1820ifndef NO_PERL
1821        $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
1822endif
1823ifndef NO_PYTHON
1824        $(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
1825endif
1826ifndef NO_TCLTK
1827        $(MAKE) -C gitk-git install
1828        $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
1829endif
1830ifneq (,$X)
1831        $(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';)
1832endif
1833
1834        bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
1835        execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
1836        { test "$$bindir/" = "$$execdir/" || \
1837                { $(RM) "$$execdir/git$X" && \
1838                test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
1839                ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
1840                cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
1841        { for p in $(BUILT_INS); do \
1842                $(RM) "$$execdir/$$p" && \
1843                ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
1844                ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
1845                cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
1846          done; } && \
1847        { test x"$(REMOTE_CURL_ALIASES)" = x || \
1848                { for p in $(REMOTE_CURL_ALIASES); do \
1849                $(RM) "$$execdir/$$p" && \
1850                ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1851                ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1852                cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
1853          done; } ; } && \
1854        ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
1855
1856install-doc:
1857        $(MAKE) -C Documentation install
1858
1859install-man:
1860        $(MAKE) -C Documentation install-man
1861
1862install-html:
1863        $(MAKE) -C Documentation install-html
1864
1865install-info:
1866        $(MAKE) -C Documentation install-info
1867
1868install-pdf:
1869        $(MAKE) -C Documentation install-pdf
1870
1871quick-install-doc:
1872        $(MAKE) -C Documentation quick-install
1873
1874quick-install-man:
1875        $(MAKE) -C Documentation quick-install-man
1876
1877quick-install-html:
1878        $(MAKE) -C Documentation quick-install-html
1879
1880
1881
1882### Maintainer's dist rules
1883
1884git.spec: git.spec.in
1885        sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
1886        mv $@+ $@
1887
1888GIT_TARNAME=git-$(GIT_VERSION)
1889dist: git.spec git-archive$(X) configure
1890        ./git-archive --format=tar \
1891                --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
1892        @mkdir -p $(GIT_TARNAME)
1893        @cp git.spec configure $(GIT_TARNAME)
1894        @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
1895        @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
1896        $(TAR) rf $(GIT_TARNAME).tar \
1897                $(GIT_TARNAME)/git.spec \
1898                $(GIT_TARNAME)/configure \
1899                $(GIT_TARNAME)/version \
1900                $(GIT_TARNAME)/git-gui/version
1901        @$(RM) -r $(GIT_TARNAME)
1902        gzip -f -9 $(GIT_TARNAME).tar
1903
1904rpm: dist
1905        $(RPMBUILD) \
1906                --define "_source_filedigest_algorithm md5" \
1907                --define "_binary_filedigest_algorithm md5" \
1908                -ta $(GIT_TARNAME).tar.gz
1909
1910htmldocs = git-htmldocs-$(GIT_VERSION)
1911manpages = git-manpages-$(GIT_VERSION)
1912dist-doc:
1913        $(RM) -r .doc-tmp-dir
1914        mkdir .doc-tmp-dir
1915        $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
1916        cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
1917        gzip -n -9 -f $(htmldocs).tar
1918        :
1919        $(RM) -r .doc-tmp-dir
1920        mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
1921        $(MAKE) -C Documentation DESTDIR=./ \
1922                man1dir=../.doc-tmp-dir/man1 \
1923                man5dir=../.doc-tmp-dir/man5 \
1924                man7dir=../.doc-tmp-dir/man7 \
1925                install
1926        cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
1927        gzip -n -9 -f $(manpages).tar
1928        $(RM) -r .doc-tmp-dir
1929
1930### Cleaning rules
1931
1932distclean: clean
1933        $(RM) configure
1934
1935clean:
1936        $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
1937                $(LIB_FILE) $(XDIFF_LIB)
1938        $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1939        $(RM) $(TEST_PROGRAMS)
1940        $(RM) -r bin-wrappers
1941        $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
1942        $(RM) -r autom4te.cache
1943        $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
1944        $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
1945        $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
1946        $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
1947        $(MAKE) -C Documentation/ clean
1948ifndef NO_PERL
1949        $(RM) gitweb/gitweb.cgi
1950        $(MAKE) -C perl clean
1951endif
1952ifndef NO_PYTHON
1953        $(MAKE) -C git_remote_helpers clean
1954endif
1955        $(MAKE) -C templates/ clean
1956        $(MAKE) -C t/ clean
1957ifndef NO_TCLTK
1958        $(MAKE) -C gitk-git clean
1959        $(MAKE) -C git-gui clean
1960endif
1961        $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
1962
1963.PHONY: all install clean strip
1964.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
1965.PHONY: FORCE TAGS tags cscope
1966
1967### Check documentation
1968#
1969check-docs::
1970        @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
1971        do \
1972                case "$$v" in \
1973                git-merge-octopus | git-merge-ours | git-merge-recursive | \
1974                git-merge-resolve | git-merge-subtree | \
1975                git-fsck-objects | git-init-db | \
1976                git-?*--?* ) continue ;; \
1977                esac ; \
1978                test -f "Documentation/$$v.txt" || \
1979                echo "no doc: $$v"; \
1980                sed -e '/^#/d' command-list.txt | \
1981                grep -q "^$$v[  ]" || \
1982                case "$$v" in \
1983                git) ;; \
1984                *) echo "no link: $$v";; \
1985                esac ; \
1986        done; \
1987        ( \
1988                sed -e '/^#/d' \
1989                    -e 's/[     ].*//' \
1990                    -e 's/^/listed /' command-list.txt; \
1991                ls -1 Documentation/git*txt | \
1992                sed -e 's|Documentation/|documented |' \
1993                    -e 's/\.txt//'; \
1994        ) | while read how cmd; \
1995        do \
1996                case "$$how,$$cmd" in \
1997                *,git-citool | \
1998                *,git-gui | \
1999                *,git-help | \
2000                documented,gitattributes | \
2001                documented,gitignore | \
2002                documented,gitmodules | \
2003                documented,gitcli | \
2004                documented,git-tools | \
2005                documented,gitcore-tutorial | \
2006                documented,gitcvs-migration | \
2007                documented,gitdiffcore | \
2008                documented,gitglossary | \
2009                documented,githooks | \
2010                documented,gitrepository-layout | \
2011                documented,gittutorial | \
2012                documented,gittutorial-2 | \
2013                sentinel,not,matching,is,ok ) continue ;; \
2014                esac; \
2015                case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
2016                *" $$cmd "*)    ;; \
2017                *) echo "removed but $$how: $$cmd" ;; \
2018                esac; \
2019        done ) | sort
2020
2021### Make sure built-ins do not have dups and listed in git.c
2022#
2023check-builtins::
2024        ./check-builtins.sh
2025
2026### Test suite coverage testing
2027#
2028.PHONY: coverage coverage-clean coverage-build coverage-report
2029
2030coverage:
2031        $(MAKE) coverage-build
2032        $(MAKE) coverage-report
2033
2034coverage-clean:
2035        rm -f *.gcda *.gcno
2036
2037COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
2038COVERAGE_LDFLAGS = $(CFLAGS)  -O0 -lgcov
2039
2040coverage-build: coverage-clean
2041        $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
2042        $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
2043                -j1 test
2044
2045coverage-report:
2046        gcov -b *.c
2047        grep '^function.*called 0 ' *.c.gcov \
2048                | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
2049                | tee coverage-untested-functions