1
0
mirror of https://github.com/git/git synced 2024-06-30 22:54:27 +00:00

Makefile(s): avoid recipe prefix in conditional statements

In GNU Make commit 07fcee35 ([SV 64815] Recipe lines cannot contain
conditional statements, 2023-05-22) and following, conditional
statements may no longer be preceded by a tab character (which Make
refers to as the recipe prefix).

There are a handful of spots in our various Makefile(s) which will break
in a future release of Make containing 07fcee35. For instance, trying to
compile the pre-image of this patch with the tip of make.git results in
the following:

    $ make -v | head -1 && make
    GNU Make 4.4.90
    config.mak.uname:842: *** missing 'endif'.  Stop.

The kernel addressed this issue in 82175d1f9430 (kbuild: Replace tabs
with spaces when followed by conditionals, 2024-01-28). Address the
issues in Git's tree by applying the same strategy.

When a conditional word (ifeq, ifneq, ifdef, etc.) is preceded by one or
more tab characters, replace each tab character with 8 space characters
with the following:

    find . -type f -not -path './.git/*' -name Makefile -or -name '*.mak' |
      xargs perl -i -pe '
        s/(\t+)(ifn?eq|ifn?def|else|endif)/" " x (length($1) * 8) . $2/ge unless /\\$/
      '

The "unless /\\$/" removes any false-positives (like "\telse \"
appearing within a shell script as part of a recipe).

After doing so, Git compiles on newer versions of Make:

    $ make -v | head -1 && make
    GNU Make 4.4.90
    GIT_VERSION = 2.44.0.414.gfac1dc44ca9
    [...]

    $ echo $?
    0

Reported-by: Dario Gjorgjevski <dario.gjorgjevski@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Taylor Blau 2024-04-08 11:51:44 -04:00 committed by Junio C Hamano
parent 3c2a3fdc38
commit 728b9ac0c3
4 changed files with 135 additions and 135 deletions

View File

