summaryrefslogtreecommitdiff
path: root/config.mak.uname
diff options
context:
space:
mode:
Diffstat (limited to 'config.mak.uname')
-rw-r--r--config.mak.uname251
1 files changed, 213 insertions, 38 deletions
diff --git a/config.mak.uname b/config.mak.uname
index 85af9f9cf1..198ab1e58f 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -1,5 +1,9 @@
# Platform specific Makefile tweaks based on uname detection
+# Define NO_SAFESEH if you need MSVC/Visual Studio to ignore the lack of
+# Microsoft's Safe Exception Handling in libraries (such as zlib).
+# Typically required for VS2013+/32-bit compilation on Vista+ versions.
+
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
@@ -11,6 +15,21 @@ ifdef MSVC
# avoid the MingW and Cygwin configuration sections
uname_S := Windows
uname_O := Windows
+
+ # Generate and include makefile variables that point to the
+ # currently installed set of MSVC command line tools.
+compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
+ @"$<" | tr '\\' / >"$@"
+include compat/vcbuild/MSVC-DEFS-GEN
+
+ # See if vcpkg and the vcpkg-build versions of the third-party
+ # libraries that we use are installed. We include the result
+ # to get $(vcpkg_*) variables defined for the Makefile.
+ifeq (,$(SKIP_VCPKG))
+compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
+ @"$<"
+include compat/vcbuild/VCPKG-DEFS
+endif
endif
# We choose to avoid "if .. else if .. else .. endif endif"
@@ -114,6 +133,17 @@ ifeq ($(uname_S),Darwin)
HAVE_BSD_SYSCTL = YesPlease
FREAD_READS_DIRECTORIES = UnfortunatelyYes
HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
+
+ # Workaround for `gettext` being keg-only and not even being linked via
+ # `brew link --force gettext`, should be obsolete as of
+ # https://github.com/Homebrew/homebrew-core/pull/53489
+ ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
+ BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
+ 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)
+ MSGFMT = /usr/local/opt/gettext/bin/msgfmt
+ endif
+ endif
endif
ifeq ($(uname_S),SunOS)
NEEDS_SOCKET = YesPlease
@@ -187,7 +217,7 @@ ifeq ($(uname_O),Cygwin)
UNRELIABLE_FSTAT = UnfortunatelyYes
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
MMAP_PREVENTS_DELETE = UnfortunatelyYes
- COMPAT_OBJS += compat/cygwin.o
+ COMPAT_OBJS += compat/win32/path-utils.o
FREAD_READS_DIRECTORIES = UnfortunatelyYes
endif
ifeq ($(uname_S),FreeBSD)
@@ -216,11 +246,11 @@ ifeq ($(uname_S),FreeBSD)
PYTHON_PATH = /usr/local/bin/python
PERL_PATH = /usr/local/bin/perl
HAVE_PATHS_H = YesPlease
- GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
HAVE_BSD_SYSCTL = YesPlease
HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
PAGER_ENV = LESS=FRX LV=-c MORE=FRX
FREAD_READS_DIRECTORIES = UnfortunatelyYes
+ FILENO_IS_A_MACRO = UnfortunatelyYes
endif
ifeq ($(uname_S),OpenBSD)
NO_STRCASESTR = YesPlease
@@ -233,6 +263,8 @@ ifeq ($(uname_S),OpenBSD)
HAVE_BSD_SYSCTL = YesPlease
HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
PROCFS_EXECUTABLE_PATH = /proc/curproc/file
+ FREAD_READS_DIRECTORIES = UnfortunatelyYes
+ FILENO_IS_A_MACRO = UnfortunatelyYes
endif
ifeq ($(uname_S),MirBSD)
NO_STRCASESTR = YesPlease
@@ -266,6 +298,8 @@ ifeq ($(uname_S),AIX)
INTERNAL_QSORT = UnfortunatelyYes
NEEDS_LIBICONV = YesPlease
BASIC_CFLAGS += -D_LARGE_FILES
+ FILENO_IS_A_MACRO = UnfortunatelyYes
+ NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
NO_PTHREADS = YesPlease
else
@@ -282,6 +316,7 @@ ifeq ($(uname_S),GNU)
NO_STRLCPY = YesPlease
HAVE_PATHS_H = YesPlease
LIBC_CONTAINS_LIBINTL = YesPlease
+ FREAD_READS_DIRECTORIES = UnfortunatelyYes
endif
ifeq ($(uname_S),IRIX)
NO_SETENV = YesPlease
@@ -349,6 +384,19 @@ endif
ifeq ($(uname_S),Windows)
GIT_VERSION := $(GIT_VERSION).MSVC
pathsep = ;
+ # Assume that this is built in Git for Windows' SDK
+ ifeq (MINGW32,$(MSYSTEM))
+ prefix = /mingw32
+ else
+ prefix = /mingw64
+ endif
+ # Prepend MSVC 64-bit tool-chain to PATH.
+ #
+ # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
+ # link.exe next to, and required by, cl.exe, we have to prepend this
+ # onto the existing $PATH.
+ #
+ SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
HAVE_ALLOCA_H = YesPlease
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
@@ -361,11 +409,14 @@ ifeq ($(uname_S),Windows)
NO_STRCASESTR = YesPlease
NO_STRLCPY = YesPlease
NO_MEMMEM = YesPlease
- # NEEDS_LIBICONV = YesPlease
- NO_ICONV = YesPlease
+ NEEDS_LIBICONV = YesPlease
NO_STRTOUMAX = YesPlease
NO_MKDTEMP = YesPlease
- SNPRINTF_RETURNS_BOGUS = YesPlease
+ NO_INTTYPES_H = YesPlease
+ # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
+ # so we don't need this:
+ #
+ # SNPRINTF_RETURNS_BOGUS = YesPlease
NO_SVN_TESTS = YesPlease
RUNTIME_PREFIX = YesPlease
HAVE_WPGMPTR = YesWeDo
@@ -378,7 +429,6 @@ ifeq ($(uname_S),Windows)
NO_REGEX = YesPlease
NO_GETTEXT = YesPlease
NO_PYTHON = YesPlease
- BLK_SHA1 = YesPlease
ETAGS_TARGET = ETAGS
NO_POSIX_GOODIES = UnfortunatelyYes
NATIVE_CRLF = YesPlease
@@ -387,23 +437,51 @@ ifeq ($(uname_S),Windows)
CC = compat/vcbuild/scripts/clink.pl
AR = compat/vcbuild/scripts/lib.pl
CFLAGS =
- BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
+ BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
+ compat/win32/path-utils.o \
compat/win32/pthread.o compat/win32/syslog.o \
+ compat/win32/trace2_win32_process_info.o \
compat/win32/dirent.o
- COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
- BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
- EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
+ COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
+ BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
+ # invalidcontinue.obj allows Git's source code to close the same file
+ # handle twice, or to access the osfhandle of an already-closed stdout
+ # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
+ EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
PTHREAD_LIBS =
lib =
+ BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
ifndef DEBUG
- BASIC_CFLAGS += -GL -Os -MD
- BASIC_LDFLAGS += -LTCG
+ BASIC_CFLAGS += $(vcpkg_rel_lib)
+else
+ BASIC_CFLAGS += $(vcpkg_dbg_lib)
+endif
+ BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
+
+ifneq ($(USE_MSVC_CRTDBG),)
+ # Optionally enable memory leak reporting.
+ BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
+endif
+ # Always give "-Zi" to the compiler and "-debug" to linker (even in
+ # release mode) to force a PDB to be generated (like RelWithDebInfo).
+ BASIC_CFLAGS += -Zi
+ BASIC_LDFLAGS += -debug -Zf
+
+ifdef NO_SAFESEH
+ LDFLAGS += -SAFESEH:NO
+endif
+
+ifndef DEBUG
+ BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
+ BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
AR += -LTCG
else
- BASIC_CFLAGS += -Zi -MDd
+ BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
endif
X = .exe
+
+compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
endif
ifeq ($(uname_S),Interix)
NO_INITGROUPS = YesPlease
@@ -440,26 +518,38 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
# INLINE='' would just replace one set of warnings with another and
# still not compile in c89 mode, due to non-const array initializations.
CC = cc -c99
+ # Build down-rev compatible objects that don't use our new getopt_long.
+ ifeq ($(uname_R).$(uname_V),J06.21)
+ CC += -WRVU=J06.20
+ endif
+ ifeq ($(uname_R).$(uname_V),L17.02)
+ CC += -WRVU=L16.05
+ endif
# 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
# abends on "git push". Needs more investigation.
- CFLAGS = -g -O0
+ CFLAGS = -g -O0 -Winline
# We'd want it to be here.
prefix = /usr/local
- # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
- PERL_PATH = ${prefix}/bin/perl
- PYTHON_PATH = ${prefix}/bin/python
-
- # As detected by './configure'.
- # Missdetected, hence commented out, see below.
- #NO_CURL = YesPlease
- # Added manually, see above.
+ # perl and python must be in /usr/bin on NonStop - supplied by HPE
+ # with operating system in that managed directory.
+ PERL_PATH = /usr/bin/perl
+ PYTHON_PATH = /usr/bin/python
+ # The current /usr/coreutils/rm at lowest support level does not work
+ # with the git test structure. Long paths as in
+ # 'trash directory...' cause rm to terminate prematurely without fully
+ # removing the directory at OS releases J06.21 and L17.02.
+ # Default to the older rm until those two releases are deprecated.
+ RM = /bin/rm -f
+ NEEDS_CRYPTO_WITH_SSL = YesPlease
+ HAVE_DEV_TTY = YesPlease
HAVE_LIBCHARSET_H = YesPlease
HAVE_STRINGS_H = YesPlease
NEEDS_LIBICONV = YesPlease
NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
NO_SYS_SELECT_H = UnfortunatelyYes
NO_D_TYPE_IN_DIRENT = YesPlease
+ NO_GETTEXT = YesPlease
NO_HSTRERROR = YesPlease
NO_STRCASESTR = YesPlease
NO_MEMMEM = YesPlease
@@ -469,8 +559,9 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
NO_MKDTEMP = YesPlease
# Currently libiconv-1.9.1.
OLD_ICONV = UnfortunatelyYes
- NO_REGEX = YesPlease
+ NO_REGEX = NeedsStartEnd
NO_PTHREADS = UnfortunatelyYes
+ FREAD_READS_DIRECTORIES = UnfortunatelyYes
# Not detected (nor checked for) by './configure'.
# We don't have SA_RESTART on NonStop, unfortunalety.
@@ -483,14 +574,8 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
NO_MMAP = YesPlease
NO_POLL = YesPlease
NO_INTPTR_T = UnfortunatelyYes
- # Bug report 10-120822-4477 submitted to HP NonStop development.
- MKDIR_WO_TRAILING_SLASH = YesPlease
- # RFE 10-120912-4693 submitted to HP NonStop development.
- NO_SETITIMER = UnfortunatelyYes
SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
- SHELL_PATH = /usr/local/bin/bash
- # as of H06.25/J06.14, we might better use this
- #SHELL_PATH = /usr/coreutils/bin/bash
+ SHELL_PATH = /usr/coreutils/bin/bash
endif
ifneq (,$(findstring MINGW,$(uname_S)))
pathsep = ;
@@ -509,7 +594,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_STRTOUMAX = YesPlease
NO_MKDTEMP = YesPlease
NO_SVN_TESTS = YesPlease
- NO_PERL_MAKEMAKER = YesPlease
RUNTIME_PREFIX = YesPlease
HAVE_WPGMPTR = YesWeDo
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
@@ -523,9 +607,12 @@ ifneq (,$(findstring MINGW,$(uname_S)))
ETAGS_TARGET = ETAGS
NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html
+ BASIC_LDFLAGS += -municode
COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
+ compat/win32/trace2_win32_process_info.o \
+ compat/win32/path-utils.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
BASIC_CFLAGS += -DWIN32
@@ -535,35 +622,43 @@ ifneq (,$(findstring MINGW,$(uname_S)))
RC = windres -O coff
NATIVE_CRLF = YesPlease
X = .exe
- SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
htmldir = doc/git/html/
prefix =
INSTALL = /bin/install
EXTLIBS += /mingw/lib/libz.a
- NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
- COMPAT_CLFAGS += -D__USE_MINGW_ACCESS
+ COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
else
- ifeq ($(shell expr "$(uname_R)" : '2\.'),2)
+ ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
# MSys2
prefix = /usr/
+ # Enable DEP
+ BASIC_LDFLAGS += -Wl,--nxcompat
+ # Enable ASLR (unless debugging)
+ ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
+ BASIC_LDFLAGS += -Wl,--dynamicbase
+ endif
ifeq (MINGW32,$(MSYSTEM))
prefix = /mingw32
+ HOST_CPU = i686
+ BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
endif
ifeq (MINGW64,$(MSYSTEM))
prefix = /mingw64
+ HOST_CPU = x86_64
+ BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
else
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware
endif
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
EXTLIBS += -lntdll
INSTALL = /bin/install
- NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT =
@@ -589,7 +684,87 @@ ifeq ($(uname_S),QNX)
NO_MKDTEMP = YesPlease
NO_NSEC = YesPlease
NO_PTHREADS = YesPlease
- NO_R_TO_GCC_LINKER = YesPlease
NO_STRCASESTR = YesPlease
NO_STRLCPY = YesPlease
endif
+
+vcxproj:
+ # Require clean work tree
+ git update-index -q --refresh && \
+ git diff-files --quiet && \
+ git diff-index --cached --quiet HEAD --
+
+ # Make .vcxproj files and add them
+ unset QUIET_GEN QUIET_BUILT_IN; \
+ perl contrib/buildsystems/generate -g Vcxproj
+ git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+
+ # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
+ (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
+ echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
+ for name in $(BUILT_INS);\
+ do \
+ echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
+ done && \
+ echo ' </Target>' && \
+ echo '</Project>') >git/LinkOrCopyBuiltins.targets
+ (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
+ echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
+ for name in $(REMOTE_CURL_ALIASES); \
+ do \
+ echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
+ done && \
+ echo ' </Target>' && \
+ echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
+ git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
+
+ # Add command-list.h and config-list.h
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 config-list.h command-list.h
+ git add -f config-list.h command-list.h
+
+ # Add scripts
+ rm -f perl/perl.mak
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
+ # Strip out the sane tool path, needed only for building
+ sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
+ git add -f $(SCRIPT_LIB) $(SCRIPTS)
+
+ # Add Perl module
+ $(MAKE) $(LIB_PERL_GEN)
+ git add -f perl/build
+
+ # Add bin-wrappers, for testing
+ rm -rf bin-wrappers/
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
+ # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
+ # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
+ # by test-lib.sh according to the current setup)
+ sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
+ \1="$$(cygpath -u "$$\1")"/' \
+ -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
+ # Ensure that test-* helpers find the .dll files copied to top-level
+ sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
+ # We do not want to force hard-linking builtins
+ sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
+ bin-wrappers/git-{receive-pack,upload-archive}
+ git add -f $(test_bindir_programs)
+ # remote-ext is a builtin, but invoked as if it were external
+ sed 's|receive-pack|remote-ext|g' \
+ <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
+ git add -f bin-wrappers/git-remote-ext
+
+ # Add templates
+ $(MAKE) -C templates
+ git add -f templates/boilerplates.made templates/blt/
+
+ # Add the translated messages
+ make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
+ git add -f $(MOFILES)
+
+ # Add build options
+ $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
+ git add -f GIT-BUILD-OPTIONS
+
+ # Commit the whole shebang
+ git commit -m "Generate Visual Studio solution" \
+ -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"