2005-12-02 04:26:41 +08:00
|
|
|
# The default target of this Makefile is...
|
2007-01-11 04:24:54 +08:00
|
|
|
all::
|
2005-12-02 04:26:41 +08:00
|
|
|
|
2007-03-06 15:09:14 +08:00
|
|
|
# Define V=1 to have a more verbose compile.
|
2007-03-06 14:35:01 +08:00
|
|
|
#
|
2009-06-06 07:36:15 +08:00
|
|
|
# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
|
|
|
|
#
|
|
|
|
# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
|
|
|
|
# to PATH if your tools in /usr/bin are broken.
|
|
|
|
#
|
2010-05-14 17:31:42 +08:00
|
|
|
# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
|
|
|
|
# system headers do not define a socklen_t type.
|
|
|
|
#
|
2010-05-14 17:31:43 +08:00
|
|
|
# Define INLINE to a suitable substitute (such as '__inline' or '') if git
|
|
|
|
# fails to compile with errors about undefined inline functions or similar.
|
|
|
|
#
|
2014-09-13 22:20:22 +08:00
|
|
|
# Define SNPRINTF_RETURNS_BOGUS if you are on a system which snprintf()
|
2008-03-05 23:46:13 +08:00
|
|
|
# or vsnprintf() return -1 instead of number of characters which would
|
|
|
|
# have been written to the final string if enough space had been available.
|
|
|
|
#
|
2014-09-13 22:20:22 +08:00
|
|
|
# Define FREAD_READS_DIRECTORIES if you are on a system which succeeds
|
2008-02-09 10:32:47 +08:00
|
|
|
# when attempting to read from an fopen'ed directory.
|
|
|
|
#
|
2006-03-01 07:07:20 +08:00
|
|
|
# Define NO_OPENSSL environment variable if you do not have OpenSSL.
|
2009-08-18 08:09:56 +08:00
|
|
|
# This also implies BLK_SHA1.
|
2005-05-23 06:08:15 +08:00
|
|
|
#
|
2011-05-10 05:52:05 +08:00
|
|
|
# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
|
|
|
|
# able to use Perl-compatible regular expressions.
|
|
|
|
#
|
|
|
|
# Define LIBPCREDIR=/foo/bar if your libpcre header and library files are in
|
|
|
|
# /foo/bar/include and /foo/bar/lib directories.
|
|
|
|
#
|
Portable alloca for Git
In the next patch we'll have to use alloca() for performance reasons,
but since alloca is non-standardized and is not portable, let's have a
trick with compatibility wrappers:
1. at configure time, determine, do we have working alloca() through
alloca.h, and define
#define HAVE_ALLOCA_H
if yes.
2. in code
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
# define xalloca(size) (alloca(size))
# define xalloca_free(p) do {} while(0)
#else
# define xalloca(size) (xmalloc(size))
# define xalloca_free(p) (free(p))
#endif
and use it like
func() {
p = xalloca(size);
...
xalloca_free(p);
}
This way, for systems, where alloca is available, we'll have optimal
on-stack allocations with fast executions. On the other hand, on
systems, where alloca is not available, this gracefully fallbacks to
xmalloc/free.
Both autoconf and config.mak.uname configurations were updated. For
autoconf, we are not bothering considering cases, when no alloca.h is
available, but alloca() works some other way - its simply alloca.h is
available and works or not, everything else is deep legacy.
For config.mak.uname, I've tried to make my almost-sure guess for where
alloca() is available, but since I only have access to Linux it is the
only change I can be sure about myself, with relevant to other changed
systems people Cc'ed.
NOTE
SunOS and Windows had explicit -DHAVE_ALLOCA_H in their configurations.
I've changed that to now-common HAVE_ALLOCA_H=YesPlease which should be
correct.
Cc: Brandon Casey <drafnel@gmail.com>
Cc: Marius Storm-Olsen <mstormo@gmail.com>
Cc: Johannes Sixt <j6t@kdbg.org>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Gerrit Pape <pape@smarden.org>
Cc: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Thomas Schwinge <thomas@codesourcery.com> (GNU Hurd changes)
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-27 22:22:50 +08:00
|
|
|
# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
|
|
|
|
#
|
2011-08-03 20:07:57 +08:00
|
|
|
# Define NO_CURL if you do not have libcurl installed. git-http-fetch and
|
2005-11-03 03:19:24 +08:00
|
|
|
# git-http-push are not built, and you cannot use http:// and https://
|
2011-08-03 20:07:57 +08:00
|
|
|
# transports (neither smart nor dumb).
|
2005-07-31 08:14:23 +08:00
|
|
|
#
|
2005-09-19 22:11:19 +08:00
|
|
|
# Define CURLDIR=/foo/bar if your curl header and library files are in
|
2014-05-01 01:58:10 +08:00
|
|
|
# /foo/bar/include and /foo/bar/lib directories.
|
2005-09-19 22:11:19 +08:00
|
|
|
#
|
2005-11-03 03:19:24 +08:00
|
|
|
# Define NO_EXPAT if you do not have expat installed. git-http-push is
|
2011-08-03 20:07:57 +08:00
|
|
|
# not built, and you cannot push using http:// and https:// transports (dumb).
|
2005-11-03 03:19:24 +08:00
|
|
|
#
|
2009-01-29 04:43:57 +08:00
|
|
|
# Define EXPATDIR=/foo/bar if your expat header and library files are in
|
|
|
|
# /foo/bar/include and /foo/bar/lib directories.
|
|
|
|
#
|
2013-02-12 06:03:45 +08:00
|
|
|
# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
|
|
|
|
# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
|
|
|
|
#
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
# Define NO_GETTEXT if you don't want Git output to be translated.
|
|
|
|
# A translated Git requires GNU libintl or another gettext implementation,
|
|
|
|
# plus libintl-perl at runtime.
|
|
|
|
#
|
2012-01-24 06:04:29 +08:00
|
|
|
# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
|
|
|
|
# the installed gettext translation of the shell scripts output.
|
|
|
|
#
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
|
|
|
|
# trust the langinfo.h's nl_langinfo(CODESET) function to return the
|
|
|
|
# current character set. GNU and Solaris have a nl_langinfo(CODESET),
|
|
|
|
# FreeBSD can use either, but MinGW and some others need to use
|
|
|
|
# libcharset.h's locale_charset() instead.
|
|
|
|
#
|
2014-03-12 06:37:33 +08:00
|
|
|
# Define CHARSET_LIB to the library you need to link with in order to
|
2012-02-13 00:23:36 +08:00
|
|
|
# use locale_charset() function. On some platforms this needs to set to
|
2014-03-12 06:37:33 +08:00
|
|
|
# -lcharset, on others to -liconv .
|
2012-02-13 00:23:36 +08:00
|
|
|
#
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
|
|
|
|
# need -lintl when linking.
|
|
|
|
#
|
|
|
|
# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
|
|
|
|
# doesn't support GNU extensions like --check and --statistics
|
|
|
|
#
|
2010-04-13 17:07:13 +08:00
|
|
|
# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
|
|
|
|
# it specifies.
|
|
|
|
#
|
2006-01-20 09:13:51 +08:00
|
|
|
# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
|
|
|
|
#
|
2006-01-20 09:13:57 +08:00
|
|
|
# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
|
2010-04-02 06:43:54 +08:00
|
|
|
# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
|
2006-01-20 09:13:57 +08:00
|
|
|
#
|
2012-12-15 03:57:01 +08:00
|
|
|
# Define HAVE_STRINGS_H if you have strings.h and need it for strcasecmp.
|
|
|
|
#
|
2005-09-19 09:30:50 +08:00
|
|
|
# Define NO_STRCASESTR if you don't have strcasestr.
|
|
|
|
#
|
2007-09-07 06:32:54 +08:00
|
|
|
# Define NO_MEMMEM if you don't have memmem.
|
|
|
|
#
|
2012-12-19 06:03:55 +08:00
|
|
|
# Define NO_GETPAGESIZE if you don't have getpagesize.
|
|
|
|
#
|
2006-06-24 22:01:25 +08:00
|
|
|
# Define NO_STRLCPY if you don't have strlcpy.
|
|
|
|
#
|
2011-11-02 23:46:22 +08:00
|
|
|
# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the
|
|
|
|
# C library. If your compiler also does not support long long or does not have
|
2007-02-20 08:22:56 +08:00
|
|
|
# strtoull, define NO_STRTOULL.
|
|
|
|
#
|
2005-12-03 07:08:28 +08:00
|
|
|
# Define NO_SETENV if you don't have setenv in the C library.
|
|
|
|
#
|
2008-01-18 09:03:51 +08:00
|
|
|
# Define NO_UNSETENV if you don't have unsetenv in the C library.
|
|
|
|
#
|
2007-10-21 04:03:49 +08:00
|
|
|
# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
|
|
|
|
#
|
2012-09-09 01:01:31 +08:00
|
|
|
# Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
|
|
|
|
#
|
2009-05-31 16:35:50 +08:00
|
|
|
# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
|
|
|
|
#
|
2011-05-19 19:37:55 +08:00
|
|
|
# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
|
|
|
|
# in the C library.
|
|
|
|
#
|
2009-05-31 16:35:51 +08:00
|
|
|
# Define NO_LIBGEN_H if you don't have libgen.h.
|
|
|
|
#
|
2009-07-11 01:10:45 +08:00
|
|
|
# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
|
|
|
|
#
|
2008-01-25 02:34:46 +08:00
|
|
|
# Define NO_SYS_SELECT_H if you don't have sys/select.h.
|
|
|
|
#
|
2006-05-02 15:40:24 +08:00
|
|
|
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
|
|
|
|
# Enable it on Windows. By default, symrefs are still used.
|
2005-11-15 13:59:50 +08:00
|
|
|
#
|
2006-07-09 17:44:58 +08:00
|
|
|
# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
|
2006-07-06 15:14:16 +08:00
|
|
|
# tests. These tests take up a significant amount of the total test time
|
|
|
|
# but are not needed unless you plan to talk to SVN repos.
|
|
|
|
#
|
2006-07-24 12:28:28 +08:00
|
|
|
# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
|
|
|
|
# installed in /sw, but don't want GIT to link against any libraries
|
|
|
|
# installed there. If defined you may specify your own (or Fink's)
|
|
|
|
# include directories and library directories by defining CFLAGS
|
|
|
|
# and LDFLAGS appropriately.
|
|
|
|
#
|
|
|
|
# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
|
|
|
|
# have DarwinPorts installed in /opt/local, but don't want GIT to
|
|
|
|
# link against any libraries installed there. If defined you may
|
|
|
|
# specify your own (or DarwinPort's) include directories and
|
|
|
|
# library directories by defining CFLAGS and LDFLAGS appropriately.
|
|
|
|
#
|
2013-05-19 18:23:34 +08:00
|
|
|
# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
|
|
|
|
# and do not want to use Apple's CommonCrypto library. This allows you
|
|
|
|
# to provide your own OpenSSL library, for example from MacPorts.
|
|
|
|
#
|
2012-07-23 14:29:14 +08:00
|
|
|
# Define BLK_SHA1 environment variable to make use of the bundled
|
|
|
|
# optimized C SHA1 routine.
|
2009-08-06 07:13:20 +08:00
|
|
|
#
|
2005-07-29 23:48:26 +08:00
|
|
|
# Define PPC_SHA1 environment variable when running make to make use of
|
|
|
|
# a bundled SHA1 routine optimized for PowerPC.
|
2005-09-08 03:22:56 +08:00
|
|
|
#
|
2009-09-08 21:54:38 +08:00
|
|
|
# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
|
|
|
|
#
|
|
|
|
# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
|
2005-09-06 07:24:03 +08:00
|
|
|
#
|
2014-05-01 01:58:10 +08:00
|
|
|
# Define NEEDS_SSL_WITH_CURL if you need -lssl with -lcurl (Minix).
|
2011-07-20 06:55:47 +08:00
|
|
|
#
|
2014-05-01 01:58:10 +08:00
|
|
|
# Define NEEDS_IDN_WITH_CURL if you need -lidn when using -lcurl (Minix).
|
2011-07-20 06:55:47 +08:00
|
|
|
#
|
2005-09-08 03:22:56 +08:00
|
|
|
# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
|
2005-09-06 07:24:03 +08:00
|
|
|
#
|
2012-09-19 18:03:30 +08:00
|
|
|
# Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
|
|
|
|
#
|
2014-04-01 06:11:46 +08:00
|
|
|
# Define NO_INTPTR_T if you don't have intptr_t or uintptr_t.
|
2012-09-19 18:03:30 +08:00
|
|
|
#
|
|
|
|
# Define NO_UINTMAX_T if you don't have uintmax_t.
|
|
|
|
#
|
2005-09-06 07:24:03 +08:00
|
|
|
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
|
|
|
|
# Patrick Mauritz).
|
|
|
|
#
|
2009-06-06 07:36:10 +08:00
|
|
|
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
|
|
|
|
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
|
|
|
|
# inet_ntop and inet_pton additionally reside there.
|
|
|
|
#
|
2005-10-09 06:54:36 +08:00
|
|
|
# Define NO_MMAP if you want to avoid mmap.
|
|
|
|
#
|
2012-09-18 05:16:39 +08:00
|
|
|
# Define NO_SYS_POLL_H if you don't have sys/poll.h.
|
|
|
|
#
|
|
|
|
# Define NO_POLL if you do not have or don't want to use poll().
|
|
|
|
# This also implies NO_SYS_POLL_H.
|
|
|
|
#
|
git-compat-util.h: do not #include <sys/param.h> by default
Earlier we allowed platforms that lack <sys/param.h> not to include
the header file from git-compat-util.h; we have included this header
file since the early days back when we used MAXPATHLEN (which we no
longer use) and also depended on it slurping ULONG_MAX (which we get
by including stdint.h or inttypes.h these days).
It turns out that we can compile our modern codebase just file
without including it on many platforms (so far, Fedora, Debian,
Ubuntu, MinGW, Mac OS X, Cygwin, HP-Nonstop, QNX and z/OS are
reported to be OK).
Let's stop including it by default, and on platforms that need it to
be included, leave "make NEEDS_SYS_PARAM_H=YesPlease" as an escape
hatch and ask them to report to us, so that we can find out about
the real dependency and fix it in a more platform agnostic way.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-19 01:35:33 +08:00
|
|
|
# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
|
|
|
|
# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
|
|
|
|
# we want to know more about the issue.
|
2012-12-15 03:56:58 +08:00
|
|
|
#
|
2008-11-15 20:08:14 +08:00
|
|
|
# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
|
|
|
|
#
|
2007-01-10 05:04:12 +08:00
|
|
|
# Define NO_PREAD if you have a problem with pread() system call (e.g.
|
2010-04-02 06:43:54 +08:00
|
|
|
# cygwin1.dll before v1.5.22).
|
2007-01-10 05:04:12 +08:00
|
|
|
#
|
2012-09-09 00:54:34 +08:00
|
|
|
# Define NO_SETITIMER if you don't have setitimer()
|
|
|
|
#
|
|
|
|
# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval
|
|
|
|
# This also implies NO_SETITIMER
|
|
|
|
#
|
2006-12-14 19:15:57 +08:00
|
|
|
# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
|
|
|
|
# generally faster on your platform than accessing the working directory.
|
|
|
|
#
|
2006-12-31 12:53:55 +08:00
|
|
|
# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
|
|
|
|
# the executable mode bit, but doesn't really do so.
|
|
|
|
#
|
2005-09-29 07:52:21 +08:00
|
|
|
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
|
|
|
|
#
|
2011-12-13 05:12:56 +08:00
|
|
|
# Define NO_UNIX_SOCKETS if your system does not offer unix sockets.
|
|
|
|
#
|
2006-01-20 09:13:32 +08:00
|
|
|
# Define NO_SOCKADDR_STORAGE if your platform does not have struct
|
|
|
|
# sockaddr_storage.
|
|
|
|
#
|
2006-02-16 16:38:01 +08:00
|
|
|
# Define NO_ICONV if your libc does not properly support iconv.
|
|
|
|
#
|
2007-03-04 02:29:03 +08:00
|
|
|
# Define OLD_ICONV if your library has an old iconv(), where the second
|
|
|
|
# (input buffer pointer) parameter is declared with type (const char **).
|
|
|
|
#
|
2007-11-07 11:24:28 +08:00
|
|
|
# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
|
|
|
|
#
|
2007-07-01 01:05:03 +08:00
|
|
|
# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
|
|
|
|
# that tells runtime paths to dynamic libraries;
|
|
|
|
# "-Wl,-rpath=/path/lib" is used instead.
|
2006-12-28 06:17:35 +08:00
|
|
|
#
|
2011-06-19 09:07:03 +08:00
|
|
|
# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
|
|
|
|
# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
|
|
|
|
#
|
2005-07-29 23:48:26 +08:00
|
|
|
# Define USE_NSEC below if you want git to care about sub-second file mtimes
|
|
|
|
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
|
|
|
|
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
|
|
|
|
# randomly break unless your underlying filesystem supports those sub-second
|
|
|
|
# times (my ext3 doesn't).
|
2006-06-24 08:57:48 +08:00
|
|
|
#
|
2009-03-09 04:04:28 +08:00
|
|
|
# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
|
|
|
|
# "st_ctim"
|
|
|
|
#
|
2009-03-05 01:47:40 +08:00
|
|
|
# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
|
|
|
|
# available. This automatically turns USE_NSEC off.
|
|
|
|
#
|
2005-07-29 23:48:26 +08:00
|
|
|
# Define USE_STDEV below if you want git to care about the underlying device
|
2007-11-30 19:35:23 +08:00
|
|
|
# change being considered an inode change from the update-index perspective.
|
2006-12-04 17:50:04 +08:00
|
|
|
#
|
2008-08-19 03:57:16 +08:00
|
|
|
# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
|
|
|
|
# field that counts the on-disk footprint in 512-byte blocks.
|
|
|
|
#
|
2009-10-09 18:15:29 +08:00
|
|
|
# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
|
|
|
|
# (not v1.73 or v1.71).
|
|
|
|
#
|
2010-11-20 01:54:24 +08:00
|
|
|
# Define ASCIIDOC_ROFF if your DocBook XSL does not escape raw roff directives
|
|
|
|
# (versions 1.68.1 through v1.72).
|
2007-11-14 17:38:46 +08:00
|
|
|
#
|
2009-10-22 16:19:06 +08:00
|
|
|
# Define GNU_ROFF if your target system uses GNU groff. This forces
|
|
|
|
# apostrophes to be ASCII so that cut&pasting examples to the shell
|
|
|
|
# will work.
|
|
|
|
#
|
2013-01-14 14:48:07 +08:00
|
|
|
# Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
|
|
|
|
#
|
2006-12-04 17:50:04 +08:00
|
|
|
# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
|
|
|
|
# MakeMaker (e.g. using ActiveState under Cygwin).
|
|
|
|
#
|
2009-04-04 03:32:20 +08:00
|
|
|
# Define NO_PERL if you do not want Perl scripts or libraries at all.
|
|
|
|
#
|
2013-01-14 14:48:07 +08:00
|
|
|
# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
|
|
|
|
# but /usr/bin/python2.7 on some platforms).
|
|
|
|
#
|
2009-11-18 09:42:31 +08:00
|
|
|
# Define NO_PYTHON if you do not want Python scripts or libraries at all.
|
|
|
|
#
|
2007-03-28 19:00:23 +08:00
|
|
|
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
|
|
|
|
#
|
2007-05-08 11:36:31 +08:00
|
|
|
# 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'.
|
|
|
|
#
|
|
|
|
# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
|
2007-03-28 19:12:07 +08:00
|
|
|
# If not set it defaults to the bare 'wish'. If it is set to the empty
|
|
|
|
# string then NO_TCLTK will be forced (this is used by configure script).
|
|
|
|
#
|
2008-02-06 05:10:44 +08:00
|
|
|
# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
|
|
|
|
# is a simplified version of the merge sort used in glibc. This is
|
|
|
|
# recommended if Git triggers O(n^2) behavior in your platform's qsort().
|
|
|
|
#
|
2009-04-20 16:17:00 +08:00
|
|
|
# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
|
|
|
|
# information on a not yet closed file that lstat would return for the same
|
|
|
|
# file after it was closed.
|
2009-04-25 17:57:14 +08:00
|
|
|
#
|
2009-04-28 06:32:25 +08:00
|
|
|
# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
|
|
|
|
# when hardlinking a file to another name and unlinking the original file right
|
2009-04-25 17:57:14 +08:00
|
|
|
# away (some NTFS drivers seem to zero the contents in that scenario).
|
2009-05-23 16:43:08 +08:00
|
|
|
#
|
2009-05-11 19:02:18 +08:00
|
|
|
# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
|
|
|
|
# programs as a tar, where bin/ and libexec/ might be on different file systems.
|
2009-06-01 00:15:23 +08:00
|
|
|
#
|
2012-05-03 06:12:10 +08:00
|
|
|
# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
|
|
|
|
# copies to install built-in git commands e.g. git-cat-file.
|
|
|
|
#
|
2009-06-01 00:15:23 +08:00
|
|
|
# Define USE_NED_ALLOCATOR if you want to replace the platforms default
|
|
|
|
# memory allocators with the nedmalloc allocator written by Niall Douglas.
|
2009-06-17 03:07:40 +08:00
|
|
|
#
|
|
|
|
# Define NO_REGEX if you have no or inferior regex support in your C library.
|
2009-10-31 09:44:41 +08:00
|
|
|
#
|
add generic terminal prompt function
When we need to prompt the user for input interactively, we
want to access their terminal directly. We can't rely on
stdio because it may be connected to pipes or files, rather
than the terminal. Instead, we use "getpass()", because it
abstracts the idea of prompting and reading from the
terminal. However, it has some problems:
1. It never echoes the typed characters, which makes it OK
for passwords but annoying for other input (like usernames).
2. Some implementations of getpass() have an extremely
small input buffer (e.g., Solaris 8 is reported to
support only 8 characters).
3. Some implementations of getpass() will fall back to
reading from stdin (e.g., glibc). We explicitly don't
want this, because our stdin may be connected to a pipe
speaking a particular protocol, and reading will
disrupt the protocol flow (e.g., the remote-curl
helper).
4. Some implementations of getpass() turn off signals, so
that hitting "^C" on the terminal does not break out of
the password prompt. This can be a mild annoyance.
Instead, let's provide an abstract "git_terminal_prompt"
function that addresses these concerns. This patch includes
an implementation based on /dev/tty, enabled by setting
HAVE_DEV_TTY. The fallback is to use getpass() as before.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10 18:41:01 +08:00
|
|
|
# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
|
|
|
|
# user.
|
|
|
|
#
|
2011-02-23 07:41:21 +08:00
|
|
|
# Define GETTEXT_POISON if you are debugging the choice of strings marked
|
2011-02-23 07:41:22 +08:00
|
|
|
# for translation. In a GETTEXT_POISON build, you can turn all strings marked
|
|
|
|
# for translation into gibberish by setting the GIT_GETTEXT_POISON variable
|
|
|
|
# (to any value) in your environment.
|
2011-02-23 07:41:21 +08:00
|
|
|
#
|
2009-09-01 19:39:20 +08:00
|
|
|
# Define JSMIN to point to JavaScript minifier that functions as
|
|
|
|
# a filter to have gitweb.js minified.
|
2009-12-02 03:28:15 +08:00
|
|
|
#
|
2010-04-03 08:35:05 +08:00
|
|
|
# Define CSSMIN to point to a CSS minifier in order to generate a minified
|
|
|
|
# version of gitweb.css
|
|
|
|
#
|
2009-10-31 09:45:34 +08:00
|
|
|
# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
|
|
|
|
# you want to use something different. The value will be interpreted by the
|
|
|
|
# shell at runtime when it is used.
|
|
|
|
#
|
2009-10-31 09:44:41 +08:00
|
|
|
# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
|
|
|
|
# want to use something different. The value will be interpreted by the shell
|
|
|
|
# if necessary when it is used. Examples:
|
|
|
|
#
|
|
|
|
# DEFAULT_EDITOR='~/bin/vi',
|
|
|
|
# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
|
|
|
|
# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
|
2010-01-26 23:52:49 +08:00
|
|
|
#
|
2011-11-18 17:58:21 +08:00
|
|
|
# Define COMPUTE_HEADER_DEPENDENCIES to "yes" if you want dependencies on
|
|
|
|
# header files to be automatically computed, to avoid rebuilding objects when
|
|
|
|
# an unrelated header file changes. Define it to "no" to use the hard-coded
|
|
|
|
# dependency rules. The default is "auto", which means to use computed header
|
|
|
|
# dependencies if your compiler is detected to support it.
|
|
|
|
#
|
2010-06-05 03:29:08 +08:00
|
|
|
# Define NATIVE_CRLF if your platform uses CRLF for line endings.
|
2012-04-07 05:01:23 +08:00
|
|
|
#
|
|
|
|
# Define XDL_FAST_HASH to use an alternative line-hashing method in
|
|
|
|
# the diff algorithm. It gives a nice speedup if your processor has
|
|
|
|
# fast unaligned word loads. Does NOT work on big-endian systems!
|
|
|
|
# Enabled by default on x86_64.
|
2012-06-03 03:01:12 +08:00
|
|
|
#
|
|
|
|
# Define GIT_USER_AGENT if you want to change how git identifies itself during
|
|
|
|
# network interactions. The default is "git/$(GIT_VERSION)".
|
2012-06-22 05:42:38 +08:00
|
|
|
#
|
2012-06-07 04:28:16 +08:00
|
|
|
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
|
|
|
|
# (defaults to "man") if you want to have a different default when
|
|
|
|
# "git help" is called without a parameter specifying the format.
|
2014-02-24 04:49:58 +08:00
|
|
|
#
|
|
|
|
# Define TEST_GIT_INDEX_VERSION to 2, 3 or 4 to run the test suite
|
|
|
|
# with a different indexfile format version. If it isn't set the index
|
|
|
|
# file format used is index-v[23].
|
2014-04-09 02:59:05 +08:00
|
|
|
#
|
2014-04-02 05:28:42 +08:00
|
|
|
# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
|
|
|
|
# return NULL when it receives a bogus time_t.
|
2014-07-12 08:05:42 +08:00
|
|
|
#
|
|
|
|
# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
|
2005-07-29 23:48:26 +08:00
|
|
|
|
2010-01-06 16:06:58 +08:00
|
|
|
GIT-VERSION-FILE: FORCE
|
2006-02-14 07:15:14 +08:00
|
|
|
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
2005-12-28 06:40:17 +08:00
|
|
|
-include GIT-VERSION-FILE
|
2005-07-08 04:09:50 +08:00
|
|
|
|
2005-11-13 17:46:13 +08:00
|
|
|
# CFLAGS and LDFLAGS are for the users to override from the command line.
|
2005-11-05 15:50:09 +08:00
|
|
|
|
2005-08-06 13:36:15 +08:00
|
|
|
CFLAGS = -g -O2 -Wall
|
2005-11-13 17:46:13 +08:00
|
|
|
LDFLAGS =
|
2010-05-14 17:31:32 +08:00
|
|
|
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
|
2005-11-13 17:46:13 +08:00
|
|
|
ALL_LDFLAGS = $(LDFLAGS)
|
2006-01-13 13:42:25 +08:00
|
|
|
STRIP ?= strip
|
2005-05-07 16:41:54 +08:00
|
|
|
|
2008-07-24 03:12:18 +08:00
|
|
|
# Among the variables below, these:
|
|
|
|
# gitexecdir
|
|
|
|
# template_dir
|
2011-05-09 16:24:55 +08:00
|
|
|
# sysconfdir
|
2009-01-18 20:00:09 +08:00
|
|
|
# can be specified as a relative path some/where/else;
|
|
|
|
# this is interpreted as relative to $(prefix) and "git" at
|
2008-07-24 03:12:18 +08:00
|
|
|
# runtime figures out where they are based on the path to the executable.
|
2013-02-25 03:55:01 +08:00
|
|
|
# Additionally, the following will be treated as relative by "git" if they
|
|
|
|
# begin with "$(prefix)/":
|
|
|
|
# mandir
|
|
|
|
# infodir
|
|
|
|
# htmldir
|
2008-07-24 03:12:18 +08:00
|
|
|
# This can help installing the suite in a relocatable way.
|
|
|
|
|
2005-08-06 13:36:15 +08:00
|
|
|
prefix = $(HOME)
|
2009-01-18 20:00:09 +08:00
|
|
|
bindir_relative = bin
|
|
|
|
bindir = $(prefix)/$(bindir_relative)
|
2013-02-25 03:55:01 +08:00
|
|
|
mandir = $(prefix)/share/man
|
|
|
|
infodir = $(prefix)/share/info
|
2009-01-18 20:00:09 +08:00
|
|
|
gitexecdir = libexec/git-core
|
2011-08-18 15:23:46 +08:00
|
|
|
mergetoolsdir = $(gitexecdir)/mergetools
|
2007-06-11 16:02:17 +08:00
|
|
|
sharedir = $(prefix)/share
|
2010-05-28 14:25:50 +08:00
|
|
|
gitwebdir = $(sharedir)/gitweb
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
localedir = $(sharedir)/locale
|
2009-01-18 20:00:09 +08:00
|
|
|
template_dir = share/git-core/templates
|
2013-02-25 03:55:01 +08:00
|
|
|
htmldir = $(prefix)/share/doc/git-doc
|
2009-01-18 20:00:09 +08:00
|
|
|
ETC_GITCONFIG = $(sysconfdir)/gitconfig
|
2010-09-01 06:42:43 +08:00
|
|
|
ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
|
2007-08-01 12:30:35 +08:00
|
|
|
lib = lib
|
2012-12-09 18:36:17 +08:00
|
|
|
# DESTDIR =
|
2009-05-23 16:04:48 +08:00
|
|
|
pathsep = :
|
2005-04-13 17:14:06 +08:00
|
|
|
|
2013-02-25 03:55:01 +08:00
|
|
|
mandir_relative = $(patsubst $(prefix)/%,%,$(mandir))
|
|
|
|
infodir_relative = $(patsubst $(prefix)/%,%,$(infodir))
|
|
|
|
htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
|
|
|
|
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
export prefix bindir sharedir sysconfdir gitwebdir localedir
|
2006-06-30 04:11:25 +08:00
|
|
|
|
2011-12-21 07:40:47 +08:00
|
|
|
CC = cc
|
2005-08-06 13:36:15 +08:00
|
|
|
AR = ar
|
2007-07-15 01:51:44 +08:00
|
|
|
RM = rm -f
|
2010-05-14 17:31:36 +08:00
|
|
|
DIFF = diff
|
2005-09-24 01:41:40 +08:00
|
|
|
TAR = tar
|
2007-07-30 06:23:28 +08:00
|
|
|
FIND = find
|
2005-08-06 13:36:15 +08:00
|
|
|
INSTALL = install
|
|
|
|
RPMBUILD = rpmbuild
|
2007-05-08 11:36:31 +08:00
|
|
|
TCL_PATH = tclsh
|
2007-03-28 19:12:07 +08:00
|
|
|
TCLTK_PATH = wish
|
2011-02-23 07:41:23 +08:00
|
|
|
XGETTEXT = xgettext
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
MSGFMT = msgfmt
|
2008-11-03 07:43:20 +08:00
|
|
|
PTHREAD_LIBS = -lpthread
|
2010-05-14 17:31:34 +08:00
|
|
|
PTHREAD_CFLAGS =
|
2010-07-26 15:43:41 +08:00
|
|
|
GCOV = gcov
|
2005-04-08 06:13:13 +08:00
|
|
|
|
2007-05-08 11:36:31 +08:00
|
|
|
export TCL_PATH TCLTK_PATH
|
|
|
|
|
2011-04-08 02:22:18 +08:00
|
|
|
SPARSE_FLAGS =
|
2005-07-04 01:02:35 +08:00
|
|
|
|
2005-07-29 23:50:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
### --- END CONFIGURATION SECTION ---
|
|
|
|
|
2006-06-25 09:47:03 +08:00
|
|
|
# Those must not be GNU-specific; they are shared with perl/ which may
|
2006-09-24 02:20:47 +08:00
|
|
|
# be built by a different compiler. (Note that this is an artifact now
|
|
|
|
# but it still might be nice to keep that distinction.)
|
2010-02-23 00:42:18 +08:00
|
|
|
BASIC_CFLAGS = -I.
|
2006-09-24 02:20:47 +08:00
|
|
|
BASIC_LDFLAGS =
|
2006-06-25 09:47:03 +08:00
|
|
|
|
2009-03-26 00:27:28 +08:00
|
|
|
# Guard against environment variables
|
|
|
|
BUILTIN_OBJS =
|
|
|
|
BUILT_INS =
|
|
|
|
COMPAT_CFLAGS =
|
|
|
|
COMPAT_OBJS =
|
2011-03-28 02:13:22 +08:00
|
|
|
XDIFF_OBJS =
|
|
|
|
VCSSVN_OBJS =
|
Makefile: fold MISC_H into LIB_H
We keep a list of most of the header files in LIB_H, but
some are split out into MISC_H. The original point
of LIB_H was that it would force recompilation of C files
when any of the library headers changed. It was
over-encompassing, since not all C files included all of the
library headers; this made it simple to maintain, but meant
that we sometimes recompiled when it was not necessary.
Over time, some new headers were omitted from LIB_H, and
rules were added to the Makefile for a few specific targets
to explicitly depend on them. This avoided some unnecessary
recompilation at the cost of having to maintain the
dependency list of those targets manually (e.g., d349a03).
Later, we needed a complete list of headers from which we
should extract strings to localized. Thus 1b8b2e4 introduced
MISC_H to mention all header files not included in LIB_H,
and the concatenation of the two lists is fed to xgettext.
Headers mentioned as dependencies must also be manually
added to MISC_H to receive the benefits of localization.
Having to update multiple locations manually is a pain and
has led to errors. For example, see "git log -Swt-status.h
Makefile" for some back-and-forth between the two locations.
Or the fact that column.h was never added to MISC_H, and
therefore was not localized (which is fixed by this patch).
Moreover, the benefits of keeping these few headers out of
LIB_H is not that great, for two reasons:
1. The better way to do this is by auto-computing the
dependencies, which is more accurate and less work to
maintain. If your compiler supports it, we turn on
computed header dependencies by default these days. So
these manual dependencies are used only for people who
do not have gcc at all (which increases the chance of
them becoming stale, as many developers will never even
use them).
2. Even if you do not have gcc, the manual header
dependencies do not help all that much. They obviously
cannot help with an initial compilation (since their
purpose is to avoid unnecessary recompilation when a
header changes), which means they are only useful when
building a new version of git in the working tree that
held an existing build (e.g., after checkout or during a
bisection). But since a change of a header in LIB_H
will force recompilation, and given that the vast
majority of headers are in LIB_H, most version changes
will result in a full rebuild anyway.
Let's just fold MISC_H into LIB_H and get rid of these
manual rules. The worst case is some extra compilation, but
even that is unlikely to matter due to the reasons above.
The one exception is that we should keep common-cmds.h
separate. Because it is generated, the computed dependencies
do not handle it properly, and we must keep separate
individual dependencies on it. Let's therefore rename MISC_H
to GENERATED_H to make it more clear what should go in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-21 02:30:56 +08:00
|
|
|
GENERATED_H =
|
2010-03-20 11:20:12 +08:00
|
|
|
EXTRA_CPPFLAGS =
|
2009-03-26 00:27:28 +08:00
|
|
|
LIB_OBJS =
|
2010-01-26 23:54:23 +08:00
|
|
|
PROGRAM_OBJS =
|
2009-03-26 00:27:28 +08:00
|
|
|
PROGRAMS =
|
|
|
|
SCRIPT_PERL =
|
2009-11-18 09:42:31 +08:00
|
|
|
SCRIPT_PYTHON =
|
2009-03-26 00:27:28 +08:00
|
|
|
SCRIPT_SH =
|
2010-02-01 03:46:53 +08:00
|
|
|
SCRIPT_LIB =
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X =
|
2009-03-26 00:27:28 +08:00
|
|
|
|
2010-03-20 08:06:15 +08:00
|
|
|
# Having this variable in your environment would break pipelines because
|
|
|
|
# you cause "cd" to echo its destination to stdout. It can also take
|
|
|
|
# scripts to unexpected places. If you like CDPATH, define it for your
|
|
|
|
# interactive shell sessions without exporting it.
|
|
|
|
unexport CDPATH
|
|
|
|
|
2008-03-12 16:46:26 +08:00
|
|
|
SCRIPT_SH += git-am.sh
|
|
|
|
SCRIPT_SH += git-bisect.sh
|
2009-04-07 16:21:20 +08:00
|
|
|
SCRIPT_SH += git-difftool--helper.sh
|
2008-03-12 16:46:26 +08:00
|
|
|
SCRIPT_SH += git-filter-branch.sh
|
|
|
|
SCRIPT_SH += git-merge-octopus.sh
|
|
|
|
SCRIPT_SH += git-merge-one-file.sh
|
|
|
|
SCRIPT_SH += git-merge-resolve.sh
|
|
|
|
SCRIPT_SH += git-mergetool.sh
|
|
|
|
SCRIPT_SH += git-pull.sh
|
|
|
|
SCRIPT_SH += git-quiltimport.sh
|
|
|
|
SCRIPT_SH += git-rebase.sh
|
2013-04-27 07:30:40 +08:00
|
|
|
SCRIPT_SH += git-remote-testgit.sh
|
2008-03-12 16:46:26 +08:00
|
|
|
SCRIPT_SH += git-request-pull.sh
|
|
|
|
SCRIPT_SH += git-stash.sh
|
|
|
|
SCRIPT_SH += git-submodule.sh
|
|
|
|
SCRIPT_SH += git-web--browse.sh
|
|
|
|
|
2010-02-01 03:46:53 +08:00
|
|
|
SCRIPT_LIB += git-mergetool--lib
|
|
|
|
SCRIPT_LIB += git-parse-remote
|
2011-02-25 11:32:06 +08:00
|
|
|
SCRIPT_LIB += git-rebase--am
|
|
|
|
SCRIPT_LIB += git-rebase--interactive
|
|
|
|
SCRIPT_LIB += git-rebase--merge
|
2010-02-01 03:46:53 +08:00
|
|
|
SCRIPT_LIB += git-sh-setup
|
2011-05-14 21:47:43 +08:00
|
|
|
SCRIPT_LIB += git-sh-i18n
|
2010-02-01 03:46:53 +08:00
|
|
|
|
2008-03-12 16:46:26 +08:00
|
|
|
SCRIPT_PERL += git-add--interactive.perl
|
2009-04-07 16:21:20 +08:00
|
|
|
SCRIPT_PERL += git-difftool.perl
|
2008-03-12 16:46:26 +08:00
|
|
|
SCRIPT_PERL += git-archimport.perl
|
|
|
|
SCRIPT_PERL += git-cvsexportcommit.perl
|
|
|
|
SCRIPT_PERL += git-cvsimport.perl
|
|
|
|
SCRIPT_PERL += git-cvsserver.perl
|
|
|
|
SCRIPT_PERL += git-relink.perl
|
|
|
|
SCRIPT_PERL += git-send-email.perl
|
|
|
|
SCRIPT_PERL += git-svn.perl
|
2005-07-31 08:31:47 +08:00
|
|
|
|
2012-04-09 08:18:00 +08:00
|
|
|
SCRIPT_PYTHON += git-p4.py
|
2010-03-30 00:48:28 +08:00
|
|
|
|
2013-06-08 06:03:07 +08:00
|
|
|
NO_INSTALL += git-remote-testgit
|
2013-05-25 10:41:06 +08:00
|
|
|
|
2013-02-09 01:31:16 +08:00
|
|
|
# Generated files for scripts
|
|
|
|
SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
|
|
|
|
SCRIPT_PERL_GEN = $(patsubst %.perl,%,$(SCRIPT_PERL))
|
|
|
|
SCRIPT_PYTHON_GEN = $(patsubst %.py,%,$(SCRIPT_PYTHON))
|
|
|
|
|
2013-05-25 10:41:05 +08:00
|
|
|
SCRIPT_SH_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_SH_GEN))
|
|
|
|
SCRIPT_PERL_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PERL_GEN))
|
|
|
|
SCRIPT_PYTHON_INS = $(filter-out $(NO_INSTALL),$(SCRIPT_PYTHON_GEN))
|
|
|
|
|
2013-02-09 01:31:16 +08:00
|
|
|
# Individual rules to allow e.g.
|
|
|
|
# "make -C ../.. SCRIPT_PERL=contrib/foo/bar.perl build-perl-script"
|
|
|
|
# from subdirectories like contrib/*/
|
|
|
|
.PHONY: build-perl-script build-sh-script build-python-script
|
|
|
|
build-perl-script: $(SCRIPT_PERL_GEN)
|
|
|
|
build-sh-script: $(SCRIPT_SH_GEN)
|
|
|
|
build-python-script: $(SCRIPT_PYTHON_GEN)
|
|
|
|
|
|
|
|
.PHONY: install-perl-script install-sh-script install-python-script
|
2013-05-25 10:41:05 +08:00
|
|
|
install-sh-script: $(SCRIPT_SH_INS)
|
2013-05-25 10:41:02 +08:00
|
|
|
$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2013-05-25 10:41:05 +08:00
|
|
|
install-perl-script: $(SCRIPT_PERL_INS)
|
2013-05-25 10:41:02 +08:00
|
|
|
$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2013-05-25 10:41:05 +08:00
|
|
|
install-python-script: $(SCRIPT_PYTHON_INS)
|
2013-05-25 10:41:02 +08:00
|
|
|
$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2013-02-09 01:31:16 +08:00
|
|
|
|
|
|
|
.PHONY: clean-perl-script clean-sh-script clean-python-script
|
|
|
|
clean-sh-script:
|
|
|
|
$(RM) $(SCRIPT_SH_GEN)
|
|
|
|
clean-perl-script:
|
|
|
|
$(RM) $(SCRIPT_PERL_GEN)
|
|
|
|
clean-python-script:
|
|
|
|
$(RM) $(SCRIPT_PYTHON_GEN)
|
|
|
|
|
2013-05-25 10:41:05 +08:00
|
|
|
SCRIPTS = $(SCRIPT_SH_INS) \
|
|
|
|
$(SCRIPT_PERL_INS) \
|
|
|
|
$(SCRIPT_PYTHON_INS) \
|
2007-11-24 04:35:08 +08:00
|
|
|
git-instaweb
|
2005-11-22 07:44:15 +08:00
|
|
|
|
2010-09-29 05:08:38 +08:00
|
|
|
ETAGS_TARGET = TAGS
|
|
|
|
|
2006-08-16 12:38:07 +08:00
|
|
|
# Empty...
|
|
|
|
EXTRA_PROGRAMS =
|
2005-11-22 07:44:15 +08:00
|
|
|
|
2008-03-12 16:46:26 +08:00
|
|
|
# ... and all the rest that could be moved out of bindir to gitexecdir
|
|
|
|
PROGRAMS += $(EXTRA_PROGRAMS)
|
2010-01-26 23:54:23 +08:00
|
|
|
|
2012-05-04 21:52:36 +08:00
|
|
|
PROGRAM_OBJS += credential-store.o
|
2010-11-04 09:35:24 +08:00
|
|
|
PROGRAM_OBJS += daemon.o
|
2010-01-26 23:54:23 +08:00
|
|
|
PROGRAM_OBJS += fast-import.o
|
2012-05-04 21:52:36 +08:00
|
|
|
PROGRAM_OBJS += http-backend.o
|
2010-01-26 23:54:23 +08:00
|
|
|
PROGRAM_OBJS += imap-send.o
|
2012-05-04 21:52:36 +08:00
|
|
|
PROGRAM_OBJS += sh-i18n--envsubst.o
|
2010-01-26 23:54:23 +08:00
|
|
|
PROGRAM_OBJS += shell.o
|
|
|
|
PROGRAM_OBJS += show-index.o
|
|
|
|
PROGRAM_OBJS += upload-pack.o
|
2012-09-19 23:21:16 +08:00
|
|
|
PROGRAM_OBJS += remote-testsvn.o
|
2010-01-26 23:54:23 +08:00
|
|
|
|
2012-02-08 18:59:04 +08:00
|
|
|
# Binary suffix, set to .exe for Windows builds
|
|
|
|
X =
|
|
|
|
|
2010-01-26 23:54:23 +08:00
|
|
|
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
|
2008-03-12 16:46:26 +08:00
|
|
|
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-chmtime
|
|
|
|
TEST_PROGRAMS_NEED_X += test-ctype
|
2014-07-28 18:10:39 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-config
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-date
|
|
|
|
TEST_PROGRAMS_NEED_X += test-delta
|
|
|
|
TEST_PROGRAMS_NEED_X += test-dump-cache-tree
|
2014-06-13 20:19:51 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-dump-split-index
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-genrandom
|
2013-11-15 03:17:54 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-hashmap
|
2011-05-20 05:24:24 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-index-version
|
2010-08-10 06:39:43 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-line-buffer
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-match-trees
|
2012-04-01 06:10:11 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-mergesort
|
2011-05-20 05:24:24 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-mktemp
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-parse-options
|
|
|
|
TEST_PROGRAMS_NEED_X += test-path-utils
|
2013-06-07 10:13:50 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-prio-queue
|
2013-06-10 01:39:17 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-read-cache
|
2012-09-02 01:46:54 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-regex
|
2012-03-29 15:21:21 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-revision-walking
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-run-command
|
2012-05-04 21:52:36 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
|
2010-01-27 00:08:44 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-sha1
|
|
|
|
TEST_PROGRAMS_NEED_X += test-sigchain
|
2012-09-12 22:04:43 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-string-list
|
2010-12-27 09:26:04 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-subprocess
|
2010-08-10 06:55:00 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-svn-fe
|
2013-08-06 04:20:36 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
|
2012-10-15 14:25:55 +08:00
|
|
|
TEST_PROGRAMS_NEED_X += test-wildmatch
|
2010-01-27 00:08:44 +08:00
|
|
|
|
2010-03-03 04:44:08 +08:00
|
|
|
TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
|
2008-03-12 16:46:26 +08:00
|
|
|
|
2008-02-24 03:08:25 +08:00
|
|
|
# List built-in command $C whose implementation cmd_$C() is not in
|
2010-02-23 00:42:18 +08:00
|
|
|
# builtin/$C.o but is linked in as part of some other command.
|
|
|
|
BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
|
2008-03-12 16:46:26 +08:00
|
|
|
|
|
|
|
BUILT_INS += git-cherry$X
|
2009-02-10 06:00:45 +08:00
|
|
|
BUILT_INS += git-cherry-pick$X
|
2008-03-12 16:46:26 +08:00
|
|
|
BUILT_INS += git-format-patch$X
|
|
|
|
BUILT_INS += git-fsck-objects$X
|
|
|
|
BUILT_INS += git-init$X
|
|
|
|
BUILT_INS += git-merge-subtree$X
|
|
|
|
BUILT_INS += git-show$X
|
2008-12-03 16:30:34 +08:00
|
|
|
BUILT_INS += git-stage$X
|
2008-03-12 16:46:26 +08:00
|
|
|
BUILT_INS += git-status$X
|
|
|
|
BUILT_INS += git-whatchanged$X
|
2006-04-11 08:37:58 +08:00
|
|
|
|
2009-08-08 03:09:29 +08:00
|
|
|
# what 'all' will build and 'install' will install in gitexecdir,
|
|
|
|
# excluding programs for built-in commands
|
2007-02-07 13:27:09 +08:00
|
|
|
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
|
2005-04-08 06:13:13 +08:00
|
|
|
|
2007-03-28 19:00:23 +08:00
|
|
|
# what 'all' will build but not install in gitexecdir
|
2009-04-04 03:32:20 +08:00
|
|
|
OTHER_PROGRAMS = git$X
|
2007-03-28 19:00:23 +08:00
|
|
|
|
2009-12-03 13:14:05 +08:00
|
|
|
# what test wrappers are needed and 'install' will install, in bindir
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git-upload-pack
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git-receive-pack
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git-upload-archive
|
|
|
|
BINDIR_PROGRAMS_NEED_X += git-shell
|
|
|
|
|
|
|
|
BINDIR_PROGRAMS_NO_X += git-cvsserver
|
|
|
|
|
2005-11-21 13:11:22 +08:00
|
|
|
# Set paths to tools early so that they can be used for version tests.
|
|
|
|
ifndef SHELL_PATH
|
|
|
|
SHELL_PATH = /bin/sh
|
|
|
|
endif
|
|
|
|
ifndef PERL_PATH
|
|
|
|
PERL_PATH = /usr/bin/perl
|
|
|
|
endif
|
2009-11-18 09:42:31 +08:00
|
|
|
ifndef PYTHON_PATH
|
|
|
|
PYTHON_PATH = /usr/bin/python
|
|
|
|
endif
|
2005-09-11 08:46:27 +08:00
|
|
|
|
2006-12-15 15:03:03 +08:00
|
|
|
export PERL_PATH
|
2009-11-18 09:42:31 +08:00
|
|
|
export PYTHON_PATH
|
2006-12-15 15:03:03 +08:00
|
|
|
|
2012-12-09 18:36:17 +08:00
|
|
|
LIB_FILE = libgit.a
|
|
|
|
XDIFF_LIB = xdiff/lib.a
|
|
|
|
VCSSVN_LIB = vcs-svn/lib.a
|
[PATCH] Add update-server-info.
The git-update-server-info command prepares informational files
to help clients discover the contents of a repository, and pull
from it via a dumb transport protocols. Currently, the
following files are produced.
- The $repo/info/refs file lists the name of heads and tags
available in the $repo/refs/ directory, along with their
SHA1. This can be used by git-ls-remote command running on
the client side.
- The $repo/info/rev-cache file describes the commit ancestry
reachable from references in the $repo/refs/ directory. This
file is in an append-only binary format to make the server
side friendly to rsync mirroring scheme, and can be read by
git-show-rev-cache command.
- The $repo/objects/info/pack file lists the name of the packs
available, the interdependencies among them, and the head
commits and tags contained in them. Along with the other two
files, this is designed to help clients to make smart pull
decisions.
The git-receive-pack command is changed to invoke it at the end,
so just after a push to a public repository finishes via "git
push", the server info is automatically updated.
In addition, building of the rev-cache file can be done by a
standalone git-build-rev-cache command separately.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-24 08:54:41 +08:00
|
|
|
|
Makefile: fold MISC_H into LIB_H
We keep a list of most of the header files in LIB_H, but
some are split out into MISC_H. The original point
of LIB_H was that it would force recompilation of C files
when any of the library headers changed. It was
over-encompassing, since not all C files included all of the
library headers; this made it simple to maintain, but meant
that we sometimes recompiled when it was not necessary.
Over time, some new headers were omitted from LIB_H, and
rules were added to the Makefile for a few specific targets
to explicitly depend on them. This avoided some unnecessary
recompilation at the cost of having to maintain the
dependency list of those targets manually (e.g., d349a03).
Later, we needed a complete list of headers from which we
should extract strings to localized. Thus 1b8b2e4 introduced
MISC_H to mention all header files not included in LIB_H,
and the concatenation of the two lists is fed to xgettext.
Headers mentioned as dependencies must also be manually
added to MISC_H to receive the benefits of localization.
Having to update multiple locations manually is a pain and
has led to errors. For example, see "git log -Swt-status.h
Makefile" for some back-and-forth between the two locations.
Or the fact that column.h was never added to MISC_H, and
therefore was not localized (which is fixed by this patch).
Moreover, the benefits of keeping these few headers out of
LIB_H is not that great, for two reasons:
1. The better way to do this is by auto-computing the
dependencies, which is more accurate and less work to
maintain. If your compiler supports it, we turn on
computed header dependencies by default these days. So
these manual dependencies are used only for people who
do not have gcc at all (which increases the chance of
them becoming stale, as many developers will never even
use them).
2. Even if you do not have gcc, the manual header
dependencies do not help all that much. They obviously
cannot help with an initial compilation (since their
purpose is to avoid unnecessary recompilation when a
header changes), which means they are only useful when
building a new version of git in the working tree that
held an existing build (e.g., after checkout or during a
bisection). But since a change of a header in LIB_H
will force recompilation, and given that the vast
majority of headers are in LIB_H, most version changes
will result in a full rebuild anyway.
Let's just fold MISC_H into LIB_H and get rid of these
manual rules. The worst case is some extra compilation, but
even that is unlikely to matter due to the reasons above.
The one exception is that we should keep common-cmds.h
separate. Because it is generated, the computed dependencies
do not handle it properly, and we must keep separate
individual dependencies on it. Let's therefore rename MISC_H
to GENERATED_H to make it more clear what should go in it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-21 02:30:56 +08:00
|
|
|
GENERATED_H += common-cmds.h
|
2012-04-23 20:30:21 +08:00
|
|
|
|
2014-08-26 04:00:42 +08:00
|
|
|
LIB_H = $(shell $(FIND) . \
|
|
|
|
-name .git -prune -o \
|
|
|
|
-name t -prune -o \
|
|
|
|
-name Documentation -prune -o \
|
|
|
|
-name '*.h' -print)
|
2008-03-12 16:46:26 +08:00
|
|
|
|
2008-06-28 04:46:42 +08:00
|
|
|
LIB_OBJS += abspath.o
|
2009-09-09 19:38:58 +08:00
|
|
|
LIB_OBJS += advice.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += alias.o
|
|
|
|
LIB_OBJS += alloc.o
|
|
|
|
LIB_OBJS += archive.o
|
|
|
|
LIB_OBJS += archive-tar.o
|
|
|
|
LIB_OBJS += archive-zip.o
|
2011-09-14 05:57:57 +08:00
|
|
|
LIB_OBJS += argv-array.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += attr.o
|
|
|
|
LIB_OBJS += base85.o
|
2009-03-26 12:55:24 +08:00
|
|
|
LIB_OBJS += bisect.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += blob.o
|
|
|
|
LIB_OBJS += branch.o
|
2011-10-29 05:48:40 +08:00
|
|
|
LIB_OBJS += bulk-checkin.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += bundle.o
|
|
|
|
LIB_OBJS += cache-tree.o
|
|
|
|
LIB_OBJS += color.o
|
2012-04-21 12:44:32 +08:00
|
|
|
LIB_OBJS += column.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += combine-diff.o
|
|
|
|
LIB_OBJS += commit.o
|
2011-08-21 06:40:40 +08:00
|
|
|
LIB_OBJS += compat/obstack.o
|
add generic terminal prompt function
When we need to prompt the user for input interactively, we
want to access their terminal directly. We can't rely on
stdio because it may be connected to pipes or files, rather
than the terminal. Instead, we use "getpass()", because it
abstracts the idea of prompting and reading from the
terminal. However, it has some problems:
1. It never echoes the typed characters, which makes it OK
for passwords but annoying for other input (like usernames).
2. Some implementations of getpass() have an extremely
small input buffer (e.g., Solaris 8 is reported to
support only 8 characters).
3. Some implementations of getpass() will fall back to
reading from stdin (e.g., glibc). We explicitly don't
want this, because our stdin may be connected to a pipe
speaking a particular protocol, and reading will
disrupt the protocol flow (e.g., the remote-curl
helper).
4. Some implementations of getpass() turn off signals, so
that hitting "^C" on the terminal does not break out of
the password prompt. This can be a mild annoyance.
Instead, let's provide an abstract "git_terminal_prompt"
function that addresses these concerns. This patch includes
an implementation based on /dev/tty, enabled by setting
HAVE_DEV_TTY. The fallback is to use getpass() as before.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10 18:41:01 +08:00
|
|
|
LIB_OBJS += compat/terminal.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += config.o
|
|
|
|
LIB_OBJS += connect.o
|
2011-09-03 07:33:22 +08:00
|
|
|
LIB_OBJS += connected.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += convert.o
|
|
|
|
LIB_OBJS += copy.o
|
2011-12-10 18:31:11 +08:00
|
|
|
LIB_OBJS += credential.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += csum-file.o
|
|
|
|
LIB_OBJS += ctype.o
|
|
|
|
LIB_OBJS += date.o
|
|
|
|
LIB_OBJS += decorate.o
|
|
|
|
LIB_OBJS += diffcore-break.o
|
|
|
|
LIB_OBJS += diffcore-delta.o
|
|
|
|
LIB_OBJS += diffcore-order.o
|
|
|
|
LIB_OBJS += diffcore-pickaxe.o
|
|
|
|
LIB_OBJS += diffcore-rename.o
|
|
|
|
LIB_OBJS += diff-delta.o
|
|
|
|
LIB_OBJS += diff-lib.o
|
2009-02-10 06:00:45 +08:00
|
|
|
LIB_OBJS += diff-no-index.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += diff.o
|
|
|
|
LIB_OBJS += dir.o
|
2008-07-26 00:28:41 +08:00
|
|
|
LIB_OBJS += editor.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += entry.o
|
|
|
|
LIB_OBJS += environment.o
|
2013-11-14 20:43:51 +08:00
|
|
|
LIB_OBJS += ewah/bitmap.o
|
|
|
|
LIB_OBJS += ewah/ewah_bitmap.o
|
|
|
|
LIB_OBJS += ewah/ewah_io.o
|
|
|
|
LIB_OBJS += ewah/ewah_rlw.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += exec_cmd.o
|
2012-10-26 23:53:55 +08:00
|
|
|
LIB_OBJS += fetch-pack.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += fsck.o
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
LIB_OBJS += gettext.o
|
2012-05-04 21:52:36 +08:00
|
|
|
LIB_OBJS += gpg-interface.o
|
2008-05-04 18:36:53 +08:00
|
|
|
LIB_OBJS += graph.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += grep.o
|
2013-11-15 03:17:54 +08:00
|
|
|
LIB_OBJS += hashmap.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += help.o
|
2010-01-22 07:25:19 +08:00
|
|
|
LIB_OBJS += hex.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += ident.o
|
Use kwset in pickaxe
Benchmarks in the hot cache case:
before:
$ perf stat --repeat=5 git log -Sqwerty
Performance counter stats for 'git log -Sqwerty' (5 runs):
47,092,744 cache-misses # 2.825 M/sec ( +- 1.607% )
123,368,389 cache-references # 7.400 M/sec ( +- 0.812% )
330,040,998 branch-misses # 3.134 % ( +- 0.257% )
10,530,896,750 branches # 631.663 M/sec ( +- 0.121% )
62,037,201,030 instructions # 1.399 IPC ( +- 0.142% )
44,331,294,321 cycles # 2659.073 M/sec ( +- 0.326% )
96,794 page-faults # 0.006 M/sec ( +- 11.952% )
25 CPU-migrations # 0.000 M/sec ( +- 25.266% )
1,424 context-switches # 0.000 M/sec ( +- 0.540% )
16671.708650 task-clock-msecs # 0.997 CPUs ( +- 0.343% )
16.728692052 seconds time elapsed ( +- 0.344% )
after:
$ perf stat --repeat=5 git log -Sqwerty
Performance counter stats for 'git log -Sqwerty' (5 runs):
51,385,522 cache-misses # 4.619 M/sec ( +- 0.565% )
129,177,880 cache-references # 11.611 M/sec ( +- 0.219% )
319,222,775 branch-misses # 6.946 % ( +- 0.134% )
4,595,913,233 branches # 413.086 M/sec ( +- 0.112% )
31,395,042,533 instructions # 1.062 IPC ( +- 0.129% )
29,558,348,598 cycles # 2656.740 M/sec ( +- 0.204% )
93,224 page-faults # 0.008 M/sec ( +- 4.487% )
19 CPU-migrations # 0.000 M/sec ( +- 10.425% )
950 context-switches # 0.000 M/sec ( +- 0.360% )
11125.796039 task-clock-msecs # 0.997 CPUs ( +- 0.239% )
11.164216599 seconds time elapsed ( +- 0.240% )
So the kwset code is about 33% faster.
Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-21 06:41:57 +08:00
|
|
|
LIB_OBJS += kwset.o
|
2008-08-31 21:50:23 +08:00
|
|
|
LIB_OBJS += levenshtein.o
|
Implement line-history search (git log -L)
This is a rewrite of much of Bo's work, mainly in an effort to split
it into smaller, easier to understand routines.
The algorithm is built around the struct range_set, which encodes a
series of line ranges as intervals [a,b). This is used in two
contexts:
* A set of lines we are tracking (which will change as we dig through
history).
* To encode diffs, as pairs of ranges.
The main routine is range_set_map_across_diff(). It processes the
diff between a commit C and some parent P. It determines which diff
hunks are relevant to the ranges tracked in C, and computes the new
ranges for P.
The algorithm is then simply to process history in topological order
from newest to oldest, computing ranges and (partial) diffs. At
branch points, we need to merge the ranges we are watching. We will
find that many commits do not affect the chosen ranges, and mark them
TREESAME (in addition to those already filtered by pathspec limiting).
Another pass of history simplification then gets rid of such commits.
This is wired as an extra filtering pass in the log machinery. This
currently only reduces code duplication, but should allow for other
simplifications and options to be used.
Finally, we hook a diff printer into the output chain. Ideally we
would wire directly into the diff logic, to optionally use features
like word diff. However, that will require some major reworking of
the diff chain, so we completely replace the output with our own diff
for now.
As this was a GSoC project, and has quite some history by now, many
people have helped. In no particular order, thanks go to
Jakub Narebski <jnareb@gmail.com>
Jens Lehmann <Jens.Lehmann@web.de>
Jonathan Nieder <jrnieder@gmail.com>
Junio C Hamano <gitster@pobox.com>
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Will Palmer <wmpalmer@gmail.com>
Apologies to everyone I forgot.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-29 00:47:32 +08:00
|
|
|
LIB_OBJS += line-log.o
|
2013-03-29 00:47:30 +08:00
|
|
|
LIB_OBJS += line-range.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += list-objects.o
|
|
|
|
LIB_OBJS += ll-merge.o
|
|
|
|
LIB_OBJS += lockfile.o
|
|
|
|
LIB_OBJS += log-tree.o
|
|
|
|
LIB_OBJS += mailmap.o
|
|
|
|
LIB_OBJS += match-trees.o
|
2012-10-26 23:53:49 +08:00
|
|
|
LIB_OBJS += merge.o
|
2012-12-07 07:08:01 +08:00
|
|
|
LIB_OBJS += merge-blobs.o
|
2008-08-13 00:45:14 +08:00
|
|
|
LIB_OBJS += merge-recursive.o
|
2012-04-01 06:10:11 +08:00
|
|
|
LIB_OBJS += mergesort.o
|
2008-03-22 04:16:24 +08:00
|
|
|
LIB_OBJS += name-hash.o
|
2009-10-09 18:21:57 +08:00
|
|
|
LIB_OBJS += notes.o
|
2010-04-02 08:07:40 +08:00
|
|
|
LIB_OBJS += notes-cache.o
|
2010-11-10 05:49:46 +08:00
|
|
|
LIB_OBJS += notes-merge.o
|
2013-06-12 08:13:00 +08:00
|
|
|
LIB_OBJS += notes-utils.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += object.o
|
pack-bitmap: add support for bitmap indexes
A bitmap index is a `.bitmap` file that can be found inside
`$GIT_DIR/objects/pack/`, next to its corresponding packfile, and
contains precalculated reachability information for selected commits.
The full specification of the format for these bitmap indexes can be found
in `Documentation/technical/bitmap-format.txt`.
For a given commit SHA1, if it happens to be available in the bitmap
index, its bitmap will represent every single object that is reachable
from the commit itself. The nth bit in the bitmap is the nth object in
the packfile; if it's set to 1, the object is reachable.
By using the bitmaps available in the index, this commit implements
several new functions:
- `prepare_bitmap_git`
- `prepare_bitmap_walk`
- `traverse_bitmap_commit_list`
- `reuse_partial_packfile_from_bitmap`
The `prepare_bitmap_walk` function tries to build a bitmap of all the
objects that can be reached from the commit roots of a given `rev_info`
struct by using the following algorithm:
- If all the interesting commits for a revision walk are available in
the index, the resulting reachability bitmap is the bitwise OR of all
the individual bitmaps.
- When the full set of WANTs is not available in the index, we perform a
partial revision walk using the commits that don't have bitmaps as
roots, and limiting the revision walk as soon as we reach a commit that
has a corresponding bitmap. The earlier OR'ed bitmap with all the
indexed commits can now be completed as this walk progresses, so the end
result is the full reachability list.
- For revision walks with a HAVEs set (a set of commits that are deemed
uninteresting), first we perform the same method as for the WANTs, but
using our HAVEs as roots, in order to obtain a full reachability bitmap
of all the uninteresting commits. This bitmap then can be used to:
a) limit the subsequent walk when building the WANTs bitmap
b) finding the final set of interesting commits by performing an
AND-NOT of the WANTs and the HAVEs.
If `prepare_bitmap_walk` runs successfully, the resulting bitmap is
stored and the equivalent of a `traverse_commit_list` call can be
performed by using `traverse_bitmap_commit_list`; the bitmap version
of this call yields the objects straight from the packfile index
(without having to look them up or parse them) and hence is several
orders of magnitude faster.
As an extra optimization, when `prepare_bitmap_walk` succeeds, the
`reuse_partial_packfile_from_bitmap` call can be attempted: it will find
the amount of objects at the beginning of the on-disk packfile that can
be reused as-is, and return an offset into the packfile. The source
packfile can then be loaded and the bytes up to `offset` can be written
directly to the result without having to consider the entires inside the
packfile individually.
If the `prepare_bitmap_walk` call fails (e.g. because no bitmap files
are available), the `rev_info` struct is left untouched, and can be used
to perform a manual rev-walk using `traverse_commit_list`.
Hence, this new set of functions are a generic API that allows to
perform the equivalent of
git rev-list --objects [roots...] [^uninteresting...]
for any set of commits, even if they don't have specific bitmaps
generated for them.
In further patches, we'll use this bitmap traversal optimization to
speed up the `pack-objects` and `rev-list` commands.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-21 22:00:01 +08:00
|
|
|
LIB_OBJS += pack-bitmap.o
|
pack-objects: implement bitmap writing
This commit extends more the functionality of `pack-objects` by allowing
it to write out a `.bitmap` index next to any written packs, together
with the `.idx` index that currently gets written.
If bitmap writing is enabled for a given repository (either by calling
`pack-objects` with the `--write-bitmap-index` flag or by having
`pack.writebitmaps` set to `true` in the config) and pack-objects is
writing a packfile that would normally be indexed (i.e. not piping to
stdout), we will attempt to write the corresponding bitmap index for the
packfile.
Bitmap index writing happens after the packfile and its index has been
successfully written to disk (`finish_tmp_packfile`). The process is
performed in several steps:
1. `bitmap_writer_set_checksum`: this call stores the partial
checksum for the packfile being written; the checksum will be
written in the resulting bitmap index to verify its integrity
2. `bitmap_writer_build_type_index`: this call uses the array of
`struct object_entry` that has just been sorted when writing out
the actual packfile index to disk to generate 4 type-index bitmaps
(one for each object type).
These bitmaps have their nth bit set if the given object is of
the bitmap's type. E.g. the nth bit of the Commits bitmap will be
1 if the nth object in the packfile index is a commit.
This is a very cheap operation because the bitmap writing code has
access to the metadata stored in the `struct object_entry` array,
and hence the real type for each object in the packfile.
3. `bitmap_writer_reuse_bitmaps`: if there exists an existing bitmap
index for one of the packfiles we're trying to repack, this call
will efficiently rebuild the existing bitmaps so they can be
reused on the new index. All the existing bitmaps will be stored
in a `reuse` hash table, and the commit selection phase will
prioritize these when selecting, as they can be written directly
to the new index without having to perform a revision walk to
fill the bitmap. This can greatly speed up the repack of a
repository that already has bitmaps.
4. `bitmap_writer_select_commits`: if bitmap writing is enabled for
a given `pack-objects` run, the sequence of commits generated
during the Counting Objects phase will be stored in an array.
We then use that array to build up the list of selected commits.
Writing a bitmap in the index for each object in the repository
would be cost-prohibitive, so we use a simple heuristic to pick
the commits that will be indexed with bitmaps.
The current heuristics are a simplified version of JGit's
original implementation. We select a higher density of commits
depending on their age: the 100 most recent commits are always
selected, after that we pick 1 commit of each 100, and the gap
increases as the commits grow older. On top of that, we make sure
that every single branch that has not been merged (all the tips
that would be required from a clone) gets their own bitmap, and
when selecting commits between a gap, we tend to prioritize the
commit with the most parents.
Do note that there is no right/wrong way to perform commit
selection; different selection algorithms will result in
different commits being selected, but there's no such thing as
"missing a commit". The bitmap walker algorithm implemented in
`prepare_bitmap_walk` is able to adapt to missing bitmaps by
performing manual walks that complete the bitmap: the ideal
selection algorithm, however, would select the commits that are
more likely to be used as roots for a walk in the future (e.g.
the tips of each branch, and so on) to ensure a bitmap for them
is always available.
5. `bitmap_writer_build`: this is the computationally expensive part
of bitmap generation. Based on the list of commits that were
selected in the previous step, we perform several incremental
walks to generate the bitmap for each commit.
The walks begin from the oldest commit, and are built up
incrementally for each branch. E.g. consider this dag where A, B,
C, D, E, F are the selected commits, and a, b, c, e are a chunk
of simplified history that will not receive bitmaps.
A---a---B--b--C--c--D
\
E--e--F
We start by building the bitmap for A, using A as the root for a
revision walk and marking all the objects that are reachable
until the walk is over. Once this bitmap is stored, we reuse the
bitmap walker to perform the walk for B, assuming that once we
reach A again, the walk will be terminated because A has already
been SEEN on the previous walk.
This process is repeated for C, and D, but when we try to
generate the bitmaps for E, we can reuse neither the current walk
nor the bitmap we have generated so far.
What we do now is resetting both the walk and clearing the
bitmap, and performing the walk from scratch using E as the
origin. This new walk, however, does not need to be completed.
Once we hit B, we can lookup the bitmap we have already stored
for that commit and OR it with the existing bitmap we've composed
so far, allowing us to limit the walk early.
After all the bitmaps have been generated, another iteration
through the list of commits is performed to find the best XOR
offsets for compression before writing them to disk. Because of
the incremental nature of these bitmaps, XORing one of them with
its predecesor results in a minimal "bitmap delta" most of the
time. We can write this delta to the on-disk bitmap index, and
then re-compose the original bitmaps by XORing them again when
loaded.
This is a phase very similar to pack-object's `find_delta` (using
bitmaps instead of objects, of course), except the heuristics
have been greatly simplified: we only check the 10 bitmaps before
any given one to find best compressing one. This gives good
results in practice, because there is locality in the ordering of
the objects (and therefore bitmaps) in the packfile.
6. `bitmap_writer_finish`: the last step in the process is
serializing to disk all the bitmap data that has been generated
in the two previous steps.
The bitmap is written to a tmp file and then moved atomically to
its final destination, using the same process as
`pack-write.c:write_idx_file`.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-21 22:00:16 +08:00
|
|
|
LIB_OBJS += pack-bitmap-write.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += pack-check.o
|
2013-10-25 02:01:06 +08:00
|
|
|
LIB_OBJS += pack-objects.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += pack-revindex.o
|
|
|
|
LIB_OBJS += pack-write.o
|
|
|
|
LIB_OBJS += pager.o
|
|
|
|
LIB_OBJS += parse-options.o
|
2011-08-11 17:15:38 +08:00
|
|
|
LIB_OBJS += parse-options-cb.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += patch-delta.o
|
|
|
|
LIB_OBJS += patch-ids.o
|
|
|
|
LIB_OBJS += path.o
|
2013-01-07 00:58:08 +08:00
|
|
|
LIB_OBJS += pathspec.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += pkt-line.o
|
2009-02-10 06:00:45 +08:00
|
|
|
LIB_OBJS += preload-index.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += pretty.o
|
2013-06-07 10:13:50 +08:00
|
|
|
LIB_OBJS += prio-queue.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += progress.o
|
2011-12-10 18:40:54 +08:00
|
|
|
LIB_OBJS += prompt.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += quote.o
|
|
|
|
LIB_OBJS += reachable.o
|
|
|
|
LIB_OBJS += read-cache.o
|
|
|
|
LIB_OBJS += reflog-walk.o
|
|
|
|
LIB_OBJS += refs.o
|
|
|
|
LIB_OBJS += remote.o
|
2009-01-23 17:06:53 +08:00
|
|
|
LIB_OBJS += replace_object.o
|
2008-07-09 20:58:57 +08:00
|
|
|
LIB_OBJS += rerere.o
|
2009-12-25 16:30:51 +08:00
|
|
|
LIB_OBJS += resolve-undo.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += revision.o
|
|
|
|
LIB_OBJS += run-command.o
|
2012-10-26 23:53:53 +08:00
|
|
|
LIB_OBJS += send-pack.o
|
2012-05-04 21:52:36 +08:00
|
|
|
LIB_OBJS += sequencer.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += server-info.o
|
|
|
|
LIB_OBJS += setup.o
|
2011-05-20 05:34:33 +08:00
|
|
|
LIB_OBJS += sha1-array.o
|
sha1-lookup: more memory efficient search in sorted list of SHA-1
Currently, when looking for a packed object from the pack idx, a
simple binary search is used.
A conventional binary search loop looks like this:
unsigned lo, hi;
do {
unsigned mi = (lo + hi) / 2;
int cmp = "entry pointed at by mi" minus "target";
if (!cmp)
return mi; "mi is the wanted one"
if (cmp > 0)
hi = mi; "mi is larger than target"
else
lo = mi+1; "mi is smaller than target"
} while (lo < hi);
"did not find what we wanted"
The invariants are:
- When entering the loop, 'lo' points at a slot that is never
above the target (it could be at the target), 'hi' points at
a slot that is guaranteed to be above the target (it can
never be at the target).
- We find a point 'mi' between 'lo' and 'hi' ('mi' could be
the same as 'lo', but never can be as high as 'hi'), and
check if 'mi' hits the target. There are three cases:
- if it is a hit, we have found what we are looking for;
- if it is strictly higher than the target, we set it to
'hi', and repeat the search.
- if it is strictly lower than the target, we update 'lo'
to one slot after it, because we allow 'lo' to be at the
target and 'mi' is known to be below the target.
If the loop exits, there is no matching entry.
When choosing 'mi', we do not have to take the "middle" but
anywhere in between 'lo' and 'hi', as long as lo <= mi < hi is
satisfied. When we somehow know that the distance between the
target and 'lo' is much shorter than the target and 'hi', we
could pick 'mi' that is much closer to 'lo' than (hi+lo)/2,
which a conventional binary search would pick.
This patch takes advantage of the fact that the SHA-1 is a good
hash function, and as long as there are enough entries in the
table, we can expect uniform distribution. An entry that begins
with for example "deadbeef..." is much likely to appear much
later than in the midway of a reasonably populated table. In
fact, it can be expected to be near 87% (222/256) from the top
of the table.
This is a work-in-progress and has switches to allow easier
experiments and debugging. Exporting GIT_USE_LOOKUP environment
variable enables this code.
On my admittedly memory starved machine, with a partial KDE
repository (3.0G pack with 95M idx):
$ GIT_USE_LOOKUP=t git log -800 --stat HEAD >/dev/null
3.93user 0.16system 0:04.09elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+55588minor)pagefaults 0swaps
Without the patch, the numbers are:
$ git log -800 --stat HEAD >/dev/null
4.00user 0.15system 0:04.17elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+60258minor)pagefaults 0swaps
In the same repository:
$ GIT_USE_LOOKUP=t git log -2000 HEAD >/dev/null
0.12user 0.00system 0:00.12elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+4241minor)pagefaults 0swaps
Without the patch, the numbers are:
$ git log -2000 HEAD >/dev/null
0.05user 0.01system 0:00.07elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+8506minor)pagefaults 0swaps
There isn't much time difference, but the number of minor faults
seems to show that we are touching much smaller number of pages,
which is expected.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-29 18:05:47 +08:00
|
|
|
LIB_OBJS += sha1-lookup.o
|
2009-02-10 06:00:45 +08:00
|
|
|
LIB_OBJS += sha1_file.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += sha1_name.o
|
|
|
|
LIB_OBJS += shallow.o
|
|
|
|
LIB_OBJS += sideband.o
|
chain kill signals for cleanup functions
If a piece of code wanted to do some cleanup before exiting
(e.g., cleaning up a lockfile or a tempfile), our usual
strategy was to install a signal handler that did something
like this:
do_cleanup(); /* actual work */
signal(signo, SIG_DFL); /* restore previous behavior */
raise(signo); /* deliver signal, killing ourselves */
For a single handler, this works fine. However, if we want
to clean up two _different_ things, we run into a problem.
The most recently installed handler will run, but when it
removes itself as a handler, it doesn't put back the first
handler.
This patch introduces sigchain, a tiny library for handling
a stack of signal handlers. You sigchain_push each handler,
and use sigchain_pop to restore whoever was before you in
the stack.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-22 14:02:35 +08:00
|
|
|
LIB_OBJS += sigchain.o
|
2014-06-13 20:19:36 +08:00
|
|
|
LIB_OBJS += split-index.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += strbuf.o
|
2011-05-12 10:30:25 +08:00
|
|
|
LIB_OBJS += streaming.o
|
2009-02-10 06:00:45 +08:00
|
|
|
LIB_OBJS += string-list.o
|
2009-10-19 20:38:32 +08:00
|
|
|
LIB_OBJS += submodule.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += symlinks.o
|
|
|
|
LIB_OBJS += tag.o
|
|
|
|
LIB_OBJS += trace.o
|
|
|
|
LIB_OBJS += transport.o
|
2009-08-05 13:01:53 +08:00
|
|
|
LIB_OBJS += transport-helper.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += tree-diff.o
|
|
|
|
LIB_OBJS += tree.o
|
|
|
|
LIB_OBJS += tree-walk.o
|
|
|
|
LIB_OBJS += unpack-trees.o
|
2010-05-23 17:17:55 +08:00
|
|
|
LIB_OBJS += url.o
|
2013-08-06 04:20:36 +08:00
|
|
|
LIB_OBJS += urlmatch.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += usage.o
|
2009-02-10 06:00:45 +08:00
|
|
|
LIB_OBJS += userdiff.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += utf8.o
|
2012-04-04 06:53:08 +08:00
|
|
|
LIB_OBJS += varint.o
|
2012-06-03 02:51:42 +08:00
|
|
|
LIB_OBJS += version.o
|
2014-02-27 20:56:52 +08:00
|
|
|
LIB_OBJS += versioncmp.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += walker.o
|
2012-10-15 14:25:55 +08:00
|
|
|
LIB_OBJS += wildmatch.o
|
Shrink the git binary a bit by avoiding unnecessary inline functions
So I was looking at the disgusting size of the git binary, and even with
the debugging removed, and using -Os instead of -O2, the size of the text
section was pretty high. In this day and age I guess almost a megabyte of
text isn't really all that surprising, but it still doesn't exactly make
me think "lean and mean".
With -Os, a surprising amount of text space is wasted on inline functions
that end up just being replicated multiple times, and where performance
really isn't a valid reason to inline them. In particular, the trivial
wrapper functions like "xmalloc()" are used _everywhere_, and making them
inline just duplicates the text (and the string we use to 'die()' on
failure) unnecessarily.
So this just moves them into a "wrapper.c" file, getting rid of a tiny bit
of unnecessary bloat. The following numbers are both with "CFLAGS=-Os":
Before:
[torvalds@woody git]$ size git
text data bss dec hex filename
700460 15160 292184 1007804 f60bc git
After:
[torvalds@woody git]$ size git
text data bss dec hex filename
670540 15160 292184 977884 eebdc git
so it saves almost 30k of text-space (it actually saves more than that
with the default -O2, but I don't think that's necessarily a very relevant
number from a "try to shrink git" standpoint).
It might conceivably have a performance impact, but none of this should be
_that_ performance critical. The real cost is not generally in the wrapper
anyway, but in the code it wraps (ie the cost of "xread()" is all in the
read itself, not in the trivial wrapping of it).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-23 03:19:25 +08:00
|
|
|
LIB_OBJS += wrapper.o
|
2008-03-12 16:46:26 +08:00
|
|
|
LIB_OBJS += write_or_die.o
|
|
|
|
LIB_OBJS += ws.o
|
|
|
|
LIB_OBJS += wt-status.o
|
|
|
|
LIB_OBJS += xdiff-interface.o
|
2010-11-06 19:47:34 +08:00
|
|
|
LIB_OBJS += zlib.o
|
2008-03-12 16:46:26 +08:00
|
|
|
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/add.o
|
|
|
|
BUILTIN_OBJS += builtin/annotate.o
|
|
|
|
BUILTIN_OBJS += builtin/apply.o
|
|
|
|
BUILTIN_OBJS += builtin/archive.o
|
|
|
|
BUILTIN_OBJS += builtin/bisect--helper.o
|
|
|
|
BUILTIN_OBJS += builtin/blame.o
|
|
|
|
BUILTIN_OBJS += builtin/branch.o
|
|
|
|
BUILTIN_OBJS += builtin/bundle.o
|
|
|
|
BUILTIN_OBJS += builtin/cat-file.o
|
|
|
|
BUILTIN_OBJS += builtin/check-attr.o
|
2013-01-07 00:58:13 +08:00
|
|
|
BUILTIN_OBJS += builtin/check-ignore.o
|
2013-07-13 08:53:10 +08:00
|
|
|
BUILTIN_OBJS += builtin/check-mailmap.o
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/check-ref-format.o
|
|
|
|
BUILTIN_OBJS += builtin/checkout-index.o
|
|
|
|
BUILTIN_OBJS += builtin/checkout.o
|
|
|
|
BUILTIN_OBJS += builtin/clean.o
|
|
|
|
BUILTIN_OBJS += builtin/clone.o
|
2012-04-21 12:44:32 +08:00
|
|
|
BUILTIN_OBJS += builtin/column.o
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/commit-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/commit.o
|
|
|
|
BUILTIN_OBJS += builtin/config.o
|
|
|
|
BUILTIN_OBJS += builtin/count-objects.o
|
2012-06-24 19:39:59 +08:00
|
|
|
BUILTIN_OBJS += builtin/credential.o
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/describe.o
|
|
|
|
BUILTIN_OBJS += builtin/diff-files.o
|
|
|
|
BUILTIN_OBJS += builtin/diff-index.o
|
|
|
|
BUILTIN_OBJS += builtin/diff-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/diff.o
|
|
|
|
BUILTIN_OBJS += builtin/fast-export.o
|
|
|
|
BUILTIN_OBJS += builtin/fetch-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/fetch.o
|
|
|
|
BUILTIN_OBJS += builtin/fmt-merge-msg.o
|
|
|
|
BUILTIN_OBJS += builtin/for-each-ref.o
|
|
|
|
BUILTIN_OBJS += builtin/fsck.o
|
|
|
|
BUILTIN_OBJS += builtin/gc.o
|
2013-12-03 07:37:10 +08:00
|
|
|
BUILTIN_OBJS += builtin/get-tar-commit-id.o
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/grep.o
|
|
|
|
BUILTIN_OBJS += builtin/hash-object.o
|
|
|
|
BUILTIN_OBJS += builtin/help.o
|
|
|
|
BUILTIN_OBJS += builtin/index-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/init-db.o
|
|
|
|
BUILTIN_OBJS += builtin/log.o
|
|
|
|
BUILTIN_OBJS += builtin/ls-files.o
|
|
|
|
BUILTIN_OBJS += builtin/ls-remote.o
|
|
|
|
BUILTIN_OBJS += builtin/ls-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/mailinfo.o
|
|
|
|
BUILTIN_OBJS += builtin/mailsplit.o
|
|
|
|
BUILTIN_OBJS += builtin/merge.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-base.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-file.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-index.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-ours.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-recursive.o
|
|
|
|
BUILTIN_OBJS += builtin/merge-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/mktag.o
|
|
|
|
BUILTIN_OBJS += builtin/mktree.o
|
|
|
|
BUILTIN_OBJS += builtin/mv.o
|
|
|
|
BUILTIN_OBJS += builtin/name-rev.o
|
2010-03-15 15:52:06 +08:00
|
|
|
BUILTIN_OBJS += builtin/notes.o
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/pack-objects.o
|
|
|
|
BUILTIN_OBJS += builtin/pack-redundant.o
|
|
|
|
BUILTIN_OBJS += builtin/pack-refs.o
|
|
|
|
BUILTIN_OBJS += builtin/patch-id.o
|
|
|
|
BUILTIN_OBJS += builtin/prune-packed.o
|
|
|
|
BUILTIN_OBJS += builtin/prune.o
|
|
|
|
BUILTIN_OBJS += builtin/push.o
|
|
|
|
BUILTIN_OBJS += builtin/read-tree.o
|
|
|
|
BUILTIN_OBJS += builtin/receive-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/reflog.o
|
|
|
|
BUILTIN_OBJS += builtin/remote.o
|
2010-10-13 00:39:43 +08:00
|
|
|
BUILTIN_OBJS += builtin/remote-ext.o
|
2010-10-13 00:39:42 +08:00
|
|
|
BUILTIN_OBJS += builtin/remote-fd.o
|
2013-09-15 23:33:20 +08:00
|
|
|
BUILTIN_OBJS += builtin/repack.o
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/replace.o
|
|
|
|
BUILTIN_OBJS += builtin/rerere.o
|
|
|
|
BUILTIN_OBJS += builtin/reset.o
|
|
|
|
BUILTIN_OBJS += builtin/rev-list.o
|
|
|
|
BUILTIN_OBJS += builtin/rev-parse.o
|
|
|
|
BUILTIN_OBJS += builtin/revert.o
|
|
|
|
BUILTIN_OBJS += builtin/rm.o
|
|
|
|
BUILTIN_OBJS += builtin/send-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/shortlog.o
|
|
|
|
BUILTIN_OBJS += builtin/show-branch.o
|
|
|
|
BUILTIN_OBJS += builtin/show-ref.o
|
|
|
|
BUILTIN_OBJS += builtin/stripspace.o
|
|
|
|
BUILTIN_OBJS += builtin/symbolic-ref.o
|
|
|
|
BUILTIN_OBJS += builtin/tag.o
|
|
|
|
BUILTIN_OBJS += builtin/unpack-file.o
|
|
|
|
BUILTIN_OBJS += builtin/unpack-objects.o
|
|
|
|
BUILTIN_OBJS += builtin/update-index.o
|
|
|
|
BUILTIN_OBJS += builtin/update-ref.o
|
|
|
|
BUILTIN_OBJS += builtin/update-server-info.o
|
|
|
|
BUILTIN_OBJS += builtin/upload-archive.o
|
|
|
|
BUILTIN_OBJS += builtin/var.o
|
2014-06-23 15:05:49 +08:00
|
|
|
BUILTIN_OBJS += builtin/verify-commit.o
|
2010-02-23 00:42:18 +08:00
|
|
|
BUILTIN_OBJS += builtin/verify-pack.o
|
|
|
|
BUILTIN_OBJS += builtin/verify-tag.o
|
|
|
|
BUILTIN_OBJS += builtin/write-tree.o
|
2006-04-22 01:27:34 +08:00
|
|
|
|
2006-03-27 07:14:52 +08:00
|
|
|
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
2007-07-30 02:35:45 +08:00
|
|
|
EXTLIBS =
|
2005-04-22 03:33:22 +08:00
|
|
|
|
2012-06-03 03:01:12 +08:00
|
|
|
GIT_USER_AGENT = git/$(GIT_VERSION)
|
|
|
|
|
Makefile: hoist uname autodetection to config.mak.uname
Our Makefile first sets up some sane per-platform defaults
by looking at "uname", then modifies that according to the
results of autoconf (if any), then modifies that according
to the user's wishes in config.mak.
For sub-Makefiles like Documentation/Makefile, the latter
two are available, but the uname defaults are available only
to the main Makefile. This hasn't been a problem so far,
because the sub-Makefiles do not rely on any of those
automatic settings to do their work.
This patch puts the uname magic into its own file so it can
be reused in other Makefiles, opening up the possibility of
new knobs.
Note that we leave one reference to uname in the top-level
Makefile: if we are on Darwin, we must check the NO_FINK and
NO_DARWIN_PORTS settings. But because we are combining uname
settings with user-options, we must do so after all of the
config is loaded. This is acceptable, as the resulting
conditionals are about setting variables specific to the
top-level Makefile (and if that ever changes, we can hoist
them into a separate post-config include, too).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-04 05:05:41 +08:00
|
|
|
include config.mak.uname
|
2006-07-03 07:56:48 +08:00
|
|
|
-include config.mak.autogen
|
2005-10-12 06:22:47 +08:00
|
|
|
-include config.mak
|
2005-09-08 03:22:56 +08:00
|
|
|
|
2011-05-09 16:24:55 +08:00
|
|
|
ifndef sysconfdir
|
|
|
|
ifeq ($(prefix),/usr)
|
|
|
|
sysconfdir = /etc
|
|
|
|
else
|
|
|
|
sysconfdir = etc
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-08-19 02:34:39 +08:00
|
|
|
ifndef COMPUTE_HEADER_DEPENDENCIES
|
2011-11-18 17:58:21 +08:00
|
|
|
COMPUTE_HEADER_DEPENDENCIES = auto
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
|
2011-08-30 16:27:35 +08:00
|
|
|
dep_check = $(shell $(CC) $(ALL_CFLAGS) \
|
2011-11-19 07:23:24 +08:00
|
|
|
-c -MF /dev/null -MQ /dev/null -MMD -MP \
|
|
|
|
-x c /dev/null -o /dev/null 2>&1; \
|
2011-08-30 16:27:35 +08:00
|
|
|
echo $$?)
|
2011-08-19 02:34:39 +08:00
|
|
|
ifeq ($(dep_check),0)
|
2011-11-18 17:58:21 +08:00
|
|
|
override COMPUTE_HEADER_DEPENDENCIES = yes
|
|
|
|
else
|
|
|
|
override COMPUTE_HEADER_DEPENDENCIES = no
|
2011-08-19 02:34:39 +08:00
|
|
|
endif
|
2010-01-26 23:57:15 +08:00
|
|
|
endif
|
|
|
|
|
2011-11-18 17:58:21 +08:00
|
|
|
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
|
2010-01-26 23:57:15 +08:00
|
|
|
USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
|
2011-11-18 17:58:21 +08:00
|
|
|
else
|
|
|
|
ifneq ($(COMPUTE_HEADER_DEPENDENCIES),no)
|
|
|
|
$(error please set COMPUTE_HEADER_DEPENDENCIES to yes, no, or auto \
|
|
|
|
(not "$(COMPUTE_HEADER_DEPENDENCIES)"))
|
|
|
|
endif
|
2010-01-26 23:57:15 +08:00
|
|
|
endif
|
|
|
|
|
2009-06-06 07:36:15 +08:00
|
|
|
ifdef SANE_TOOL_PATH
|
2009-06-09 00:41:49 +08:00
|
|
|
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
|
|
|
|
BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
|
2009-06-06 07:36:15 +08:00
|
|
|
PATH := $(SANE_TOOL_PATH):${PATH}
|
|
|
|
else
|
2009-06-09 00:41:49 +08:00
|
|
|
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
|
2009-06-06 07:36:15 +08:00
|
|
|
endif
|
|
|
|
|
2010-05-14 17:31:43 +08:00
|
|
|
ifneq (,$(INLINE))
|
|
|
|
BASIC_CFLAGS += -Dinline=$(INLINE)
|
|
|
|
endif
|
|
|
|
|
2010-05-14 17:31:42 +08:00
|
|
|
ifneq (,$(SOCKLEN_T))
|
|
|
|
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
|
|
|
|
endif
|
|
|
|
|
2006-12-13 01:01:47 +08:00
|
|
|
ifeq ($(uname_S),Darwin)
|
|
|
|
ifndef NO_FINK
|
|
|
|
ifeq ($(shell test -d /sw/lib && echo y),y)
|
|
|
|
BASIC_CFLAGS += -I/sw/include
|
|
|
|
BASIC_LDFLAGS += -L/sw/lib
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifndef NO_DARWIN_PORTS
|
|
|
|
ifeq ($(shell test -d /opt/local/lib && echo y),y)
|
|
|
|
BASIC_CFLAGS += -I/opt/local/include
|
|
|
|
BASIC_LDFLAGS += -L/opt/local/lib
|
|
|
|
endif
|
|
|
|
endif
|
2013-05-19 18:23:34 +08:00
|
|
|
ifndef NO_APPLE_COMMON_CRYPTO
|
|
|
|
APPLE_COMMON_CRYPTO = YesPlease
|
|
|
|
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
|
|
|
|
endif
|
2013-05-11 16:22:26 +08:00
|
|
|
NO_REGEX = YesPlease
|
2009-01-27 03:03:59 +08:00
|
|
|
PTHREAD_LIBS =
|
2006-12-13 01:01:47 +08:00
|
|
|
endif
|
|
|
|
|
2008-08-17 12:56:24 +08:00
|
|
|
ifndef CC_LD_DYNPATH
|
|
|
|
ifdef NO_R_TO_GCC_LINKER
|
|
|
|
# Some gcc does not accept and pass -R to the linker to specify
|
|
|
|
# the runtime dynamic library path.
|
|
|
|
CC_LD_DYNPATH = -Wl,-rpath,
|
|
|
|
else
|
|
|
|
CC_LD_DYNPATH = -R
|
|
|
|
endif
|
2006-12-28 06:17:35 +08:00
|
|
|
endif
|
|
|
|
|
2009-05-31 16:35:51 +08:00
|
|
|
ifdef NO_LIBGEN_H
|
|
|
|
COMPAT_CFLAGS += -DNO_LIBGEN_H
|
|
|
|
COMPAT_OBJS += compat/basename.o
|
|
|
|
endif
|
|
|
|
|
2011-05-10 05:52:05 +08:00
|
|
|
ifdef USE_LIBPCRE
|
|
|
|
BASIC_CFLAGS += -DUSE_LIBPCRE
|
|
|
|
ifdef LIBPCREDIR
|
|
|
|
BASIC_CFLAGS += -I$(LIBPCREDIR)/include
|
|
|
|
EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
|
|
|
|
endif
|
|
|
|
EXTLIBS += -lpcre
|
|
|
|
endif
|
|
|
|
|
Portable alloca for Git
In the next patch we'll have to use alloca() for performance reasons,
but since alloca is non-standardized and is not portable, let's have a
trick with compatibility wrappers:
1. at configure time, determine, do we have working alloca() through
alloca.h, and define
#define HAVE_ALLOCA_H
if yes.
2. in code
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
# define xalloca(size) (alloca(size))
# define xalloca_free(p) do {} while(0)
#else
# define xalloca(size) (xmalloc(size))
# define xalloca_free(p) (free(p))
#endif
and use it like
func() {
p = xalloca(size);
...
xalloca_free(p);
}
This way, for systems, where alloca is available, we'll have optimal
on-stack allocations with fast executions. On the other hand, on
systems, where alloca is not available, this gracefully fallbacks to
xmalloc/free.
Both autoconf and config.mak.uname configurations were updated. For
autoconf, we are not bothering considering cases, when no alloca.h is
available, but alloca() works some other way - its simply alloca.h is
available and works or not, everything else is deep legacy.
For config.mak.uname, I've tried to make my almost-sure guess for where
alloca() is available, but since I only have access to Linux it is the
only change I can be sure about myself, with relevant to other changed
systems people Cc'ed.
NOTE
SunOS and Windows had explicit -DHAVE_ALLOCA_H in their configurations.
I've changed that to now-common HAVE_ALLOCA_H=YesPlease which should be
correct.
Cc: Brandon Casey <drafnel@gmail.com>
Cc: Marius Storm-Olsen <mstormo@gmail.com>
Cc: Johannes Sixt <j6t@kdbg.org>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Gerrit Pape <pape@smarden.org>
Cc: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Thomas Schwinge <thomas@codesourcery.com> (GNU Hurd changes)
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-27 22:22:50 +08:00
|
|
|
ifdef HAVE_ALLOCA_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_ALLOCA_H
|
|
|
|
endif
|
|
|
|
|
2007-09-11 11:02:45 +08:00
|
|
|
ifdef NO_CURL
|
|
|
|
BASIC_CFLAGS += -DNO_CURL
|
2010-01-19 23:39:12 +08:00
|
|
|
REMOTE_CURL_PRIMARY =
|
|
|
|
REMOTE_CURL_ALIASES =
|
|
|
|
REMOTE_CURL_NAMES =
|
2007-09-11 11:02:45 +08:00
|
|
|
else
|
2005-09-24 01:41:40 +08:00
|
|
|
ifdef CURLDIR
|
2014-05-01 01:58:10 +08:00
|
|
|
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
|
|
|
|
BASIC_CFLAGS += -I$(CURLDIR)/include
|
|
|
|
CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
|
2014-04-29 05:01:23 +08:00
|
|
|
else
|
2014-05-01 01:58:10 +08:00
|
|
|
CURL_LIBCURL = -lcurl
|
2014-04-29 05:01:23 +08:00
|
|
|
endif
|
2014-05-01 01:58:10 +08:00
|
|
|
ifdef NEEDS_SSL_WITH_CURL
|
|
|
|
CURL_LIBCURL += -lssl
|
|
|
|
ifdef NEEDS_CRYPTO_WITH_SSL
|
|
|
|
CURL_LIBCURL += -lcrypto
|
2011-07-20 06:55:47 +08:00
|
|
|
endif
|
|
|
|
endif
|
2014-05-01 01:58:10 +08:00
|
|
|
ifdef NEEDS_IDN_WITH_CURL
|
|
|
|
CURL_LIBCURL += -lidn
|
|
|
|
endif
|
2011-07-20 06:55:47 +08:00
|
|
|
|
2010-01-19 23:39:12 +08:00
|
|
|
REMOTE_CURL_PRIMARY = git-remote-http$X
|
|
|
|
REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
|
|
|
|
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
|
2010-01-26 23:54:23 +08:00
|
|
|
PROGRAM_OBJS += http-fetch.o
|
|
|
|
PROGRAMS += $(REMOTE_CURL_NAMES)
|
2012-11-22 11:19:57 +08:00
|
|
|
curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p)
|
2005-11-19 09:08:36 +08:00
|
|
|
ifeq "$(curl_check)" "070908"
|
|
|
|
ifndef NO_EXPAT
|
2010-01-26 23:54:23 +08:00
|
|
|
PROGRAM_OBJS += http-push.o
|
2005-11-19 09:08:36 +08:00
|
|
|
endif
|
2005-11-03 03:19:24 +08:00
|
|
|
endif
|
2006-04-05 22:22:40 +08:00
|
|
|
ifndef NO_EXPAT
|
2009-01-29 04:43:57 +08:00
|
|
|
ifdef EXPATDIR
|
|
|
|
BASIC_CFLAGS += -I$(EXPATDIR)/include
|
|
|
|
EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
|
|
|
|
else
|
|
|
|
EXPAT_LIBEXPAT = -lexpat
|
|
|
|
endif
|
2013-02-12 06:03:45 +08:00
|
|
|
ifdef EXPAT_NEEDS_XMLPARSE_H
|
|
|
|
BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
|
|
|
|
endif
|
2006-04-05 22:22:40 +08:00
|
|
|
endif
|
2005-09-24 01:41:40 +08:00
|
|
|
endif
|
|
|
|
|
2007-07-30 02:35:45 +08:00
|
|
|
ifdef ZLIB_PATH
|
|
|
|
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
|
2007-08-01 12:30:35 +08:00
|
|
|
EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
|
2007-07-30 02:35:45 +08:00
|
|
|
endif
|
|
|
|
EXTLIBS += -lz
|
|
|
|
|
2005-07-29 23:50:51 +08:00
|
|
|
ifndef NO_OPENSSL
|
2005-09-08 08:26:23 +08:00
|
|
|
OPENSSL_LIBSSL = -lssl
|
2005-10-01 04:31:16 +08:00
|
|
|
ifdef OPENSSLDIR
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -I$(OPENSSLDIR)/include
|
2007-08-01 12:30:35 +08:00
|
|
|
OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
|
2005-10-01 04:31:16 +08:00
|
|
|
else
|
|
|
|
OPENSSL_LINK =
|
|
|
|
endif
|
2009-09-08 21:54:38 +08:00
|
|
|
ifdef NEEDS_CRYPTO_WITH_SSL
|
2011-07-20 06:55:47 +08:00
|
|
|
OPENSSL_LIBSSL += -lcrypto
|
2009-09-08 21:54:38 +08:00
|
|
|
endif
|
2005-07-29 23:50:51 +08:00
|
|
|
else
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -DNO_OPENSSL
|
2009-08-18 08:09:56 +08:00
|
|
|
BLK_SHA1 = 1
|
2005-09-08 08:26:23 +08:00
|
|
|
OPENSSL_LIBSSL =
|
2005-07-29 23:50:51 +08:00
|
|
|
endif
|
2010-12-09 06:54:13 +08:00
|
|
|
ifdef NO_OPENSSL
|
|
|
|
LIB_4_CRYPTO =
|
|
|
|
else
|
2005-09-08 03:22:56 +08:00
|
|
|
ifdef NEEDS_SSL_WITH_CRYPTO
|
2005-10-01 04:31:16 +08:00
|
|
|
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
|
2005-09-08 03:22:56 +08:00
|
|
|
else
|
2005-10-01 04:31:16 +08:00
|
|
|
LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
|
2005-09-08 03:22:56 +08:00
|
|
|
endif
|
2013-08-05 23:59:22 +08:00
|
|
|
ifdef APPLE_COMMON_CRYPTO
|
|
|
|
LIB_4_CRYPTO += -framework Security -framework CoreFoundation
|
|
|
|
endif
|
2010-12-09 06:54:13 +08:00
|
|
|
endif
|
2005-09-08 03:22:56 +08:00
|
|
|
ifdef NEEDS_LIBICONV
|
2005-10-01 04:31:16 +08:00
|
|
|
ifdef ICONVDIR
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -I$(ICONVDIR)/include
|
2007-08-01 12:30:35 +08:00
|
|
|
ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
|
2005-10-01 04:31:16 +08:00
|
|
|
else
|
|
|
|
ICONV_LINK =
|
|
|
|
endif
|
2012-09-19 18:03:30 +08:00
|
|
|
ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
|
|
|
|
ICONV_LINK += -lintl
|
|
|
|
endif
|
2006-06-25 09:35:12 +08:00
|
|
|
EXTLIBS += $(ICONV_LINK) -liconv
|
2005-09-08 03:22:56 +08:00
|
|
|
endif
|
2009-07-11 01:10:45 +08:00
|
|
|
ifdef NEEDS_LIBGEN
|
|
|
|
EXTLIBS += -lgen
|
|
|
|
endif
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
ifndef NO_GETTEXT
|
|
|
|
ifndef LIBC_CONTAINS_LIBINTL
|
|
|
|
EXTLIBS += -lintl
|
|
|
|
endif
|
|
|
|
endif
|
2005-09-06 07:24:03 +08:00
|
|
|
ifdef NEEDS_SOCKET
|
2006-06-25 09:35:12 +08:00
|
|
|
EXTLIBS += -lsocket
|
2005-09-06 07:24:03 +08:00
|
|
|
endif
|
2005-09-12 13:25:49 +08:00
|
|
|
ifdef NEEDS_NSL
|
2006-06-25 09:35:12 +08:00
|
|
|
EXTLIBS += -lnsl
|
2005-09-12 13:25:49 +08:00
|
|
|
endif
|
2009-06-06 07:36:10 +08:00
|
|
|
ifdef NEEDS_RESOLV
|
|
|
|
EXTLIBS += -lresolv
|
|
|
|
endif
|
2006-01-20 09:13:57 +08:00
|
|
|
ifdef NO_D_TYPE_IN_DIRENT
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
|
2006-01-20 09:13:57 +08:00
|
|
|
endif
|
2006-01-20 09:13:51 +08:00
|
|
|
ifdef NO_D_INO_IN_DIRENT
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
|
2006-01-20 09:13:51 +08:00
|
|
|
endif
|
2012-12-15 03:56:59 +08:00
|
|
|
ifdef NO_GECOS_IN_PWENT
|
|
|
|
BASIC_CFLAGS += -DNO_GECOS_IN_PWENT
|
|
|
|
endif
|
2008-08-19 03:57:16 +08:00
|
|
|
ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
|
|
|
|
BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
|
|
|
|
endif
|
2009-03-09 05:22:51 +08:00
|
|
|
ifdef USE_NSEC
|
|
|
|
BASIC_CFLAGS += -DUSE_NSEC
|
|
|
|
endif
|
2009-03-09 04:04:28 +08:00
|
|
|
ifdef USE_ST_TIMESPEC
|
|
|
|
BASIC_CFLAGS += -DUSE_ST_TIMESPEC
|
|
|
|
endif
|
2011-06-19 09:07:03 +08:00
|
|
|
ifdef NO_NORETURN
|
|
|
|
BASIC_CFLAGS += -DNO_NORETURN
|
|
|
|
endif
|
2009-03-05 01:47:40 +08:00
|
|
|
ifdef NO_NSEC
|
|
|
|
BASIC_CFLAGS += -DNO_NSEC
|
|
|
|
endif
|
2008-03-05 23:46:13 +08:00
|
|
|
ifdef SNPRINTF_RETURNS_BOGUS
|
|
|
|
COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
|
|
|
|
COMPAT_OBJS += compat/snprintf.o
|
|
|
|
endif
|
2008-02-09 10:32:47 +08:00
|
|
|
ifdef FREAD_READS_DIRECTORIES
|
|
|
|
COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
|
|
|
|
COMPAT_OBJS += compat/fopen.o
|
|
|
|
endif
|
2006-05-02 15:40:24 +08:00
|
|
|
ifdef NO_SYMLINK_HEAD
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -DNO_SYMLINK_HEAD
|
2006-05-02 15:40:24 +08:00
|
|
|
endif
|
2011-02-23 07:41:21 +08:00
|
|
|
ifdef GETTEXT_POISON
|
|
|
|
BASIC_CFLAGS += -DGETTEXT_POISON
|
|
|
|
endif
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
ifdef NO_GETTEXT
|
|
|
|
BASIC_CFLAGS += -DNO_GETTEXT
|
2012-01-24 08:31:09 +08:00
|
|
|
USE_GETTEXT_SCHEME ?= fallthrough
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
endif
|
2012-09-18 05:16:39 +08:00
|
|
|
ifdef NO_POLL
|
|
|
|
NO_SYS_POLL_H = YesPlease
|
|
|
|
COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
|
|
|
|
COMPAT_OBJS += compat/poll/poll.o
|
|
|
|
endif
|
2005-09-19 09:30:50 +08:00
|
|
|
ifdef NO_STRCASESTR
|
2005-12-06 03:54:29 +08:00
|
|
|
COMPAT_CFLAGS += -DNO_STRCASESTR
|
2005-12-03 07:08:28 +08:00
|
|
|
COMPAT_OBJS += compat/strcasestr.o
|
|
|
|
endif
|
2006-06-24 22:01:25 +08:00
|
|
|
ifdef NO_STRLCPY
|
|
|
|
COMPAT_CFLAGS += -DNO_STRLCPY
|
|
|
|
COMPAT_OBJS += compat/strlcpy.o
|
|
|
|
endif
|
2007-02-20 08:22:56 +08:00
|
|
|
ifdef NO_STRTOUMAX
|
|
|
|
COMPAT_CFLAGS += -DNO_STRTOUMAX
|
2011-11-02 23:46:22 +08:00
|
|
|
COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o
|
2007-02-20 08:22:56 +08:00
|
|
|
endif
|
|
|
|
ifdef NO_STRTOULL
|
|
|
|
COMPAT_CFLAGS += -DNO_STRTOULL
|
|
|
|
endif
|
2005-12-03 07:08:28 +08:00
|
|
|
ifdef NO_SETENV
|
2005-12-06 03:54:29 +08:00
|
|
|
COMPAT_CFLAGS += -DNO_SETENV
|
2005-12-03 07:08:28 +08:00
|
|
|
COMPAT_OBJS += compat/setenv.o
|
2005-09-19 09:30:50 +08:00
|
|
|
endif
|
2007-10-21 04:03:49 +08:00
|
|
|
ifdef NO_MKDTEMP
|
|
|
|
COMPAT_CFLAGS += -DNO_MKDTEMP
|
|
|
|
COMPAT_OBJS += compat/mkdtemp.o
|
|
|
|
endif
|
2012-09-09 01:01:31 +08:00
|
|
|
ifdef MKDIR_WO_TRAILING_SLASH
|
|
|
|
COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
|
|
|
|
COMPAT_OBJS += compat/mkdir.o
|
|
|
|
endif
|
2009-05-31 16:35:50 +08:00
|
|
|
ifdef NO_MKSTEMPS
|
|
|
|
COMPAT_CFLAGS += -DNO_MKSTEMPS
|
|
|
|
endif
|
2006-08-29 18:51:14 +08:00
|
|
|
ifdef NO_UNSETENV
|
2006-01-26 04:38:36 +08:00
|
|
|
COMPAT_CFLAGS += -DNO_UNSETENV
|
|
|
|
COMPAT_OBJS += compat/unsetenv.o
|
|
|
|
endif
|
2008-01-25 02:34:46 +08:00
|
|
|
ifdef NO_SYS_SELECT_H
|
|
|
|
BASIC_CFLAGS += -DNO_SYS_SELECT_H
|
|
|
|
endif
|
2010-10-27 16:39:52 +08:00
|
|
|
ifdef NO_SYS_POLL_H
|
|
|
|
BASIC_CFLAGS += -DNO_SYS_POLL_H
|
|
|
|
endif
|
git-compat-util.h: do not #include <sys/param.h> by default
Earlier we allowed platforms that lack <sys/param.h> not to include
the header file from git-compat-util.h; we have included this header
file since the early days back when we used MAXPATHLEN (which we no
longer use) and also depended on it slurping ULONG_MAX (which we get
by including stdint.h or inttypes.h these days).
It turns out that we can compile our modern codebase just file
without including it on many platforms (so far, Fedora, Debian,
Ubuntu, MinGW, Mac OS X, Cygwin, HP-Nonstop, QNX and z/OS are
reported to be OK).
Let's stop including it by default, and on platforms that need it to
be included, leave "make NEEDS_SYS_PARAM_H=YesPlease" as an escape
hatch and ask them to report to us, so that we can find out about
the real dependency and fix it in a more platform agnostic way.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-19 01:35:33 +08:00
|
|
|
ifdef NEEDS_SYS_PARAM_H
|
|
|
|
BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
|
2012-12-15 03:56:58 +08:00
|
|
|
endif
|
2010-10-27 16:39:52 +08:00
|
|
|
ifdef NO_INTTYPES_H
|
|
|
|
BASIC_CFLAGS += -DNO_INTTYPES_H
|
|
|
|
endif
|
|
|
|
ifdef NO_INITGROUPS
|
|
|
|
BASIC_CFLAGS += -DNO_INITGROUPS
|
|
|
|
endif
|
2005-10-09 06:54:36 +08:00
|
|
|
ifdef NO_MMAP
|
2005-12-06 03:54:29 +08:00
|
|
|
COMPAT_CFLAGS += -DNO_MMAP
|
2005-12-03 07:08:28 +08:00
|
|
|
COMPAT_OBJS += compat/mmap.o
|
2009-03-13 23:50:45 +08:00
|
|
|
else
|
|
|
|
ifdef USE_WIN32_MMAP
|
|
|
|
COMPAT_CFLAGS += -DUSE_WIN32_MMAP
|
|
|
|
COMPAT_OBJS += compat/win32mmap.o
|
|
|
|
endif
|
2005-10-09 06:54:36 +08:00
|
|
|
endif
|
2009-04-28 06:32:25 +08:00
|
|
|
ifdef OBJECT_CREATION_USES_RENAMES
|
|
|
|
COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
|
2009-04-25 17:57:14 +08:00
|
|
|
endif
|
2012-09-09 00:54:34 +08:00
|
|
|
ifdef NO_STRUCT_ITIMERVAL
|
|
|
|
COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
|
2012-12-09 18:36:17 +08:00
|
|
|
NO_SETITIMER = YesPlease
|
2012-09-09 00:54:34 +08:00
|
|
|
endif
|
|
|
|
ifdef NO_SETITIMER
|
|
|
|
COMPAT_CFLAGS += -DNO_SETITIMER
|
|
|
|
endif
|
2007-01-10 05:04:12 +08:00
|
|
|
ifdef NO_PREAD
|
|
|
|
COMPAT_CFLAGS += -DNO_PREAD
|
|
|
|
COMPAT_OBJS += compat/pread.o
|
|
|
|
endif
|
2006-12-14 19:15:57 +08:00
|
|
|
ifdef NO_FAST_WORKING_DIRECTORY
|
|
|
|
BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
|
|
|
|
endif
|
2006-12-31 12:53:55 +08:00
|
|
|
ifdef NO_TRUSTABLE_FILEMODE
|
|
|
|
BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
|
|
|
|
endif
|
2005-09-29 07:52:21 +08:00
|
|
|
ifdef NO_IPV6
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -DNO_IPV6
|
2006-01-20 09:13:32 +08:00
|
|
|
endif
|
2012-09-19 18:03:30 +08:00
|
|
|
ifdef NO_INTPTR_T
|
|
|
|
COMPAT_CFLAGS += -DNO_INTPTR_T
|
|
|
|
endif
|
2008-10-26 19:52:37 +08:00
|
|
|
ifdef NO_UINTMAX_T
|
|
|
|
BASIC_CFLAGS += -Duintmax_t=uint32_t
|
|
|
|
endif
|
2006-01-20 09:13:32 +08:00
|
|
|
ifdef NO_SOCKADDR_STORAGE
|
|
|
|
ifdef NO_IPV6
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
|
2006-01-20 09:13:32 +08:00
|
|
|
else
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
|
2006-01-20 09:13:32 +08:00
|
|
|
endif
|
2005-09-29 07:52:21 +08:00
|
|
|
endif
|
2006-05-22 05:37:00 +08:00
|
|
|
ifdef NO_INET_NTOP
|
|
|
|
LIB_OBJS += compat/inet_ntop.o
|
2010-11-04 09:35:11 +08:00
|
|
|
BASIC_CFLAGS += -DNO_INET_NTOP
|
2006-05-22 05:37:00 +08:00
|
|
|
endif
|
2006-09-26 22:47:43 +08:00
|
|
|
ifdef NO_INET_PTON
|
|
|
|
LIB_OBJS += compat/inet_pton.o
|
2010-11-04 09:35:11 +08:00
|
|
|
BASIC_CFLAGS += -DNO_INET_PTON
|
2006-09-26 22:47:43 +08:00
|
|
|
endif
|
2011-12-13 05:12:56 +08:00
|
|
|
ifndef NO_UNIX_SOCKETS
|
|
|
|
LIB_OBJS += unix-socket.o
|
|
|
|
PROGRAM_OBJS += credential-cache.o
|
|
|
|
PROGRAM_OBJS += credential-cache--daemon.o
|
|
|
|
endif
|
2005-04-22 03:33:22 +08:00
|
|
|
|
2006-02-16 16:38:01 +08:00
|
|
|
ifdef NO_ICONV
|
2006-06-25 09:47:03 +08:00
|
|
|
BASIC_CFLAGS += -DNO_ICONV
|
2006-02-16 16:38:01 +08:00
|
|
|
endif
|
|
|
|
|
2007-03-04 02:29:03 +08:00
|
|
|
ifdef OLD_ICONV
|
|
|
|
BASIC_CFLAGS += -DOLD_ICONV
|
|
|
|
endif
|
|
|
|
|
2007-11-07 11:24:28 +08:00
|
|
|
ifdef NO_DEFLATE_BOUND
|
|
|
|
BASIC_CFLAGS += -DNO_DEFLATE_BOUND
|
|
|
|
endif
|
|
|
|
|
2010-11-04 09:35:24 +08:00
|
|
|
ifdef NO_POSIX_GOODIES
|
|
|
|
BASIC_CFLAGS += -DNO_POSIX_GOODIES
|
|
|
|
endif
|
|
|
|
|
2009-08-06 07:13:20 +08:00
|
|
|
ifdef BLK_SHA1
|
|
|
|
SHA1_HEADER = "block-sha1/sha1.h"
|
|
|
|
LIB_OBJS += block-sha1/sha1.o
|
|
|
|
else
|
2005-09-21 00:27:13 +08:00
|
|
|
ifdef PPC_SHA1
|
|
|
|
SHA1_HEADER = "ppc/sha1.h"
|
|
|
|
LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
|
2013-05-19 18:23:35 +08:00
|
|
|
else
|
|
|
|
ifdef APPLE_COMMON_CRYPTO
|
|
|
|
COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
|
|
|
|
SHA1_HEADER = <CommonCrypto/CommonDigest.h>
|
2005-09-21 00:27:13 +08:00
|
|
|
else
|
|
|
|
SHA1_HEADER = <openssl/sha.h>
|
2006-06-25 09:35:12 +08:00
|
|
|
EXTLIBS += $(LIB_4_CRYPTO)
|
2005-09-21 00:27:13 +08:00
|
|
|
endif
|
|
|
|
endif
|
2013-05-19 18:23:35 +08:00
|
|
|
endif
|
|
|
|
|
2006-12-04 17:50:04 +08:00
|
|
|
ifdef NO_PERL_MAKEMAKER
|
|
|
|
export NO_PERL_MAKEMAKER
|
|
|
|
endif
|
2007-06-14 02:54:32 +08:00
|
|
|
ifdef NO_HSTRERROR
|
|
|
|
COMPAT_CFLAGS += -DNO_HSTRERROR
|
|
|
|
COMPAT_OBJS += compat/hstrerror.o
|
|
|
|
endif
|
2007-09-07 06:32:54 +08:00
|
|
|
ifdef NO_MEMMEM
|
|
|
|
COMPAT_CFLAGS += -DNO_MEMMEM
|
|
|
|
COMPAT_OBJS += compat/memmem.o
|
|
|
|
endif
|
2012-12-19 06:03:55 +08:00
|
|
|
ifdef NO_GETPAGESIZE
|
|
|
|
COMPAT_CFLAGS += -DNO_GETPAGESIZE
|
|
|
|
endif
|
2008-02-06 05:10:44 +08:00
|
|
|
ifdef INTERNAL_QSORT
|
|
|
|
COMPAT_CFLAGS += -DINTERNAL_QSORT
|
|
|
|
COMPAT_OBJS += compat/qsort.o
|
|
|
|
endif
|
Compute prefix at runtime if RUNTIME_PREFIX is set
This commit adds support for relocatable binaries (called
RUNTIME_PREFIX). Such binaries can be moved together with the
system configuration files to a different directory, as long as the
relative paths from the binary to the configuration files is
preserved. This functionality is essential on Windows where we
deliver git binaries with an installer that allows to freely choose
the installation location.
If RUNTIME_PREFIX is unset we use the static prefix. This will be
the default on Unix. Thus, the behavior on Unix will remain
identical to the old implementation, which used to add the prefix
in the Makefile.
If RUNTIME_PREFIX is set the prefix is computed from the location
of the executable. In this case, system_path() tries to strip
known directories that executables can be located in from the path
of the executable. If the path is successfully stripped it is used
as the prefix. For example, if the executable is
"/msysgit/bin/git" and BINDIR is "bin", then the prefix computed is
"/msysgit".
If the runtime prefix computation fails, we fall back to the static
prefix specified in the makefile. This can be the case if the
executable is not installed at a known location. Note that our
test system sets GIT_CONFIG_NOSYSTEM to tell git to ignore global
configuration files during testing. Hence testing does not trigger
the fall back.
Note that RUNTIME_PREFIX only works on Windows, though adding
support on Unix should not be too hard. The implementation
requires argv0_path to be set to an absolute path. argv0_path must
point to the directory of the executable. We use assert() to
verify this in debug builds. On Windows, the wrapper for main()
(see compat/mingw.h) guarantees that argv0_path is correctly
initialized. On Unix, further work is required before
RUNTIME_PREFIX can be enabled.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-18 20:00:14 +08:00
|
|
|
ifdef RUNTIME_PREFIX
|
|
|
|
COMPAT_CFLAGS += -DRUNTIME_PREFIX
|
|
|
|
endif
|
2007-03-07 07:44:49 +08:00
|
|
|
|
2008-11-15 20:08:14 +08:00
|
|
|
ifdef NO_PTHREADS
|
|
|
|
BASIC_CFLAGS += -DNO_PTHREADS
|
|
|
|
else
|
2010-05-14 17:31:34 +08:00
|
|
|
BASIC_CFLAGS += $(PTHREAD_CFLAGS)
|
2008-11-15 20:08:14 +08:00
|
|
|
EXTLIBS += $(PTHREAD_LIBS)
|
2008-02-23 10:11:56 +08:00
|
|
|
LIB_OBJS += thread-utils.o
|
2007-09-06 14:13:11 +08:00
|
|
|
endif
|
2010-01-30 09:22:19 +08:00
|
|
|
|
2010-04-13 17:07:13 +08:00
|
|
|
ifdef HAVE_PATHS_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_PATHS_H
|
|
|
|
endif
|
|
|
|
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
ifdef HAVE_LIBCHARSET_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_LIBCHARSET_H
|
2012-02-13 00:23:36 +08:00
|
|
|
EXTLIBS += $(CHARSET_LIB)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
endif
|
|
|
|
|
2012-12-15 03:57:01 +08:00
|
|
|
ifdef HAVE_STRINGS_H
|
|
|
|
BASIC_CFLAGS += -DHAVE_STRINGS_H
|
|
|
|
endif
|
|
|
|
|
add generic terminal prompt function
When we need to prompt the user for input interactively, we
want to access their terminal directly. We can't rely on
stdio because it may be connected to pipes or files, rather
than the terminal. Instead, we use "getpass()", because it
abstracts the idea of prompting and reading from the
terminal. However, it has some problems:
1. It never echoes the typed characters, which makes it OK
for passwords but annoying for other input (like usernames).
2. Some implementations of getpass() have an extremely
small input buffer (e.g., Solaris 8 is reported to
support only 8 characters).
3. Some implementations of getpass() will fall back to
reading from stdin (e.g., glibc). We explicitly don't
want this, because our stdin may be connected to a pipe
speaking a particular protocol, and reading will
disrupt the protocol flow (e.g., the remote-curl
helper).
4. Some implementations of getpass() turn off signals, so
that hitting "^C" on the terminal does not break out of
the password prompt. This can be a mild annoyance.
Instead, let's provide an abstract "git_terminal_prompt"
function that addresses these concerns. This patch includes
an implementation based on /dev/tty, enabled by setting
HAVE_DEV_TTY. The fallback is to use getpass() as before.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10 18:41:01 +08:00
|
|
|
ifdef HAVE_DEV_TTY
|
|
|
|
BASIC_CFLAGS += -DHAVE_DEV_TTY
|
|
|
|
endif
|
|
|
|
|
2008-03-05 07:15:39 +08:00
|
|
|
ifdef DIR_HAS_BSD_GROUP_SEMANTICS
|
|
|
|
COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
|
|
|
|
endif
|
2009-04-20 16:17:00 +08:00
|
|
|
ifdef UNRELIABLE_FSTAT
|
|
|
|
BASIC_CFLAGS += -DUNRELIABLE_FSTAT
|
|
|
|
endif
|
2009-06-17 03:07:40 +08:00
|
|
|
ifdef NO_REGEX
|
|
|
|
COMPAT_CFLAGS += -Icompat/regex
|
|
|
|
COMPAT_OBJS += compat/regex/regex.o
|
|
|
|
endif
|
2014-08-31 05:38:59 +08:00
|
|
|
ifdef NATIVE_CRLF
|
|
|
|
BASIC_CFLAGS += -DNATIVE_CRLF
|
|
|
|
endif
|
2007-09-06 14:13:11 +08:00
|
|
|
|
2009-06-01 00:15:23 +08:00
|
|
|
ifdef USE_NED_ALLOCATOR
|
2010-09-11 17:59:18 +08:00
|
|
|
COMPAT_CFLAGS += -Icompat/nedmalloc
|
2009-06-01 00:15:23 +08:00
|
|
|
COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
|
|
|
|
endif
|
|
|
|
|
2010-06-01 08:35:20 +08:00
|
|
|
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
|
|
|
|
export GIT_TEST_CMP_USE_COPIED_CONTEXT
|
|
|
|
endif
|
|
|
|
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
ifndef NO_MSGFMT_EXTENDED_OPTIONS
|
|
|
|
MSGFMT += --check --statistics
|
|
|
|
endif
|
|
|
|
|
2012-04-07 05:01:23 +08:00
|
|
|
ifneq (,$(XDL_FAST_HASH))
|
|
|
|
BASIC_CFLAGS += -DXDL_FAST_HASH
|
|
|
|
endif
|
|
|
|
|
2014-04-02 05:28:42 +08:00
|
|
|
ifdef GMTIME_UNRELIABLE_ERRORS
|
|
|
|
COMPAT_OBJS += compat/gmtime.o
|
|
|
|
BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
|
|
|
|
endif
|
|
|
|
|
2014-07-12 08:05:42 +08:00
|
|
|
ifdef HAVE_CLOCK_GETTIME
|
|
|
|
BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
|
|
|
|
EXTLIBS += -lrt
|
|
|
|
endif
|
|
|
|
|
2007-03-28 19:12:07 +08:00
|
|
|
ifeq ($(TCLTK_PATH),)
|
2012-12-09 18:36:17 +08:00
|
|
|
NO_TCLTK = NoThanks
|
2007-03-28 19:12:07 +08:00
|
|
|
endif
|
|
|
|
|
2009-04-04 03:32:20 +08:00
|
|
|
ifeq ($(PERL_PATH),)
|
2012-12-09 18:36:17 +08:00
|
|
|
NO_PERL = NoThanks
|
2009-04-04 03:32:20 +08:00
|
|
|
endif
|
|
|
|
|
2009-11-18 09:42:31 +08:00
|
|
|
ifeq ($(PYTHON_PATH),)
|
2012-12-09 18:36:17 +08:00
|
|
|
NO_PYTHON = NoThanks
|
2009-11-18 09:42:31 +08:00
|
|
|
endif
|
|
|
|
|
2007-04-05 04:42:33 +08:00
|
|
|
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
|
2007-03-07 07:44:49 +08:00
|
|
|
QUIET_SUBDIR1 =
|
|
|
|
|
2007-03-07 07:05:34 +08:00
|
|
|
ifneq ($(findstring $(MAKEFLAGS),w),w)
|
|
|
|
PRINT_DIR = --no-print-directory
|
|
|
|
else # "make -w"
|
|
|
|
NO_SUBDIR = :
|
|
|
|
endif
|
|
|
|
|
2007-03-07 07:44:49 +08:00
|
|
|
ifneq ($(findstring $(MAKEFLAGS),s),s)
|
2007-03-06 15:09:14 +08:00
|
|
|
ifndef V
|
2007-03-07 06:37:18 +08:00
|
|
|
QUIET_CC = @echo ' ' CC $@;
|
2007-03-06 14:35:01 +08:00
|
|
|
QUIET_AR = @echo ' ' AR $@;
|
|
|
|
QUIET_LINK = @echo ' ' LINK $@;
|
|
|
|
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
|
|
|
|
QUIET_GEN = @echo ' ' GEN $@;
|
2009-08-07 13:08:09 +08:00
|
|
|
QUIET_LNCP = @echo ' ' LN/CP $@;
|
2011-02-23 07:41:23 +08:00
|
|
|
QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
QUIET_MSGFMT = @echo ' ' MSGFMT $@;
|
2010-07-26 03:52:40 +08:00
|
|
|
QUIET_GCOV = @echo ' ' GCOV $@;
|
2011-04-22 03:14:42 +08:00
|
|
|
QUIET_SP = @echo ' ' SP $<;
|
2012-05-24 07:56:24 +08:00
|
|
|
QUIET_RC = @echo ' ' RC $@;
|
2007-04-05 04:42:33 +08:00
|
|
|
QUIET_SUBDIR0 = +@subdir=
|
2007-03-07 07:05:34 +08:00
|
|
|
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
|
|
|
|
$(MAKE) $(PRINT_DIR) -C $$subdir
|
2007-03-06 15:09:14 +08:00
|
|
|
export V
|
2007-03-07 06:37:18 +08:00
|
|
|
export QUIET_GEN
|
2007-03-07 07:44:49 +08:00
|
|
|
export QUIET_BUILT_IN
|
|
|
|
endif
|
2007-03-06 14:35:01 +08:00
|
|
|
endif
|
2005-09-21 00:27:13 +08:00
|
|
|
|
2012-05-03 06:12:10 +08:00
|
|
|
ifdef NO_INSTALL_HARDLINKS
|
|
|
|
export NO_INSTALL_HARDLINKS
|
|
|
|
endif
|
|
|
|
|
2012-02-06 14:00:17 +08:00
|
|
|
### profile feedback build
|
|
|
|
#
|
|
|
|
|
|
|
|
# Can adjust this to be a global directory if you want to do extended
|
|
|
|
# data gathering
|
|
|
|
PROFILE_DIR := $(CURDIR)
|
|
|
|
|
2012-02-09 16:22:26 +08:00
|
|
|
ifeq ("$(PROFILE)","GEN")
|
2014-07-05 07:43:48 +08:00
|
|
|
BASIC_CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
|
2012-02-06 14:00:17 +08:00
|
|
|
EXTLIBS += -lgcov
|
2012-12-09 18:36:17 +08:00
|
|
|
export CCACHE_DISABLE = t
|
|
|
|
V = 1
|
2012-02-09 16:22:26 +08:00
|
|
|
else
|
|
|
|
ifneq ("$(PROFILE)","")
|
2014-07-05 07:43:48 +08:00
|
|
|
BASIC_CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
|
2012-12-09 18:36:17 +08:00
|
|
|
export CCACHE_DISABLE = t
|
|
|
|
V = 1
|
2012-02-06 14:00:17 +08:00
|
|
|
endif
|
2012-02-09 16:22:26 +08:00
|
|
|
endif
|
2012-02-06 14:00:17 +08:00
|
|
|
|
2006-07-09 15:44:30 +08:00
|
|
|
# Shell quote (do not use $(call) to accommodate ancient setups);
|
2006-02-18 19:40:22 +08:00
|
|
|
|
|
|
|
SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
|
2007-02-14 19:48:14 +08:00
|
|
|
ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
|
2010-09-01 06:42:43 +08:00
|
|
|
ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
|
2006-02-18 19:40:22 +08:00
|
|
|
|
|
|
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
|
|
|
bindir_SQ = $(subst ','\'',$(bindir))
|
2009-01-18 20:00:09 +08:00
|
|
|
bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
|
2013-02-25 03:55:01 +08:00
|
|
|
mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
|
|
|
|
infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
localedir_SQ = $(subst ','\'',$(localedir))
|
2006-02-18 19:40:22 +08:00
|
|
|
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
|
|
|
|
template_dir_SQ = $(subst ','\'',$(template_dir))
|
2013-02-25 03:55:01 +08:00
|
|
|
htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
|
2006-06-15 06:36:00 +08:00
|
|
|
prefix_SQ = $(subst ','\'',$(prefix))
|
2010-05-28 14:25:52 +08:00
|
|
|
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
|
2006-02-18 19:40:22 +08:00
|
|
|
|
|
|
|
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
|
|
|
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
|
2009-11-18 09:42:31 +08:00
|
|
|
PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
|
2007-03-28 19:12:07 +08:00
|
|
|
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
|
2010-06-06 00:36:13 +08:00
|
|
|
DIFF_SQ = $(subst ','\'',$(DIFF))
|
2013-11-16 05:10:28 +08:00
|
|
|
PERLLIB_EXTRA_SQ = $(subst ','\'',$(PERLLIB_EXTRA))
|
2006-02-18 19:40:22 +08:00
|
|
|
|
2006-06-25 09:35:12 +08:00
|
|
|
LIBS = $(GITLIBS) $(EXTLIBS)
|
|
|
|
|
2007-02-14 19:48:14 +08:00
|
|
|
BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
|
2007-11-14 04:05:05 +08:00
|
|
|
$(COMPAT_CFLAGS)
|
2005-12-03 07:08:28 +08:00
|
|
|
LIB_OBJS += $(COMPAT_OBJS)
|
2006-06-25 09:47:03 +08:00
|
|
|
|
2009-10-31 09:44:41 +08:00
|
|
|
# Quote for C
|
|
|
|
|
|
|
|
ifdef DEFAULT_EDITOR
|
|
|
|
DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
|
|
|
|
DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
|
|
|
|
|
|
|
|
BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
|
|
|
|
endif
|
|
|
|
|
2009-10-31 09:45:34 +08:00
|
|
|
ifdef DEFAULT_PAGER
|
|
|
|
DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
|
|
|
|
DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
|
|
|
|
|
|
|
|
BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
|
|
|
|
endif
|
|
|
|
|
2012-03-31 09:33:21 +08:00
|
|
|
ifdef SHELL_PATH
|
|
|
|
SHELL_PATH_CQ = "$(subst ",\",$(subst \,\\,$(SHELL_PATH)))"
|
|
|
|
SHELL_PATH_CQ_SQ = $(subst ','\'',$(SHELL_PATH_CQ))
|
|
|
|
|
|
|
|
BASIC_CFLAGS += -DSHELL_PATH='$(SHELL_PATH_CQ_SQ)'
|
|
|
|
endif
|
|
|
|
|
2012-06-03 03:01:12 +08:00
|
|
|
GIT_USER_AGENT_SQ = $(subst ','\'',$(GIT_USER_AGENT))
|
|
|
|
GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
|
|
|
|
GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
|
2012-06-21 02:31:51 +08:00
|
|
|
GIT-USER-AGENT: FORCE
|
|
|
|
@if test x'$(GIT_USER_AGENT_SQ)' != x"`cat GIT-USER-AGENT 2>/dev/null`"; then \
|
|
|
|
echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
|
|
|
|
fi
|
2012-06-03 03:01:12 +08:00
|
|
|
|
2012-06-07 04:28:16 +08:00
|
|
|
ifdef DEFAULT_HELP_FORMAT
|
|
|
|
BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
|
|
|
|
endif
|
|
|
|
|
2006-06-25 09:47:03 +08:00
|
|
|
ALL_CFLAGS += $(BASIC_CFLAGS)
|
|
|
|
ALL_LDFLAGS += $(BASIC_LDFLAGS)
|
|
|
|
|
2010-05-14 17:31:36 +08:00
|
|
|
export DIFF TAR INSTALL DESTDIR SHELL_PATH
|
2006-06-25 09:35:12 +08:00
|
|
|
|
|
|
|
|
2005-07-29 23:50:24 +08:00
|
|
|
### Build rules
|
|
|
|
|
2008-08-08 03:03:42 +08:00
|
|
|
SHELL = $(SHELL_PATH)
|
|
|
|
|
2012-02-06 14:00:17 +08:00
|
|
|
all:: shell_compatibility_test
|
|
|
|
|
|
|
|
ifeq "$(PROFILE)" "BUILD"
|
2014-07-08 14:35:11 +08:00
|
|
|
all:: profile
|
|
|
|
endif
|
|
|
|
|
|
|
|
profile:: profile-clean
|
2012-02-06 14:00:17 +08:00
|
|
|
$(MAKE) PROFILE=GEN all
|
|
|
|
$(MAKE) PROFILE=GEN -j1 test
|
2014-08-19 14:12:03 +08:00
|
|
|
@if test -n "$$GIT_PERF_REPO" || test -d .git; then \
|
|
|
|
$(MAKE) PROFILE=GEN -j1 perf; \
|
|
|
|
else \
|
|
|
|
echo "Skipping profile of perf tests..."; \
|
|
|
|
fi
|
2014-07-08 14:35:11 +08:00
|
|
|
$(MAKE) PROFILE=USE all
|
|
|
|
|
|
|
|
profile-fast: profile-clean
|
|
|
|
$(MAKE) PROFILE=GEN all
|
|
|
|
$(MAKE) PROFILE=GEN -j1 perf
|
|
|
|
$(MAKE) PROFILE=USE all
|
|
|
|
|
2012-02-06 14:00:17 +08:00
|
|
|
|
|
|
|
all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
|
2007-01-11 04:24:54 +08:00
|
|
|
ifneq (,$X)
|
2009-10-27 19:23:33 +08:00
|
|
|
$(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';)
|
2007-01-11 04:24:54 +08:00
|
|
|
endif
|
2005-05-01 04:19:56 +08:00
|
|
|
|
2007-01-11 04:24:54 +08:00
|
|
|
all::
|
2007-03-28 19:00:23 +08:00
|
|
|
ifndef NO_TCLTK
|
2008-07-28 15:02:48 +08:00
|
|
|
$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
|
2007-11-18 02:51:16 +08:00
|
|
|
$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
|
2007-03-28 19:00:23 +08:00
|
|
|
endif
|
2009-04-04 03:32:20 +08:00
|
|
|
ifndef NO_PERL
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all
|
2009-04-04 03:32:20 +08:00
|
|
|
endif
|
2010-03-20 22:48:08 +08:00
|
|
|
$(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
|
2005-08-06 13:36:15 +08:00
|
|
|
|
2008-08-08 03:06:26 +08:00
|
|
|
please_set_SHELL_PATH_to_a_more_modern_shell:
|
|
|
|
@$$(:)
|
|
|
|
|
|
|
|
shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
|
|
|
|
|
2006-01-13 13:42:25 +08:00
|
|
|
strip: $(PROGRAMS) git$X
|
2013-05-25 10:41:02 +08:00
|
|
|
$(STRIP) $(STRIP_OPTS) $^
|
2006-01-13 13:42:25 +08:00
|
|
|
|
2012-07-07 12:19:09 +08:00
|
|
|
### Target-specific flags and dependencies
|
|
|
|
|
|
|
|
# The generic compilation pattern rule and automatically
|
|
|
|
# computed header dependencies (falling back to a dependency on
|
|
|
|
# LIB_H) are enough to describe how most targets should be built,
|
|
|
|
# but some targets are special enough to need something a little
|
|
|
|
# different.
|
|
|
|
#
|
|
|
|
# - When a source file "foo.c" #includes a generated header file,
|
|
|
|
# we need to list that dependency for the "foo.o" target.
|
|
|
|
#
|
|
|
|
# We also list it from other targets that are built from foo.c
|
|
|
|
# like "foo.sp" and "foo.s", even though that is easy to forget
|
|
|
|
# to do because the generated header is already present around
|
|
|
|
# after a regular build attempt.
|
|
|
|
#
|
|
|
|
# - Some code depends on configuration kept in makefile
|
|
|
|
# variables. The target-specific variable EXTRA_CPPFLAGS can
|
|
|
|
# be used to convey that information to the C preprocessor
|
|
|
|
# using -D options.
|
|
|
|
#
|
|
|
|
# The "foo.o" target should have a corresponding dependency on
|
|
|
|
# a file that changes when the value of the makefile variable
|
|
|
|
# changes. For example, targets making use of the
|
|
|
|
# $(GIT_VERSION) variable depend on GIT-VERSION-FILE.
|
|
|
|
#
|
|
|
|
# Technically the ".sp" and ".s" targets do not need this
|
|
|
|
# dependency because they are force-built, but they get the
|
|
|
|
# same dependency for consistency. This way, you do not have to
|
|
|
|
# know how each target is implemented. And it means the
|
|
|
|
# dependencies here will not need to change if the force-build
|
|
|
|
# details change some day.
|
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
git.sp git.s git.o: GIT-PREFIX
|
2012-06-03 02:51:42 +08:00
|
|
|
git.sp git.s git.o: EXTRA_CPPFLAGS = \
|
2013-02-25 03:55:01 +08:00
|
|
|
'-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
|
|
|
|
'-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
|
|
|
|
'-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
|
2007-06-13 16:28:21 +08:00
|
|
|
|
2011-06-22 18:50:56 +08:00
|
|
|
git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
|
2007-07-10 09:30:39 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
|
2006-04-22 01:27:34 +08:00
|
|
|
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
|
2005-09-08 12:26:52 +08:00
|
|
|
|
Makefile: apply dependencies consistently to sparse/asm targets
When a C file "foo.c" depends on a generated header file, we
note the dependency for the "foo.o" target. However, we
should also note it for other targets that are built from
foo.c, like "foo.sp" and "foo.s". These tend to be missed
because the latter two are not part of the default build,
and are typically built after a regular build which will
generate the header. Let's be consistent about including
them in dependencies.
This also makes us more consistent with nearby lines which
tack on EXTRA_CPPFLAGS when building certain files. These
flags may sometimes require extra dependencies to be added
(e.g., like GIT-VERSION-FILE; this is not the case for any
of the updated lines in this patch, but it is establishing a
style that will be used in later patches). Technically the
".sp" and ".s" targets do not care about these dependencies,
because they are force-built (".sp" because it is a phony
target, and ".s" because we explicitly force a rebuild).
Since the blocks in question are about communicating "things
built from foo.c depend on these flags", it frees the reader
from having to know or care more about how those targets are
implemented, and why it is OK for only "foo.o" to depend on
GIT-VERSION-FILE while "foo.sp" and "foo.s" both are
impacted by $(GIT_VERSION). And it helps future-proof us if
those force-build details should ever change.
This patch explicitly does not update the static header
dependencies used when COMPUTED_HEADER_DEPENDENCIES is off.
They are similar to the GIT-VERSION-FILE case above, in that
technically "foo.s" would depend on its included headers,
but it is irrelevant because we force-build it anyway. So it
would be tempting to update them in the same way (for
readability and future-proofing). However, those rules are
meant as a fallback to the computed header dependencies,
which do not handle ".s" and ".sp" at all (and are a much
harder problem to solve, as gcc is the one generating those
dependency lists).
So let's leave that harder problem until (and if) somebody
wants to change the ".sp" and ".s" rules, and keep the
static header dependencies consistent with the computed
ones.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-21 02:31:33 +08:00
|
|
|
help.sp help.s help.o: common-cmds.h
|
2010-11-27 00:00:39 +08:00
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX
|
2011-04-22 03:14:42 +08:00
|
|
|
builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
|
2013-02-25 03:55:01 +08:00
|
|
|
'-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
|
|
|
|
'-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
|
|
|
|
'-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
|
2006-04-22 12:56:13 +08:00
|
|
|
|
2012-06-21 02:32:22 +08:00
|
|
|
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
|
2012-06-03 02:51:42 +08:00
|
|
|
version.sp version.s version.o: EXTRA_CPPFLAGS = \
|
2012-06-21 02:31:51 +08:00
|
|
|
'-DGIT_VERSION="$(GIT_VERSION)"' \
|
|
|
|
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
|
2012-06-03 02:51:42 +08:00
|
|
|
|
2006-04-11 08:37:58 +08:00
|
|
|
$(BUILT_INS): git$X
|
2008-08-25 23:33:03 +08:00
|
|
|
$(QUIET_BUILT_IN)$(RM) $@ && \
|
2013-05-25 10:41:03 +08:00
|
|
|
ln $< $@ 2>/dev/null || \
|
|
|
|
ln -s $< $@ 2>/dev/null || \
|
|
|
|
cp $< $@
|
2006-04-11 08:37:58 +08:00
|
|
|
|
2007-12-02 15:39:19 +08:00
|
|
|
common-cmds.h: ./generate-cmdlist.sh command-list.txt
|
2007-06-13 17:00:01 +08:00
|
|
|
|
2007-04-06 06:03:48 +08:00
|
|
|
common-cmds.h: $(wildcard Documentation/git-*.txt)
|
2007-03-06 14:35:01 +08:00
|
|
|
$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
|
2006-03-10 00:24:19 +08:00
|
|
|
|
2012-06-21 02:32:16 +08:00
|
|
|
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
|
2012-06-21 02:32:19 +08:00
|
|
|
$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
|
|
|
|
$(gitwebdir_SQ):$(PERL_PATH_SQ)
|
2010-02-01 03:46:53 +08:00
|
|
|
define cmd_munge_script
|
|
|
|
$(RM) $@ $@+ && \
|
|
|
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
|
2010-06-06 00:36:13 +08:00
|
|
|
-e 's|@@DIFF@@|$(DIFF_SQ)|' \
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
-e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
|
2010-02-01 03:46:53 +08:00
|
|
|
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
|
2012-01-24 06:04:29 +08:00
|
|
|
-e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
|
2010-02-01 03:46:53 +08:00
|
|
|
-e $(BROKEN_PATH_FIX) \
|
2012-06-21 02:32:19 +08:00
|
|
|
-e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
|
|
|
|
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
|
2010-02-01 03:46:53 +08:00
|
|
|
$@.sh >$@+
|
|
|
|
endef
|
|
|
|
|
2012-06-21 02:32:16 +08:00
|
|
|
GIT-SCRIPT-DEFINES: FORCE
|
|
|
|
@FLAGS='$(SCRIPT_DEFINES)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
|
2012-12-18 23:26:39 +08:00
|
|
|
echo >&2 " * new script parameters"; \
|
2012-06-21 02:32:16 +08:00
|
|
|
echo "$$FLAGS" >$@; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh GIT-SCRIPT-DEFINES
|
2010-02-01 03:46:53 +08:00
|
|
|
$(QUIET_GEN)$(cmd_munge_script) && \
|
2007-03-06 14:35:01 +08:00
|
|
|
chmod +x $@+ && \
|
Don't write directly to a make target ($@).
Otherwise, if make is suspended, or killed with prejudice, or if the
system crashes, you could be left with an up-to-date, yet corrupt,
generated file.
I left off the `clean' addition, because I believe "make clean" should
not remove wildcard patterns like "*+", on the off-chance that someone
uses names like that for files they care about. Besides, in practice,
those temporary files are left behind so rarely that they're not a bother,
and they're removed again as part of the next build.
[jc: sign-off?]
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-26 00:52:01 +08:00
|
|
|
mv $@+ $@
|
2005-09-09 09:50:33 +08:00
|
|
|
|
2012-06-21 02:32:16 +08:00
|
|
|
$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
|
2010-02-01 03:46:53 +08:00
|
|
|
$(QUIET_GEN)$(cmd_munge_script) && \
|
|
|
|
mv $@+ $@
|
|
|
|
|
2012-06-02 06:29:33 +08:00
|
|
|
git.res: git.rc GIT-VERSION-FILE
|
2012-05-24 07:56:24 +08:00
|
|
|
$(QUIET_RC)$(RC) \
|
2014-01-23 15:28:58 +08:00
|
|
|
$(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \
|
2012-05-24 07:56:24 +08:00
|
|
|
-DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
|
|
|
|
|
2009-04-04 03:32:20 +08:00
|
|
|
ifndef NO_PERL
|
2006-12-04 17:50:04 +08:00
|
|
|
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
|
|
|
|
|
2012-07-28 04:04:20 +08:00
|
|
|
perl/perl.mak: perl/PM.stamp
|
|
|
|
|
|
|
|
perl/PM.stamp: FORCE
|
2012-08-07 05:06:14 +08:00
|
|
|
$(QUIET_GEN)$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
|
2012-07-28 04:04:20 +08:00
|
|
|
{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
|
|
|
|
$(RM) $@+
|
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL
|
2007-03-07 06:37:18 +08:00
|
|
|
$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
|
2006-12-04 17:50:04 +08:00
|
|
|
|
2013-11-16 05:10:28 +08:00
|
|
|
PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)
|
2013-11-19 06:23:11 +08:00
|
|
|
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE
|
2007-07-15 01:51:44 +08:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
2007-09-25 14:42:16 +08:00
|
|
|
INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
|
2013-11-16 05:10:28 +08:00
|
|
|
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
|
|
|
|
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
|
2006-07-08 04:04:35 +08:00
|
|
|
sed -e '1{' \
|
|
|
|
-e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
|
|
|
|
-e ' h' \
|
2010-05-31 01:12:41 +08:00
|
|
|
-e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
|
2006-07-08 04:04:35 +08:00
|
|
|
-e ' H' \
|
|
|
|
-e ' x' \
|
|
|
|
-e '}' \
|
2005-10-05 03:41:35 +08:00
|
|
|
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
|
2013-05-25 10:41:03 +08:00
|
|
|
$< >$@+ && \
|
2007-03-06 14:35:01 +08:00
|
|
|
chmod +x $@+ && \
|
Don't write directly to a make target ($@).
Otherwise, if make is suspended, or killed with prejudice, or if the
system crashes, you could be left with an up-to-date, yet corrupt,
generated file.
I left off the `clean' addition, because I believe "make clean" should
not remove wildcard patterns like "*+", on the off-chance that someone
uses names like that for files they care about. Besides, in practice,
those temporary files are left behind so rarely that they're not a bother,
and they're removed again as part of the next build.
[jc: sign-off?]
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-26 00:52:01 +08:00
|
|
|
mv $@+ $@
|
2005-09-09 09:50:33 +08:00
|
|
|
|
2013-11-19 06:23:11 +08:00
|
|
|
GIT-PERL-DEFINES: FORCE
|
|
|
|
@FLAGS='$(PERL_DEFINES)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
|
|
|
|
echo >&2 " * new perl-specific parameters"; \
|
|
|
|
echo "$$FLAGS" >$@; \
|
|
|
|
fi
|
|
|
|
|
2010-01-31 06:30:40 +08:00
|
|
|
|
|
|
|
.PHONY: gitweb
|
|
|
|
gitweb:
|
|
|
|
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
|
|
|
|
|
2012-06-21 02:32:19 +08:00
|
|
|
git-instaweb: git-instaweb.sh gitweb GIT-SCRIPT-DEFINES
|
|
|
|
$(QUIET_GEN)$(cmd_munge_script) && \
|
2007-03-06 14:35:01 +08:00
|
|
|
chmod +x $@+ && \
|
2006-07-02 06:14:14 +08:00
|
|
|
mv $@+ $@
|
2009-04-04 03:32:20 +08:00
|
|
|
else # NO_PERL
|
|
|
|
$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
|
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
|
|
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
|
|
|
|
unimplemented.sh >$@+ && \
|
|
|
|
chmod +x $@+ && \
|
|
|
|
mv $@+ $@
|
|
|
|
endif # NO_PERL
|
2006-07-02 06:14:14 +08:00
|
|
|
|
2009-11-18 09:42:32 +08:00
|
|
|
ifndef NO_PYTHON
|
2013-05-25 10:41:01 +08:00
|
|
|
$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
|
|
|
|
$(SCRIPT_PYTHON_GEN): % : %.py
|
2009-11-18 09:42:32 +08:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
2010-04-09 23:57:45 +08:00
|
|
|
sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
|
2013-05-25 10:41:03 +08:00
|
|
|
$< >$@+ && \
|
2009-11-18 09:42:32 +08:00
|
|
|
chmod +x $@+ && \
|
|
|
|
mv $@+ $@
|
|
|
|
else # NO_PYTHON
|
2013-05-25 10:41:01 +08:00
|
|
|
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
|
2009-11-18 09:42:32 +08:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
|
|
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
|
|
|
|
unimplemented.sh >$@+ && \
|
|
|
|
chmod +x $@+ && \
|
|
|
|
mv $@+ $@
|
|
|
|
endif # NO_PYTHON
|
|
|
|
|
2013-02-21 14:26:14 +08:00
|
|
|
CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
|
|
|
|
sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
|
|
|
|
configure.ac >configure.ac+ && \
|
|
|
|
autoconf -o configure configure.ac+ && \
|
|
|
|
$(RM) configure.ac+
|
|
|
|
|
2012-06-21 02:32:22 +08:00
|
|
|
configure: configure.ac GIT-VERSION-FILE
|
2013-02-21 14:26:14 +08:00
|
|
|
$(QUIET_GEN)$(CONFIGURE_RECIPE)
|
2006-08-09 00:35:23 +08:00
|
|
|
|
2012-07-19 15:50:02 +08:00
|
|
|
ifdef AUTOCONFIGURED
|
2013-01-02 16:25:44 +08:00
|
|
|
# We avoid depending on 'configure' here, because it gets rebuilt
|
|
|
|
# every time GIT-VERSION-FILE is modified, only to update the embedded
|
|
|
|
# version number string, which config.status does not care about. We
|
|
|
|
# do want to recheck when the platform/environment detection logic
|
|
|
|
# changes, hence this depends on configure.ac.
|
|
|
|
config.status: configure.ac
|
2013-02-21 14:26:14 +08:00
|
|
|
$(QUIET_GEN)$(CONFIGURE_RECIPE) && \
|
2013-01-02 16:25:44 +08:00
|
|
|
if test -f config.status; then \
|
2012-07-19 15:50:02 +08:00
|
|
|
./config.status --recheck; \
|
|
|
|
else \
|
|
|
|
./configure; \
|
|
|
|
fi
|
|
|
|
reconfigure config.mak.autogen: config.status
|
|
|
|
$(QUIET_GEN)./config.status
|
|
|
|
.PHONY: reconfigure # This is a convenience target.
|
|
|
|
endif
|
|
|
|
|
2011-03-28 02:13:22 +08:00
|
|
|
XDIFF_OBJS += xdiff/xdiffi.o
|
|
|
|
XDIFF_OBJS += xdiff/xprepare.o
|
|
|
|
XDIFF_OBJS += xdiff/xutils.o
|
|
|
|
XDIFF_OBJS += xdiff/xemit.o
|
|
|
|
XDIFF_OBJS += xdiff/xmerge.o
|
|
|
|
XDIFF_OBJS += xdiff/xpatience.o
|
2012-01-28 03:04:28 +08:00
|
|
|
XDIFF_OBJS += xdiff/xhistogram.o
|
2011-03-28 02:13:22 +08:00
|
|
|
|
|
|
|
VCSSVN_OBJS += vcs-svn/line_buffer.o
|
vcs-svn: learn to maintain a sliding view of a file
Each section of a Subversion-format delta only requires examining (and
keeping in random-access memory) a small portion of the preimage. At
any moment, this portion starts at a certain file offset and has a
well-defined length, and as the delta is applied, the portion advances
from the beginning to the end of the preimage. Add a move_window
function to keep track of this view into the preimage.
You can use it like this:
buffer_init(f, NULL);
struct sliding_view window = SLIDING_VIEW_INIT(f);
move_window(&window, 3, 7); /* (1) */
move_window(&window, 5, 5); /* (2) */
move_window(&window, 12, 2); /* (3) */
strbuf_release(&window.buf);
buffer_deinit(f);
The data structure is called sliding_view instead of _window to
prevent confusion with svndiff0 Windows.
In this example, (1) reads 10 bytes and discards the first 3;
(2) discards the first 2, which are not needed any more; and (3) skips
2 bytes and reads 2 new bytes to work with.
When move_window returns, the file position indicator is at position
window->off + window->width and the data from positions window->off to
the current file position are stored in window->buf.
This function performs only sequential access from the input file and
never seeks, so it can be safely used on pipes and sockets.
On end-of-file, move_window silently reads less than the caller
requested. On other errors, it prints a message and returns -1.
Helped-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-01-03 11:54:58 +08:00
|
|
|
VCSSVN_OBJS += vcs-svn/sliding_window.o
|
2011-03-28 02:13:22 +08:00
|
|
|
VCSSVN_OBJS += vcs-svn/repo_tree.o
|
|
|
|
VCSSVN_OBJS += vcs-svn/fast_export.o
|
2010-12-25 19:11:32 +08:00
|
|
|
VCSSVN_OBJS += vcs-svn/svndiff.o
|
2011-03-28 02:13:22 +08:00
|
|
|
VCSSVN_OBJS += vcs-svn/svndump.o
|
|
|
|
|
2012-07-07 11:39:18 +08:00
|
|
|
TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
|
|
|
|
OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
|
|
|
|
$(XDIFF_OBJS) \
|
|
|
|
$(VCSSVN_OBJS) \
|
|
|
|
git.o
|
|
|
|
ifndef NO_CURL
|
|
|
|
OBJECTS += http.o http-walker.o remote-curl.o
|
|
|
|
endif
|
2010-01-26 23:52:11 +08:00
|
|
|
|
2010-02-01 05:23:53 +08:00
|
|
|
dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
|
2010-02-01 05:37:25 +08:00
|
|
|
dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
|
2010-01-26 23:49:33 +08:00
|
|
|
|
2011-11-18 17:58:21 +08:00
|
|
|
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
|
2010-01-26 23:52:49 +08:00
|
|
|
$(dep_dirs):
|
2011-09-12 03:40:18 +08:00
|
|
|
@mkdir -p $@
|
2010-01-26 23:52:49 +08:00
|
|
|
|
|
|
|
missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
|
2010-02-01 05:23:53 +08:00
|
|
|
dep_file = $(dir $@).depend/$(notdir $@).d
|
2011-11-19 07:23:24 +08:00
|
|
|
dep_args = -MF $(dep_file) -MQ $@ -MMD -MP
|
2010-01-26 23:57:15 +08:00
|
|
|
endif
|
|
|
|
|
2011-11-18 17:58:21 +08:00
|
|
|
ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
|
2010-01-26 23:52:49 +08:00
|
|
|
dep_dirs =
|
|
|
|
missing_dep_dirs =
|
2010-01-26 23:57:15 +08:00
|
|
|
dep_args =
|
|
|
|
endif
|
|
|
|
|
|
|
|
ASM_SRC := $(wildcard $(OBJECTS:o=S))
|
|
|
|
ASM_OBJ := $(ASM_SRC:S=o)
|
|
|
|
C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
|
|
|
|
|
2010-01-26 23:51:24 +08:00
|
|
|
.SUFFIXES:
|
|
|
|
|
2010-01-26 23:52:49 +08:00
|
|
|
$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
|
2010-03-20 11:20:12 +08:00
|
|
|
$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
|
2010-01-26 23:52:49 +08:00
|
|
|
$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
|
2010-03-20 11:20:12 +08:00
|
|
|
$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
|
2010-01-26 23:52:49 +08:00
|
|
|
|
2010-01-06 16:06:58 +08:00
|
|
|
%.s: %.c GIT-CFLAGS FORCE
|
2012-07-23 07:47:26 +08:00
|
|
|
$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
|
2010-01-26 23:57:15 +08:00
|
|
|
|
|
|
|
ifdef USE_COMPUTED_HEADER_DEPENDENCIES
|
2010-01-26 23:52:49 +08:00
|
|
|
# Take advantage of gcc's on-the-fly dependency generation
|
|
|
|
# See <http://gcc.gnu.org/gcc-3.0/features.html>.
|
2010-01-26 23:57:15 +08:00
|
|
|
dep_files_present := $(wildcard $(dep_files))
|
|
|
|
ifneq ($(dep_files_present),)
|
|
|
|
include $(dep_files_present)
|
2010-01-26 23:52:49 +08:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
# Dependencies on header files, for platforms that do not support
|
|
|
|
# the gcc -MMD option.
|
|
|
|
#
|
|
|
|
# Dependencies on automatically generated headers such as common-cmds.h
|
|
|
|
# should _not_ be included here, since they are necessary even when
|
|
|
|
# building an object for the first time.
|
2010-08-10 06:04:29 +08:00
|
|
|
|
2012-07-07 11:39:18 +08:00
|
|
|
$(OBJECTS): $(LIB_H)
|
2010-01-26 23:52:49 +08:00
|
|
|
endif
|
2005-05-19 22:27:14 +08:00
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
exec_cmd.sp exec_cmd.s exec_cmd.o: GIT-PREFIX
|
2011-04-22 03:14:42 +08:00
|
|
|
exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
|
2010-01-06 16:05:04 +08:00
|
|
|
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
|
|
|
|
'-DBINDIR="$(bindir_relative_SQ)"' \
|
|
|
|
'-DPREFIX="$(prefix_SQ)"'
|
2009-01-18 20:00:09 +08:00
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: GIT-PREFIX
|
2011-04-22 03:14:42 +08:00
|
|
|
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
|
2010-01-06 16:05:04 +08:00
|
|
|
-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
|
2006-01-11 10:12:17 +08:00
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
config.sp config.s config.o: GIT-PREFIX
|
2011-04-22 03:14:42 +08:00
|
|
|
config.sp config.s config.o: EXTRA_CPPFLAGS = \
|
|
|
|
-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
|
2007-11-14 04:05:05 +08:00
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
attr.sp attr.s attr.o: GIT-PREFIX
|
2011-04-22 03:14:42 +08:00
|
|
|
attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
|
|
|
|
-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
|
2010-09-01 06:42:43 +08:00
|
|
|
|
2012-06-21 02:31:55 +08:00
|
|
|
gettext.sp gettext.s gettext.o: GIT-PREFIX
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
|
|
|
|
-DGIT_LOCALE_PATH='"$(localedir_SQ)"'
|
|
|
|
|
sparse: suppress some "using sizeof on a function" warnings
Sparse issues an "using sizeof on a function" warning for each
call to curl_easy_setopt() which sets an option that takes a
function pointer parameter. (currently 12 such warnings over 4
files.)
The warnings relate to the use of the "typecheck-gcc.h" header
file which adds a layer of type-checking macros to the curl
function invocations (for gcc >= 4.3 and !__cplusplus). As part
of the type-checking layer, 'sizeof' is applied to the function
parameter of curl_easy_setopt(). Note that, in the context of
sizeof, the function to function pointer conversion is not
performed and that sizeof(f) != sizeof(&f).
A simple solution, therefore, would be to replace the function
name in each such call to curl_easy_setopt() with an explicit
function pointer expression (i.e. replace f with &f).
However, the "typecheck-gcc.h" header file is only conditionally
included, in addition to the gcc and C++ checks mentioned above,
depending on the CURL_DISABLE_TYPECHECK preprocessor variable.
In order to suppress the warnings, we use target-specific variable
assignments to add -DCURL_DISABLE_TYPECHECK to SPARSE_FLAGS for
each file affected (http-push.c, http.c, http-walker.c and
remote-curl.c).
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2013-10-07 04:52:21 +08:00
|
|
|
http-push.sp http.sp http-walker.sp remote-curl.sp: SPARSE_FLAGS += \
|
|
|
|
-DCURL_DISABLE_TYPECHECK
|
|
|
|
|
2006-04-04 20:33:18 +08:00
|
|
|
ifdef NO_EXPAT
|
2011-04-22 03:14:42 +08:00
|
|
|
http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
|
2006-04-04 20:33:18 +08:00
|
|
|
endif
|
|
|
|
|
2010-08-17 17:24:39 +08:00
|
|
|
ifdef NO_REGEX
|
2011-04-22 03:14:42 +08:00
|
|
|
compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
|
|
|
|
-DGAWK -DNO_MBSUPPORT
|
2010-08-17 17:24:39 +08:00
|
|
|
endif
|
|
|
|
|
2010-09-11 17:59:18 +08:00
|
|
|
ifdef USE_NED_ALLOCATOR
|
2011-04-22 03:14:42 +08:00
|
|
|
compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
|
2010-09-11 17:59:18 +08:00
|
|
|
-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
|
2013-04-28 02:45:02 +08:00
|
|
|
compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null
|
2010-09-11 17:59:18 +08:00
|
|
|
endif
|
|
|
|
|
2011-06-22 18:50:56 +08:00
|
|
|
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
|
2007-03-06 14:35:01 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
|
2005-07-30 01:21:53 +08:00
|
|
|
|
2011-06-22 18:50:56 +08:00
|
|
|
git-imap-send$X: imap-send.o GIT-LDFLAGS $(GITLIBS)
|
2008-07-10 05:29:00 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
2010-11-25 04:03:53 +08:00
|
|
|
$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
|
2006-03-10 13:32:50 +08:00
|
|
|
|
2014-01-25 21:11:44 +08:00
|
|
|
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
|
2009-08-05 13:01:59 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
2009-08-07 12:21:33 +08:00
|
|
|
$(LIBS) $(CURL_LIBCURL)
|
2014-01-25 21:11:44 +08:00
|
|
|
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
|
2007-03-06 14:35:01 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
2006-02-18 19:40:22 +08:00
|
|
|
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
|
|
|
|
|
2012-09-19 23:21:16 +08:00
|
|
|
git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
|
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
|
|
|
|
$(VCSSVN_LIB)
|
|
|
|
|
2009-12-09 23:26:34 +08:00
|
|
|
$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
|
|
|
|
$(QUIET_LNCP)$(RM) $@ && \
|
|
|
|
ln $< $@ 2>/dev/null || \
|
|
|
|
ln -s $< $@ 2>/dev/null || \
|
|
|
|
cp $< $@
|
|
|
|
|
2011-06-22 18:50:56 +08:00
|
|
|
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
|
2009-08-05 13:01:56 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
|
|
|
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
|
|
|
|
|
2005-07-29 23:50:24 +08:00
|
|
|
$(LIB_FILE): $(LIB_OBJS)
|
2013-06-09 06:38:58 +08:00
|
|
|
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^
|
2005-07-29 23:50:24 +08:00
|
|
|
|
Use a *real* built-in diff generator
This uses a simplified libxdiff setup to generate unified diffs _without_
doing fork/execve of GNU "diff".
This has several huge advantages, for example:
Before:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m24.818s
user 0m13.332s
sys 0m8.664s
After:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m4.563s
user 0m2.944s
sys 0m1.580s
and the fact that this should be a lot more portable (ie we can ignore all
the issues with doing fork/execve under Windows).
Perhaps even more importantly, this allows us to do diffs without actually
ever writing out the git file contents to a temporary file (and without
any of the shell quoting issues on filenames etc etc).
NOTE! THIS PATCH DOES NOT DO THAT OPTIMIZATION YET! I was lazy, and the
current "diff-core" code actually will always write the temp-files,
because it used to be something that you simply had to do. So this current
one actually writes a temp-file like before, and then reads it into memory
again just to do the diff. Stupid.
But if this basic infrastructure is accepted, we can start switching over
diff-core to not write temp-files, which should speed things up even
further, especially when doing big tree-to-tree diffs.
Now, in the interest of full disclosure, I should also point out a few
downsides:
- the libxdiff algorithm is different, and I bet GNU diff has gotten a
lot more testing. And the thing is, generating a diff is not an exact
science - you can get two different diffs (and you will), and they can
both be perfectly valid. So it's not possible to "validate" the
libxdiff output by just comparing it against GNU diff.
- GNU diff does some nice eye-candy, like trying to figure out what the
last function was, and adding that information to the "@@ .." line.
libxdiff doesn't do that.
- The libxdiff thing has some known deficiencies. In particular, it gets
the "\No newline at end of file" case wrong. So this is currently for
the experimental branch only. I hope Davide will help fix it.
That said, I think the huge performance advantage, and the fact that it
integrates better is definitely worth it. But it should go into a
development branch at least due to the missing newline issue.
Technical note: this is based on libxdiff-0.17, but I did some surgery to
get rid of the extraneous fat - stuff that git doesn't need, and seriously
cutting down on mmfile_t, which had much more capabilities than the diff
algorithm either needed or used. In this version, "mmfile_t" is just a
trivial <pointer,length> tuple.
That said, I tried to keep the differences to simple removals, so that you
can do a diff between this and the libxdiff origin, and you'll basically
see just things getting deleted. Even the mmfile_t simplifications are
left in a state where the diffs should be readable.
Apologies to Davide, whom I'd love to get feedback on this all from (I
wrote my own "fill_mmfile()" for the new simpler mmfile_t format: the old
complex format had a helper function for that, but I did my surgery with
the goal in mind that eventually we _should_ just do
mmfile_t mf;
buf = read_sha1_file(sha1, type, &size);
mf->ptr = buf;
mf->size = size;
.. use "mf" directly ..
which was really a nightmare with the old "helpful" mmfile_t, and really
is that easy with the new cut-down interfaces).
[ Btw, as any hawk-eye can see from the diff, this was actually generated
with itself, so it is "self-hosting". That's about all the testing it
has gotten, along with the above kernel diff, which eye-balls correctly,
but shows the newline issue when you double-check it with "git-apply" ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 12:13:22 +08:00
|
|
|
$(XDIFF_LIB): $(XDIFF_OBJS)
|
2013-06-09 06:38:58 +08:00
|
|
|
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^
|
Use a *real* built-in diff generator
This uses a simplified libxdiff setup to generate unified diffs _without_
doing fork/execve of GNU "diff".
This has several huge advantages, for example:
Before:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m24.818s
user 0m13.332s
sys 0m8.664s
After:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m4.563s
user 0m2.944s
sys 0m1.580s
and the fact that this should be a lot more portable (ie we can ignore all
the issues with doing fork/execve under Windows).
Perhaps even more importantly, this allows us to do diffs without actually
ever writing out the git file contents to a temporary file (and without
any of the shell quoting issues on filenames etc etc).
NOTE! THIS PATCH DOES NOT DO THAT OPTIMIZATION YET! I was lazy, and the
current "diff-core" code actually will always write the temp-files,
because it used to be something that you simply had to do. So this current
one actually writes a temp-file like before, and then reads it into memory
again just to do the diff. Stupid.
But if this basic infrastructure is accepted, we can start switching over
diff-core to not write temp-files, which should speed things up even
further, especially when doing big tree-to-tree diffs.
Now, in the interest of full disclosure, I should also point out a few
downsides:
- the libxdiff algorithm is different, and I bet GNU diff has gotten a
lot more testing. And the thing is, generating a diff is not an exact
science - you can get two different diffs (and you will), and they can
both be perfectly valid. So it's not possible to "validate" the
libxdiff output by just comparing it against GNU diff.
- GNU diff does some nice eye-candy, like trying to figure out what the
last function was, and adding that information to the "@@ .." line.
libxdiff doesn't do that.
- The libxdiff thing has some known deficiencies. In particular, it gets
the "\No newline at end of file" case wrong. So this is currently for
the experimental branch only. I hope Davide will help fix it.
That said, I think the huge performance advantage, and the fact that it
integrates better is definitely worth it. But it should go into a
development branch at least due to the missing newline issue.
Technical note: this is based on libxdiff-0.17, but I did some surgery to
get rid of the extraneous fat - stuff that git doesn't need, and seriously
cutting down on mmfile_t, which had much more capabilities than the diff
algorithm either needed or used. In this version, "mmfile_t" is just a
trivial <pointer,length> tuple.
That said, I tried to keep the differences to simple removals, so that you
can do a diff between this and the libxdiff origin, and you'll basically
see just things getting deleted. Even the mmfile_t simplifications are
left in a state where the diffs should be readable.
Apologies to Davide, whom I'd love to get feedback on this all from (I
wrote my own "fill_mmfile()" for the new simpler mmfile_t format: the old
complex format had a helper function for that, but I did my surgery with
the goal in mind that eventually we _should_ just do
mmfile_t mf;
buf = read_sha1_file(sha1, type, &size);
mf->ptr = buf;
mf->size = size;
.. use "mf" directly ..
which was really a nightmare with the old "helpful" mmfile_t, and really
is that easy with the new cut-down interfaces).
[ Btw, as any hawk-eye can see from the diff, this was actually generated
with itself, so it is "self-hosting". That's about all the testing it
has gotten, along with the above kernel diff, which eye-balls correctly,
but shows the newline issue when you double-check it with "git-apply" ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 12:13:22 +08:00
|
|
|
|
2010-08-10 06:04:29 +08:00
|
|
|
$(VCSSVN_LIB): $(VCSSVN_OBJS)
|
2013-06-09 06:38:58 +08:00
|
|
|
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^
|
Use a *real* built-in diff generator
This uses a simplified libxdiff setup to generate unified diffs _without_
doing fork/execve of GNU "diff".
This has several huge advantages, for example:
Before:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m24.818s
user 0m13.332s
sys 0m8.664s
After:
[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
real 0m4.563s
user 0m2.944s
sys 0m1.580s
and the fact that this should be a lot more portable (ie we can ignore all
the issues with doing fork/execve under Windows).
Perhaps even more importantly, this allows us to do diffs without actually
ever writing out the git file contents to a temporary file (and without
any of the shell quoting issues on filenames etc etc).
NOTE! THIS PATCH DOES NOT DO THAT OPTIMIZATION YET! I was lazy, and the
current "diff-core" code actually will always write the temp-files,
because it used to be something that you simply had to do. So this current
one actually writes a temp-file like before, and then reads it into memory
again just to do the diff. Stupid.
But if this basic infrastructure is accepted, we can start switching over
diff-core to not write temp-files, which should speed things up even
further, especially when doing big tree-to-tree diffs.
Now, in the interest of full disclosure, I should also point out a few
downsides:
- the libxdiff algorithm is different, and I bet GNU diff has gotten a
lot more testing. And the thing is, generating a diff is not an exact
science - you can get two different diffs (and you will), and they can
both be perfectly valid. So it's not possible to "validate" the
libxdiff output by just comparing it against GNU diff.
- GNU diff does some nice eye-candy, like trying to figure out what the
last function was, and adding that information to the "@@ .." line.
libxdiff doesn't do that.
- The libxdiff thing has some known deficiencies. In particular, it gets
the "\No newline at end of file" case wrong. So this is currently for
the experimental branch only. I hope Davide will help fix it.
That said, I think the huge performance advantage, and the fact that it
integrates better is definitely worth it. But it should go into a
development branch at least due to the missing newline issue.
Technical note: this is based on libxdiff-0.17, but I did some surgery to
get rid of the extraneous fat - stuff that git doesn't need, and seriously
cutting down on mmfile_t, which had much more capabilities than the diff
algorithm either needed or used. In this version, "mmfile_t" is just a
trivial <pointer,length> tuple.
That said, I tried to keep the differences to simple removals, so that you
can do a diff between this and the libxdiff origin, and you'll basically
see just things getting deleted. Even the mmfile_t simplifications are
left in a state where the diffs should be readable.
Apologies to Davide, whom I'd love to get feedback on this all from (I
wrote my own "fill_mmfile()" for the new simpler mmfile_t format: the old
complex format had a helper function for that, but I did my surgery with
the goal in mind that eventually we _should_ just do
mmfile_t mf;
buf = read_sha1_file(sha1, type, &size);
mf->ptr = buf;
mf->size = size;
.. use "mf" directly ..
which was really a nightmare with the old "helpful" mmfile_t, and really
is that easy with the new cut-down interfaces).
[ Btw, as any hawk-eye can see from the diff, this was actually generated
with itself, so it is "self-hosting". That's about all the testing it
has gotten, along with the above kernel diff, which eye-balls correctly,
but shows the newline issue when you double-check it with "git-apply" ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 12:13:22 +08:00
|
|
|
|
2012-03-31 16:44:53 +08:00
|
|
|
export DEFAULT_EDITOR DEFAULT_PAGER
|
|
|
|
|
2005-07-29 23:50:24 +08:00
|
|
|
doc:
|
|
|
|
$(MAKE) -C Documentation all
|
|
|
|
|
2008-09-10 16:19:34 +08:00
|
|
|
man:
|
|
|
|
$(MAKE) -C Documentation man
|
|
|
|
|
|
|
|
html:
|
|
|
|
$(MAKE) -C Documentation html
|
|
|
|
|
2007-08-06 18:22:57 +08:00
|
|
|
info:
|
|
|
|
$(MAKE) -C Documentation info
|
|
|
|
|
2008-12-11 06:44:50 +08:00
|
|
|
pdf:
|
|
|
|
$(MAKE) -C Documentation pdf
|
|
|
|
|
2011-02-23 07:41:23 +08:00
|
|
|
XGETTEXT_FLAGS = \
|
|
|
|
--force-po \
|
i18n: only extract comments marked with "TRANSLATORS:"
When extract l10n messages, we use "--add-comments" option to keep
comments right above the l10n messages for references. But sometimes
irrelevant comments are also extracted. For example in the following
code block, the comment in line 2 will be extracted as comment for the
l10n message in line 3, but obviously it's wrong.
{ OPTION_CALLBACK, 0, "ignore-removal", &addremove_explicit,
NULL /* takes no arguments */,
N_("ignore paths removed in the working tree (same as
--no-all)"),
PARSE_OPT_NOARG, ignore_removal_cb },
Since almost all comments for l10n translators are marked with the same
prefix (tag): "TRANSLATORS:", it's safe to only extract comments with
this special tag. I.E. it's better to call xgettext as:
xgettext --add-comments=TRANSLATORS: ...
Also tweaks the multi-line comment in "init-db.c", to make it start with
the proper tag, not "* TRANSLATORS:" (which has a star before the tag).
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-17 13:37:18 +08:00
|
|
|
--add-comments=TRANSLATORS: \
|
2011-02-23 07:41:23 +08:00
|
|
|
--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
|
|
|
|
--from-code=UTF-8
|
2011-04-11 03:37:01 +08:00
|
|
|
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
|
|
|
|
--keyword=_ --keyword=N_ --keyword="Q_:1,2"
|
2012-07-25 22:53:07 +08:00
|
|
|
XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
|
|
|
|
--keyword=gettextln --keyword=eval_gettextln
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
|
2014-08-26 04:00:42 +08:00
|
|
|
LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
|
|
|
|
LOCALIZED_SH = $(SCRIPT_SH)
|
|
|
|
LOCALIZED_PERL = $(SCRIPT_PERL)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
|
|
|
|
ifdef XGETTEXT_INCLUDE_TESTS
|
|
|
|
LOCALIZED_C += t/t0200/test.c
|
|
|
|
LOCALIZED_SH += t/t0200/test.sh
|
|
|
|
LOCALIZED_PERL += t/t0200/test.perl
|
|
|
|
endif
|
2011-02-23 07:41:23 +08:00
|
|
|
|
2014-08-22 12:32:08 +08:00
|
|
|
po/git.pot: $(GENERATED_H) FORCE
|
2011-05-14 21:47:45 +08:00
|
|
|
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
|
|
|
|
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
|
|
|
|
$(LOCALIZED_SH)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \
|
|
|
|
$(LOCALIZED_PERL)
|
2011-02-23 07:41:23 +08:00
|
|
|
mv $@+ $@
|
|
|
|
|
|
|
|
pot: po/git.pot
|
|
|
|
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
POFILES := $(wildcard po/*.po)
|
|
|
|
MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
|
|
|
|
|
|
|
|
ifndef NO_GETTEXT
|
|
|
|
all:: $(MOFILES)
|
|
|
|
endif
|
|
|
|
|
|
|
|
po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
|
|
|
|
$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
|
|
|
|
|
2011-10-18 15:26:18 +08:00
|
|
|
FIND_SOURCE_FILES = ( git ls-files '*.[hcS]' 2>/dev/null || \
|
|
|
|
$(FIND) . \( -name .git -type d -prune \) \
|
|
|
|
-o \( -name '*.[hcS]' -type f -print \) )
|
|
|
|
|
2010-09-29 05:08:38 +08:00
|
|
|
$(ETAGS_TARGET): FORCE
|
|
|
|
$(RM) $(ETAGS_TARGET)
|
2011-10-18 15:26:18 +08:00
|
|
|
$(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
|
2006-03-18 18:07:12 +08:00
|
|
|
|
2010-09-29 05:08:38 +08:00
|
|
|
tags: FORCE
|
2007-07-15 01:51:44 +08:00
|
|
|
$(RM) tags
|
2011-10-18 15:26:18 +08:00
|
|
|
$(FIND_SOURCE_FILES) | xargs ctags -a
|
2005-07-29 23:50:24 +08:00
|
|
|
|
2007-10-06 22:24:42 +08:00
|
|
|
cscope:
|
|
|
|
$(RM) cscope*
|
2011-10-18 15:26:18 +08:00
|
|
|
$(FIND_SOURCE_FILES) | xargs cscope -b
|
2007-10-06 22:24:42 +08:00
|
|
|
|
2006-06-15 06:36:00 +08:00
|
|
|
### Detect prefix changes
|
2012-06-21 02:31:55 +08:00
|
|
|
TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
|
|
|
|
$(localedir_SQ)
|
|
|
|
|
|
|
|
GIT-PREFIX: FORCE
|
|
|
|
@FLAGS='$(TRACK_PREFIX)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
|
2012-12-18 23:26:39 +08:00
|
|
|
echo >&2 " * new prefix flags"; \
|
2012-06-21 02:31:55 +08:00
|
|
|
echo "$$FLAGS" >GIT-PREFIX; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
|
2006-06-15 06:36:00 +08:00
|
|
|
|
2010-01-06 16:06:58 +08:00
|
|
|
GIT-CFLAGS: FORCE
|
2006-06-15 06:36:00 +08:00
|
|
|
@FLAGS='$(TRACK_CFLAGS)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
|
2012-12-18 23:26:39 +08:00
|
|
|
echo >&2 " * new build flags"; \
|
2006-06-15 06:36:00 +08:00
|
|
|
echo "$$FLAGS" >GIT-CFLAGS; \
|
|
|
|
fi
|
|
|
|
|
2011-06-22 18:50:56 +08:00
|
|
|
TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
|
|
|
|
|
|
|
|
GIT-LDFLAGS: FORCE
|
|
|
|
@FLAGS='$(TRACK_LDFLAGS)'; \
|
|
|
|
if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
|
2012-12-18 23:26:39 +08:00
|
|
|
echo >&2 " * new link flags"; \
|
2011-06-22 18:50:56 +08:00
|
|
|
echo "$$FLAGS" >GIT-LDFLAGS; \
|
|
|
|
fi
|
|
|
|
|
2008-07-26 03:35:10 +08:00
|
|
|
# We need to apply sq twice, once to protect from the shell
|
|
|
|
# that runs GIT-BUILD-OPTIONS, and then again to protect it
|
|
|
|
# and the first level quoting from the shell that runs "echo".
|
2010-01-06 16:06:58 +08:00
|
|
|
GIT-BUILD-OPTIONS: FORCE
|
2008-07-26 03:35:10 +08:00
|
|
|
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
|
2009-11-17 16:42:39 +08:00
|
|
|
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
|
2010-05-14 17:31:36 +08:00
|
|
|
@echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@
|
2010-06-10 05:23:59 +08:00
|
|
|
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@
|
2008-07-26 03:35:10 +08:00
|
|
|
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
|
2009-02-25 16:32:09 +08:00
|
|
|
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
|
2011-05-16 15:11:53 +08:00
|
|
|
@echo USE_LIBPCRE=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE)))'\' >>$@
|
2009-04-04 03:33:59 +08:00
|
|
|
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
|
2009-12-07 13:32:50 +08:00
|
|
|
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
|
2012-02-17 18:25:09 +08:00
|
|
|
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
|
2013-04-30 02:16:21 +08:00
|
|
|
ifdef TEST_OUTPUT_DIRECTORY
|
|
|
|
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@
|
|
|
|
endif
|
2012-02-17 18:25:09 +08:00
|
|
|
ifdef GIT_TEST_OPTS
|
|
|
|
@echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@
|
|
|
|
endif
|
2010-06-12 00:40:25 +08:00
|
|
|
ifdef GIT_TEST_CMP
|
|
|
|
@echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@
|
|
|
|
endif
|
|
|
|
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
|
|
|
|
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
|
|
|
|
endif
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
@echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@
|
2011-02-23 07:41:21 +08:00
|
|
|
@echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
|
2012-02-17 18:25:09 +08:00
|
|
|
ifdef GIT_PERF_REPEAT_COUNT
|
|
|
|
@echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@
|
|
|
|
endif
|
|
|
|
ifdef GIT_PERF_REPO
|
|
|
|
@echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@
|
|
|
|
endif
|
|
|
|
ifdef GIT_PERF_LARGE_REPO
|
|
|
|
@echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@
|
|
|
|
endif
|
|
|
|
ifdef GIT_PERF_MAKE_OPTS
|
|
|
|
@echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@
|
|
|
|
endif
|
2014-02-24 04:49:58 +08:00
|
|
|
ifdef TEST_GIT_INDEX_VERSION
|
|
|
|
@echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@
|
|
|
|
endif
|
2008-02-25 03:40:45 +08:00
|
|
|
|
2012-12-18 23:26:38 +08:00
|
|
|
### Detect Python interpreter path changes
|
|
|
|
ifndef NO_PYTHON
|
|
|
|
TRACK_PYTHON = $(subst ','\'',-DPYTHON_PATH='$(PYTHON_PATH_SQ)')
|
2007-03-28 19:22:02 +08:00
|
|
|
|
2012-12-18 23:26:38 +08:00
|
|
|
GIT-PYTHON-VARS: FORCE
|
|
|
|
@VARS='$(TRACK_PYTHON)'; \
|
2007-03-28 19:22:02 +08:00
|
|
|
if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
|
2012-12-18 23:26:39 +08:00
|
|
|
echo >&2 " * new Python interpreter location"; \
|
2007-03-28 19:22:02 +08:00
|
|
|
echo "$$VARS" >$@; \
|
|
|
|
fi
|
|
|
|
endif
|
|
|
|
|
2009-12-03 13:14:05 +08:00
|
|
|
test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
|
|
|
|
|
|
|
|
all:: $(TEST_PROGRAMS) $(test_bindir_programs)
|
2013-06-08 06:03:06 +08:00
|
|
|
all:: $(NO_INSTALL)
|
2009-12-03 13:14:05 +08:00
|
|
|
|
|
|
|
bin-wrappers/%: wrap-for-bin.sh
|
|
|
|
@mkdir -p bin-wrappers
|
|
|
|
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
|
|
|
|
-e 's|@@PROG@@|$(@F)|' < $< > $@ && \
|
|
|
|
chmod +x $@
|
2007-04-29 06:32:49 +08:00
|
|
|
|
2006-02-18 20:01:18 +08:00
|
|
|
# GNU make supports exporting all variables by "export" without parameters.
|
|
|
|
# However, the environment gets quite big, and some programs have problems
|
|
|
|
# with that.
|
|
|
|
|
2006-07-07 19:26:31 +08:00
|
|
|
export NO_SVN_TESTS
|
2012-10-07 01:33:08 +08:00
|
|
|
export TEST_NO_MALLOC_CHECK
|
2006-02-18 20:01:18 +08:00
|
|
|
|
2010-01-27 00:08:44 +08:00
|
|
|
### Testing rules
|
|
|
|
|
2007-04-29 06:32:49 +08:00
|
|
|
test: all
|
2005-07-29 23:50:24 +08:00
|
|
|
$(MAKE) -C t/ all
|
|
|
|
|
2012-02-17 18:25:09 +08:00
|
|
|
perf: all
|
|
|
|
$(MAKE) -C t/perf/ all
|
|
|
|
|
|
|
|
.PHONY: test perf
|
|
|
|
|
2009-01-17 23:50:13 +08:00
|
|
|
test-ctype$X: ctype.o
|
|
|
|
|
2007-05-31 07:18:24 +08:00
|
|
|
test-date$X: date.o ctype.o
|
2005-07-29 23:50:24 +08:00
|
|
|
|
2007-05-31 07:18:24 +08:00
|
|
|
test-delta$X: diff-delta.o patch-delta.o
|
2005-07-29 23:50:24 +08:00
|
|
|
|
2010-08-10 06:39:43 +08:00
|
|
|
test-line-buffer$X: vcs-svn/lib.a
|
|
|
|
|
2011-08-11 17:15:38 +08:00
|
|
|
test-parse-options$X: parse-options.o parse-options-cb.o
|
2007-11-14 07:16:36 +08:00
|
|
|
|
2010-08-10 06:55:00 +08:00
|
|
|
test-svn-fe$X: vcs-svn/lib.a
|
|
|
|
|
2010-01-26 23:45:54 +08:00
|
|
|
.PRECIOUS: $(TEST_OBJS)
|
2007-08-31 10:14:31 +08:00
|
|
|
|
2011-06-22 18:50:56 +08:00
|
|
|
test-%$X: test-%.o GIT-LDFLAGS $(GITLIBS)
|
2010-08-10 06:34:42 +08:00
|
|
|
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
|
2007-04-12 01:59:51 +08:00
|
|
|
|
2006-06-24 15:59:49 +08:00
|
|
|
check-sha1:: test-sha1$X
|
|
|
|
./test-sha1.sh
|
|
|
|
|
2011-04-22 03:14:42 +08:00
|
|
|
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
|
|
|
|
|
|
|
|
$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
|
|
|
|
$(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
|
|
|
|
$(SPARSE_FLAGS) $<
|
|
|
|
|
|
|
|
.PHONY: sparse $(SP_OBJ)
|
|
|
|
sparse: $(SP_OBJ)
|
|
|
|
|
2007-01-05 02:33:48 +08:00
|
|
|
check: common-cmds.h
|
2011-04-08 02:22:18 +08:00
|
|
|
@if sparse; \
|
2008-11-12 05:12:17 +08:00
|
|
|
then \
|
2011-04-22 03:14:42 +08:00
|
|
|
echo 2>&1 "Use 'make sparse' instead"; \
|
|
|
|
$(MAKE) --no-print-directory sparse; \
|
2008-11-12 05:12:17 +08:00
|
|
|
else \
|
|
|
|
echo 2>&1 "Did you mean 'make test'?"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2005-07-29 23:50:24 +08:00
|
|
|
|
|
|
|
### Installation rules
|
|
|
|
|
2009-02-05 16:04:17 +08:00
|
|
|
ifneq ($(filter /%,$(firstword $(template_dir))),)
|
2008-01-02 05:15:21 +08:00
|
|
|
template_instdir = $(template_dir)
|
2009-01-18 20:00:09 +08:00
|
|
|
else
|
|
|
|
template_instdir = $(prefix)/$(template_dir)
|
2008-01-02 05:15:21 +08:00
|
|
|
endif
|
|
|
|
export template_instdir
|
|
|
|
|
2009-02-05 16:04:17 +08:00
|
|
|
ifneq ($(filter /%,$(firstword $(gitexecdir))),)
|
2008-07-24 03:12:18 +08:00
|
|
|
gitexec_instdir = $(gitexecdir)
|
2009-01-18 20:00:09 +08:00
|
|
|
else
|
|
|
|
gitexec_instdir = $(prefix)/$(gitexecdir)
|
2008-07-24 03:12:18 +08:00
|
|
|
endif
|
|
|
|
gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
|
|
|
|
export gitexec_instdir
|
|
|
|
|
2011-08-18 15:23:46 +08:00
|
|
|
ifneq ($(filter /%,$(firstword $(mergetoolsdir))),)
|
|
|
|
mergetools_instdir = $(mergetoolsdir)
|
|
|
|
else
|
|
|
|
mergetools_instdir = $(prefix)/$(mergetoolsdir)
|
|
|
|
endif
|
|
|
|
mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
|
|
|
|
|
2009-12-03 13:14:05 +08:00
|
|
|
install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
|
|
|
|
|
2014-07-08 14:35:11 +08:00
|
|
|
profile-install: profile
|
|
|
|
$(MAKE) install
|
|
|
|
|
|
|
|
profile-fast-install: profile-fast
|
|
|
|
$(MAKE) install
|
|
|
|
|
2005-11-22 07:44:15 +08:00
|
|
|
install: all
|
2007-12-02 01:05:40 +08:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
|
2008-07-24 03:12:18 +08:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
|
|
|
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2010-02-01 03:46:53 +08:00
|
|
|
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
2009-12-03 13:14:05 +08:00
|
|
|
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
|
2006-07-30 00:25:03 +08:00
|
|
|
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
|
2011-08-18 15:23:46 +08:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
|
2011-10-09 17:17:07 +08:00
|
|
|
$(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
ifndef NO_GETTEXT
|
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
|
|
|
|
(cd po/build/locale && $(TAR) cf - .) | \
|
|
|
|
(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
|
|
|
|
endif
|
2009-04-23 13:42:28 +08:00
|
|
|
ifndef NO_PERL
|
2007-12-10 17:31:02 +08:00
|
|
|
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
|
2010-06-21 21:02:44 +08:00
|
|
|
$(MAKE) -C gitweb install
|
2009-04-23 13:42:28 +08:00
|
|
|
endif
|
2007-03-28 19:00:23 +08:00
|
|
|
ifndef NO_TCLTK
|
2007-11-18 02:51:16 +08:00
|
|
|
$(MAKE) -C gitk-git install
|
2008-07-24 03:12:18 +08:00
|
|
|
$(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
|
2007-03-28 19:00:23 +08:00
|
|
|
endif
|
2007-01-11 04:24:54 +08:00
|
|
|
ifneq (,$X)
|
2009-04-28 20:28:31 +08:00
|
|
|
$(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';)
|
2007-01-11 04:24:54 +08:00
|
|
|
endif
|
2009-12-09 23:26:34 +08:00
|
|
|
|
2008-07-22 03:19:51 +08:00
|
|
|
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
|
2008-07-24 03:12:18 +08:00
|
|
|
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
|
2009-07-11 11:17:33 +08:00
|
|
|
{ test "$$bindir/" = "$$execdir/" || \
|
2010-07-24 01:50:45 +08:00
|
|
|
for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
|
|
|
|
$(RM) "$$execdir/$$p" && \
|
2012-05-03 06:12:10 +08:00
|
|
|
test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
|
2010-07-24 01:50:45 +08:00
|
|
|
ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
|
|
|
|
done; \
|
|
|
|
} && \
|
2010-07-24 01:50:44 +08:00
|
|
|
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
|
|
|
|
$(RM) "$$bindir/$$p" && \
|
2012-05-03 06:12:10 +08:00
|
|
|
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
2010-07-24 01:50:44 +08:00
|
|
|
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
|
|
|
|
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
|
|
|
|
done && \
|
2010-07-03 02:50:28 +08:00
|
|
|
for p in $(BUILT_INS); do \
|
2009-01-20 09:44:03 +08:00
|
|
|
$(RM) "$$execdir/$$p" && \
|
2012-05-03 06:12:10 +08:00
|
|
|
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
Makefile: install 'git' in execdir
When a git command executes a subcommand, it uses the "git
foo" form, which relies on finding "git" in the PATH.
Normally this should not be a problem, since the same "git"
that was used to invoke git in the first place will be
found. And if somebody invokes a "git" outside of the PATH
(e.g., by giving its absolute path), this case is already
covered: we put that absolute path onto the front of PATH.
However, if one is using "sudo", then sudo will execute the
"git" from the PATH, but pass along a restricted PATH that
may not contain the original "git" directory. In this case,
executing a subcommand will fail.
To solve this, we put the "git" wrapper itself into the
execdir; this directory is prepended to the PATH when git
starts, so the wrapper will always be found.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-09 14:37:35 +08:00
|
|
|
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
|
2010-07-03 02:50:28 +08:00
|
|
|
done && \
|
Makefile: work around ksh's failure to handle missing list argument to for loop
ksh does not like it when the list argument is missing in a 'for' loop.
This can happen when NO_CURL is set which causes REMOTE_CURL_ALIASES to be
unset. In this case, the 'for' loop in the Makefile is expanded to look
like this:
for p in ; do
and ksh complains like this:
/bin/ksh: syntax error at line 15 : `;' unexpected
The existing attempt to work around this issue, introduced by 70b89f87,
tried to protect the 'for' loop by first testing whether REMOTE_CURL_ALIASES
was empty, but this does not work since, as Johannes Sixt explains, "Before
the test for emptyness can happen, the complete statement must be parsed,
but ksh finds a syntax error in the statement and, therefore, cannot even
begin to execute the statement. (ksh doesn't follow POSIX in this regard,
where this would not be a syntax error.)".
Make's $(foreach) function could be used to avoid this shell glitch, but
since it has already caused a problem once before by generating a command
line that exceeded the maximum argument list length on IRIX, let's adopt
Bruce Stephens's suggestion for working around this issue in the same way
the OpenSSL folks have done it. This solution first assigns the contents
of the REMOTE_CURL_ALIASES make variable to a shell variable and then
supplies the shell variable as the list argument in the 'for' loop. This
satisfies ksh and has the expected behavior even if $(REMOTE_CURL_ALIASES)
is empty.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-07 05:56:51 +08:00
|
|
|
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
|
|
|
|
for p in $$remote_curl_aliases; do \
|
2009-12-09 23:26:34 +08:00
|
|
|
$(RM) "$$execdir/$$p" && \
|
2012-05-03 06:12:10 +08:00
|
|
|
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
2009-12-09 23:26:34 +08:00
|
|
|
ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
|
|
|
|
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
|
Makefile: work around ksh's failure to handle missing list argument to for loop
ksh does not like it when the list argument is missing in a 'for' loop.
This can happen when NO_CURL is set which causes REMOTE_CURL_ALIASES to be
unset. In this case, the 'for' loop in the Makefile is expanded to look
like this:
for p in ; do
and ksh complains like this:
/bin/ksh: syntax error at line 15 : `;' unexpected
The existing attempt to work around this issue, introduced by 70b89f87,
tried to protect the 'for' loop by first testing whether REMOTE_CURL_ALIASES
was empty, but this does not work since, as Johannes Sixt explains, "Before
the test for emptyness can happen, the complete statement must be parsed,
but ksh finds a syntax error in the statement and, therefore, cannot even
begin to execute the statement. (ksh doesn't follow POSIX in this regard,
where this would not be a syntax error.)".
Make's $(foreach) function could be used to avoid this shell glitch, but
since it has already caused a problem once before by generating a command
line that exceeded the maximum argument list length on IRIX, let's adopt
Bruce Stephens's suggestion for working around this issue in the same way
the OpenSSL folks have done it. This solution first assigns the contents
of the REMOTE_CURL_ALIASES make variable to a shell variable and then
supplies the shell variable as the list argument in the 'for' loop. This
satisfies ksh and has the expected behavior even if $(REMOTE_CURL_ALIASES)
is empty.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-07 05:56:51 +08:00
|
|
|
done && \
|
2008-07-22 03:19:58 +08:00
|
|
|
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
|
2005-07-29 23:50:24 +08:00
|
|
|
|
2010-05-02 04:36:15 +08:00
|
|
|
install-gitweb:
|
|
|
|
$(MAKE) -C gitweb install
|
|
|
|
|
2005-07-29 23:50:24 +08:00
|
|
|
install-doc:
|
|
|
|
$(MAKE) -C Documentation install
|
|
|
|
|
2008-11-03 01:53:03 +08:00
|
|
|
install-man:
|
|
|
|
$(MAKE) -C Documentation install-man
|
|
|
|
|
2008-06-10 16:34:25 +08:00
|
|
|
install-html:
|
|
|
|
$(MAKE) -C Documentation install-html
|
|
|
|
|
2007-08-06 18:22:57 +08:00
|
|
|
install-info:
|
|
|
|
$(MAKE) -C Documentation install-info
|
|
|
|
|
2008-12-11 06:44:50 +08:00
|
|
|
install-pdf:
|
|
|
|
$(MAKE) -C Documentation install-pdf
|
|
|
|
|
2006-12-24 00:26:09 +08:00
|
|
|
quick-install-doc:
|
|
|
|
$(MAKE) -C Documentation quick-install
|
2005-07-29 23:50:24 +08:00
|
|
|
|
2008-11-03 01:53:03 +08:00
|
|
|
quick-install-man:
|
|
|
|
$(MAKE) -C Documentation quick-install-man
|
|
|
|
|
2008-09-10 04:44:17 +08:00
|
|
|
quick-install-html:
|
|
|
|
$(MAKE) -C Documentation quick-install-html
|
|
|
|
|
2005-07-29 23:50:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
### Maintainer's dist rules
|
|
|
|
|
2012-06-21 02:32:22 +08:00
|
|
|
git.spec: git.spec.in GIT-VERSION-FILE
|
Don't write directly to a make target ($@).
Otherwise, if make is suspended, or killed with prejudice, or if the
system crashes, you could be left with an up-to-date, yet corrupt,
generated file.
I left off the `clean' addition, because I believe "make clean" should
not remove wildcard patterns like "*+", on the off-chance that someone
uses names like that for files they care about. Besides, in practice,
those temporary files are left behind so rarely that they're not a bother,
and they're removed again as part of the next build.
[jc: sign-off?]
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-26 00:52:01 +08:00
|
|
|
sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
|
|
|
|
mv $@+ $@
|
2005-07-08 04:09:50 +08:00
|
|
|
|
2012-12-09 18:36:17 +08:00
|
|
|
GIT_TARNAME = git-$(GIT_VERSION)
|
2008-02-24 13:38:04 +08:00
|
|
|
dist: git.spec git-archive$(X) configure
|
2006-10-05 17:26:12 +08:00
|
|
|
./git-archive --format=tar \
|
|
|
|
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
|
2005-07-08 04:09:50 +08:00
|
|
|
@mkdir -p $(GIT_TARNAME)
|
2007-06-19 05:30:36 +08:00
|
|
|
@cp git.spec configure $(GIT_TARNAME)
|
2006-01-10 10:07:01 +08:00
|
|
|
@echo $(GIT_VERSION) > $(GIT_TARNAME)/version
|
2007-02-13 07:20:34 +08:00
|
|
|
@$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
|
2006-01-10 10:07:01 +08:00
|
|
|
$(TAR) rf $(GIT_TARNAME).tar \
|
2007-02-13 07:20:34 +08:00
|
|
|
$(GIT_TARNAME)/git.spec \
|
2007-06-19 05:30:36 +08:00
|
|
|
$(GIT_TARNAME)/configure \
|
2007-02-13 07:20:34 +08:00
|
|
|
$(GIT_TARNAME)/version \
|
2007-03-13 01:40:31 +08:00
|
|
|
$(GIT_TARNAME)/git-gui/version
|
2007-07-15 01:51:44 +08:00
|
|
|
@$(RM) -r $(GIT_TARNAME)
|
2005-07-15 09:20:50 +08:00
|
|
|
gzip -f -9 $(GIT_TARNAME).tar
|
2005-07-08 04:09:50 +08:00
|
|
|
|
|
|
|
rpm: dist
|
2009-11-12 05:59:52 +08:00
|
|
|
$(RPMBUILD) \
|
|
|
|
--define "_source_filedigest_algorithm md5" \
|
|
|
|
--define "_binary_filedigest_algorithm md5" \
|
|
|
|
-ta $(GIT_TARNAME).tar.gz
|
2005-07-08 04:09:50 +08:00
|
|
|
|
2006-05-18 18:57:04 +08:00
|
|
|
htmldocs = git-htmldocs-$(GIT_VERSION)
|
|
|
|
manpages = git-manpages-$(GIT_VERSION)
|
|
|
|
dist-doc:
|
2007-07-15 01:51:44 +08:00
|
|
|
$(RM) -r .doc-tmp-dir
|
2006-05-18 18:57:04 +08:00
|
|
|
mkdir .doc-tmp-dir
|
|
|
|
$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
|
|
|
|
cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
|
|
|
|
gzip -n -9 -f $(htmldocs).tar
|
|
|
|
:
|
2007-07-15 01:51:44 +08:00
|
|
|
$(RM) -r .doc-tmp-dir
|
2007-04-20 11:47:04 +08:00
|
|
|
mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
|
2006-05-25 20:37:46 +08:00
|
|
|
$(MAKE) -C Documentation DESTDIR=./ \
|
2006-06-30 05:26:54 +08:00
|
|
|
man1dir=../.doc-tmp-dir/man1 \
|
2007-04-20 11:47:04 +08:00
|
|
|
man5dir=../.doc-tmp-dir/man5 \
|
2006-06-30 05:26:54 +08:00
|
|
|
man7dir=../.doc-tmp-dir/man7 \
|
2006-05-18 18:57:04 +08:00
|
|
|
install
|
|
|
|
cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
|
|
|
|
gzip -n -9 -f $(manpages).tar
|
2007-07-15 01:51:44 +08:00
|
|
|
$(RM) -r .doc-tmp-dir
|
2006-05-18 18:57:04 +08:00
|
|
|
|
2005-07-29 23:50:24 +08:00
|
|
|
### Cleaning rules
|
2005-07-15 09:21:57 +08:00
|
|
|
|
2007-10-05 05:49:19 +08:00
|
|
|
distclean: clean
|
|
|
|
$(RM) configure
|
2012-07-19 15:50:01 +08:00
|
|
|
$(RM) config.log config.status config.cache
|
|
|
|
$(RM) config.mak.autogen config.mak.append
|
|
|
|
$(RM) -r autom4te.cache
|
2007-10-05 05:49:19 +08:00
|
|
|
|
2012-02-06 14:00:17 +08:00
|
|
|
profile-clean:
|
|
|
|
$(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
|
|
|
|
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
|
|
|
|
|
2013-05-14 05:27:26 +08:00
|
|
|
clean: profile-clean coverage-clean
|
2013-11-14 20:43:51 +08:00
|
|
|
$(RM) *.o *.res block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o
|
|
|
|
$(RM) xdiff/*.o vcs-svn/*.o ewah/*.o builtin/*.o
|
|
|
|
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
|
2010-02-01 03:46:53 +08:00
|
|
|
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
|
2013-06-08 06:03:06 +08:00
|
|
|
$(RM) $(TEST_PROGRAMS) $(NO_INSTALL)
|
2013-02-13 23:57:48 +08:00
|
|
|
$(RM) -r bin-wrappers $(dep_dirs)
|
i18n: add infrastructure for translating Git with gettext
Change the skeleton implementation of i18n in Git to one that can show
localized strings to users for our C, Shell and Perl programs using
either GNU libintl or the Solaris gettext implementation.
This new internationalization support is enabled by default. If
gettext isn't available, or if Git is compiled with
NO_GETTEXT=YesPlease, Git falls back on its current behavior of
showing interface messages in English. When using the autoconf script
we'll auto-detect if the gettext libraries are installed and act
appropriately.
This change is somewhat large because as well as adding a C, Shell and
Perl i18n interface we're adding a lot of tests for them, and for
those tests to work we need a skeleton PO file to actually test
translations. A minimal Icelandic translation is included for this
purpose. Icelandic includes multi-byte characters which makes it easy
to test various edge cases, and it's a language I happen to
understand.
The rest of the commit message goes into detail about various
sub-parts of this commit.
= Installation
Gettext .mo files will be installed and looked for in the standard
$(prefix)/share/locale path. GIT_TEXTDOMAINDIR can also be set to
override that, but that's only intended to be used to test Git itself.
= Perl
Perl code that's to be localized should use the new Git::I18n
module. It imports a __ function into the caller's package by default.
Instead of using the high level Locale::TextDomain interface I've
opted to use the low-level (equivalent to the C interface)
Locale::Messages module, which Locale::TextDomain itself uses.
Locale::TextDomain does a lot of redundant work we don't need, and
some of it would potentially introduce bugs. It tries to set the
$TEXTDOMAIN based on package of the caller, and has its own
hardcoded paths where it'll search for messages.
I found it easier just to completely avoid it rather than try to
circumvent its behavior. In any case, this is an issue wholly
internal Git::I18N. Its guts can be changed later if that's deemed
necessary.
See <AANLkTilYD_NyIZMyj9dHtVk-ylVBfvyxpCC7982LWnVd@mail.gmail.com> for
a further elaboration on this topic.
= Shell
Shell code that's to be localized should use the git-sh-i18n
library. It's basically just a wrapper for the system's gettext.sh.
If gettext.sh isn't available we'll fall back on gettext(1) if it's
available. The latter is available without the former on Solaris,
which has its own non-GNU gettext implementation. We also need to
emulate eval_gettext() there.
If neither are present we'll use a dumb printf(1) fall-through
wrapper.
= About libcharset.h and langinfo.h
We use libcharset to query the character set of the current locale if
it's available. I.e. we'll use it instead of nl_langinfo if
HAVE_LIBCHARSET_H is set.
The GNU gettext manual recommends using langinfo.h's
nl_langinfo(CODESET) to acquire the current character set, but on
systems that have libcharset.h's locale_charset() using the latter is
either saner, or the only option on those systems.
GNU and Solaris have a nl_langinfo(CODESET), FreeBSD can use either,
but MinGW and some others need to use libcharset.h's locale_charset()
instead.
=Credits
This patch is based on work by Jeff Epler <jepler@unpythonic.net> who
did the initial Makefile / C work, and a lot of comments from the Git
mailing list, including Jonathan Nieder, Jakub Narebski, Johannes
Sixt, Erik Faye-Lund, Peter Krefting, Junio C Hamano, Thomas Rast and
others.
[jc: squashed a small Makefile fix from Ramsay]
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-18 07:14:42 +08:00
|
|
|
$(RM) -r po/build/
|
2010-09-29 05:08:38 +08:00
|
|
|
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
|
2007-07-15 01:51:44 +08:00
|
|
|
$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
|
|
|
|
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
|
|
|
|
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
|
2005-05-23 02:27:28 +08:00
|
|
|
$(MAKE) -C Documentation/ clean
|
2009-04-04 03:32:20 +08:00
|
|
|
ifndef NO_PERL
|
2010-05-09 01:36:15 +08:00
|
|
|
$(MAKE) -C gitweb clean
|
2006-12-04 17:50:04 +08:00
|
|
|
$(MAKE) -C perl clean
|
2009-04-04 03:32:20 +08:00
|
|
|
endif
|
Introduce Git.pm (v4)
This patch introduces a very basic and barebone Git.pm module
with a sketch of how the generic interface would look like;
most functions are missing, but this should give some good base.
I will continue expanding it.
Most desirable now is more careful error reporting, generic_in() for feeding
input to Git commands and the repository() constructor doing some poking
with git-rev-parse to get the git directory and subdirectory prefix.
Those three are basically the prerequisities for converting git-mv.
I will send them as follow-ups to this patch.
Currently Git.pm just wraps up exec()s of Git commands, but even that
is not trivial to get right and various Git perl scripts do it in
various inconsistent ways. In addition to Git.pm, there is now also
Git.xs which provides barebone Git.xs for directly interfacing with
libgit.a, and as an example providing the hash_object() function using
libgit.
This adds the Git module, integrates it to the build system and as
an example converts the git-fmt-merge-msg.perl script to it (the result
is not very impressive since its advantage is not quite apparent in this
one, but I just picked up the simplest Git user around).
Compared to v3, only very minor things were fixed in this patch (some
whitespaces, a missing export, tiny bug in git-fmt-merge-msg.perl);
at first I wanted to post them as a separate patch but since this
is still only in pu, I decided that it will be cleaner to just resend
the patch.
My current working state is available all the time at
http://pasky.or.cz/~xpasky/git-perl/Git.pm
and an irregularily updated API documentation is at
http://pasky.or.cz/~xpasky/git-perl/Git.html
Many thanks to Jakub Narebski, Junio and others for their feedback.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-24 10:34:29 +08:00
|
|
|
$(MAKE) -C templates/ clean
|
2005-08-03 08:24:11 +08:00
|
|
|
$(MAKE) -C t/ clean
|
2007-03-28 19:00:23 +08:00
|
|
|
ifndef NO_TCLTK
|
2007-11-18 02:51:16 +08:00
|
|
|
$(MAKE) -C gitk-git clean
|
2007-03-28 19:00:23 +08:00
|
|
|
$(MAKE) -C git-gui clean
|
|
|
|
endif
|
2012-12-18 23:26:37 +08:00
|
|
|
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-BUILD-OPTIONS
|
2013-11-19 06:23:11 +08:00
|
|
|
$(RM) GIT-USER-AGENT GIT-PREFIX
|
|
|
|
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PYTHON-VARS
|
2005-12-28 06:40:17 +08:00
|
|
|
|
2012-02-06 14:00:17 +08:00
|
|
|
.PHONY: all install profile-clean clean strip
|
2008-08-08 03:06:26 +08:00
|
|
|
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
|
2010-09-29 05:08:38 +08:00
|
|
|
.PHONY: FORCE cscope
|
2005-12-20 09:59:58 +08:00
|
|
|
|
2006-04-13 15:17:19 +08:00
|
|
|
### Check documentation
|
|
|
|
#
|
2012-08-09 04:56:04 +08:00
|
|
|
ALL_COMMANDS = $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS)
|
|
|
|
ALL_COMMANDS += git
|
|
|
|
ALL_COMMANDS += gitk
|
|
|
|
ALL_COMMANDS += gitweb
|
2012-08-09 04:56:42 +08:00
|
|
|
ALL_COMMANDS += git-gui git-citool
|
2006-04-13 15:17:19 +08:00
|
|
|
check-docs::
|
2012-08-09 04:56:04 +08:00
|
|
|
@(for v in $(ALL_COMMANDS); \
|
2006-04-13 15:17:19 +08:00
|
|
|
do \
|
|
|
|
case "$$v" in \
|
|
|
|
git-merge-octopus | git-merge-ours | git-merge-recursive | \
|
2008-07-05 22:43:51 +08:00
|
|
|
git-merge-resolve | git-merge-subtree | \
|
2008-01-18 14:52:40 +08:00
|
|
|
git-fsck-objects | git-init-db | \
|
2010-03-11 07:31:34 +08:00
|
|
|
git-remote-* | git-stage | \
|
2007-12-15 14:02:57 +08:00
|
|
|
git-?*--?* ) continue ;; \
|
2006-04-13 15:17:19 +08:00
|
|
|
esac ; \
|
|
|
|
test -f "Documentation/$$v.txt" || \
|
|
|
|
echo "no doc: $$v"; \
|
2007-12-02 15:39:19 +08:00
|
|
|
sed -e '/^#/d' command-list.txt | \
|
2007-02-14 14:45:22 +08:00
|
|
|
grep -q "^$$v[ ]" || \
|
2006-04-13 15:17:19 +08:00
|
|
|
case "$$v" in \
|
|
|
|
git) ;; \
|
|
|
|
*) echo "no link: $$v";; \
|
|
|
|
esac ; \
|
2007-11-09 10:38:27 +08:00
|
|
|
done; \
|
|
|
|
( \
|
2007-12-02 15:39:19 +08:00
|
|
|
sed -e '/^#/d' \
|
2007-11-09 10:38:27 +08:00
|
|
|
-e 's/[ ].*//' \
|
2007-12-02 15:39:19 +08:00
|
|
|
-e 's/^/listed /' command-list.txt; \
|
2012-08-09 04:57:52 +08:00
|
|
|
$(MAKE) -C Documentation print-man1 | \
|
|
|
|
grep '\.txt$$' | \
|
2007-11-09 10:38:27 +08:00
|
|
|
sed -e 's|Documentation/|documented |' \
|
|
|
|
-e 's/\.txt//'; \
|
|
|
|
) | while read how cmd; \
|
|
|
|
do \
|
2012-08-09 04:56:04 +08:00
|
|
|
case " $(ALL_COMMANDS) " in \
|
2007-11-09 10:38:27 +08:00
|
|
|
*" $$cmd "*) ;; \
|
|
|
|
*) echo "removed but $$how: $$cmd" ;; \
|
|
|
|
esac; \
|
|
|
|
done ) | sort
|
2006-11-06 03:26:21 +08:00
|
|
|
|
|
|
|
### Make sure built-ins do not have dups and listed in git.c
|
|
|
|
#
|
|
|
|
check-builtins::
|
|
|
|
./check-builtins.sh
|
2008-01-15 07:10:38 +08:00
|
|
|
|
2009-02-19 19:13:35 +08:00
|
|
|
### Test suite coverage testing
|
|
|
|
#
|
2013-05-14 05:27:25 +08:00
|
|
|
.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
|
2013-05-14 05:27:26 +08:00
|
|
|
.PHONY: coverage-clean-results
|
2009-02-19 19:13:35 +08:00
|
|
|
|
|
|
|
coverage:
|
2013-05-14 05:27:25 +08:00
|
|
|
$(MAKE) coverage-test
|
2013-05-14 05:27:28 +08:00
|
|
|
$(MAKE) coverage-untested-functions
|
2009-02-19 19:13:35 +08:00
|
|
|
|
2010-07-26 03:52:40 +08:00
|
|
|
object_dirs := $(sort $(dir $(OBJECTS)))
|
2013-05-14 05:27:26 +08:00
|
|
|
coverage-clean-results:
|
2010-07-26 03:52:40 +08:00
|
|
|
$(RM) $(addsuffix *.gcov,$(object_dirs))
|
|
|
|
$(RM) $(addsuffix *.gcda,$(object_dirs))
|
|
|
|
$(RM) coverage-untested-functions
|
2010-07-26 03:52:42 +08:00
|
|
|
$(RM) -r cover_db/
|
2010-07-26 03:52:43 +08:00
|
|
|
$(RM) -r cover_db_html/
|
2009-02-19 19:13:35 +08:00
|
|
|
|
2013-05-14 05:27:26 +08:00
|
|
|
coverage-clean: coverage-clean-results
|
|
|
|
$(RM) $(addsuffix *.gcno,$(object_dirs))
|
|
|
|
|
2009-02-19 19:13:35 +08:00
|
|
|
COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
|
|
|
|
COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
|
2010-07-26 03:52:40 +08:00
|
|
|
GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
|
2009-02-19 19:13:35 +08:00
|
|
|
|
2013-05-14 05:27:25 +08:00
|
|
|
coverage-compile:
|
2009-02-19 19:13:35 +08:00
|
|
|
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
|
2013-05-14 05:27:25 +08:00
|
|
|
|
|
|
|
coverage-test: coverage-clean-results coverage-compile
|
2009-02-19 19:13:35 +08:00
|
|
|
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
|
2013-05-14 05:27:27 +08:00
|
|
|
DEFAULT_TEST_TARGET=test -j1 test
|
2009-02-19 19:13:35 +08:00
|
|
|
|
|
|
|
coverage-report:
|
2010-07-26 03:52:40 +08:00
|
|
|
$(QUIET_GCOV)for dir in $(object_dirs); do \
|
2010-07-26 15:43:41 +08:00
|
|
|
$(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \
|
2010-07-26 03:52:40 +08:00
|
|
|
done
|
2010-07-26 03:52:41 +08:00
|
|
|
|
|
|
|
coverage-untested-functions: coverage-report
|
2009-02-19 19:13:35 +08:00
|
|
|
grep '^function.*called 0 ' *.c.gcov \
|
|
|
|
| sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
|
2010-07-26 03:52:40 +08:00
|
|
|
> coverage-untested-functions
|
2010-07-26 03:52:42 +08:00
|
|
|
|
|
|
|
cover_db: coverage-report
|
|
|
|
gcov2perl -db cover_db *.gcov
|
2010-07-26 03:52:43 +08:00
|
|
|
|
|
|
|
cover_db_html: cover_db
|
|
|
|
cover -report html -outputdir cover_db_html cover_db
|
2011-06-19 09:07:05 +08:00
|
|
|
|