@ -1552,23 +1552,23 @@ ifneq (,$(SOCKLEN_T))
endif endif
ifeq ($(uname_S),Darwin) ifeq ($(uname_S),Darwin)
ifndef NO_FINK ifndef NO_FINK
ifeq ($(shell test -d /sw/lib && echo y),y) ifeq ($(shell test -d /sw/lib && echo y),y)
BASIC_CFLAGS += -I/sw/include BASIC_CFLAGS += -I/sw/include
BASIC_LDFLAGS += -L/sw/lib BASIC_LDFLAGS += -L/sw/lib
endif endif
endif endif
ifndef NO_DARWIN_PORTS ifndef NO_DARWIN_PORTS
ifeq ($(shell test -d /opt/local/lib && echo y),y) ifeq ($(shell test -d /opt/local/lib && echo y),y)
BASIC_CFLAGS += -I/opt/local/include BASIC_CFLAGS += -I/opt/local/include
BASIC_LDFLAGS += -L/opt/local/lib BASIC_LDFLAGS += -L/opt/local/lib
endif endif
endif endif
ifndef NO_APPLE_COMMON_CRYPTO ifndef NO_APPLE_COMMON_CRYPTO
NO_OPENSSL = YesPlease NO_OPENSSL = YesPlease
APPLE_COMMON_CRYPTO = YesPlease APPLE_COMMON_CRYPTO = YesPlease
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
endif endif
PTHREAD_LIBS = PTHREAD_LIBS =
endif endif
@ -1607,23 +1607,23 @@ ifdef NO_CURL
REMOTE_CURL_NAMES = REMOTE_CURL_NAMES =
EXCLUDED_PROGRAMS += git-http-fetch git-http-push EXCLUDED_PROGRAMS += git-http-fetch git-http-push
else else
ifdef CURLDIR ifdef CURLDIR
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case. # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
CURL_CFLAGS = -I$(CURLDIR)/include CURL_CFLAGS = -I$(CURLDIR)/include
CURL_LIBCURL = $(call libpath_template,$(CURLDIR)/$(lib)) CURL_LIBCURL = $(call libpath_template,$(CURLDIR)/$(lib))
else else
CURL_CFLAGS = CURL_CFLAGS =
CURL_LIBCURL = CURL_LIBCURL =
endif endif
ifndef CURL_LDFLAGS ifndef CURL_LDFLAGS
CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS) CURL_LDFLAGS = $(eval CURL_LDFLAGS := $$(shell $$(CURL_CONFIG) --libs))$(CURL_LDFLAGS)
endif endif
CURL_LIBCURL += $(CURL_LDFLAGS) CURL_LIBCURL += $(CURL_LDFLAGS)
ifndef CURL_CFLAGS ifndef CURL_CFLAGS
CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS) CURL_CFLAGS = $(eval CURL_CFLAGS := $$(shell $$(CURL_CONFIG) --cflags))$(CURL_CFLAGS)
endif endif
BASIC_CFLAGS += $(CURL_CFLAGS) BASIC_CFLAGS += $(CURL_CFLAGS)
REMOTE_CURL_PRIMARY = git-remote-http$X REMOTE_CURL_PRIMARY = git-remote-http$X
@ -1631,29 +1631,29 @@ else
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
PROGRAM_OBJS += http-fetch.o PROGRAM_OBJS += http-fetch.o
PROGRAMS += $(REMOTE_CURL_NAMES) PROGRAMS += $(REMOTE_CURL_NAMES)
ifndef NO_EXPAT ifndef NO_EXPAT
PROGRAM_OBJS += http-push.o PROGRAM_OBJS += http-push.o
endif endif
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p) curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
ifeq "$(curl_check)" "072200" ifeq "$(curl_check)" "072200"
USE_CURL_FOR_IMAP_SEND = YesPlease USE_CURL_FOR_IMAP_SEND = YesPlease
endif endif
ifdef USE_CURL_FOR_IMAP_SEND ifdef USE_CURL_FOR_IMAP_SEND
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
IMAP_SEND_BUILDDEPS = http.o IMAP_SEND_BUILDDEPS = http.o
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL) IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
endif endif
ifndef NO_EXPAT ifndef NO_EXPAT
ifdef EXPATDIR ifdef EXPATDIR
BASIC_CFLAGS += -I$(EXPATDIR)/include BASIC_CFLAGS += -I$(EXPATDIR)/include
EXPAT_LIBEXPAT = $(call libpath_template,$(EXPATDIR)/$(lib)) -lexpat EXPAT_LIBEXPAT = $(call libpath_template,$(EXPATDIR)/$(lib)) -lexpat
else else
EXPAT_LIBEXPAT = -lexpat EXPAT_LIBEXPAT = -lexpat
endif endif
ifdef EXPAT_NEEDS_XMLPARSE_H ifdef EXPAT_NEEDS_XMLPARSE_H
BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H BASIC_CFLAGS += -DEXPAT_NEEDS_XMLPARSE_H
endif endif
endif endif
endif endif
IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO) IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
@ -1665,15 +1665,15 @@ EXTLIBS += -lz
ifndef NO_OPENSSL ifndef NO_OPENSSL
OPENSSL_LIBSSL = -lssl OPENSSL_LIBSSL = -lssl
ifdef OPENSSLDIR ifdef OPENSSLDIR
BASIC_CFLAGS += -I$(OPENSSLDIR)/include BASIC_CFLAGS += -I$(OPENSSLDIR)/include
OPENSSL_LINK = $(call libpath_template,$(OPENSSLDIR)/$(lib)) OPENSSL_LINK = $(call libpath_template,$(OPENSSLDIR)/$(lib))
else else
OPENSSL_LINK = OPENSSL_LINK =
endif endif
ifdef NEEDS_CRYPTO_WITH_SSL ifdef NEEDS_CRYPTO_WITH_SSL
OPENSSL_LIBSSL += -lcrypto OPENSSL_LIBSSL += -lcrypto
endif endif
else else
BASIC_CFLAGS += -DNO_OPENSSL BASIC_CFLAGS += -DNO_OPENSSL
OPENSSL_LIBSSL = OPENSSL_LIBSSL =
@ -1691,18 +1691,18 @@ ifdef APPLE_COMMON_CRYPTO
endif endif
endif endif
ifndef NO_ICONV ifndef NO_ICONV
ifdef NEEDS_LIBICONV ifdef NEEDS_LIBICONV
ifdef ICONVDIR ifdef ICONVDIR
BASIC_CFLAGS += -I$(ICONVDIR)/include BASIC_CFLAGS += -I$(ICONVDIR)/include
ICONV_LINK = $(call libpath_template,$(ICONVDIR)/$(lib)) ICONV_LINK = $(call libpath_template,$(ICONVDIR)/$(lib))
else else
ICONV_LINK = ICONV_LINK =
endif endif
ifdef NEEDS_LIBINTL_BEFORE_LIBICONV ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
ICONV_LINK += -lintl ICONV_LINK += -lintl
endif endif
EXTLIBS += $(ICONV_LINK) -liconv EXTLIBS += $(ICONV_LINK) -liconv
endif endif
endif endif
ifdef ICONV_OMITS_BOM ifdef ICONV_OMITS_BOM
BASIC_CFLAGS += -DICONV_OMITS_BOM BASIC_CFLAGS += -DICONV_OMITS_BOM
@ -1823,10 +1823,10 @@ ifdef NO_MMAP
COMPAT_CFLAGS += -DNO_MMAP COMPAT_CFLAGS += -DNO_MMAP
COMPAT_OBJS += compat/mmap.o COMPAT_OBJS += compat/mmap.o
else else
ifdef USE_WIN32_MMAP ifdef USE_WIN32_MMAP
COMPAT_CFLAGS += -DUSE_WIN32_MMAP COMPAT_CFLAGS += -DUSE_WIN32_MMAP
COMPAT_OBJS += compat/win32mmap.o COMPAT_OBJS += compat/win32mmap.o
endif endif
endif endif
ifdef MMAP_PREVENTS_DELETE ifdef MMAP_PREVENTS_DELETE
BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE BASIC_CFLAGS += -DMMAP_PREVENTS_DELETE
@ -1951,11 +1951,11 @@ else
BASIC_CFLAGS += -DSHA1_DC BASIC_CFLAGS += -DSHA1_DC
LIB_OBJS += sha1dc_git.o LIB_OBJS += sha1dc_git.o
ifdef DC_SHA1_EXTERNAL ifdef DC_SHA1_EXTERNAL
ifdef DC_SHA1_SUBMODULE ifdef DC_SHA1_SUBMODULE
ifneq ($(DC_SHA1_SUBMODULE),auto) ifneq ($(DC_SHA1_SUBMODULE),auto)
$(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both) $(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
endif endif
endif endif
BASIC_CFLAGS += -DDC_SHA1_EXTERNAL BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
EXTLIBS += -lsha1detectcoll EXTLIBS += -lsha1detectcoll
else else

View File

@ -65,9 +65,9 @@ ifeq ($(uname_S),Linux)
HAVE_PLATFORM_PROCINFO = YesPlease HAVE_PLATFORM_PROCINFO = YesPlease
COMPAT_OBJS += compat/linux/procinfo.o COMPAT_OBJS += compat/linux/procinfo.o
# centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7. # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
ifneq ($(findstring .el7.,$(uname_R)),) ifneq ($(findstring .el7.,$(uname_R)),)
BASIC_CFLAGS += -std=c99 BASIC_CFLAGS += -std=c99
endif endif
endif endif
ifeq ($(uname_S),GNU/kFreeBSD) ifeq ($(uname_S),GNU/kFreeBSD)
HAVE_ALLOCA_H = YesPlease HAVE_ALLOCA_H = YesPlease
@ -95,13 +95,13 @@ ifeq ($(uname_S),UnixWare)
NO_MEMMEM = YesPlease NO_MEMMEM = YesPlease
endif endif
ifeq ($(uname_S),SCO_SV) ifeq ($(uname_S),SCO_SV)
ifeq ($(uname_R),3.2) ifeq ($(uname_R),3.2)
CFLAGS = -O2 CFLAGS = -O2
endif endif
ifeq ($(uname_R),5) ifeq ($(uname_R),5)
CC = cc CC = cc
BASIC_CFLAGS += -Kthread BASIC_CFLAGS += -Kthread
endif endif
NEEDS_SOCKET = YesPlease NEEDS_SOCKET = YesPlease
NEEDS_NSL = YesPlease NEEDS_NSL = YesPlease
NEEDS_SSL_WITH_CRYPTO = YesPlease NEEDS_SSL_WITH_CRYPTO = YesPlease
@ -124,19 +124,19 @@ ifeq ($(uname_S),Darwin)
# - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.* # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
# - MacOS 10.x.* = Darwin (x+4).* for (1 <= x) # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
# i.e. "begins with [15678] and a dot" means "10.4.* or older". # i.e. "begins with [15678] and a dot" means "10.4.* or older".
ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2) ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
OLD_ICONV = UnfortunatelyYes OLD_ICONV = UnfortunatelyYes
NO_APPLE_COMMON_CRYPTO = YesPlease NO_APPLE_COMMON_CRYPTO = YesPlease
endif endif
ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2) ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
NO_STRLCPY = YesPlease NO_STRLCPY = YesPlease
endif endif
ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1) ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
HAVE_GETDELIM = YesPlease HAVE_GETDELIM = YesPlease
endif endif
ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1) ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
OPEN_RETURNS_EINTR = UnfortunatelyYes OPEN_RETURNS_EINTR = UnfortunatelyYes
endif endif
NO_MEMMEM = YesPlease NO_MEMMEM = YesPlease
USE_ST_TIMESPEC = YesPlease USE_ST_TIMESPEC = YesPlease
HAVE_DEV_TTY = YesPlease HAVE_DEV_TTY = YesPlease
@ -152,12 +152,12 @@ ifeq ($(uname_S),Darwin)
# Workaround for `gettext` being keg-only and not even being linked via # Workaround for `gettext` being keg-only and not even being linked via
# `brew link --force gettext`, should be obsolete as of # `brew link --force gettext`, should be obsolete as of
# https://github.com/Homebrew/homebrew-core/pull/53489 # https://github.com/Homebrew/homebrew-core/pull/53489
ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y) ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y) ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
MSGFMT = /usr/local/opt/gettext/bin/msgfmt MSGFMT = /usr/local/opt/gettext/bin/msgfmt
endif endif
# On newer ARM-based machines the default installation path has changed to # On newer ARM-based machines the default installation path has changed to
# /opt/homebrew. Include it in our search paths so that the user does not # /opt/homebrew. Include it in our search paths so that the user does not
# have to configure this manually. # have to configure this manually.
@ -165,22 +165,22 @@ ifeq ($(uname_S),Darwin)
# Note that we do not employ the same workaround as above where we manually # Note that we do not employ the same workaround as above where we manually
# add gettext. The issue was fixed more than three years ago by now, and at # add gettext. The issue was fixed more than three years ago by now, and at
# that point there haven't been any ARM-based Macs yet. # that point there haven't been any ARM-based Macs yet.
else ifeq ($(shell test -d /opt/homebrew/ && echo y),y) else ifeq ($(shell test -d /opt/homebrew/ && echo y),y)
BASIC_CFLAGS += -I/opt/homebrew/include BASIC_CFLAGS += -I/opt/homebrew/include
BASIC_LDFLAGS += -L/opt/homebrew/lib BASIC_LDFLAGS += -L/opt/homebrew/lib
ifeq ($(shell test -x /opt/homebrew/bin/msgfmt && echo y),y) ifeq ($(shell test -x /opt/homebrew/bin/msgfmt && echo y),y)
MSGFMT = /opt/homebrew/bin/msgfmt MSGFMT = /opt/homebrew/bin/msgfmt
endif endif
endif endif
# The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
# Unix domain sockets and PThreads. # Unix domain sockets and PThreads.
ifndef NO_PTHREADS ifndef NO_PTHREADS
ifndef NO_UNIX_SOCKETS ifndef NO_UNIX_SOCKETS
FSMONITOR_DAEMON_BACKEND = darwin FSMONITOR_DAEMON_BACKEND = darwin
FSMONITOR_OS_SETTINGS = darwin FSMONITOR_OS_SETTINGS = darwin
endif endif
endif endif
BASIC_LDFLAGS += -framework CoreServices BASIC_LDFLAGS += -framework CoreServices
endif endif
@ -196,7 +196,7 @@ ifeq ($(uname_S),SunOS)
NO_REGEX = YesPlease NO_REGEX = YesPlease
NO_MSGFMT_EXTENDED_OPTIONS = YesPlease NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
HAVE_DEV_TTY = YesPlease HAVE_DEV_TTY = YesPlease
ifeq ($(uname_R),5.6) ifeq ($(uname_R),5.6)
SOCKLEN_T = int SOCKLEN_T = int
NO_HSTRERROR = YesPlease NO_HSTRERROR = YesPlease
NO_IPV6 = YesPlease NO_IPV6 = YesPlease
@ -206,8 +206,8 @@ ifeq ($(uname_S),SunOS)
NO_STRLCPY = YesPlease NO_STRLCPY = YesPlease
NO_STRTOUMAX = YesPlease NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp GIT_TEST_CMP = cmp
endif endif
ifeq ($(uname_R),5.7) ifeq ($(uname_R),5.7)
NEEDS_RESOLV = YesPlease NEEDS_RESOLV = YesPlease
NO_IPV6 = YesPlease NO_IPV6 = YesPlease
NO_SOCKADDR_STORAGE = YesPlease NO_SOCKADDR_STORAGE = YesPlease
@ -216,25 +216,25 @@ ifeq ($(uname_S),SunOS)
NO_STRLCPY = YesPlease NO_STRLCPY = YesPlease
NO_STRTOUMAX = YesPlease NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp GIT_TEST_CMP = cmp
endif endif
ifeq ($(uname_R),5.8) ifeq ($(uname_R),5.8)
NO_UNSETENV = YesPlease NO_UNSETENV = YesPlease
NO_SETENV = YesPlease NO_SETENV = YesPlease
NO_STRTOUMAX = YesPlease NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp GIT_TEST_CMP = cmp
endif endif
ifeq ($(uname_R),5.9) ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease NO_UNSETENV = YesPlease
NO_SETENV = YesPlease NO_SETENV = YesPlease
NO_STRTOUMAX = YesPlease NO_STRTOUMAX = YesPlease
GIT_TEST_CMP = cmp GIT_TEST_CMP = cmp
endif endif
INSTALL = /usr/ucb/install INSTALL = /usr/ucb/install
TAR = gtar TAR = gtar
BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
endif endif
ifeq ($(uname_O),Cygwin) ifeq ($(uname_O),Cygwin)
ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4) ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
NO_D_TYPE_IN_DIRENT = YesPlease NO_D_TYPE_IN_DIRENT = YesPlease
NO_STRCASESTR = YesPlease NO_STRCASESTR = YesPlease
NO_MEMMEM = YesPlease NO_MEMMEM = YesPlease
@ -245,9 +245,9 @@ ifeq ($(uname_O),Cygwin)
# On some boxes NO_MMAP is needed, and not so elsewhere. # On some boxes NO_MMAP is needed, and not so elsewhere.
# Try commenting this out if you suspect MMAP is more efficient # Try commenting this out if you suspect MMAP is more efficient
NO_MMAP = YesPlease NO_MMAP = YesPlease
else else
NO_REGEX = UnfortunatelyYes NO_REGEX = UnfortunatelyYes
endif endif
HAVE_ALLOCA_H = YesPlease HAVE_ALLOCA_H = YesPlease
NEEDS_LIBICONV = YesPlease NEEDS_LIBICONV = YesPlease
NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
@ -263,25 +263,25 @@ ifeq ($(uname_S),FreeBSD)
NEEDS_LIBICONV = YesPlease NEEDS_LIBICONV = YesPlease
# Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't. # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
# A typical version string looks like "10.2-RELEASE". # A typical version string looks like "10.2-RELEASE".
ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2) ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
OLD_ICONV = YesPlease OLD_ICONV = YesPlease
endif endif
ifeq ($(firstword $(subst -, ,$(uname_R))),10.0) ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
OLD_ICONV = YesPlease OLD_ICONV = YesPlease
endif endif
ifeq ($(firstword $(subst -, ,$(uname_R))),10.1) ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
OLD_ICONV = YesPlease OLD_ICONV = YesPlease
endif endif
NO_MEMMEM = YesPlease NO_MEMMEM = YesPlease
BASIC_CFLAGS += -I/usr/local/include BASIC_CFLAGS += -I/usr/local/include
BASIC_LDFLAGS += -L/usr/local/lib BASIC_LDFLAGS += -L/usr/local/lib
DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
USE_ST_TIMESPEC = YesPlease USE_ST_TIMESPEC = YesPlease
ifeq ($(shell expr "$(uname_R)" : '4\.'),2) ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
PTHREAD_LIBS = -pthread PTHREAD_LIBS = -pthread
NO_UINTMAX_T = YesPlease NO_UINTMAX_T = YesPlease
NO_STRTOUMAX = YesPlease NO_STRTOUMAX = YesPlease
endif endif
PYTHON_PATH = /usr/local/bin/python PYTHON_PATH = /usr/local/bin/python
PERL_PATH = /usr/local/bin/perl PERL_PATH = /usr/local/bin/perl
HAVE_PATHS_H = YesPlease HAVE_PATHS_H = YesPlease
@ -317,9 +317,9 @@ ifeq ($(uname_S),MirBSD)
CSPRNG_METHOD = arc4random CSPRNG_METHOD = arc4random
endif endif
ifeq ($(uname_S),NetBSD) ifeq ($(uname_S),NetBSD)
ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
NEEDS_LIBICONV = YesPlease NEEDS_LIBICONV = YesPlease
endif endif
BASIC_CFLAGS += -I/usr/pkg/include BASIC_CFLAGS += -I/usr/pkg/include
BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
USE_ST_TIMESPEC = YesPlease USE_ST_TIMESPEC = YesPlease
@ -343,14 +343,14 @@ ifeq ($(uname_S),AIX)
BASIC_CFLAGS += -D_LARGE_FILES BASIC_CFLAGS += -D_LARGE_FILES
FILENO_IS_A_MACRO = UnfortunatelyYes FILENO_IS_A_MACRO = UnfortunatelyYes
NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
ifeq ($(shell expr "$(uname_V)" : '[1234]'),1) ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
NO_PTHREADS = YesPlease NO_PTHREADS = YesPlease
else else
PTHREAD_LIBS = -lpthread PTHREAD_LIBS = -lpthread
endif endif
ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3) ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
INLINE = '' INLINE = ''
endif endif
GIT_TEST_CMP = cmp GIT_TEST_CMP = cmp
endif endif
ifeq ($(uname_S),GNU) ifeq ($(uname_S),GNU)
@ -410,29 +410,29 @@ ifeq ($(uname_S),HP-UX)
NO_SYS_SELECT_H = YesPlease NO_SYS_SELECT_H = YesPlease
SNPRINTF_RETURNS_BOGUS = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease
NO_NSEC = YesPlease NO_NSEC = YesPlease
ifeq ($(uname_R),B.11.00) ifeq ($(uname_R),B.11.00)
NO_INET_NTOP = YesPlease NO_INET_NTOP = YesPlease
NO_INET_PTON = YesPlease NO_INET_PTON = YesPlease
endif endif
ifeq ($(uname_R),B.10.20) ifeq ($(uname_R),B.10.20)
# Override HP-UX 11.x setting: # Override HP-UX 11.x setting:
INLINE = INLINE =
SOCKLEN_T = size_t SOCKLEN_T = size_t
NO_PREAD = YesPlease NO_PREAD = YesPlease
NO_INET_NTOP = YesPlease NO_INET_NTOP = YesPlease
NO_INET_PTON = YesPlease NO_INET_PTON = YesPlease
endif endif
GIT_TEST_CMP = cmp GIT_TEST_CMP = cmp
endif endif
ifeq ($(uname_S),Windows) ifeq ($(uname_S),Windows)
GIT_VERSION := $(GIT_VERSION).MSVC GIT_VERSION := $(GIT_VERSION).MSVC
pathsep = ; pathsep = ;
# Assume that this is built in Git for Windows' SDK # Assume that this is built in Git for Windows' SDK
ifeq (MINGW32,$(MSYSTEM)) ifeq (MINGW32,$(MSYSTEM))
prefix = /mingw32 prefix = /mingw32
else else
prefix = /mingw64 prefix = /mingw64
endif endif
# Prepend MSVC 64-bit tool-chain to PATH. # Prepend MSVC 64-bit tool-chain to PATH.
# #
# A regular Git Bash *does not* have cl.exe in its $PATH. As there is a # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
@ -550,16 +550,16 @@ ifeq ($(uname_S),Interix)
NO_MKDTEMP = YesPlease NO_MKDTEMP = YesPlease
NO_STRTOUMAX = YesPlease NO_STRTOUMAX = YesPlease
NO_NSEC = YesPlease NO_NSEC = YesPlease
ifeq ($(uname_R),3.5) ifeq ($(uname_R),3.5)
NO_INET_NTOP = YesPlease NO_INET_NTOP = YesPlease
NO_INET_PTON = YesPlease NO_INET_PTON = YesPlease
NO_SOCKADDR_STORAGE = YesPlease NO_SOCKADDR_STORAGE = YesPlease
endif endif
ifeq ($(uname_R),5.2) ifeq ($(uname_R),5.2)
NO_INET_NTOP = YesPlease NO_INET_NTOP = YesPlease
NO_INET_PTON = YesPlease NO_INET_PTON = YesPlease
NO_SOCKADDR_STORAGE = YesPlease NO_SOCKADDR_STORAGE = YesPlease
endif endif
endif endif
ifeq ($(uname_S),Minix) ifeq ($(uname_S),Minix)
NO_IPV6 = YesPlease NO_IPV6 = YesPlease
@ -579,12 +579,12 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
# still not compile in c89 mode, due to non-const array initializations. # still not compile in c89 mode, due to non-const array initializations.
CC = cc -c99 CC = cc -c99
# Build down-rev compatible objects that don't use our new getopt_long. # Build down-rev compatible objects that don't use our new getopt_long.
ifeq ($(uname_R).$(uname_V),J06.21) ifeq ($(uname_R).$(uname_V),J06.21)
CC += -WRVU=J06.20 CC += -WRVU=J06.20
endif endif
ifeq ($(uname_R).$(uname_V),L17.02) ifeq ($(uname_R).$(uname_V),L17.02)
CC += -WRVU=L16.05 CC += -WRVU=L16.05
endif endif
# Disable all optimization, seems to result in bad code, with -O or -O2 # Disable all optimization, seems to result in bad code, with -O or -O2
# or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
# abends on "git push". Needs more investigation. # abends on "git push". Needs more investigation.
@ -639,9 +639,9 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
SHELL_PATH = /usr/coreutils/bin/bash SHELL_PATH = /usr/coreutils/bin/bash
endif endif
ifeq ($(uname_S),MINGW) ifeq ($(uname_S),MINGW)
ifeq ($(shell expr "$(uname_R)" : '1\.'),2) ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
$(error "Building with MSys is no longer supported") $(error "Building with MSys is no longer supported")
endif endif
pathsep = ; pathsep = ;
HAVE_ALLOCA_H = YesPlease HAVE_ALLOCA_H = YesPlease
NO_PREAD = YesPlease NO_PREAD = YesPlease
@ -700,22 +700,22 @@ ifeq ($(uname_S),MINGW)
# Enable DEP # Enable DEP
BASIC_LDFLAGS += -Wl,--nxcompat BASIC_LDFLAGS += -Wl,--nxcompat
# Enable ASLR (unless debugging) # Enable ASLR (unless debugging)
ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS)))) ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
BASIC_LDFLAGS += -Wl,--dynamicbase BASIC_LDFLAGS += -Wl,--dynamicbase
endif endif
ifeq (MINGW32,$(MSYSTEM)) ifeq (MINGW32,$(MSYSTEM))
prefix = /mingw32 prefix = /mingw32
HOST_CPU = i686 HOST_CPU = i686
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
endif endif
ifeq (MINGW64,$(MSYSTEM)) ifeq (MINGW64,$(MSYSTEM))
prefix = /mingw64 prefix = /mingw64
HOST_CPU = x86_64 HOST_CPU = x86_64
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
else else
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware BASIC_LDFLAGS += -Wl,--large-address-aware
endif endif
CC = gcc CC = gcc
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \ COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
-fstack-protector-strong -fstack-protector-strong
@ -727,11 +727,11 @@ ifeq ($(uname_S),MINGW)
USE_GETTEXT_SCHEME = fallthrough USE_GETTEXT_SCHEME = fallthrough
USE_LIBPCRE = YesPlease USE_LIBPCRE = YesPlease
USE_NED_ALLOCATOR = YesPlease USE_NED_ALLOCATOR = YesPlease
ifeq (/mingw64,$(subst 32,64,$(prefix))) ifeq (/mingw64,$(subst 32,64,$(prefix)))
# Move system config into top-level /etc/ # Move system config into top-level /etc/
ETC_GITCONFIG = ../etc/gitconfig ETC_GITCONFIG = ../etc/gitconfig
ETC_GITATTRIBUTES = ../etc/gitattributes ETC_GITATTRIBUTES = ../etc/gitattributes
endif endif
endif endif
ifeq ($(uname_S),QNX) ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0 COMPAT_CFLAGS += -DSA_RESTART=0

