]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'dd/document-runtime-prefix-better'
authorJunio C Hamano <gitster@pobox.com>
Mon, 17 Oct 2022 21:56:34 +0000 (14:56 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Oct 2022 21:56:34 +0000 (14:56 -0700)
Update comment in the Makefile about the RUNTIME_PREFIX config knob.

* dd/document-runtime-prefix-better:
  Makefile: clarify runtime relative gitexecdir

1  2 
Makefile

diff --combined Makefile
index 9553d590824444e85beaa88098d1624361cdaab6,3625b63c0be991c5013a43faa570a8117d16d050..d93ad956e589bd3a4c4800c97c98f36d040b323e
+++ b/Makefile
@@@ -1,9 -1,6 +1,9 @@@
  # The default target of this Makefile is...
  all::
  
 +# Import tree-wide shared Makefile behavior and libraries
 +include shared.mak
 +
  # Define V=1 to have a more verbose compile.
  #
  # Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
  # Define BLK_SHA1 environment variable to make use of the bundled
  # optimized C SHA1 routine.
  #
 -# Define PPC_SHA1 environment variable when running make to make use of
 -# a bundled SHA1 routine optimized for PowerPC.
 -#
  # Define DC_SHA1 to unconditionally enable the collision-detecting sha1
  # algorithm. This is slower, but may detect attempted collision attacks.
  # Takes priority over other *_SHA1 knobs.
  #
  # Define BLK_SHA256 to use the built-in SHA-256 routines.
  #
 +# Define NETTLE_SHA256 to use the SHA-256 routines in libnettle.
 +#
  # Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt.
  #
  # Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL.
  # Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
  # the executable mode bit, but doesn't really do so.
  #
 +# Define CSPRNG_METHOD to "arc4random" if your system has arc4random and
 +# arc4random_buf, "libbsd" if your system has those functions from libbsd,
 +# "getrandom" if your system has getrandom, "getentropy" if your system has
 +# getentropy, "rtlgenrandom" for RtlGenRandom (Windows only), or "openssl" if
 +# you'd want to use the OpenSSL CSPRNG.  You may set multiple options with
 +# spaces, in which case a suitable option will be chosen.  If unset or set to
 +# anything else, defaults to using "/dev/urandom".
 +#
  # Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
  # bits in mode values (e.g. z/OS defines I_SFMT to 0xFF000000 as opposed to the
  # usual 0xF000).
  # distributions that want to use their packaged versions of Perl
  # modules, instead of the fallbacks shipped with Git.
  #
 +# Define NO_GITWEB if you do not want to build or install
 +# 'gitweb'. Note that defining NO_PERL currently has the same effect
 +# on not installing gitweb, but not on whether it's built in the
 +# gitweb/ directory.
 +#
  # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
  # but /usr/bin/python2.7 or /usr/bin/python3 on some platforms).
  #
  #
  # Define NO_TCLTK if you do not want Tcl/Tk GUI.
  #
 -# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
 -# and egrep that are pickier when their input contains non-ASCII data.
 -#
  # The TCL_PATH variable governs the location of the Tcl interpreter
  # used to optimize git-gui for your system.  Only used if NO_TCLTK
  # is not set.  Defaults to the bare 'tclsh'.
  #
  # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
  #
 +# Define HAVE_SYNC_FILE_RANGE if your platform has sync_file_range.
 +#
  # Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
  # before 2.17) for clock_gettime and CLOCK_MONOTONIC.
  #
  # directory, and the JSON compilation database 'compile_commands.json' will be
  # created at the root of the repository.
  #
 +# If your platform supports a built-in fsmonitor backend, set
 +# FSMONITOR_DAEMON_BACKEND to the "<name>" of the corresponding
 +# `compat/fsmonitor/fsm-listen-<name>.c` and
 +# `compat/fsmonitor/fsm-health-<name>.c` files
 +# that implement the `fsm_listen__*()` and `fsm_health__*()` routines.
 +#
 +# If your platform has OS-specific ways to tell if a repo is incompatible with
 +# fsmonitor (whether the hook or IPC daemon version), set FSMONITOR_OS_SETTINGS
 +# to the "<name>" of the corresponding `compat/fsmonitor/fsm-settings-<name>.c`
 +# that implements the `fsm_os_settings__*()` routines.
 +#
  # Define DEVELOPER to enable more compiler warnings. Compiler version
  # and family are auto detected, but could be overridden by defining
  # COMPILER_FEATURES (see config.mak.dev). You can still set
@@@ -529,8 -504,9 +529,9 @@@ GIT-VERSION-FILE: FORC
  #   template_dir
  #   sysconfdir
  # can be specified as a relative path some/where/else;
- # this is interpreted as relative to $(prefix) and "git" at
- # runtime figures out where they are based on the path to the executable.
+ # this is interpreted as relative to $(prefix) and "git" built with
+ # RUNTIME_PREFIX flag will figure out (at runtime) where they are
+ # based on the path to the executable.
  # Additionally, the following will be treated as relative by "git" if they
  # begin with "$(prefix)/":
  #   mandir
@@@ -548,7 -524,6 +549,7 @@@ gitexecdir = libexec/git-cor
  mergetoolsdir = $(gitexecdir)/mergetools
  sharedir = $(prefix)/share
  gitwebdir = $(sharedir)/gitweb
 +gitwebstaticdir = $(gitwebdir)/static
  perllibdir = $(sharedir)/perl5
  localedir = $(sharedir)/locale
  template_dir = share/git-core/templates
@@@ -567,7 -542,7 +568,7 @@@ localedir_relative = $(patsubst $(prefi
  htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
  perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
  
 -export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
 +export prefix bindir sharedir sysconfdir perllibdir localedir
  
  # Set our default programs
  CC = cc
@@@ -580,9 -555,7 +581,9 @@@ INSTALL = instal
  TCL_PATH = tclsh
  TCLTK_PATH = wish
  XGETTEXT = xgettext
 +MSGCAT = msgcat
  MSGFMT = msgfmt
 +MSGMERGE = msgmerge
  CURL_CONFIG = curl-config
  GCOV = gcov
  STRIP = strip
@@@ -605,9 -578,7 +606,9 @@@ FUZZ_OBJS 
  FUZZ_PROGRAMS =
  GIT_OBJS =
  LIB_OBJS =
 +SCALAR_OBJS =
  OBJECTS =
 +OTHER_PROGRAMS =
  PROGRAM_OBJS =
  PROGRAMS =
  EXCLUDED_PROGRAMS =
@@@ -688,9 -659,9 +689,9 @@@ SCRIPTS = $(SCRIPT_SH_GEN) 
  
  ETAGS_TARGET = TAGS
  
 -FUZZ_OBJS += fuzz-commit-graph.o
 -FUZZ_OBJS += fuzz-pack-headers.o
 -FUZZ_OBJS += fuzz-pack-idx.o
 +FUZZ_OBJS += oss-fuzz/fuzz-commit-graph.o
 +FUZZ_OBJS += oss-fuzz/fuzz-pack-headers.o
 +FUZZ_OBJS += oss-fuzz/fuzz-pack-idx.o
  .PHONY: fuzz-objs
  fuzz-objs: $(FUZZ_OBJS)
  
@@@ -724,7 -695,6 +725,7 @@@ TEST_BUILTINS_OBJS += test-bloom.
  TEST_BUILTINS_OBJS += test-chmtime.o
  TEST_BUILTINS_OBJS += test-config.o
  TEST_BUILTINS_OBJS += test-crontab.o
 +TEST_BUILTINS_OBJS += test-csprng.o
  TEST_BUILTINS_OBJS += test-ctype.o
  TEST_BUILTINS_OBJS += test-date.o
  TEST_BUILTINS_OBJS += test-delta.o
@@@ -736,14 -706,12 +737,14 @@@ TEST_BUILTINS_OBJS += test-dump-split-i
  TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
  TEST_BUILTINS_OBJS += test-example-decorate.o
  TEST_BUILTINS_OBJS += test-fast-rebase.o
 +TEST_BUILTINS_OBJS += test-fsmonitor-client.o
  TEST_BUILTINS_OBJS += test-genrandom.o
  TEST_BUILTINS_OBJS += test-genzeros.o
  TEST_BUILTINS_OBJS += test-getcwd.o
  TEST_BUILTINS_OBJS += test-hash-speed.o
  TEST_BUILTINS_OBJS += test-hash.o
  TEST_BUILTINS_OBJS += test-hashmap.o
 +TEST_BUILTINS_OBJS += test-hexdump.o
  TEST_BUILTINS_OBJS += test-index-version.o
  TEST_BUILTINS_OBJS += test-json-writer.o
  TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
@@@ -754,7 -722,6 +755,7 @@@ TEST_BUILTINS_OBJS += test-oid-array.
  TEST_BUILTINS_OBJS += test-oidmap.o
  TEST_BUILTINS_OBJS += test-oidtree.o
  TEST_BUILTINS_OBJS += test-online-cpus.o
 +TEST_BUILTINS_OBJS += test-pack-mtimes.o
  TEST_BUILTINS_OBJS += test-parse-options.o
  TEST_BUILTINS_OBJS += test-parse-pathspec-file.o
  TEST_BUILTINS_OBJS += test-partial-clone.o
@@@ -769,9 -736,7 +770,9 @@@ TEST_BUILTINS_OBJS += test-read-cache.
  TEST_BUILTINS_OBJS += test-read-graph.o
  TEST_BUILTINS_OBJS += test-read-midx.o
  TEST_BUILTINS_OBJS += test-ref-store.o
 +TEST_BUILTINS_OBJS += test-reftable.o
  TEST_BUILTINS_OBJS += test-regex.o
 +TEST_BUILTINS_OBJS += test-rot13-filter.o
  TEST_BUILTINS_OBJS += test-repository.o
  TEST_BUILTINS_OBJS += test-revision-walking.o
  TEST_BUILTINS_OBJS += test-run-command.o
@@@ -785,7 -750,6 +786,7 @@@ TEST_BUILTINS_OBJS += test-strcmp-offse
  TEST_BUILTINS_OBJS += test-string-list.o
  TEST_BUILTINS_OBJS += test-submodule-config.o
  TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
 +TEST_BUILTINS_OBJS += test-submodule.o
  TEST_BUILTINS_OBJS += test-subprocess.o
  TEST_BUILTINS_OBJS += test-trace2.o
  TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
@@@ -818,16 -782,13 +819,16 @@@ BUILT_INS += git-show$
  BUILT_INS += git-stage$X
  BUILT_INS += git-status$X
  BUILT_INS += git-switch$X
 +BUILT_INS += git-version$X
  BUILT_INS += git-whatchanged$X
  
  # what 'all' will build but not install in gitexecdir
 -OTHER_PROGRAMS = git$X
 +OTHER_PROGRAMS += git$X
 +OTHER_PROGRAMS += scalar$X
  
  # what test wrappers are needed and 'install' will install, in bindir
  BINDIR_PROGRAMS_NEED_X += git
 +BINDIR_PROGRAMS_NEED_X += scalar
  BINDIR_PROGRAMS_NEED_X += git-receive-pack
  BINDIR_PROGRAMS_NEED_X += git-shell
  BINDIR_PROGRAMS_NEED_X += git-upload-archive
@@@ -853,8 -814,6 +854,8 @@@ TEST_SHELL_PATH = $(SHELL_PATH
  
  LIB_FILE = libgit.a
  XDIFF_LIB = xdiff/lib.a
 +REFTABLE_LIB = reftable/libreftable.a
 +REFTABLE_TEST_LIB = reftable/libreftable_test.a
  
  GENERATED_H += command-list.h
  GENERATED_H += config-list.h
@@@ -863,34 -822,12 +864,34 @@@ GENERATED_H += hook-list.
  .PHONY: generated-hdrs
  generated-hdrs: $(GENERATED_H)
  
 -LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
 +## Exhaustive lists of our source files, either dynamically generated,
 +## or hardcoded.
 +SOURCES_CMD = ( \
 +      git ls-files --deduplicate \
 +              '*.[hcS]' \
 +              '*.sh' \
 +              ':!*[tp][0-9][0-9][0-9][0-9]*' \
 +              ':!contrib' \
 +              2>/dev/null || \
        $(FIND) . \
 -      -name .git -prune -o \
 -      -name t -prune -o \
 -      -name Documentation -prune -o \
 -      -name '*.h' -print)))
 +              \( -name .git -type d -prune \) \
 +              -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
 +              -o \( -name contrib -type d -prune \) \
 +              -o \( -name build -type d -prune \) \
 +              -o \( -name .build -type d -prune \) \
 +              -o \( -name 'trash*' -type d -prune \) \
 +              -o \( -name '*.[hcS]' -type f -print \) \
 +              -o \( -name '*.sh' -type f -print \) \
 +              | sed -e 's|^\./||' \
 +      )
 +FOUND_SOURCE_FILES := $(filter-out $(GENERATED_H),$(shell $(SOURCES_CMD)))
 +
 +FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
 +FOUND_H_SOURCES = $(filter %.h,$(FOUND_SOURCE_FILES))
 +
 +COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
 +
 +LIB_H = $(FOUND_H_SOURCES)
  
  LIB_OBJS += abspath.o
  LIB_OBJS += add-interactive.o
@@@ -910,7 -847,6 +911,7 @@@ LIB_OBJS += blob.
  LIB_OBJS += bloom.o
  LIB_OBJS += branch.o
  LIB_OBJS += bulk-checkin.o
 +LIB_OBJS += bundle-uri.o
  LIB_OBJS += bundle.o
  LIB_OBJS += cache-tree.o
  LIB_OBJS += cbtree.o
@@@ -923,10 -859,8 +924,10 @@@ LIB_OBJS += combine-diff.
  LIB_OBJS += commit-graph.o
  LIB_OBJS += commit-reach.o
  LIB_OBJS += commit.o
 +LIB_OBJS += compat/nonblock.o
  LIB_OBJS += compat/obstack.o
  LIB_OBJS += compat/terminal.o
 +LIB_OBJS += compat/zlib-uncompress2.o
  LIB_OBJS += config.o
  LIB_OBJS += connect.o
  LIB_OBJS += connected.o
@@@ -938,7 -872,6 +939,7 @@@ LIB_OBJS += ctype.
  LIB_OBJS += date.o
  LIB_OBJS += decorate.o
  LIB_OBJS += delta-islands.o
 +LIB_OBJS += diagnose.o
  LIB_OBJS += diff-delta.o
  LIB_OBJS += diff-merges.o
  LIB_OBJS += diff-lib.o
@@@ -965,8 -898,6 +966,8 @@@ LIB_OBJS += fetch-pack.
  LIB_OBJS += fmt-merge-msg.o
  LIB_OBJS += fsck.o
  LIB_OBJS += fsmonitor.o
 +LIB_OBJS += fsmonitor-ipc.o
 +LIB_OBJS += fsmonitor-settings.o
  LIB_OBJS += gettext.o
  LIB_OBJS += gpg-interface.o
  LIB_OBJS += graph.o
@@@ -999,6 -930,7 +1000,6 @@@ LIB_OBJS += merge-ort.
  LIB_OBJS += merge-ort-wrappers.o
  LIB_OBJS += merge-recursive.o
  LIB_OBJS += merge.o
 -LIB_OBJS += mergesort.o
  LIB_OBJS += midx.o
  LIB_OBJS += name-hash.o
  LIB_OBJS += negotiator/default.o
@@@ -1018,7 -950,6 +1019,7 @@@ LIB_OBJS += oidtree.
  LIB_OBJS += pack-bitmap-write.o
  LIB_OBJS += pack-bitmap.o
  LIB_OBJS += pack-check.o
 +LIB_OBJS += pack-mtimes.o
  LIB_OBJS += pack-objects.o
  LIB_OBJS += pack-revindex.o
  LIB_OBJS += pack-write.o
@@@ -1049,7 -980,6 +1050,7 @@@ LIB_OBJS += rebase-interactive.
  LIB_OBJS += rebase.o
  LIB_OBJS += ref-filter.o
  LIB_OBJS += reflog-walk.o
 +LIB_OBJS += reflog.o
  LIB_OBJS += refs.o
  LIB_OBJS += refs/debug.o
  LIB_OBJS += refs/files-backend.o
@@@ -1159,7 -1089,6 +1160,7 @@@ BUILTIN_OBJS += builtin/credential-cach
  BUILTIN_OBJS += builtin/credential-store.o
  BUILTIN_OBJS += builtin/credential.o
  BUILTIN_OBJS += builtin/describe.o
 +BUILTIN_OBJS += builtin/diagnose.o
  BUILTIN_OBJS += builtin/diff-files.o
  BUILTIN_OBJS += builtin/diff-index.o
  BUILTIN_OBJS += builtin/diff-tree.o
@@@ -1174,13 -1103,11 +1175,13 @@@ BUILTIN_OBJS += builtin/fmt-merge-msg.
  BUILTIN_OBJS += builtin/for-each-ref.o
  BUILTIN_OBJS += builtin/for-each-repo.o
  BUILTIN_OBJS += builtin/fsck.o
 +BUILTIN_OBJS += builtin/fsmonitor--daemon.o
  BUILTIN_OBJS += builtin/gc.o
  BUILTIN_OBJS += builtin/get-tar-commit-id.o
  BUILTIN_OBJS += builtin/grep.o
  BUILTIN_OBJS += builtin/hash-object.o
  BUILTIN_OBJS += builtin/help.o
 +BUILTIN_OBJS += builtin/hook.o
  BUILTIN_OBJS += builtin/index-pack.o
  BUILTIN_OBJS += builtin/init-db.o
  BUILTIN_OBJS += builtin/interpret-trailers.o
@@@ -1266,8 -1193,7 +1267,8 @@@ THIRD_PARTY_SOURCES += compat/regex/
  THIRD_PARTY_SOURCES += sha1collisiondetection/%
  THIRD_PARTY_SOURCES += sha1dc/%
  
 -GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
 +# xdiff and reftable libs may in turn depend on what is in libgit.a
 +GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
  EXTLIBS =
  
  GIT_USER_AGENT = git/$(GIT_VERSION)
@@@ -1279,7 -1205,6 +1280,7 @@@ endi
  # Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
  # tweaked by config.* below as well as the command-line, both of
  # which'll override these defaults.
 +# Older versions of GCC may require adding "-std=gnu99" at the end.
  CFLAGS = -g -O2 -Wall
  LDFLAGS =
  CC_LD_DYNPATH = -Wl,-rpath,
@@@ -1291,17 -1216,16 +1292,17 @@@ ARFLAGS = rc
  PTHREAD_CFLAGS =
  
  # For the 'sparse' target
 -SPARSE_FLAGS ?=
 +SPARSE_FLAGS ?= -std=gnu99
  SP_EXTRA_FLAGS = -Wno-universal-initializer
  
 -# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak target
 +# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak,address targets
  SANITIZE_LEAK =
 +SANITIZE_ADDRESS =
  
  # For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
  # usually result in less CPU usage at the cost of higher peak memory.
  # Setting it to 0 will feed all files in a single spatch invocation.
 -SPATCH_FLAGS = --all-includes --patch .
 +SPATCH_FLAGS = --all-includes
  SPATCH_BATCH_SIZE = 1
  
  include config.mak.uname
@@@ -1329,6 -1253,10 +1330,6 @@@ endi
  ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
  ALL_LDFLAGS = $(LDFLAGS)
  
 -comma := ,
 -empty :=
 -space := $(empty) $(empty)
 -
  ifdef SANITIZE
  SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
  BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
@@@ -1342,7 -1270,6 +1343,7 @@@ SANITIZE_LEAK = YesCompiledWithI
  endif
  ifneq ($(filter address,$(SANITIZERS)),)
  NO_REGEX = NeededForASAN
 +SANITIZE_ADDRESS = YesCompiledWithIt
  endif
  endif
  
@@@ -1442,6 -1369,7 +1443,6 @@@ ifeq ($(uname_S),Darwin
                APPLE_COMMON_CRYPTO = YesPlease
                COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
        endif
 -      NO_REGEX = YesPlease
        PTHREAD_LIBS =
  endif
  
@@@ -1805,10 -1733,6 +1806,10 @@@ ifdef APPLE_COMMON_CRYPT
        SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
  endif
  
 +ifdef PPC_SHA1
 +$(error the PPC_SHA1 flag has been removed along with the PowerPC-specific SHA-1 implementation.)
 +endif
 +
  ifdef OPENSSL_SHA1
        EXTLIBS += $(LIB_4_CRYPTO)
        BASIC_CFLAGS += -DSHA1_OPENSSL
@@@ -1817,6 -1741,10 +1818,6 @@@ ifdef BLK_SHA
        LIB_OBJS += block-sha1/sha1.o
        BASIC_CFLAGS += -DSHA1_BLK
  else
 -ifdef PPC_SHA1
 -      LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
 -      BASIC_CFLAGS += -DSHA1_PPC
 -else
  ifdef APPLE_COMMON_CRYPTO
        COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
        BASIC_CFLAGS += -DSHA1_APPLE
@@@ -1850,15 -1778,12 +1851,15 @@@ endi
  endif
  endif
  endif
 -endif
  
  ifdef OPENSSL_SHA256
        EXTLIBS += $(LIB_4_CRYPTO)
        BASIC_CFLAGS += -DSHA256_OPENSSL
  else
 +ifdef NETTLE_SHA256
 +      BASIC_CFLAGS += -DSHA256_NETTLE
 +      EXTLIBS += -lnettle
 +else
  ifdef GCRYPT_SHA256
        BASIC_CFLAGS += -DSHA256_GCRYPT
        EXTLIBS += -lgcrypt
@@@ -1867,7 -1792,6 +1868,7 @@@ els
        BASIC_CFLAGS += -DSHA256_BLK
  endif
  endif
 +endif
  
  ifdef SHA1_MAX_BLOCK_SIZE
        LIB_OBJS += compat/sha1-chunked.o
@@@ -1950,7 -1874,7 +1951,7 @@@ ifdef GIT_TEST_CMP_USE_COPIED_CONTEX
  endif
  
  ifndef NO_MSGFMT_EXTENDED_OPTIONS
 -      MSGFMT += --check --statistics
 +      MSGFMT += --check
  endif
  
  ifdef HAVE_CLOCK_GETTIME
@@@ -1961,10 -1885,6 +1962,10 @@@ ifdef HAVE_CLOCK_MONOTONI
        BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
  endif
  
 +ifdef HAVE_SYNC_FILE_RANGE
 +      BASIC_CFLAGS += -DHAVE_SYNC_FILE_RANGE
 +endif
 +
  ifdef NEEDS_LIBRT
        EXTLIBS += -lrt
  endif
@@@ -1981,32 -1901,6 +1982,32 @@@ ifdef HAVE_GETDELI
        BASIC_CFLAGS += -DHAVE_GETDELIM
  endif
  
 +ifneq ($(findstring arc4random,$(CSPRNG_METHOD)),)
 +      BASIC_CFLAGS += -DHAVE_ARC4RANDOM
 +endif
 +
 +ifneq ($(findstring libbsd,$(CSPRNG_METHOD)),)
 +      BASIC_CFLAGS += -DHAVE_ARC4RANDOM_LIBBSD
 +      EXTLIBS += -lbsd
 +endif
 +
 +ifneq ($(findstring getrandom,$(CSPRNG_METHOD)),)
 +      BASIC_CFLAGS += -DHAVE_GETRANDOM
 +endif
 +
 +ifneq ($(findstring getentropy,$(CSPRNG_METHOD)),)
 +      BASIC_CFLAGS += -DHAVE_GETENTROPY
 +endif
 +
 +ifneq ($(findstring rtlgenrandom,$(CSPRNG_METHOD)),)
 +      BASIC_CFLAGS += -DHAVE_RTLGENRANDOM
 +endif
 +
 +ifneq ($(findstring openssl,$(CSPRNG_METHOD)),)
 +      BASIC_CFLAGS += -DHAVE_OPENSSL_CSPRNG
 +      EXTLIBS += -lcrypto -lssl
 +endif
 +
  ifneq ($(PROCFS_EXECUTABLE_PATH),)
        procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
        BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
@@@ -2034,19 -1928,6 +2035,19 @@@ ifdef NEED_ACCESS_ROOT_HANDLE
        COMPAT_OBJS += compat/access.o
  endif
  
 +ifdef FSMONITOR_DAEMON_BACKEND
 +      COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
 +      COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
 +      COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o
 +      COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND).o
 +endif
 +
 +ifdef FSMONITOR_OS_SETTINGS
 +      COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
 +      COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
 +      COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
 +endif
 +
  ifeq ($(TCLTK_PATH),)
  NO_TCLTK = NoThanks
  endif
@@@ -2063,6 -1944,39 +2064,6 @@@ ifndef PAGER_EN
  PAGER_ENV = LESS=FRX LV=-c
  endif
  
 -QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
 -QUIET_SUBDIR1  =
 -
 -ifneq ($(findstring w,$(MAKEFLAGS)),w)
 -PRINT_DIR = --no-print-directory
 -else # "make -w"
 -NO_SUBDIR = :
 -endif
 -
 -ifneq ($(findstring s,$(MAKEFLAGS)),s)
 -ifndef V
 -      QUIET_CC       = @echo '   ' CC $@;
 -      QUIET_AR       = @echo '   ' AR $@;
 -      QUIET_LINK     = @echo '   ' LINK $@;
 -      QUIET_BUILT_IN = @echo '   ' BUILTIN $@;
 -      QUIET_GEN      = @echo '   ' GEN $@;
 -      QUIET_LNCP     = @echo '   ' LN/CP $@;
 -      QUIET_XGETTEXT = @echo '   ' XGETTEXT $@;
 -      QUIET_MSGFMT   = @echo '   ' MSGFMT $@;
 -      QUIET_GCOV     = @echo '   ' GCOV $@;
 -      QUIET_SP       = @echo '   ' SP $<;
 -      QUIET_HDR      = @echo '   ' HDR $(<:hcc=h);
 -      QUIET_RC       = @echo '   ' RC $@;
 -      QUIET_SPATCH   = @echo '   ' SPATCH $<;
 -      QUIET_SUBDIR0  = +@subdir=
 -      QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 -                       $(MAKE) $(PRINT_DIR) -C $$subdir
 -      export V
 -      export QUIET_GEN
 -      export QUIET_BUILT_IN
 -endif
 -endif
 -
  ifdef NO_INSTALL_HARDLINKS
        export NO_INSTALL_HARDLINKS
  endif
@@@ -2109,7 -2023,6 +2110,7 @@@ htmldir_relative_SQ = $(subst ','\'',$(
  prefix_SQ = $(subst ','\'',$(prefix))
  perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
  gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
 +gitwebstaticdir_SQ = $(subst ','\'',$(gitwebstaticdir))
  
  SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
  TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
@@@ -2192,6 -2105,11 +2193,6 @@@ ifdef DEFAULT_HELP_FORMA
  BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
  endif
  
 -PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
 -PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
 -PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
 -BASIC_CFLAGS += -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
 -
  ALL_CFLAGS += $(BASIC_CFLAGS)
  ALL_LDFLAGS += $(BASIC_LDFLAGS)
  
@@@ -2226,7 -2144,7 +2227,7 @@@ profile-fast: profile-clea
  
  all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
  ifneq (,$X)
 -      $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
 +      $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
  endif
  
  all::
@@@ -2244,6 -2162,16 +2245,6 @@@ shell_compatibility_test: please_set_SH
  strip: $(PROGRAMS) git$X
        $(STRIP) $(STRIP_OPTS) $^
  
 -### Flags affecting all rules
 -
 -# A GNU make extension since gmake 3.72 (released in late 1994) to
 -# remove the target of rules if commands in those rules fail. The
 -# default is to only do that if make itself receives a signal. Affects
 -# all targets, see:
 -#
 -#    info make --index-search=.DELETE_ON_ERROR
 -.DELETE_ON_ERROR:
 -
  ### Target-specific flags and dependencies
  
  # The generic compilation pattern rule and automatically
@@@ -2288,20 -2216,14 +2289,20 @@@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS
                $(filter %.o,$^) $(LIBS)
  
  help.sp help.s help.o: command-list.h
 -hook.sp hook.s hook.o: hook-list.h
 +builtin/bugreport.sp builtin/bugreport.s builtin/bugreport.o: hook-list.h
  
 -builtin/help.sp builtin/help.s builtin/help.o: config-list.h hook-list.h GIT-PREFIX
 +builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
  builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
        '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
        '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
        '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
  
 +PAGER_ENV_SQ = $(subst ','\'',$(PAGER_ENV))
 +PAGER_ENV_CQ = "$(subst ",\",$(subst \,\\,$(PAGER_ENV)))"
 +PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
 +pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
 +      -DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
 +
  version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
  version.sp version.s version.o: EXTRA_CPPFLAGS = \
        '-DGIT_VERSION="$(GIT_VERSION)"' \
@@@ -2331,30 -2253,33 +2332,30 @@@ command-list.h: $(wildcard Documentatio
  hook-list.h: generate-hooklist.sh Documentation/githooks.txt
        $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
  
 -SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
 -      $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
 -      $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
 +SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
 +      $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
 +      $(gitwebdir_SQ):$(PERL_PATH_SQ):$(PAGER_ENV):\
        $(perllibdir_SQ)
 +GIT-SCRIPT-DEFINES: FORCE
 +      @FLAGS='$(SCRIPT_DEFINES)'; \
 +          if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
 +              echo >&2 "    * new script parameters"; \
 +              echo "$$FLAGS" >$@; \
 +            fi
 +
  define cmd_munge_script
  sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
      -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
      -e 's|@@DIFF@@|$(DIFF_SQ)|' \
      -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
 -    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
      -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
      -e $(BROKEN_PATH_FIX) \
      -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
      -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 -    -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
      -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
      $@.sh >$@+
  endef
  
 -GIT-SCRIPT-DEFINES: FORCE
 -      @FLAGS='$(SCRIPT_DEFINES)'; \
 -          if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
 -              echo >&2 "    * new script parameters"; \
 -              echo "$$FLAGS" >$@; \
 -            fi
 -
 -
  $(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
        $(QUIET_GEN)$(cmd_munge_script) && \
        chmod +x $@+ && \
@@@ -2438,6 -2363,10 +2439,6 @@@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE
  perllibdir:
        @echo '$(perllibdir_SQ)'
  
 -.PHONY: gitweb
 -gitweb:
 -      $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
 -
  git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
        $(QUIET_GEN)$(cmd_munge_script) && \
        chmod +x $@+ && \
@@@ -2509,36 -2438,7 +2510,36 @@@ XDIFF_OBJS += xdiff/xutils.
  .PHONY: xdiff-objs
  xdiff-objs: $(XDIFF_OBJS)
  
 +REFTABLE_OBJS += reftable/basics.o
 +REFTABLE_OBJS += reftable/error.o
 +REFTABLE_OBJS += reftable/block.o
 +REFTABLE_OBJS += reftable/blocksource.o
 +REFTABLE_OBJS += reftable/iter.o
 +REFTABLE_OBJS += reftable/publicbasics.o
 +REFTABLE_OBJS += reftable/merged.o
 +REFTABLE_OBJS += reftable/pq.o
 +REFTABLE_OBJS += reftable/reader.o
 +REFTABLE_OBJS += reftable/record.o
 +REFTABLE_OBJS += reftable/refname.o
 +REFTABLE_OBJS += reftable/generic.o
 +REFTABLE_OBJS += reftable/stack.o
 +REFTABLE_OBJS += reftable/tree.o
 +REFTABLE_OBJS += reftable/writer.o
 +
 +REFTABLE_TEST_OBJS += reftable/basics_test.o
 +REFTABLE_TEST_OBJS += reftable/block_test.o
 +REFTABLE_TEST_OBJS += reftable/dump.o
 +REFTABLE_TEST_OBJS += reftable/merged_test.o
 +REFTABLE_TEST_OBJS += reftable/pq_test.o
 +REFTABLE_TEST_OBJS += reftable/record_test.o
 +REFTABLE_TEST_OBJS += reftable/readwrite_test.o
 +REFTABLE_TEST_OBJS += reftable/refname_test.o
 +REFTABLE_TEST_OBJS += reftable/stack_test.o
 +REFTABLE_TEST_OBJS += reftable/test_framework.o
 +REFTABLE_TEST_OBJS += reftable/tree_test.o
 +
  TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
 +
  .PHONY: test-objs
  test-objs: $(TEST_OBJS)
  
@@@ -2549,22 -2449,14 +2550,22 @@@ GIT_OBJS += git.
  .PHONY: git-objs
  git-objs: $(GIT_OBJS)
  
 +SCALAR_OBJS += scalar.o
 +.PHONY: scalar-objs
 +scalar-objs: $(SCALAR_OBJS)
 +
  OBJECTS += $(GIT_OBJS)
 +OBJECTS += $(SCALAR_OBJS)
  OBJECTS += $(PROGRAM_OBJS)
  OBJECTS += $(TEST_OBJS)
  OBJECTS += $(XDIFF_OBJS)
  OBJECTS += $(FUZZ_OBJS)
 +OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
 +
  ifndef NO_CURL
        OBJECTS += http.o http-walker.o remote-curl.o
  endif
 +
  .PHONY: objects
  objects: $(OBJECTS)
  
@@@ -2599,7 -2491,15 +2600,7 @@@ missing_compdb_dir 
  compdb_args =
  endif
  
 -ASM_SRC := $(wildcard $(OBJECTS:o=S))
 -ASM_OBJ := $(ASM_SRC:S=o)
 -C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
 -
 -.SUFFIXES:
 -
 -$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
 -      $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
 -$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
 +$(OBJECTS): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
        $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
  
  %.s: %.c GIT-CFLAGS FORCE
@@@ -2690,22 -2590,12 +2691,22 @@@ $(REMOTE_CURL_PRIMARY): remote-curl.o h
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
                $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
  
 +scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
 +      $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
 +              $(filter %.o,$^) $(LIBS)
 +
  $(LIB_FILE): $(LIB_OBJS)
        $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
  
  $(XDIFF_LIB): $(XDIFF_OBJS)
        $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
  
 +$(REFTABLE_LIB): $(REFTABLE_OBJS)
 +      $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 +
 +$(REFTABLE_TEST_LIB): $(REFTABLE_TEST_OBJS)
 +      $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 +
  export DEFAULT_EDITOR DEFAULT_PAGER
  
  Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
@@@ -2738,17 -2628,17 +2739,17 @@@ XGETTEXT_FLAGS = 
        --force-po \
        --add-comments=TRANSLATORS: \
        --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
 -      --from-code=UTF-8
 +      --package-name=Git
  XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
        --keyword=_ --keyword=N_ --keyword="Q_:1,2"
  XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
        --keyword=gettextln --keyword=eval_gettextln
  XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
        --keyword=__ --keyword=N__ --keyword="__n:1,2"
 -LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
 -LOCALIZED_SH = $(SCRIPT_SH)
 -LOCALIZED_SH += git-sh-setup.sh
 -LOCALIZED_PERL = $(SCRIPT_PERL)
 +MSGMERGE_FLAGS = --add-location --backup=off --update
 +LOCALIZED_C = $(sort $(FOUND_C_SOURCES) $(FOUND_H_SOURCES) $(GENERATED_H))
 +LOCALIZED_SH = $(sort $(SCRIPT_SH) git-sh-setup.sh)
 +LOCALIZED_PERL = $(sort $(SCRIPT_PERL))
  
  ifdef XGETTEXT_INCLUDE_TESTS
  LOCALIZED_C += t/t0200/test.c
@@@ -2756,129 -2646,38 +2757,129 @@@ LOCALIZED_SH += t/t0200/test.s
  LOCALIZED_PERL += t/t0200/test.perl
  endif
  
 -## Note that this is meant to be run only by the localization coordinator
 -## under a very controlled condition, i.e. (1) it is to be run in a
 -## Git repository (not a tarball extract), (2) any local modifications
 -## will be lost.
 +## We generate intermediate .build/pot/po/%.po files containing a
 +## extract of the translations we find in each file in the source
 +## tree. We will assemble them using msgcat to create the final
 +## "po/git.pot" file.
 +LOCALIZED_ALL_GEN_PO =
 +
 +LOCALIZED_C_GEN_PO = $(LOCALIZED_C:%=.build/pot/po/%.po)
 +LOCALIZED_ALL_GEN_PO += $(LOCALIZED_C_GEN_PO)
 +
 +LOCALIZED_SH_GEN_PO = $(LOCALIZED_SH:%=.build/pot/po/%.po)
 +LOCALIZED_ALL_GEN_PO += $(LOCALIZED_SH_GEN_PO)
 +
 +LOCALIZED_PERL_GEN_PO = $(LOCALIZED_PERL:%=.build/pot/po/%.po)
 +LOCALIZED_ALL_GEN_PO += $(LOCALIZED_PERL_GEN_PO)
 +
  ## Gettext tools cannot work with our own custom PRItime type, so
  ## we replace PRItime with PRIuMAX.  We need to update this to
  ## PRIdMAX if we switch to a signed type later.
 +$(LOCALIZED_C_GEN_PO): .build/pot/po/%.po: %
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_XGETTEXT) \
 +          if grep -q PRItime $<; then \
 +              (\
 +                      sed -e 's|PRItime|PRIuMAX|g' <$< \
 +                              >.build/pot/po/$< && \
 +                      cd .build/pot/po && \
 +                      $(XGETTEXT) --omit-header \
 +                              -o $(@:.build/pot/po/%=%) \
 +                              $(XGETTEXT_FLAGS_C) $< && \
 +                      rm $<; \
 +              ); \
 +          else \
 +              $(XGETTEXT) --omit-header \
 +                      -o $@ $(XGETTEXT_FLAGS_C) $<; \
 +          fi
  
 -po/git.pot: $(GENERATED_H) FORCE
 -      # All modifications will be reverted at the end, so we do not
 -      # want to have any local change.
 -      git diff --quiet HEAD && git diff --quiet --cached
 -
 -      @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \
 -      do \
 -              sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \
 -              cat "$$s+" >"$$s" && rm "$$s+"; \
 -      done
 +$(LOCALIZED_SH_GEN_PO): .build/pot/po/%.po: %
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_XGETTEXT)$(XGETTEXT) --omit-header \
 +              -o$@ $(XGETTEXT_FLAGS_SH) $<
 +
 +$(LOCALIZED_PERL_GEN_PO): .build/pot/po/%.po: %
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_XGETTEXT)$(XGETTEXT) --omit-header \
 +              -o$@ $(XGETTEXT_FLAGS_PERL) $<
 +
 +define gen_pot_header
 +$(XGETTEXT) $(XGETTEXT_FLAGS_C) \
 +      -o - /dev/null | \
 +sed -e 's|charset=CHARSET|charset=UTF-8|' \
 +    -e 's|\(Last-Translator: \)FULL NAME <.*>|\1make by the Makefile|' \
 +    -e 's|\(Language-Team: \)LANGUAGE <.*>|\1Git Mailing List <git@vger.kernel.org>|' \
 +    >$@ && \
 +echo '"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n"' >>$@
 +endef
  
 -      $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
 -      $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
 -              $(LOCALIZED_SH)
 -      $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
 -              $(LOCALIZED_PERL)
 +.build/pot/git.header: $(LOCALIZED_ALL_GEN_PO)
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_GEN)$(gen_pot_header)
  
 -      # Reverting the munged source, leaving only the updated $@
 -      git reset --hard
 -      mv $@+ $@
 +po/git.pot: .build/pot/git.header $(LOCALIZED_ALL_GEN_PO)
 +      $(QUIET_GEN)$(MSGCAT) $^ >$@
  
  .PHONY: pot
  pot: po/git.pot
  
 +define check_po_file_envvar
 +      $(if $(PO_FILE), \
 +              $(if $(filter po/%.po,$(PO_FILE)), , \
 +                      $(error PO_FILE should match pattern: "po/%.po")), \
 +              $(error PO_FILE is not defined))
 +endef
 +
 +.PHONY: po-update
 +po-update: po/git.pot
 +      $(check_po_file_envvar)
 +      @if test ! -e $(PO_FILE); then \
 +              echo >&2 "error: $(PO_FILE) does not exist"; \
 +              echo >&2 'To create an initial po file, use: "make po-init PO_FILE=po/XX.po"'; \
 +              exit 1; \
 +      fi
 +      $(QUIET_MSGMERGE)$(MSGMERGE) $(MSGMERGE_FLAGS) $(PO_FILE) po/git.pot
 +
 +.PHONY: check-pot
 +check-pot: $(LOCALIZED_ALL_GEN_PO)
 +
 +### TODO FIXME: Translating everything in these files is a bad
 +### heuristic for "core", as we'll translate obscure error() messages
 +### along with commonly seen i18n messages. A better heuristic would
 +### be to e.g. use spatch to first remove error/die/warning
 +### etc. messages.
 +LOCALIZED_C_CORE =
 +LOCALIZED_C_CORE += builtin/checkout.c
 +LOCALIZED_C_CORE += builtin/clone.c
 +LOCALIZED_C_CORE += builtin/index-pack.c
 +LOCALIZED_C_CORE += builtin/push.c
 +LOCALIZED_C_CORE += builtin/reset.c
 +LOCALIZED_C_CORE += remote.c
 +LOCALIZED_C_CORE += wt-status.c
 +
 +LOCALIZED_C_CORE_GEN_PO = $(LOCALIZED_C_CORE:%=.build/pot/po/%.po)
 +
 +.build/pot/git-core.header: $(LOCALIZED_C_CORE_GEN_PO)
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_GEN)$(gen_pot_header)
 +
 +po/git-core.pot: .build/pot/git-core.header $(LOCALIZED_C_CORE_GEN_PO)
 +      $(QUIET_GEN)$(MSGCAT) $^ >$@
 +
 +.PHONY: po-init
 +po-init: po/git-core.pot
 +      $(check_po_file_envvar)
 +      @if test -e $(PO_FILE); then \
 +              echo >&2 "error: $(PO_FILE) exists already"; \
 +              exit 1; \
 +      fi
 +      $(QUIET_MSGINIT)msginit \
 +              --input=$< \
 +              --output=$(PO_FILE) \
 +              --no-translator \
 +              --locale=$(PO_FILE:po/%.po=%)
 +
 +## po/*.po files & their rules
  ifdef NO_GETTEXT
  POFILES :=
  MOFILES :=
