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
67 ifeq ($(uname_S),GNU/kFreeBSD)
68 HAVE_ALLOCA_H = YesPlease
69 NO_STRLCPY = YesPlease
70 HAVE_PATHS_H = YesPlease
71 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
72 LIBC_CONTAINS_LIBINTL = YesPlease
73 FREAD_READS_DIRECTORIES = UnfortunatelyYes
75 ifeq ($(uname_S),UnixWare)
77 NEEDS_SOCKET = YesPlease
79 NEEDS_SSL_WITH_CRYPTO = YesPlease
80 NEEDS_LIBICONV = YesPlease
81 SHELL_PATH = /usr/local/bin/bash
83 NO_HSTRERROR = YesPlease
84 BASIC_CFLAGS += -Kthread
85 BASIC_CFLAGS += -I/usr/local/include
86 BASIC_LDFLAGS += -L/usr/local/lib
89 NO_STRCASESTR = YesPlease
92 ifeq ($(uname_S),SCO_SV)
98 BASIC_CFLAGS += -Kthread
100 NEEDS_SOCKET = YesPlease
101 NEEDS_NSL = YesPlease
102 NEEDS_SSL_WITH_CRYPTO = YesPlease
103 NEEDS_LIBICONV = YesPlease
104 SHELL_PATH = /usr/bin/bash
106 NO_HSTRERROR = YesPlease
107 BASIC_CFLAGS += -I/usr/local/include
108 BASIC_LDFLAGS += -L/usr/local/lib
109 NO_STRCASESTR = YesPlease
110 NO_MEMMEM = YesPlease
114 ifeq ($(uname_S),Darwin)
115 NEEDS_CRYPTO_WITH_SSL = YesPlease
116 NEEDS_SSL_WITH_CRYPTO = YesPlease
117 NEEDS_LIBICONV = YesPlease
118 # Note: $(uname_R) gives us the underlying Darwin version.
119 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
120 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
121 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
122 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
123 OLD_ICONV = UnfortunatelyYes
124 NO_APPLE_COMMON_CRYPTO = YesPlease
126 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
127 NO_STRLCPY = YesPlease
129 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
130 HAVE_GETDELIM = YesPlease
132 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
133 OPEN_RETURNS_EINTR = UnfortunatelyYes
135 NO_MEMMEM = YesPlease
136 USE_ST_TIMESPEC = YesPlease
137 HAVE_DEV_TTY = YesPlease
138 COMPAT_OBJS += compat/precompose_utf8.o
139 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
140 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
141 HAVE_BSD_SYSCTL = YesPlease
142 FREAD_READS_DIRECTORIES = UnfortunatelyYes
143 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
145 # Workaround for `gettext` being keg-only and not even being linked via
146 # `brew link --force gettext`, should be obsolete as of
147 # https://github.com/Homebrew/homebrew-core/pull/53489
148 ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
149 BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
150 BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
151 ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
152 MSGFMT = /usr/local/opt/gettext/bin/msgfmt
156 ifeq ($(uname_S),SunOS)
157 NEEDS_SOCKET = YesPlease
158 NEEDS_NSL = YesPlease
159 SHELL_PATH = /bin/bash
160 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
161 HAVE_ALLOCA_H = YesPlease
162 NO_STRCASESTR = YesPlease
163 NO_MEMMEM = YesPlease
164 NO_MKDTEMP = YesPlease
166 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
167 HAVE_DEV_TTY = YesPlease
168 ifeq ($(uname_R),5.6)
170 NO_HSTRERROR = YesPlease
172 NO_SOCKADDR_STORAGE = YesPlease
173 NO_UNSETENV = YesPlease
174 NO_SETENV = YesPlease
175 NO_STRLCPY = YesPlease
176 NO_STRTOUMAX = YesPlease
179 ifeq ($(uname_R),5.7)
180 NEEDS_RESOLV = YesPlease
182 NO_SOCKADDR_STORAGE = YesPlease
183 NO_UNSETENV = YesPlease
184 NO_SETENV = YesPlease
185 NO_STRLCPY = YesPlease
186 NO_STRTOUMAX = YesPlease
189 ifeq ($(uname_R),5.8)
190 NO_UNSETENV = YesPlease
191 NO_SETENV = YesPlease
192 NO_STRTOUMAX = YesPlease
195 ifeq ($(uname_R),5.9)
196 NO_UNSETENV = YesPlease
197 NO_SETENV = YesPlease
198 NO_STRTOUMAX = YesPlease
201 INSTALL = /usr/ucb/install
203 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
205 ifeq ($(uname_O),Cygwin)
206 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
207 NO_D_TYPE_IN_DIRENT = YesPlease
208 NO_STRCASESTR = YesPlease
209 NO_MEMMEM = YesPlease
210 NO_SYMLINK_HEAD = YesPlease
212 OLD_ICONV = UnfortunatelyYes
213 # There are conflicting reports about this.
214 # On some boxes NO_MMAP is needed, and not so elsewhere.
215 # Try commenting this out if you suspect MMAP is more efficient
218 NO_REGEX = UnfortunatelyYes
220 HAVE_ALLOCA_H = YesPlease
221 NEEDS_LIBICONV = YesPlease
222 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
223 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
225 UNRELIABLE_FSTAT = UnfortunatelyYes
226 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
227 MMAP_PREVENTS_DELETE = UnfortunatelyYes
228 COMPAT_OBJS += compat/win32/path-utils.o
229 FREAD_READS_DIRECTORIES = UnfortunatelyYes
231 ifeq ($(uname_S),FreeBSD)
232 NEEDS_LIBICONV = YesPlease
233 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
234 # A typical version string looks like "10.2-RELEASE".
235 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
236 OLD_ICONV = YesPlease
238 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
239 OLD_ICONV = YesPlease
241 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
242 OLD_ICONV = YesPlease
244 NO_MEMMEM = YesPlease
245 BASIC_CFLAGS += -I/usr/local/include
246 BASIC_LDFLAGS += -L/usr/local/lib
247 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
248 USE_ST_TIMESPEC = YesPlease
249 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
250 PTHREAD_LIBS = -pthread
251 NO_UINTMAX_T = YesPlease
252 NO_STRTOUMAX = YesPlease
254 PYTHON_PATH = /usr/local/bin/python
255 PERL_PATH = /usr/local/bin/perl
256 HAVE_PATHS_H = YesPlease
257 HAVE_BSD_SYSCTL = YesPlease
258 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
259 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
260 FREAD_READS_DIRECTORIES = UnfortunatelyYes
261 FILENO_IS_A_MACRO = UnfortunatelyYes
263 ifeq ($(uname_S),OpenBSD)
264 NO_STRCASESTR = YesPlease
265 NO_MEMMEM = YesPlease
266 USE_ST_TIMESPEC = YesPlease
267 NEEDS_LIBICONV = YesPlease
268 BASIC_CFLAGS += -I/usr/local/include
269 BASIC_LDFLAGS += -L/usr/local/lib
270 HAVE_PATHS_H = YesPlease
271 HAVE_BSD_SYSCTL = YesPlease
272 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
273 PROCFS_EXECUTABLE_PATH = /proc/curproc/file
274 FREAD_READS_DIRECTORIES = UnfortunatelyYes
275 FILENO_IS_A_MACRO = UnfortunatelyYes
277 ifeq ($(uname_S),MirBSD)
278 NO_STRCASESTR = YesPlease
279 NO_MEMMEM = YesPlease
280 USE_ST_TIMESPEC = YesPlease
281 NEEDS_LIBICONV = YesPlease
282 HAVE_PATHS_H = YesPlease
283 HAVE_BSD_SYSCTL = YesPlease
285 ifeq ($(uname_S),NetBSD)
286 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
287 NEEDS_LIBICONV = YesPlease
289 BASIC_CFLAGS += -I/usr/pkg/include
290 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
291 USE_ST_TIMESPEC = YesPlease
292 HAVE_PATHS_H = YesPlease
293 HAVE_BSD_SYSCTL = YesPlease
294 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
295 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
297 ifeq ($(uname_S),AIX)
299 NO_STRCASESTR = YesPlease
300 NO_MEMMEM = YesPlease
301 NO_MKDTEMP = YesPlease
302 NO_STRLCPY = YesPlease
304 NO_REGEX = NeedsStartEnd
305 FREAD_READS_DIRECTORIES = UnfortunatelyYes
306 INTERNAL_QSORT = UnfortunatelyYes
307 NEEDS_LIBICONV = YesPlease
308 BASIC_CFLAGS += -D_LARGE_FILES
309 FILENO_IS_A_MACRO = UnfortunatelyYes
310 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
311 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
312 NO_PTHREADS = YesPlease
314 PTHREAD_LIBS = -lpthread
316 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
321 ifeq ($(uname_S),GNU)
323 HAVE_ALLOCA_H = YesPlease
324 NO_STRLCPY = YesPlease
325 HAVE_PATHS_H = YesPlease
326 LIBC_CONTAINS_LIBINTL = YesPlease
327 FREAD_READS_DIRECTORIES = UnfortunatelyYes
329 ifeq ($(uname_S),IRIX)
330 NO_SETENV = YesPlease
331 NO_UNSETENV = YesPlease
332 NO_STRCASESTR = YesPlease
333 NO_MEMMEM = YesPlease
334 NO_MKDTEMP = YesPlease
335 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
336 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
337 # git dies with a segmentation fault when trying to access the first
338 # entry of a reflog. The conservative choice is made to always set
339 # NO_MMAP. If you suspect that your compiler is not affected by this
340 # issue, comment out the NO_MMAP statement.
343 SNPRINTF_RETURNS_BOGUS = YesPlease
344 SHELL_PATH = /usr/gnu/bin/bash
345 NEEDS_LIBGEN = YesPlease
347 ifeq ($(uname_S),IRIX64)
348 NO_SETENV = YesPlease
349 NO_UNSETENV = YesPlease
350 NO_STRCASESTR = YesPlease
351 NO_MEMMEM = YesPlease
352 NO_MKDTEMP = YesPlease
353 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
354 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
355 # git dies with a segmentation fault when trying to access the first
356 # entry of a reflog. The conservative choice is made to always set
357 # NO_MMAP. If you suspect that your compiler is not affected by this
358 # issue, comment out the NO_MMAP statement.
361 SNPRINTF_RETURNS_BOGUS = YesPlease
362 SHELL_PATH = /usr/gnu/bin/bash
363 NEEDS_LIBGEN = YesPlease
365 ifeq ($(uname_S),HP-UX)
368 NO_SETENV = YesPlease
369 NO_STRCASESTR = YesPlease
370 NO_MEMMEM = YesPlease
371 NO_STRLCPY = YesPlease
372 NO_MKDTEMP = YesPlease
373 NO_UNSETENV = YesPlease
374 NO_HSTRERROR = YesPlease
375 NO_SYS_SELECT_H = YesPlease
376 SNPRINTF_RETURNS_BOGUS = YesPlease
378 ifeq ($(uname_R),B.11.00)
379 NO_INET_NTOP = YesPlease
380 NO_INET_PTON = YesPlease
382 ifeq ($(uname_R),B.10.20)
383 # Override HP-UX 11.x setting:
387 NO_INET_NTOP = YesPlease
388 NO_INET_PTON = YesPlease
392 ifeq ($(uname_S),Windows)
393 GIT_VERSION := $(GIT_VERSION).MSVC
395 # Assume that this is built in Git for Windows' SDK
396 ifeq (MINGW32,$(MSYSTEM))
401 # Prepend MSVC 64-bit tool-chain to PATH.
403 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
404 # link.exe next to, and required by, cl.exe, we have to prepend this
405 # onto the existing $PATH.
407 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
408 HAVE_ALLOCA_H = YesPlease
410 NEEDS_CRYPTO_WITH_SSL = YesPlease
411 NO_LIBGEN_H = YesPlease
413 NO_SYMLINK_HEAD = YesPlease
415 NO_UNIX_SOCKETS = YesPlease
416 NO_SETENV = YesPlease
417 NO_STRCASESTR = YesPlease
418 NO_STRLCPY = YesPlease
419 NO_MEMMEM = YesPlease
420 NEEDS_LIBICONV = YesPlease
421 NO_STRTOUMAX = YesPlease
422 NO_MKDTEMP = YesPlease
423 NO_INTTYPES_H = YesPlease
424 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
425 # so we don't need this:
427 # SNPRINTF_RETURNS_BOGUS = YesPlease
428 NO_SVN_TESTS = YesPlease
429 RUNTIME_PREFIX = YesPlease
430 HAVE_WPGMPTR = YesWeDo
431 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
432 USE_WIN32_IPC = YesPlease
433 USE_WIN32_MMAP = YesPlease
434 MMAP_PREVENTS_DELETE = UnfortunatelyYes
435 # USE_NED_ALLOCATOR = YesPlease
436 UNRELIABLE_FSTAT = UnfortunatelyYes
437 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
439 NO_GETTEXT = YesPlease
440 NO_PYTHON = YesPlease
442 NO_POSIX_GOODIES = UnfortunatelyYes
443 NATIVE_CRLF = YesPlease
444 DEFAULT_HELP_FORMAT = html
445 ifeq (/mingw64,$(subst 32,64,$(prefix)))
446 # Move system config into top-level /etc/
447 ETC_GITCONFIG = ../etc/gitconfig
448 ETC_GITATTRIBUTES = ../etc/gitattributes
451 CC = compat/vcbuild/scripts/clink.pl
452 AR = compat/vcbuild/scripts/lib.pl
454 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
455 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
456 compat/win32/path-utils.o \
457 compat/win32/pthread.o compat/win32/syslog.o \
458 compat/win32/trace2_win32_process_info.o \
459 compat/win32/dirent.o
460 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
461 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
462 # invalidcontinue.obj allows Git's source code to close the same file
463 # handle twice, or to access the osfhandle of an already-closed stdout
464 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
465 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
468 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
470 BASIC_CFLAGS += $(vcpkg_rel_lib)
472 BASIC_CFLAGS += $(vcpkg_dbg_lib)
474 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
476 ifneq ($(USE_MSVC_CRTDBG),)
477 # Optionally enable memory leak reporting.
478 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
480 # Always give "-Zi" to the compiler and "-debug" to linker (even in
481 # release mode) to force a PDB to be generated (like RelWithDebInfo).
483 BASIC_LDFLAGS += -debug -Zf
486 LDFLAGS += -SAFESEH:NO
490 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
491 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
494 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
498 compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
500 ifeq ($(uname_S),Interix)
501 NO_INITGROUPS = YesPlease
503 NO_MEMMEM = YesPlease
504 NO_MKDTEMP = YesPlease
505 NO_STRTOUMAX = YesPlease
507 ifeq ($(uname_R),3.5)
508 NO_INET_NTOP = YesPlease
509 NO_INET_PTON = YesPlease
510 NO_SOCKADDR_STORAGE = YesPlease
512 ifeq ($(uname_R),5.2)
513 NO_INET_NTOP = YesPlease
514 NO_INET_PTON = YesPlease
515 NO_SOCKADDR_STORAGE = YesPlease
518 ifeq ($(uname_S),Minix)
520 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
523 NEEDS_CRYPTO_WITH_SSL = YesPlease
525 NO_HSTRERROR = YesPlease
530 ifeq ($(uname_S),NONSTOP_KERNEL)
531 # Needs some C99 features, "inline" is just one of them.
532 # INLINE='' would just replace one set of warnings with another and
533 # still not compile in c89 mode, due to non-const array initializations.
535 # Build down-rev compatible objects that don't use our new getopt_long.
536 ifeq ($(uname_R).$(uname_V),J06.21)
539 ifeq ($(uname_R).$(uname_V),L17.02)
542 # Disable all optimization, seems to result in bad code, with -O or -O2
543 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
544 # abends on "git push". Needs more investigation.
545 CFLAGS = -g -O0 -Winline
546 # We'd want it to be here.
548 # perl and python must be in /usr/bin on NonStop - supplied by HPE
549 # with operating system in that managed directory.
550 PERL_PATH = /usr/bin/perl
551 PYTHON_PATH = /usr/bin/python
552 # The current /usr/coreutils/rm at lowest support level does not work
553 # with the git test structure. Long paths as in
554 # 'trash directory...' cause rm to terminate prematurely without fully
555 # removing the directory at OS releases J06.21 and L17.02.
556 # Default to the older rm until those two releases are deprecated.
558 NEEDS_CRYPTO_WITH_SSL = YesPlease
559 HAVE_DEV_TTY = YesPlease
560 HAVE_LIBCHARSET_H = YesPlease
561 HAVE_STRINGS_H = YesPlease
562 NEEDS_LIBICONV = YesPlease
563 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
564 NO_SYS_SELECT_H = UnfortunatelyYes
565 NO_D_TYPE_IN_DIRENT = YesPlease
566 NO_GETTEXT = YesPlease
567 NO_HSTRERROR = YesPlease
568 NO_STRCASESTR = YesPlease
569 NO_MEMMEM = YesPlease
570 NO_STRLCPY = YesPlease
571 NO_SETENV = YesPlease
572 NO_UNSETENV = YesPlease
573 NO_MKDTEMP = YesPlease
574 # Currently libiconv-1.9.1.
575 OLD_ICONV = UnfortunatelyYes
576 NO_REGEX = NeedsStartEnd
577 NO_PTHREADS = UnfortunatelyYes
578 FREAD_READS_DIRECTORIES = UnfortunatelyYes
580 # Not detected (nor checked for) by './configure'.
581 # We don't have SA_RESTART on NonStop, unfortunalety.
582 COMPAT_CFLAGS += -DSA_RESTART=0
583 # Apparently needed in compat/fnmatch/fnmatch.c.
584 COMPAT_CFLAGS += -DHAVE_STRING_H=1
585 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
590 NO_INTPTR_T = UnfortunatelyYes
591 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
592 SHELL_PATH = /usr/coreutils/bin/bash
594 ifeq ($(uname_S),MINGW)
596 HAVE_ALLOCA_H = YesPlease
598 NEEDS_CRYPTO_WITH_SSL = YesPlease
599 NO_LIBGEN_H = YesPlease
601 NO_SYMLINK_HEAD = YesPlease
602 NO_UNIX_SOCKETS = YesPlease
603 NO_SETENV = YesPlease
604 NO_STRCASESTR = YesPlease
605 NO_STRLCPY = YesPlease
606 NO_MEMMEM = YesPlease
607 NEEDS_LIBICONV = YesPlease
608 NO_STRTOUMAX = YesPlease
609 NO_MKDTEMP = YesPlease
610 NO_SVN_TESTS = YesPlease
611 RUNTIME_PREFIX = YesPlease
612 HAVE_WPGMPTR = YesWeDo
613 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
614 USE_WIN32_IPC = YesPlease
615 USE_WIN32_MMAP = YesPlease
616 MMAP_PREVENTS_DELETE = UnfortunatelyYes
617 USE_NED_ALLOCATOR = YesPlease
618 UNRELIABLE_FSTAT = UnfortunatelyYes
619 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
621 NO_PYTHON = YesPlease
623 NO_POSIX_GOODIES = UnfortunatelyYes
624 DEFAULT_HELP_FORMAT = html
625 HAVE_PLATFORM_PROCINFO = YesPlease
626 BASIC_LDFLAGS += -municode
627 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
628 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
629 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
630 compat/win32/trace2_win32_process_info.o \
631 compat/win32/path-utils.o \
632 compat/win32/pthread.o compat/win32/syslog.o \
633 compat/win32/dirent.o
634 BASIC_CFLAGS += -DWIN32
639 NATIVE_CRLF = YesPlease
641 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
642 htmldir = doc/git/html/
644 INSTALL = /bin/install
645 EXTLIBS += /mingw/lib/libz.a
646 INTERNAL_QSORT = YesPlease
647 HAVE_LIBCHARSET_H = YesPlease
648 NO_GETTEXT = YesPlease
649 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
651 ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
655 BASIC_LDFLAGS += -Wl,--nxcompat
656 # Enable ASLR (unless debugging)
657 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
658 BASIC_LDFLAGS += -Wl,--dynamicbase
660 ifeq (MINGW32,$(MSYSTEM))
663 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
665 ifeq (MINGW64,$(MSYSTEM))
668 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
670 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
671 BASIC_LDFLAGS += -Wl,--large-address-aware
674 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
675 -fstack-protector-strong
677 INSTALL = /bin/install
678 INTERNAL_QSORT = YesPlease
679 HAVE_LIBCHARSET_H = YesPlease
681 USE_GETTEXT_SCHEME = fallthrough
682 USE_LIBPCRE = YesPlease
684 USE_NED_ALLOCATOR = YesPlease
685 ifeq (/mingw64,$(subst 32,64,$(prefix)))
686 # Move system config into top-level /etc/
687 ETC_GITCONFIG = ../etc/gitconfig
688 ETC_GITATTRIBUTES = ../etc/gitattributes
691 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
696 ifeq ($(uname_S),QNX)
697 COMPAT_CFLAGS += -DSA_RESTART=0
698 EXPAT_NEEDS_XMLPARSE_H = YesPlease
699 HAVE_STRINGS_H = YesPlease
700 NEEDS_SOCKET = YesPlease
701 NO_GETPAGESIZE = YesPlease
703 NO_MEMMEM = YesPlease
704 NO_MKDTEMP = YesPlease
706 NO_PTHREADS = YesPlease
707 NO_STRCASESTR = YesPlease
708 NO_STRLCPY = YesPlease
712 # Require clean work tree
713 git update-index -q --refresh && \
714 git diff-files --quiet && \
715 git diff-index --cached --quiet HEAD --
717 # Make .vcxproj files and add them
718 unset QUIET_GEN QUIET_BUILT_IN; \
719 perl contrib/buildsystems/generate -g Vcxproj
720 git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
722 # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
723 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
724 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
725 for name in $(BUILT_INS);\
727 echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
729 echo ' </Target>' && \
730 echo '</Project>') >git/LinkOrCopyBuiltins.targets
731 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
732 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
733 for name in $(REMOTE_CURL_ALIASES); \
735 echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
737 echo ' </Target>' && \
738 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
739 git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
741 # Add generated headers
742 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
743 git add -f $(GENERATED_H)
747 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
748 # Strip out the sane tool path, needed only for building
749 sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
750 git add -f $(SCRIPT_LIB) $(SCRIPTS)
753 $(MAKE) $(LIB_PERL_GEN)
754 git add -f perl/build
756 # Add bin-wrappers, for testing
758 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
759 # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
760 # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
761 # by test-lib.sh according to the current setup)
762 sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
763 \1="$$(cygpath -u "$$\1")"/' \
764 -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
765 # Ensure that test-* helpers find the .dll files copied to top-level
766 sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
767 # We do not want to force hard-linking builtins
768 sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
769 bin-wrappers/git-{receive-pack,upload-archive}
770 git add -f $(test_bindir_programs)
771 # remote-ext is a builtin, but invoked as if it were external
772 sed 's|receive-pack|remote-ext|g' \
773 <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
774 git add -f bin-wrappers/git-remote-ext
778 git add -f templates/boilerplates.made templates/blt/
780 # Add the translated messages
781 make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
782 git add -f $(MOFILES)
785 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
786 git add -f GIT-BUILD-OPTIONS
788 # Commit the whole shebang
789 git commit -m "Generate Visual Studio solution" \
790 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"