View File

@ -107,12 +107,12 @@ endif
ifeq ($(uname_S),Darwin) ifeq ($(uname_S),Darwin)
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq ($(shell echo "$(uname_R)" | awk -F. '{if ($$1 >= 9) print "y"}')_$(shell test -d $(TKFRAMEWORK) || echo n),y_n) ifeq ($(shell echo "$(uname_R)" | awk -F. '{if ($$1 >= 9) print "y"}')_$(shell test -d $(TKFRAMEWORK) || echo n),y_n)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish.app TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq ($(shell test -d $(TKFRAMEWORK) || echo n),n) ifeq ($(shell test -d $(TKFRAMEWORK) || echo n),n)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
endif endif
endif endif
TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app) TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
endif endif
@ -143,9 +143,9 @@ ifeq ($(exedir),$(gg_libdir))
endif endif
gg_libdir_sed_in := $(gg_libdir) gg_libdir_sed_in := $(gg_libdir)
ifeq ($(uname_S),Darwin) ifeq ($(uname_S),Darwin)
ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y) ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
GITGUI_MACOSXAPP := YesPlease GITGUI_MACOSXAPP := YesPlease
endif endif
endif endif
ifneq (,$(findstring MINGW,$(uname_S))) ifneq (,$(findstring MINGW,$(uname_S)))
ifeq ($(shell expr "$(uname_R)" : '1\.'),2) ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
@ -220,9 +220,9 @@ ifdef NO_MSGFMT
MSGFMT ?= $(TCL_PATH) po/po2msg.sh MSGFMT ?= $(TCL_PATH) po/po2msg.sh
else else
MSGFMT ?= msgfmt MSGFMT ?= msgfmt
ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0) ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0)
MSGFMT := $(TCL_PATH) po/po2msg.sh MSGFMT := $(TCL_PATH) po/po2msg.sh
endif endif
endif endif
msgsdir = $(gg_libdir)/msgs msgsdir = $(gg_libdir)/msgs

View File

@ -33,9 +33,9 @@ ifdef NO_MSGFMT
MSGFMT ?= $(TCL_PATH) po/po2msg.sh MSGFMT ?= $(TCL_PATH) po/po2msg.sh
else else
MSGFMT ?= msgfmt MSGFMT ?= msgfmt
ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0) ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0)
MSGFMT := $(TCL_PATH) po/po2msg.sh MSGFMT := $(TCL_PATH) po/po2msg.sh
endif endif
endif endif
PO_TEMPLATE = po/gitk.pot PO_TEMPLATE = po/gitk.pot