@@@ -2890,8 -2689,7 +2891,8 @@@ all:: $(MOFILES
  endif
  
  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
 -      $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_MSGFMT)$(MSGFMT) -o $@ $<
  
  LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
  LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
@@@ -2907,16 -2705,35 +2908,16 @@@ NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','
  endif
  
  perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
 -      $(QUIET_GEN)mkdir -p $(dir $@) && \
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_GEN) \
        sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
            -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
            -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
        < $< > $@
  
  perl/build/man/man3/Git.3pm: perl/Git.pm
 -      $(QUIET_GEN)mkdir -p $(dir $@) && \
 -      pod2man $< $@
 -
 -FIND_SOURCE_FILES = ( \
 -      git ls-files \
 -              '*.[hcS]' \
 -              '*.sh' \
 -              ':!*[tp][0-9][0-9][0-9][0-9]*' \
 -              ':!contrib' \
 -              2>/dev/null || \
 -      $(FIND) . \
 -              \( -name .git -type d -prune \) \
 -              -o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
 -              -o \( -name contrib -type d -prune \) \
 -              -o \( -name build -type d -prune \) \
 -              -o \( -name 'trash*' -type d -prune \) \
 -              -o \( -name '*.[hcS]' -type f -print \) \
 -              -o \( -name '*.sh' -type f -print \) \
 -              | sed -e 's|^\./||' \
 -      )
 -
 -FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_GEN)pod2man $< $@
  
  $(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
        $(QUIET_GEN)$(RM) $@+ && \
@@@ -2981,19 -2798,11 +2982,19 @@@ GIT-BUILD-OPTIONS: FORC
        @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
        @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
        @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
 +      @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
        @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
        @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
        @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
        @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
 +      @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
        @echo X=\'$(X)\' >>$@+
 +ifdef FSMONITOR_DAEMON_BACKEND
 +      @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
 +endif
 +ifdef FSMONITOR_OS_SETTINGS
 +      @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
 +endif
  ifdef TEST_OUTPUT_DIRECTORY
        @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
  endif
@@@ -3058,10 -2867,10 +3059,10 @@@ test_bindir_programs := $(patsubst %,bi
  all:: $(TEST_PROGRAMS) $(test_bindir_programs)
  
  bin-wrappers/%: wrap-for-bin.sh
 -      @mkdir -p bin-wrappers
 +      $(call mkdir_p_parent_template)
        $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
             -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
 -           -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
 +           -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
        chmod +x $@
  
  # GNU make supports exporting all variables by "export" without parameters.
@@@ -3085,13 -2894,13 +3086,13 @@@ perf: al
  
  t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
  
 -t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
 +t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
  
  check-sha1:: t/helper/test-tool$X
        t/helper/test-sha1.sh
  
 -SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
 +SP_OBJ = $(patsubst %.o,%.sp,$(OBJECTS))
  
  $(SP_OBJ): %.sp: %.c %.o
        $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
  sparse: $(SP_OBJ)
  
  EXCEPT_HDRS := $(GENERATED_H) unicode-width.h compat/% xdiff/%
 +ifndef NETTLE_SHA256
 +      EXCEPT_HDRS += sha256/nettle.h
 +endif
  ifndef GCRYPT_SHA256
        EXCEPT_HDRS += sha256/gcrypt.h
  endif
@@@ -3138,7 -2944,8 +3139,7 @@@ check: $(GENERATED_H
                exit 1; \
        fi
  
 -FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
 -COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
 +COCCI_TEST_RES = $(wildcard contrib/coccinelle/tests/*.res)
  
  %.cocci.patch: %.cocci $(COCCI_SOURCES)
        $(QUIET_SPATCH) \
                limit='-n $(SPATCH_BATCH_SIZE)'; \
        fi; \
        if ! echo $(COCCI_SOURCES) | xargs $$limit \
 -              $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
 +              $(SPATCH) $(SPATCH_FLAGS) \
 +              --sp-file $< --patch . \
                >$@+ 2>$@.log; \
        then \
                cat $@.log; \
        then \
                echo '    ' SPATCH result: $@; \
        fi
 +
 +COCCI_TEST_RES_GEN = $(addprefix .build/,$(COCCI_TEST_RES))
 +$(COCCI_TEST_RES_GEN): .build/%.res : %.c
 +$(COCCI_TEST_RES_GEN): .build/%.res : %.res
 +$(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : contrib/coccinelle/%.cocci
 +      $(call mkdir_p_parent_template)
 +      $(QUIET_SPATCH_T)$(SPATCH) $(SPATCH_FLAGS) \
 +              --very-quiet --no-show-diff \
 +              --sp-file $< -o $@ \
 +              $(@:.build/%.res=%.c) && \
 +      cmp $(@:.build/%=%) $@ || \
 +      git -P diff --no-index $(@:.build/%=%) $@ 2>/dev/null; \
 +
 +.PHONY: coccicheck-test
 +coccicheck-test: $(COCCI_TEST_RES_GEN)
 +
 +coccicheck: coccicheck-test
  coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
  
  # See contrib/coccinelle/README
 +coccicheck-pending: coccicheck-test
  coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
  
  .PHONY: coccicheck coccicheck-pending
  
 +# "Sub"-Makefiles, not really because they can't be run stand-alone,
 +# only there to contain directory-specific rules and variables
 +## gitweb/Makefile inclusion:
 +MAK_DIR_GITWEB = gitweb/
 +include gitweb/Makefile
 +
 +.PHONY: gitweb
 +gitweb: $(MAK_DIR_GITWEB_ALL)
 +ifndef NO_GITWEB
 +all:: gitweb
 +endif
 +
  ### Installation rules
  
  ifneq ($(filter /%,$(firstword $(template_dir))),)
@@@ -3269,20 -3045,21 +3270,20 @@@ ifndef NO_PER
        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
        (cd perl/build/lib && $(TAR) cf - .) | \
        (cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
 -      $(MAKE) -C gitweb install
  endif
  ifndef NO_TCLTK
        $(MAKE) -C gitk-git install
        $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
  endif
  ifneq (,$X)
 -      $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) git$X)), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
 +      $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
  endif
  
        bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
        execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
        destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
        { test "$$bindir/" = "$$execdir/" || \
 -        for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
 +        for p in $(OTHER_PROGRAMS) $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
                $(RM) "$$execdir/$$p" && \
                test -n "$(INSTALL_SYMLINKS)" && \
                ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
                  cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
        done
  
 -.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
 +.PHONY: install-doc install-man install-man-perl install-html install-info install-pdf
  .PHONY: quick-install-doc quick-install-man quick-install-html
 -install-gitweb:
 -      $(MAKE) -C gitweb install
  
  install-doc: install-man-perl
        $(MAKE) -C Documentation install
@@@ -3448,16 -3227,13 +3449,16 @@@ profile-clean
        $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
  
  cocciclean:
 +      $(RM) -r .build/contrib/coccinelle
        $(RM) contrib/coccinelle/*.cocci.patch*
  
  clean: profile-clean coverage-clean cocciclean
 -      $(RM) *.res
 +      $(RM) -r .build
 +      $(RM) po/git.pot po/git-core.pot
 +      $(RM) git.res
        $(RM) $(OBJECTS)
 -      $(RM) $(LIB_FILE) $(XDIFF_LIB)
 -      $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 +      $(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
 +      $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
        $(RM) $(TEST_PROGRAMS)
        $(RM) $(FUZZ_PROGRAMS)
        $(RM) $(SP_OBJ)
        $(MAKE) -C Documentation/ clean
        $(RM) Documentation/GIT-EXCLUDED-PROGRAMS
  ifndef NO_PERL
 -      $(MAKE) -C gitweb clean
        $(RM) -r perl/build/
  endif
        $(MAKE) -C templates/ clean
@@@ -3508,7 -3285,6 +3509,7 @@@ ALL_COMMANDS += git-citoo
  ALL_COMMANDS += git-gui
  ALL_COMMANDS += gitk
  ALL_COMMANDS += gitweb
 +ALL_COMMANDS += scalar
  
  .PHONY: check-docs
  check-docs::
                sed -e '1,/^### command list/d' \
                    -e '/^#/d' \
                    -e '/guide$$/d' \
 +                  -e '/interfaces$$/d' \
                    -e 's/[     ].*//' \
                    -e 's/^/listed /' command-list.txt; \
                $(MAKE) -C Documentation print-man1 | \
@@@ -3572,7 -3347,6 +3573,7 @@@ coverage-clean-results
        $(RM) coverage-untested-functions
        $(RM) -r cover_db/
        $(RM) -r cover_db_html/
 +      $(RM) coverage-test.made
  
  coverage-clean: coverage-clean-results
        $(RM) $(addsuffix *.gcno,$(object_dirs))
@@@ -3587,17 -3361,13 +3588,17 @@@ coverage-compile
  coverage-test: coverage-clean-results coverage-compile
        $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
                DEFAULT_TEST_TARGET=test -j1 test
 +      touch coverage-test.made
 +
 +coverage-test.made:
 +      $(MAKE) coverage-test
  
  coverage-prove: coverage-clean-results coverage-compile
        $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
                DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \
                -j1 test
  
 -coverage-report:
 +coverage-report: coverage-test.made
        $(QUIET_GCOV)for dir in $(object_dirs); do \
                $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
        done