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
62 FREAD_READS_DIRECTORIES = UnfortunatelyYes
63 BASIC_CFLAGS += -DHAVE_SYSINFO
64 PROCFS_EXECUTABLE_PATH = /proc/self/exe
65 HAVE_PLATFORM_PROCINFO = YesPlease
66 COMPAT_OBJS += compat/linux/procinfo.o
68 ifeq ($(uname_S),GNU/kFreeBSD)
69 HAVE_ALLOCA_H = YesPlease
70 NO_STRLCPY = YesPlease
71 HAVE_PATHS_H = YesPlease
72 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
73 LIBC_CONTAINS_LIBINTL = YesPlease
74 FREAD_READS_DIRECTORIES = UnfortunatelyYes
76 ifeq ($(uname_S),UnixWare)
78 NEEDS_SOCKET = YesPlease
80 NEEDS_SSL_WITH_CRYPTO = YesPlease
81 NEEDS_LIBICONV = YesPlease
82 SHELL_PATH = /usr/local/bin/bash
84 NO_HSTRERROR = YesPlease
85 BASIC_CFLAGS += -Kthread
86 BASIC_CFLAGS += -I/usr/local/include
87 BASIC_LDFLAGS += -L/usr/local/lib
90 NO_STRCASESTR = YesPlease
93 ifeq ($(uname_S),SCO_SV)
99 BASIC_CFLAGS += -Kthread
101 NEEDS_SOCKET = YesPlease
102 NEEDS_NSL = YesPlease
103 NEEDS_SSL_WITH_CRYPTO = YesPlease
104 NEEDS_LIBICONV = YesPlease
105 SHELL_PATH = /usr/bin/bash
107 NO_HSTRERROR = YesPlease
108 BASIC_CFLAGS += -I/usr/local/include
109 BASIC_LDFLAGS += -L/usr/local/lib
110 NO_STRCASESTR = YesPlease
111 NO_MEMMEM = YesPlease
115 ifeq ($(uname_S),Darwin)
116 NEEDS_CRYPTO_WITH_SSL = YesPlease
117 NEEDS_SSL_WITH_CRYPTO = YesPlease
118 NEEDS_LIBICONV = YesPlease
119 # Note: $(uname_R) gives us the underlying Darwin version.
120 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
121 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
122 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
123 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
124 OLD_ICONV = UnfortunatelyYes
125 NO_APPLE_COMMON_CRYPTO = YesPlease
127 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
128 NO_STRLCPY = YesPlease
130 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
131 HAVE_GETDELIM = YesPlease
133 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
134 OPEN_RETURNS_EINTR = UnfortunatelyYes
136 NO_MEMMEM = YesPlease
137 USE_ST_TIMESPEC = YesPlease
138 HAVE_DEV_TTY = YesPlease
139 COMPAT_OBJS += compat/precompose_utf8.o
140 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
141 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
142 HAVE_BSD_SYSCTL = YesPlease
143 FREAD_READS_DIRECTORIES = UnfortunatelyYes
144 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
146 # Workaround for `gettext` being keg-only and not even being linked via
147 # `brew link --force gettext`, should be obsolete as of
148 # https://github.com/Homebrew/homebrew-core/pull/53489
149 ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
150 BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
151 BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
152 ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
153 MSGFMT = /usr/local/opt/gettext/bin/msgfmt
157 ifeq ($(uname_S),SunOS)
158 NEEDS_SOCKET = YesPlease
159 NEEDS_NSL = YesPlease
160 SHELL_PATH = /bin/bash
161 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
162 HAVE_ALLOCA_H = YesPlease
163 NO_STRCASESTR = YesPlease
164 NO_MEMMEM = YesPlease
165 NO_MKDTEMP = YesPlease
167 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
168 HAVE_DEV_TTY = YesPlease
169 ifeq ($(uname_R),5.6)
171 NO_HSTRERROR = YesPlease
173 NO_SOCKADDR_STORAGE = YesPlease
174 NO_UNSETENV = YesPlease
175 NO_SETENV = YesPlease
176 NO_STRLCPY = YesPlease
177 NO_STRTOUMAX = YesPlease
180 ifeq ($(uname_R),5.7)
181 NEEDS_RESOLV = YesPlease
183 NO_SOCKADDR_STORAGE = YesPlease
184 NO_UNSETENV = YesPlease
185 NO_SETENV = YesPlease
186 NO_STRLCPY = YesPlease
187 NO_STRTOUMAX = YesPlease
190 ifeq ($(uname_R),5.8)
191 NO_UNSETENV = YesPlease
192 NO_SETENV = YesPlease
193 NO_STRTOUMAX = YesPlease
196 ifeq ($(uname_R),5.9)
197 NO_UNSETENV = YesPlease
198 NO_SETENV = YesPlease
199 NO_STRTOUMAX = YesPlease
202 INSTALL = /usr/ucb/install
204 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
206 ifeq ($(uname_O),Cygwin)
207 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
208 NO_D_TYPE_IN_DIRENT = YesPlease
209 NO_STRCASESTR = YesPlease
210 NO_MEMMEM = YesPlease
211 NO_SYMLINK_HEAD = YesPlease
213 OLD_ICONV = UnfortunatelyYes
214 # There are conflicting reports about this.
215 # On some boxes NO_MMAP is needed, and not so elsewhere.
216 # Try commenting this out if you suspect MMAP is more efficient
219 NO_REGEX = UnfortunatelyYes
221 HAVE_ALLOCA_H = YesPlease
222 NEEDS_LIBICONV = YesPlease
223 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
224 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
226 UNRELIABLE_FSTAT = UnfortunatelyYes
227 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
228 MMAP_PREVENTS_DELETE = UnfortunatelyYes
229 COMPAT_OBJS += compat/win32/path-utils.o
230 FREAD_READS_DIRECTORIES = UnfortunatelyYes
232 ifeq ($(uname_S),FreeBSD)
233 NEEDS_LIBICONV = YesPlease
234 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
235 # A typical version string looks like "10.2-RELEASE".
236 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
237 OLD_ICONV = YesPlease
239 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
240 OLD_ICONV = YesPlease
242 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
243 OLD_ICONV = YesPlease
245 NO_MEMMEM = YesPlease
246 BASIC_CFLAGS += -I/usr/local/include
247 BASIC_LDFLAGS += -L/usr/local/lib
248 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
249 USE_ST_TIMESPEC = YesPlease
250 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
251 PTHREAD_LIBS = -pthread
252 NO_UINTMAX_T = YesPlease
253 NO_STRTOUMAX = YesPlease
255 PYTHON_PATH = /usr/local/bin/python
256 PERL_PATH = /usr/local/bin/perl
257 HAVE_PATHS_H = YesPlease
258 HAVE_BSD_SYSCTL = YesPlease
259 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
260 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
261 FREAD_READS_DIRECTORIES = UnfortunatelyYes
262 FILENO_IS_A_MACRO = UnfortunatelyYes
264 ifeq ($(uname_S),OpenBSD)
265 NO_STRCASESTR = YesPlease
266 NO_MEMMEM = YesPlease
267 USE_ST_TIMESPEC = YesPlease
268 NEEDS_LIBICONV = YesPlease
269 BASIC_CFLAGS += -I/usr/local/include
270 BASIC_LDFLAGS += -L/usr/local/lib
271 HAVE_PATHS_H = YesPlease
272 HAVE_BSD_SYSCTL = YesPlease
273 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
274 PROCFS_EXECUTABLE_PATH = /proc/curproc/file
275 FREAD_READS_DIRECTORIES = UnfortunatelyYes
276 FILENO_IS_A_MACRO = UnfortunatelyYes
278 ifeq ($(uname_S),MirBSD)
279 NO_STRCASESTR = YesPlease
280 NO_MEMMEM = YesPlease
281 USE_ST_TIMESPEC = YesPlease
282 NEEDS_LIBICONV = YesPlease
283 HAVE_PATHS_H = YesPlease
284 HAVE_BSD_SYSCTL = YesPlease
286 ifeq ($(uname_S),NetBSD)
287 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
288 NEEDS_LIBICONV = YesPlease
290 BASIC_CFLAGS += -I/usr/pkg/include
291 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
292 USE_ST_TIMESPEC = YesPlease
293 HAVE_PATHS_H = YesPlease
294 HAVE_BSD_SYSCTL = YesPlease
295 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
296 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
298 ifeq ($(uname_S),AIX)
300 NO_STRCASESTR = YesPlease
301 NO_MEMMEM = YesPlease
302 NO_MKDTEMP = YesPlease
303 NO_STRLCPY = YesPlease
305 NO_REGEX = NeedsStartEnd
306 FREAD_READS_DIRECTORIES = UnfortunatelyYes
307 INTERNAL_QSORT = UnfortunatelyYes
308 NEEDS_LIBICONV = YesPlease
309 BASIC_CFLAGS += -D_LARGE_FILES
310 FILENO_IS_A_MACRO = UnfortunatelyYes
311 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
312 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
313 NO_PTHREADS = YesPlease
315 PTHREAD_LIBS = -lpthread
317 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
322 ifeq ($(uname_S),GNU)
324 HAVE_ALLOCA_H = YesPlease
325 NO_STRLCPY = YesPlease
326 HAVE_PATHS_H = YesPlease
327 LIBC_CONTAINS_LIBINTL = YesPlease
328 FREAD_READS_DIRECTORIES = UnfortunatelyYes
330 ifeq ($(uname_S),IRIX)
331 NO_SETENV = YesPlease
332 NO_UNSETENV = YesPlease
333 NO_STRCASESTR = YesPlease
334 NO_MEMMEM = YesPlease
335 NO_MKDTEMP = YesPlease
336 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
337 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
338 # git dies with a segmentation fault when trying to access the first
339 # entry of a reflog. The conservative choice is made to always set
340 # NO_MMAP. If you suspect that your compiler is not affected by this
341 # issue, comment out the NO_MMAP statement.
344 SNPRINTF_RETURNS_BOGUS = YesPlease
345 SHELL_PATH = /usr/gnu/bin/bash
346 NEEDS_LIBGEN = YesPlease
348 ifeq ($(uname_S),IRIX64)
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),HP-UX)
369 NO_SETENV = YesPlease
370 NO_STRCASESTR = YesPlease
371 NO_MEMMEM = YesPlease
372 NO_STRLCPY = YesPlease
373 NO_MKDTEMP = YesPlease
374 NO_UNSETENV = YesPlease
375 NO_HSTRERROR = YesPlease
376 NO_SYS_SELECT_H = YesPlease
377 SNPRINTF_RETURNS_BOGUS = YesPlease
379 ifeq ($(uname_R),B.11.00)
380 NO_INET_NTOP = YesPlease
381 NO_INET_PTON = YesPlease
383 ifeq ($(uname_R),B.10.20)
384 # Override HP-UX 11.x setting:
388 NO_INET_NTOP = YesPlease
389 NO_INET_PTON = YesPlease
393 ifeq ($(uname_S),Windows)
394 GIT_VERSION := $(GIT_VERSION).MSVC
396 # Assume that this is built in Git for Windows' SDK
397 ifeq (MINGW32,$(MSYSTEM))
402 # Prepend MSVC 64-bit tool-chain to PATH.
404 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
405 # link.exe next to, and required by, cl.exe, we have to prepend this
406 # onto the existing $PATH.
408 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
409 HAVE_ALLOCA_H = YesPlease
411 NEEDS_CRYPTO_WITH_SSL = YesPlease
412 NO_LIBGEN_H = YesPlease
414 NO_SYMLINK_HEAD = YesPlease
416 NO_UNIX_SOCKETS = YesPlease
417 NO_SETENV = YesPlease
418 NO_STRCASESTR = YesPlease
419 NO_STRLCPY = YesPlease
420 NO_MEMMEM = YesPlease
421 NEEDS_LIBICONV = YesPlease
422 NO_STRTOUMAX = YesPlease
423 NO_MKDTEMP = YesPlease
424 NO_INTTYPES_H = YesPlease
425 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
426 # so we don't need this:
428 # SNPRINTF_RETURNS_BOGUS = YesPlease
429 NO_SVN_TESTS = YesPlease
430 RUNTIME_PREFIX = YesPlease
431 HAVE_WPGMPTR = YesWeDo
432 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
433 USE_WIN32_IPC = YesPlease
434 USE_WIN32_MMAP = YesPlease
435 MMAP_PREVENTS_DELETE = UnfortunatelyYes
436 # USE_NED_ALLOCATOR = YesPlease
437 UNRELIABLE_FSTAT = UnfortunatelyYes
438 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
440 NO_GETTEXT = YesPlease
441 NO_PYTHON = YesPlease
443 NO_POSIX_GOODIES = UnfortunatelyYes
444 NATIVE_CRLF = YesPlease
445 DEFAULT_HELP_FORMAT = html
446 ifeq (/mingw64,$(subst 32,64,$(prefix)))
447 # Move system config into top-level /etc/
448 ETC_GITCONFIG = ../etc/gitconfig
449 ETC_GITATTRIBUTES = ../etc/gitattributes
452 CC = compat/vcbuild/scripts/clink.pl
453 AR = compat/vcbuild/scripts/lib.pl
455 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
456 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
457 compat/win32/path-utils.o \
458 compat/win32/pthread.o compat/win32/syslog.o \
459 compat/win32/trace2_win32_process_info.o \
460 compat/win32/dirent.o
461 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
462 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
463 # invalidcontinue.obj allows Git's source code to close the same file
464 # handle twice, or to access the osfhandle of an already-closed stdout
465 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
466 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
469 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
471 BASIC_CFLAGS += $(vcpkg_rel_lib)
473 BASIC_CFLAGS += $(vcpkg_dbg_lib)
475 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
477 ifneq ($(USE_MSVC_CRTDBG),)
478 # Optionally enable memory leak reporting.
479 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
481 # Always give "-Zi" to the compiler and "-debug" to linker (even in
482 # release mode) to force a PDB to be generated (like RelWithDebInfo).
484 BASIC_LDFLAGS += -debug -Zf
487 LDFLAGS += -SAFESEH:NO
491 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
492 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
495 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
499 compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
501 ifeq ($(uname_S),Interix)
502 NO_INITGROUPS = YesPlease
504 NO_MEMMEM = YesPlease
505 NO_MKDTEMP = YesPlease
506 NO_STRTOUMAX = YesPlease
508 ifeq ($(uname_R),3.5)
509 NO_INET_NTOP = YesPlease
510 NO_INET_PTON = YesPlease
511 NO_SOCKADDR_STORAGE = YesPlease
513 ifeq ($(uname_R),5.2)
514 NO_INET_NTOP = YesPlease
515 NO_INET_PTON = YesPlease
516 NO_SOCKADDR_STORAGE = YesPlease
519 ifeq ($(uname_S),Minix)
521 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
524 NEEDS_CRYPTO_WITH_SSL = YesPlease
526 NO_HSTRERROR = YesPlease
531 ifeq ($(uname_S),NONSTOP_KERNEL)
532 # Needs some C99 features, "inline" is just one of them.
533 # INLINE='' would just replace one set of warnings with another and
534 # still not compile in c89 mode, due to non-const array initializations.
536 # Build down-rev compatible objects that don't use our new getopt_long.
537 ifeq ($(uname_R).$(uname_V),J06.21)
540 ifeq ($(uname_R).$(uname_V),L17.02)
543 # Disable all optimization, seems to result in bad code, with -O or -O2
544 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
545 # abends on "git push". Needs more investigation.
546 CFLAGS = -g -O0 -Winline
547 # We'd want it to be here.
549 # perl and python must be in /usr/bin on NonStop - supplied by HPE
550 # with operating system in that managed directory.
551 PERL_PATH = /usr/bin/perl
552 PYTHON_PATH = /usr/bin/python
553 # The current /usr/coreutils/rm at lowest support level does not work
554 # with the git test structure. Long paths as in
555 # 'trash directory...' cause rm to terminate prematurely without fully
556 # removing the directory at OS releases J06.21 and L17.02.
557 # Default to the older rm until those two releases are deprecated.
559 NEEDS_CRYPTO_WITH_SSL = YesPlease
560 HAVE_DEV_TTY = YesPlease
561 HAVE_LIBCHARSET_H = YesPlease
562 HAVE_STRINGS_H = YesPlease
563 NEEDS_LIBICONV = YesPlease
564 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
565 NO_SYS_SELECT_H = UnfortunatelyYes
566 NO_D_TYPE_IN_DIRENT = YesPlease
567 NO_GETTEXT = YesPlease
568 NO_HSTRERROR = YesPlease
569 NO_STRCASESTR = YesPlease
570 NO_MEMMEM = YesPlease
571 NO_STRLCPY = YesPlease
572 NO_SETENV = YesPlease
573 NO_UNSETENV = YesPlease
574 NO_MKDTEMP = YesPlease
575 # Currently libiconv-1.9.1.
576 OLD_ICONV = UnfortunatelyYes
577 NO_REGEX = NeedsStartEnd
578 NO_PTHREADS = UnfortunatelyYes
579 FREAD_READS_DIRECTORIES = UnfortunatelyYes
581 # Not detected (nor checked for) by './configure'.
582 # We don't have SA_RESTART on NonStop, unfortunalety.
583 COMPAT_CFLAGS += -DSA_RESTART=0
584 # Apparently needed in compat/fnmatch/fnmatch.c.
585 COMPAT_CFLAGS += -DHAVE_STRING_H=1
586 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
591 NO_INTPTR_T = UnfortunatelyYes
592 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
593 SHELL_PATH = /usr/coreutils/bin/bash
595 ifeq ($(uname_S),MINGW)
597 HAVE_ALLOCA_H = YesPlease
599 NEEDS_CRYPTO_WITH_SSL = YesPlease
600 NO_LIBGEN_H = YesPlease
602 NO_SYMLINK_HEAD = YesPlease
603 NO_UNIX_SOCKETS = YesPlease
604 NO_SETENV = YesPlease
605 NO_STRCASESTR = YesPlease
606 NO_STRLCPY = YesPlease
607 NO_MEMMEM = YesPlease
608 NEEDS_LIBICONV = YesPlease
609 NO_STRTOUMAX = YesPlease
610 NO_MKDTEMP = YesPlease
611 NO_SVN_TESTS = YesPlease
612 RUNTIME_PREFIX = YesPlease
613 HAVE_WPGMPTR = YesWeDo
614 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
615 USE_WIN32_IPC = YesPlease
616 USE_WIN32_MMAP = YesPlease
617 MMAP_PREVENTS_DELETE = UnfortunatelyYes
618 USE_NED_ALLOCATOR = YesPlease
619 UNRELIABLE_FSTAT = UnfortunatelyYes
620 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
622 NO_PYTHON = YesPlease
624 NO_POSIX_GOODIES = UnfortunatelyYes
625 DEFAULT_HELP_FORMAT = html
626 HAVE_PLATFORM_PROCINFO = YesPlease
627 BASIC_LDFLAGS += -municode
628 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
629 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
630 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
631 compat/win32/trace2_win32_process_info.o \
632 compat/win32/path-utils.o \
633 compat/win32/pthread.o compat/win32/syslog.o \
634 compat/win32/dirent.o
635 BASIC_CFLAGS += -DWIN32
640 NATIVE_CRLF = YesPlease
642 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
643 htmldir = doc/git/html/
645 INSTALL = /bin/install
646 EXTLIBS += /mingw/lib/libz.a
647 INTERNAL_QSORT = YesPlease
648 HAVE_LIBCHARSET_H = YesPlease
649 NO_GETTEXT = YesPlease
650 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
652 ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
656 BASIC_LDFLAGS += -Wl,--nxcompat
657 # Enable ASLR (unless debugging)
658 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
659 BASIC_LDFLAGS += -Wl,--dynamicbase
661 ifeq (MINGW32,$(MSYSTEM))
664 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
666 ifeq (MINGW64,$(MSYSTEM))
669 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
671 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
672 BASIC_LDFLAGS += -Wl,--large-address-aware
675 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
676 -fstack-protector-strong
678 INSTALL = /bin/install
679 INTERNAL_QSORT = YesPlease
680 HAVE_LIBCHARSET_H = YesPlease
682 USE_GETTEXT_SCHEME = fallthrough
683 USE_LIBPCRE = YesPlease
685 USE_NED_ALLOCATOR = YesPlease
686 ifeq (/mingw64,$(subst 32,64,$(prefix)))
687 # Move system config into top-level /etc/
688 ETC_GITCONFIG = ../etc/gitconfig
689 ETC_GITATTRIBUTES = ../etc/gitattributes
692 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
697 ifeq ($(uname_S),QNX)
698 COMPAT_CFLAGS += -DSA_RESTART=0
699 EXPAT_NEEDS_XMLPARSE_H = YesPlease
700 HAVE_STRINGS_H = YesPlease
701 NEEDS_SOCKET = YesPlease
702 NO_GETPAGESIZE = YesPlease
704 NO_MEMMEM = YesPlease
705 NO_MKDTEMP = YesPlease
707 NO_PTHREADS = YesPlease
708 NO_STRCASESTR = YesPlease
709 NO_STRLCPY = YesPlease
713 # Require clean work tree
714 git update-index -q --refresh && \
715 git diff-files --quiet && \
716 git diff-index --cached --quiet HEAD --
718 # Make .vcxproj files and add them
719 unset QUIET_GEN QUIET_BUILT_IN; \
720 perl contrib/buildsystems/generate -g Vcxproj
721 git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
723 # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
724 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
725 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
726 for name in $(BUILT_INS);\
728 echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
730 echo ' </Target>' && \
731 echo '</Project>') >git/LinkOrCopyBuiltins.targets
732 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
733 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
734 for name in $(REMOTE_CURL_ALIASES); \
736 echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
738 echo ' </Target>' && \
739 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
740 git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
742 # Add generated headers
743 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
744 git add -f $(GENERATED_H)
748 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
749 # Strip out the sane tool path, needed only for building
750 sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
751 git add -f $(SCRIPT_LIB) $(SCRIPTS)
754 $(MAKE) $(LIB_PERL_GEN)
755 git add -f perl/build
757 # Add bin-wrappers, for testing
759 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
760 # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
761 # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
762 # by test-lib.sh according to the current setup)
763 sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
764 \1="$$(cygpath -u "$$\1")"/' \
765 -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
766 # Ensure that test-* helpers find the .dll files copied to top-level
767 sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
768 # We do not want to force hard-linking builtins
769 sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
770 bin-wrappers/git-{receive-pack,upload-archive}
771 git add -f $(test_bindir_programs)
772 # remote-ext is a builtin, but invoked as if it were external
773 sed 's|receive-pack|remote-ext|g' \
774 <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
775 git add -f bin-wrappers/git-remote-ext
779 git add -f templates/boilerplates.made templates/blt/
781 # Add the translated messages
782 make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
783 git add -f $(MOFILES)
786 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
787 git add -f GIT-BUILD-OPTIONS
789 # Commit the whole shebang
790 git commit -m "Generate Visual Studio solution" \
791 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"