1 # Platform specific Makefile tweaks based on uname detection
3 # Define NO_SAFESEH if you need MSVC/Visual Studio to ignore the lack of
4 # Microsoft's Safe Exception Handling in libraries (such as zlib).
5 # Typically required for VS2013+/32-bit compilation on Vista+ versions.
7 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
8 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
9 uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
10 uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
11 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
12 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
14 ifneq ($(findstring MINGW,$(uname_S)),)
19 # avoid the MingW and Cygwin configuration sections
23 # Generate and include makefile variables that point to the
24 # currently installed set of MSVC command line tools.
25 compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
26 @"$<" | tr '\\' / >"$@"
27 include compat/vcbuild/MSVC-DEFS-GEN
29 # See if vcpkg and the vcpkg-build versions of the third-party
30 # libraries that we use are installed. We include the result
31 # to get $(vcpkg_*) variables defined for the Makefile.
33 compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
35 include compat/vcbuild/VCPKG-DEFS
39 # We choose to avoid "if .. else if .. else .. endif endif"
40 # because maintaining the nesting to match is a pain. If
41 # we had "elif" things would have been much nicer...
43 ifeq ($(uname_S),OSF1)
44 # Need this for u_short definitions et al
45 BASIC_CFLAGS += -D_OSF_SOURCE
47 NO_STRTOULL = YesPlease
50 ifeq ($(uname_S),Linux)
51 HAVE_ALLOCA_H = YesPlease
52 NO_STRLCPY = YesPlease
53 HAVE_PATHS_H = YesPlease
54 LIBC_CONTAINS_LIBINTL = YesPlease
55 HAVE_DEV_TTY = YesPlease
56 HAVE_CLOCK_GETTIME = YesPlease
57 HAVE_CLOCK_MONOTONIC = YesPlease
58 # -lrt is needed for clock_gettime on glibc <= 2.16
59 NEEDS_LIBRT = YesPlease
60 HAVE_GETDELIM = YesPlease
61 FREAD_READS_DIRECTORIES = UnfortunatelyYes
62 BASIC_CFLAGS += -DHAVE_SYSINFO
63 PROCFS_EXECUTABLE_PATH = /proc/self/exe
64 HAVE_PLATFORM_PROCINFO = YesPlease
65 COMPAT_OBJS += compat/linux/procinfo.o
66 # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
67 ifneq ($(findstring .el7.,$(uname_R)),)
68 BASIC_CFLAGS += -std=c99
71 ifeq ($(uname_S),GNU/kFreeBSD)
72 HAVE_ALLOCA_H = YesPlease
73 NO_STRLCPY = YesPlease
74 HAVE_PATHS_H = YesPlease
75 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
76 LIBC_CONTAINS_LIBINTL = YesPlease
77 FREAD_READS_DIRECTORIES = UnfortunatelyYes
79 ifeq ($(uname_S),UnixWare)
81 NEEDS_SOCKET = YesPlease
83 NEEDS_SSL_WITH_CRYPTO = YesPlease
84 NEEDS_LIBICONV = YesPlease
85 SHELL_PATH = /usr/local/bin/bash
87 NO_HSTRERROR = YesPlease
88 BASIC_CFLAGS += -Kthread
89 BASIC_CFLAGS += -I/usr/local/include
90 BASIC_LDFLAGS += -L/usr/local/lib
93 NO_STRCASESTR = YesPlease
96 ifeq ($(uname_S),SCO_SV)
102 BASIC_CFLAGS += -Kthread
104 NEEDS_SOCKET = YesPlease
105 NEEDS_NSL = YesPlease
106 NEEDS_SSL_WITH_CRYPTO = YesPlease
107 NEEDS_LIBICONV = YesPlease
108 SHELL_PATH = /usr/bin/bash
110 NO_HSTRERROR = YesPlease
111 BASIC_CFLAGS += -I/usr/local/include
112 BASIC_LDFLAGS += -L/usr/local/lib
113 NO_STRCASESTR = YesPlease
114 NO_MEMMEM = YesPlease
118 ifeq ($(uname_S),Darwin)
119 NEEDS_CRYPTO_WITH_SSL = YesPlease
120 NEEDS_SSL_WITH_CRYPTO = YesPlease
121 NEEDS_LIBICONV = YesPlease
122 # Note: $(uname_R) gives us the underlying Darwin version.
123 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
124 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
125 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
126 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
127 OLD_ICONV = UnfortunatelyYes
128 NO_APPLE_COMMON_CRYPTO = YesPlease
130 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
131 NO_STRLCPY = YesPlease
133 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
134 HAVE_GETDELIM = YesPlease
136 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
137 OPEN_RETURNS_EINTR = UnfortunatelyYes
139 NO_MEMMEM = YesPlease
140 USE_ST_TIMESPEC = YesPlease
141 HAVE_DEV_TTY = YesPlease
142 COMPAT_OBJS += compat/precompose_utf8.o
143 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
144 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
145 HAVE_BSD_SYSCTL = YesPlease
146 FREAD_READS_DIRECTORIES = UnfortunatelyYes
147 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
148 CSPRNG_METHOD = arc4random
150 # Workaround for `gettext` being keg-only and not even being linked via
151 # `brew link --force gettext`, should be obsolete as of
152 # https://github.com/Homebrew/homebrew-core/pull/53489
153 ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
154 BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
155 BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
156 ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
157 MSGFMT = /usr/local/opt/gettext/bin/msgfmt
161 # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
162 # Unix domain sockets and PThreads.
164 ifndef NO_UNIX_SOCKETS
165 FSMONITOR_DAEMON_BACKEND = darwin
169 BASIC_LDFLAGS += -framework CoreServices
171 ifeq ($(uname_S),SunOS)
172 NEEDS_SOCKET = YesPlease
173 NEEDS_NSL = YesPlease
174 SHELL_PATH = /bin/bash
175 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
176 HAVE_ALLOCA_H = YesPlease
177 NO_STRCASESTR = YesPlease
178 NO_MEMMEM = YesPlease
179 NO_MKDTEMP = YesPlease
181 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
182 HAVE_DEV_TTY = YesPlease
183 ifeq ($(uname_R),5.6)
185 NO_HSTRERROR = YesPlease
187 NO_SOCKADDR_STORAGE = YesPlease
188 NO_UNSETENV = YesPlease
189 NO_SETENV = YesPlease
190 NO_STRLCPY = YesPlease
191 NO_STRTOUMAX = YesPlease
194 ifeq ($(uname_R),5.7)
195 NEEDS_RESOLV = YesPlease
197 NO_SOCKADDR_STORAGE = YesPlease
198 NO_UNSETENV = YesPlease
199 NO_SETENV = YesPlease
200 NO_STRLCPY = YesPlease
201 NO_STRTOUMAX = YesPlease
204 ifeq ($(uname_R),5.8)
205 NO_UNSETENV = YesPlease
206 NO_SETENV = YesPlease
207 NO_STRTOUMAX = YesPlease
210 ifeq ($(uname_R),5.9)
211 NO_UNSETENV = YesPlease
212 NO_SETENV = YesPlease
213 NO_STRTOUMAX = YesPlease
216 INSTALL = /usr/ucb/install
218 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
220 ifeq ($(uname_O),Cygwin)
221 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
222 NO_D_TYPE_IN_DIRENT = YesPlease
223 NO_STRCASESTR = YesPlease
224 NO_MEMMEM = YesPlease
225 NO_SYMLINK_HEAD = YesPlease
227 OLD_ICONV = UnfortunatelyYes
228 # There are conflicting reports about this.
229 # On some boxes NO_MMAP is needed, and not so elsewhere.
230 # Try commenting this out if you suspect MMAP is more efficient
233 NO_REGEX = UnfortunatelyYes
235 HAVE_ALLOCA_H = YesPlease
236 NEEDS_LIBICONV = YesPlease
237 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
238 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
240 UNRELIABLE_FSTAT = UnfortunatelyYes
241 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
242 MMAP_PREVENTS_DELETE = UnfortunatelyYes
243 COMPAT_OBJS += compat/win32/path-utils.o
244 FREAD_READS_DIRECTORIES = UnfortunatelyYes
246 ifeq ($(uname_S),FreeBSD)
247 NEEDS_LIBICONV = YesPlease
248 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
249 # A typical version string looks like "10.2-RELEASE".
250 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
251 OLD_ICONV = YesPlease
253 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
254 OLD_ICONV = YesPlease
256 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
257 OLD_ICONV = YesPlease
259 NO_MEMMEM = YesPlease
260 BASIC_CFLAGS += -I/usr/local/include
261 BASIC_LDFLAGS += -L/usr/local/lib
262 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
263 USE_ST_TIMESPEC = YesPlease
264 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
265 PTHREAD_LIBS = -pthread
266 NO_UINTMAX_T = YesPlease
267 NO_STRTOUMAX = YesPlease
269 PYTHON_PATH = /usr/local/bin/python
270 PERL_PATH = /usr/local/bin/perl
271 HAVE_PATHS_H = YesPlease
272 HAVE_BSD_SYSCTL = YesPlease
273 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
274 CSPRNG_METHOD = arc4random
275 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
276 FREAD_READS_DIRECTORIES = UnfortunatelyYes
277 FILENO_IS_A_MACRO = UnfortunatelyYes
279 ifeq ($(uname_S),OpenBSD)
280 NO_STRCASESTR = YesPlease
281 NO_MEMMEM = YesPlease
282 USE_ST_TIMESPEC = YesPlease
283 NEEDS_LIBICONV = YesPlease
284 BASIC_CFLAGS += -I/usr/local/include
285 BASIC_LDFLAGS += -L/usr/local/lib
286 HAVE_PATHS_H = YesPlease
287 HAVE_BSD_SYSCTL = YesPlease
288 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
289 CSPRNG_METHOD = arc4random
290 PROCFS_EXECUTABLE_PATH = /proc/curproc/file
291 FREAD_READS_DIRECTORIES = UnfortunatelyYes
292 FILENO_IS_A_MACRO = UnfortunatelyYes
294 ifeq ($(uname_S),MirBSD)
295 NO_STRCASESTR = YesPlease
296 NO_MEMMEM = YesPlease
297 USE_ST_TIMESPEC = YesPlease
298 NEEDS_LIBICONV = YesPlease
299 HAVE_PATHS_H = YesPlease
300 HAVE_BSD_SYSCTL = YesPlease
301 CSPRNG_METHOD = arc4random
303 ifeq ($(uname_S),NetBSD)
304 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
305 NEEDS_LIBICONV = YesPlease
307 BASIC_CFLAGS += -I/usr/pkg/include
308 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
309 USE_ST_TIMESPEC = YesPlease
310 HAVE_PATHS_H = YesPlease
311 HAVE_BSD_SYSCTL = YesPlease
312 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
313 CSPRNG_METHOD = arc4random
314 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
316 ifeq ($(uname_S),AIX)
318 NO_STRCASESTR = YesPlease
319 NO_MEMMEM = YesPlease
320 NO_MKDTEMP = YesPlease
321 NO_STRLCPY = YesPlease
323 NO_REGEX = NeedsStartEnd
324 FREAD_READS_DIRECTORIES = UnfortunatelyYes
325 INTERNAL_QSORT = UnfortunatelyYes
326 NEEDS_LIBICONV = YesPlease
327 BASIC_CFLAGS += -D_LARGE_FILES
328 FILENO_IS_A_MACRO = UnfortunatelyYes
329 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
330 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
331 NO_PTHREADS = YesPlease
333 PTHREAD_LIBS = -lpthread
335 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
340 ifeq ($(uname_S),GNU)
342 HAVE_ALLOCA_H = YesPlease
343 NO_STRLCPY = YesPlease
344 HAVE_PATHS_H = YesPlease
345 LIBC_CONTAINS_LIBINTL = YesPlease
346 FREAD_READS_DIRECTORIES = UnfortunatelyYes
348 ifeq ($(uname_S),IRIX)
349 NO_SETENV = YesPlease
350 NO_UNSETENV = YesPlease
351 NO_STRCASESTR = YesPlease
352 NO_MEMMEM = YesPlease
353 NO_MKDTEMP = YesPlease
354 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
355 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
356 # git dies with a segmentation fault when trying to access the first
357 # entry of a reflog. The conservative choice is made to always set
358 # NO_MMAP. If you suspect that your compiler is not affected by this
359 # issue, comment out the NO_MMAP statement.
362 SNPRINTF_RETURNS_BOGUS = YesPlease
363 SHELL_PATH = /usr/gnu/bin/bash
364 NEEDS_LIBGEN = YesPlease
366 ifeq ($(uname_S),IRIX64)
367 NO_SETENV = YesPlease
368 NO_UNSETENV = YesPlease
369 NO_STRCASESTR = YesPlease
370 NO_MEMMEM = YesPlease
371 NO_MKDTEMP = YesPlease
372 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
373 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
374 # git dies with a segmentation fault when trying to access the first
375 # entry of a reflog. The conservative choice is made to always set
376 # NO_MMAP. If you suspect that your compiler is not affected by this
377 # issue, comment out the NO_MMAP statement.
380 SNPRINTF_RETURNS_BOGUS = YesPlease
381 SHELL_PATH = /usr/gnu/bin/bash
382 NEEDS_LIBGEN = YesPlease
384 ifeq ($(uname_S),HP-UX)
387 NO_SETENV = YesPlease
388 NO_STRCASESTR = YesPlease
389 NO_MEMMEM = YesPlease
390 NO_STRLCPY = YesPlease
391 NO_MKDTEMP = YesPlease
392 NO_UNSETENV = YesPlease
393 NO_HSTRERROR = YesPlease
394 NO_SYS_SELECT_H = YesPlease
395 SNPRINTF_RETURNS_BOGUS = YesPlease
397 ifeq ($(uname_R),B.11.00)
398 NO_INET_NTOP = YesPlease
399 NO_INET_PTON = YesPlease
401 ifeq ($(uname_R),B.10.20)
402 # Override HP-UX 11.x setting:
406 NO_INET_NTOP = YesPlease
407 NO_INET_PTON = YesPlease
411 ifeq ($(uname_S),Windows)
412 GIT_VERSION := $(GIT_VERSION).MSVC
414 # Assume that this is built in Git for Windows' SDK
415 ifeq (MINGW32,$(MSYSTEM))
420 # Prepend MSVC 64-bit tool-chain to PATH.
422 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
423 # link.exe next to, and required by, cl.exe, we have to prepend this
424 # onto the existing $PATH.
426 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
427 HAVE_ALLOCA_H = YesPlease
429 NEEDS_CRYPTO_WITH_SSL = YesPlease
430 NO_LIBGEN_H = YesPlease
432 NO_SYMLINK_HEAD = YesPlease
434 NO_UNIX_SOCKETS = YesPlease
435 NO_SETENV = YesPlease
436 NO_STRCASESTR = YesPlease
437 NO_STRLCPY = YesPlease
438 NO_MEMMEM = YesPlease
439 NEEDS_LIBICONV = YesPlease
440 NO_STRTOUMAX = YesPlease
441 NO_MKDTEMP = YesPlease
442 NO_INTTYPES_H = YesPlease
443 CSPRNG_METHOD = rtlgenrandom
444 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
445 # so we don't need this:
447 # SNPRINTF_RETURNS_BOGUS = YesPlease
449 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
450 # These are always available, so we do not have to conditionally
452 FSMONITOR_DAEMON_BACKEND = win32
453 NO_SVN_TESTS = YesPlease
454 RUNTIME_PREFIX = YesPlease
455 HAVE_WPGMPTR = YesWeDo
456 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
457 USE_WIN32_IPC = YesPlease
458 USE_WIN32_MMAP = YesPlease
459 MMAP_PREVENTS_DELETE = UnfortunatelyYes
460 # USE_NED_ALLOCATOR = YesPlease
461 UNRELIABLE_FSTAT = UnfortunatelyYes
462 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
464 NO_GETTEXT = YesPlease
465 NO_PYTHON = YesPlease
467 NO_POSIX_GOODIES = UnfortunatelyYes
468 NATIVE_CRLF = YesPlease
469 DEFAULT_HELP_FORMAT = html
470 ifeq (/mingw64,$(subst 32,64,$(prefix)))
471 # Move system config into top-level /etc/
472 ETC_GITCONFIG = ../etc/gitconfig
473 ETC_GITATTRIBUTES = ../etc/gitattributes
476 CC = compat/vcbuild/scripts/clink.pl
477 AR = compat/vcbuild/scripts/lib.pl
479 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
480 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
481 compat/win32/path-utils.o \
482 compat/win32/pthread.o compat/win32/syslog.o \
483 compat/win32/trace2_win32_process_info.o \
484 compat/win32/dirent.o
485 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
486 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
487 # invalidcontinue.obj allows Git's source code to close the same file
488 # handle twice, or to access the osfhandle of an already-closed stdout
489 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
490 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
493 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
495 BASIC_CFLAGS += $(vcpkg_rel_lib)
497 BASIC_CFLAGS += $(vcpkg_dbg_lib)
499 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
501 ifneq ($(USE_MSVC_CRTDBG),)
502 # Optionally enable memory leak reporting.
503 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
505 # Always give "-Zi" to the compiler and "-debug" to linker (even in
506 # release mode) to force a PDB to be generated (like RelWithDebInfo).
508 BASIC_LDFLAGS += -debug -Zf
511 LDFLAGS += -SAFESEH:NO
515 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
516 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
519 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
523 compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
525 ifeq ($(uname_S),Interix)
526 NO_INITGROUPS = YesPlease
528 NO_MEMMEM = YesPlease
529 NO_MKDTEMP = YesPlease
530 NO_STRTOUMAX = YesPlease
532 ifeq ($(uname_R),3.5)
533 NO_INET_NTOP = YesPlease
534 NO_INET_PTON = YesPlease
535 NO_SOCKADDR_STORAGE = YesPlease
537 ifeq ($(uname_R),5.2)
538 NO_INET_NTOP = YesPlease
539 NO_INET_PTON = YesPlease
540 NO_SOCKADDR_STORAGE = YesPlease
543 ifeq ($(uname_S),Minix)
545 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
548 NEEDS_CRYPTO_WITH_SSL = YesPlease
550 NO_HSTRERROR = YesPlease
555 ifeq ($(uname_S),NONSTOP_KERNEL)
556 # Needs some C99 features, "inline" is just one of them.
557 # INLINE='' would just replace one set of warnings with another and
558 # still not compile in c89 mode, due to non-const array initializations.
560 # Build down-rev compatible objects that don't use our new getopt_long.
561 ifeq ($(uname_R).$(uname_V),J06.21)
564 ifeq ($(uname_R).$(uname_V),L17.02)
567 # Disable all optimization, seems to result in bad code, with -O or -O2
568 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
569 # abends on "git push". Needs more investigation.
570 CFLAGS = -g -O0 -Winline
571 # We'd want it to be here.
573 # perl and python must be in /usr/bin on NonStop - supplied by HPE
574 # with operating system in that managed directory.
575 PERL_PATH = /usr/bin/perl
576 PYTHON_PATH = /usr/bin/python
577 # The current /usr/coreutils/rm at lowest support level does not work
578 # with the git test structure. Long paths as in
579 # 'trash directory...' cause rm to terminate prematurely without fully
580 # removing the directory at OS releases J06.21 and L17.02.
581 # Default to the older rm until those two releases are deprecated.
583 NEEDS_CRYPTO_WITH_SSL = YesPlease
584 HAVE_DEV_TTY = YesPlease
585 HAVE_LIBCHARSET_H = YesPlease
586 HAVE_STRINGS_H = YesPlease
587 NEEDS_LIBICONV = YesPlease
588 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
589 NO_SYS_SELECT_H = UnfortunatelyYes
590 NO_D_TYPE_IN_DIRENT = YesPlease
591 NO_GETTEXT = YesPlease
592 NO_HSTRERROR = YesPlease
593 NO_STRCASESTR = YesPlease
594 NO_MEMMEM = YesPlease
595 NO_STRLCPY = YesPlease
596 NO_SETENV = YesPlease
597 NO_UNSETENV = YesPlease
598 NO_MKDTEMP = YesPlease
599 # Currently libiconv-1.9.1.
600 OLD_ICONV = UnfortunatelyYes
601 NO_REGEX = NeedsStartEnd
602 NO_PTHREADS = UnfortunatelyYes
603 FREAD_READS_DIRECTORIES = UnfortunatelyYes
605 # Not detected (nor checked for) by './configure'.
606 # We don't have SA_RESTART on NonStop, unfortunalety.
607 COMPAT_CFLAGS += -DSA_RESTART=0
608 # Apparently needed in compat/fnmatch/fnmatch.c.
609 COMPAT_CFLAGS += -DHAVE_STRING_H=1
610 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
615 NO_INTPTR_T = UnfortunatelyYes
616 CSPRNG_METHOD = openssl
617 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
618 SHELL_PATH = /usr/coreutils/bin/bash
620 ifeq ($(uname_S),MINGW)
622 HAVE_ALLOCA_H = YesPlease
624 NEEDS_CRYPTO_WITH_SSL = YesPlease
625 NO_LIBGEN_H = YesPlease
627 NO_SYMLINK_HEAD = YesPlease
628 NO_UNIX_SOCKETS = YesPlease
629 NO_SETENV = YesPlease
630 NO_STRCASESTR = YesPlease
631 NO_STRLCPY = YesPlease
632 NO_MEMMEM = YesPlease
633 NEEDS_LIBICONV = YesPlease
634 NO_STRTOUMAX = YesPlease
635 NO_MKDTEMP = YesPlease
636 NO_SVN_TESTS = YesPlease
638 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
639 # These are always available, so we do not have to conditionally
641 FSMONITOR_DAEMON_BACKEND = win32
642 RUNTIME_PREFIX = YesPlease
643 HAVE_WPGMPTR = YesWeDo
644 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
645 USE_WIN32_IPC = YesPlease
646 USE_WIN32_MMAP = YesPlease
647 MMAP_PREVENTS_DELETE = UnfortunatelyYes
648 USE_NED_ALLOCATOR = YesPlease
649 UNRELIABLE_FSTAT = UnfortunatelyYes
650 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
652 NO_PYTHON = YesPlease
654 NO_POSIX_GOODIES = UnfortunatelyYes
655 DEFAULT_HELP_FORMAT = html
656 HAVE_PLATFORM_PROCINFO = YesPlease
657 CSPRNG_METHOD = rtlgenrandom
658 BASIC_LDFLAGS += -municode
659 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
660 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
661 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
662 compat/win32/trace2_win32_process_info.o \
663 compat/win32/path-utils.o \
664 compat/win32/pthread.o compat/win32/syslog.o \
665 compat/win32/dirent.o
666 BASIC_CFLAGS += -DWIN32
671 NATIVE_CRLF = YesPlease
673 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
674 htmldir = doc/git/html/
676 INSTALL = /bin/install
677 EXTLIBS += /mingw/lib/libz.a
678 INTERNAL_QSORT = YesPlease
679 HAVE_LIBCHARSET_H = YesPlease
680 NO_GETTEXT = YesPlease
681 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
683 ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
687 BASIC_LDFLAGS += -Wl,--nxcompat
688 # Enable ASLR (unless debugging)
689 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
690 BASIC_LDFLAGS += -Wl,--dynamicbase
692 ifeq (MINGW32,$(MSYSTEM))
695 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
697 ifeq (MINGW64,$(MSYSTEM))
700 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
702 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
703 BASIC_LDFLAGS += -Wl,--large-address-aware
706 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
707 -fstack-protector-strong
709 INSTALL = /bin/install
710 INTERNAL_QSORT = YesPlease
711 HAVE_LIBCHARSET_H = YesPlease
713 USE_GETTEXT_SCHEME = fallthrough
714 USE_LIBPCRE = YesPlease
716 USE_NED_ALLOCATOR = YesPlease
717 ifeq (/mingw64,$(subst 32,64,$(prefix)))
718 # Move system config into top-level /etc/
719 ETC_GITCONFIG = ../etc/gitconfig
720 ETC_GITATTRIBUTES = ../etc/gitattributes
723 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
728 ifeq ($(uname_S),QNX)
729 COMPAT_CFLAGS += -DSA_RESTART=0
730 EXPAT_NEEDS_XMLPARSE_H = YesPlease
731 HAVE_STRINGS_H = YesPlease
732 NEEDS_SOCKET = YesPlease
733 NO_GETPAGESIZE = YesPlease
735 NO_MEMMEM = YesPlease
736 NO_MKDTEMP = YesPlease
738 NO_PTHREADS = YesPlease
739 NO_STRCASESTR = YesPlease
740 NO_STRLCPY = YesPlease
744 # Require clean work tree
745 git update-index -q --refresh && \
746 git diff-files --quiet && \
747 git diff-index --cached --quiet HEAD --
749 # Make .vcxproj files and add them
750 unset QUIET_GEN QUIET_BUILT_IN; \
751 perl contrib/buildsystems/generate -g Vcxproj
752 git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
754 # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
755 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
756 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
757 for name in $(BUILT_INS);\
759 echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
761 echo ' </Target>' && \
762 echo '</Project>') >git/LinkOrCopyBuiltins.targets
763 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
764 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
765 for name in $(REMOTE_CURL_ALIASES); \
767 echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
769 echo ' </Target>' && \
770 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
771 git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
773 # Add generated headers
774 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
775 git add -f $(GENERATED_H)
779 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
780 # Strip out the sane tool path, needed only for building
781 sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
782 git add -f $(SCRIPT_LIB) $(SCRIPTS)
785 $(MAKE) $(LIB_PERL_GEN)
786 git add -f perl/build
788 # Add bin-wrappers, for testing
790 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
791 # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
792 # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
793 # by test-lib.sh according to the current setup)
794 sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
795 \1="$$(cygpath -u "$$\1")"/' \
796 -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
797 # Ensure that test-* helpers find the .dll files copied to top-level
798 sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
799 # We do not want to force hard-linking builtins
800 sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
801 bin-wrappers/git-{receive-pack,upload-archive}
802 git add -f $(test_bindir_programs)
803 # remote-ext is a builtin, but invoked as if it were external
804 sed 's|receive-pack|remote-ext|g' \
805 <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
806 git add -f bin-wrappers/git-remote-ext
810 git add -f templates/boilerplates.made templates/blt/
812 # Add the translated messages
813 make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
814 git add -f $(MOFILES)
817 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
818 git add -f GIT-BUILD-OPTIONS
820 # Commit the whole shebang
821 git commit -m "Generate Visual Studio solution" \
822 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"