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')
15 # avoid the MingW and Cygwin configuration sections
19 # Generate and include makefile variables that point to the
20 # currently installed set of MSVC command line tools.
21 compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
22 @"$<" | tr '\\' / >"$@"
23 include compat/vcbuild/MSVC-DEFS-GEN
25 # See if vcpkg and the vcpkg-build versions of the third-party
26 # libraries that we use are installed. We include the result
27 # to get $(vcpkg_*) variables defined for the Makefile.
29 compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
31 include compat/vcbuild/VCPKG-DEFS
35 # We choose to avoid "if .. else if .. else .. endif endif"
36 # because maintaining the nesting to match is a pain. If
37 # we had "elif" things would have been much nicer...
39 ifeq ($(uname_S),OSF1)
40 # Need this for u_short definitions et al
41 BASIC_CFLAGS += -D_OSF_SOURCE
43 NO_STRTOULL = YesPlease
46 ifeq ($(uname_S),Linux)
47 HAVE_ALLOCA_H = YesPlease
48 NO_STRLCPY = YesPlease
49 HAVE_PATHS_H = YesPlease
50 LIBC_CONTAINS_LIBINTL = YesPlease
51 HAVE_DEV_TTY = YesPlease
52 HAVE_CLOCK_GETTIME = YesPlease
53 HAVE_CLOCK_MONOTONIC = YesPlease
54 # -lrt is needed for clock_gettime on glibc <= 2.16
55 NEEDS_LIBRT = YesPlease
56 HAVE_GETDELIM = YesPlease
58 FREAD_READS_DIRECTORIES = UnfortunatelyYes
59 BASIC_CFLAGS += -DHAVE_SYSINFO
60 PROCFS_EXECUTABLE_PATH = /proc/self/exe
62 ifeq ($(uname_S),GNU/kFreeBSD)
63 HAVE_ALLOCA_H = YesPlease
64 NO_STRLCPY = YesPlease
65 HAVE_PATHS_H = YesPlease
66 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
67 LIBC_CONTAINS_LIBINTL = YesPlease
68 FREAD_READS_DIRECTORIES = UnfortunatelyYes
70 ifeq ($(uname_S),UnixWare)
72 NEEDS_SOCKET = YesPlease
74 NEEDS_SSL_WITH_CRYPTO = YesPlease
75 NEEDS_LIBICONV = YesPlease
76 SHELL_PATH = /usr/local/bin/bash
78 NO_HSTRERROR = YesPlease
79 BASIC_CFLAGS += -Kthread
80 BASIC_CFLAGS += -I/usr/local/include
81 BASIC_LDFLAGS += -L/usr/local/lib
84 NO_STRCASESTR = YesPlease
87 ifeq ($(uname_S),SCO_SV)
93 BASIC_CFLAGS += -Kthread
95 NEEDS_SOCKET = YesPlease
97 NEEDS_SSL_WITH_CRYPTO = YesPlease
98 NEEDS_LIBICONV = YesPlease
99 SHELL_PATH = /usr/bin/bash
101 NO_HSTRERROR = YesPlease
102 BASIC_CFLAGS += -I/usr/local/include
103 BASIC_LDFLAGS += -L/usr/local/lib
104 NO_STRCASESTR = YesPlease
105 NO_MEMMEM = YesPlease
109 ifeq ($(uname_S),Darwin)
110 NEEDS_CRYPTO_WITH_SSL = YesPlease
111 NEEDS_SSL_WITH_CRYPTO = YesPlease
112 NEEDS_LIBICONV = YesPlease
113 # Note: $(uname_R) gives us the underlying Darwin version.
114 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
115 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
116 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
117 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
118 OLD_ICONV = UnfortunatelyYes
119 NO_APPLE_COMMON_CRYPTO = YesPlease
121 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
122 NO_STRLCPY = YesPlease
124 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
125 HAVE_GETDELIM = YesPlease
127 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
128 OPEN_RETURNS_EINTR = UnfortunatelyYes
130 NO_MEMMEM = YesPlease
131 USE_ST_TIMESPEC = YesPlease
132 HAVE_DEV_TTY = YesPlease
133 COMPAT_OBJS += compat/precompose_utf8.o
134 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
135 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
136 HAVE_BSD_SYSCTL = YesPlease
137 FREAD_READS_DIRECTORIES = UnfortunatelyYes
138 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
140 # Workaround for `gettext` being keg-only and not even being linked via
141 # `brew link --force gettext`, should be obsolete as of
142 # https://github.com/Homebrew/homebrew-core/pull/53489
143 ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
144 BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
145 BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
146 ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
147 MSGFMT = /usr/local/opt/gettext/bin/msgfmt
151 ifeq ($(uname_S),SunOS)
152 NEEDS_SOCKET = YesPlease
153 NEEDS_NSL = YesPlease
154 SHELL_PATH = /bin/bash
155 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
156 HAVE_ALLOCA_H = YesPlease
157 NO_STRCASESTR = YesPlease
158 NO_MEMMEM = YesPlease
159 NO_MKDTEMP = YesPlease
161 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
162 HAVE_DEV_TTY = YesPlease
163 ifeq ($(uname_R),5.6)
165 NO_HSTRERROR = YesPlease
167 NO_SOCKADDR_STORAGE = YesPlease
168 NO_UNSETENV = YesPlease
169 NO_SETENV = YesPlease
170 NO_STRLCPY = YesPlease
171 NO_STRTOUMAX = YesPlease
174 ifeq ($(uname_R),5.7)
175 NEEDS_RESOLV = YesPlease
177 NO_SOCKADDR_STORAGE = YesPlease
178 NO_UNSETENV = YesPlease
179 NO_SETENV = YesPlease
180 NO_STRLCPY = YesPlease
181 NO_STRTOUMAX = YesPlease
184 ifeq ($(uname_R),5.8)
185 NO_UNSETENV = YesPlease
186 NO_SETENV = YesPlease
187 NO_STRTOUMAX = YesPlease
190 ifeq ($(uname_R),5.9)
191 NO_UNSETENV = YesPlease
192 NO_SETENV = YesPlease
193 NO_STRTOUMAX = YesPlease
196 INSTALL = /usr/ucb/install
198 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
200 ifeq ($(uname_O),Cygwin)
201 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
202 NO_D_TYPE_IN_DIRENT = YesPlease
203 NO_STRCASESTR = YesPlease
204 NO_MEMMEM = YesPlease
205 NO_SYMLINK_HEAD = YesPlease
207 OLD_ICONV = UnfortunatelyYes
208 # There are conflicting reports about this.
209 # On some boxes NO_MMAP is needed, and not so elsewhere.
210 # Try commenting this out if you suspect MMAP is more efficient
213 NO_REGEX = UnfortunatelyYes
215 HAVE_ALLOCA_H = YesPlease
216 NEEDS_LIBICONV = YesPlease
217 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
218 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
220 UNRELIABLE_FSTAT = UnfortunatelyYes
221 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
222 MMAP_PREVENTS_DELETE = UnfortunatelyYes
223 COMPAT_OBJS += compat/win32/path-utils.o
224 FREAD_READS_DIRECTORIES = UnfortunatelyYes
226 ifeq ($(uname_S),FreeBSD)
227 NEEDS_LIBICONV = YesPlease
228 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
229 # A typical version string looks like "10.2-RELEASE".
230 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
231 OLD_ICONV = YesPlease
233 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
234 OLD_ICONV = YesPlease
236 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
237 OLD_ICONV = YesPlease
239 NO_MEMMEM = YesPlease
240 BASIC_CFLAGS += -I/usr/local/include
241 BASIC_LDFLAGS += -L/usr/local/lib
242 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
243 USE_ST_TIMESPEC = YesPlease
244 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
245 PTHREAD_LIBS = -pthread
246 NO_UINTMAX_T = YesPlease
247 NO_STRTOUMAX = YesPlease
249 PYTHON_PATH = /usr/local/bin/python
250 PERL_PATH = /usr/local/bin/perl
251 HAVE_PATHS_H = YesPlease
252 HAVE_BSD_SYSCTL = YesPlease
253 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
254 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
255 FREAD_READS_DIRECTORIES = UnfortunatelyYes
256 FILENO_IS_A_MACRO = UnfortunatelyYes
258 ifeq ($(uname_S),OpenBSD)
259 NO_STRCASESTR = YesPlease
260 NO_MEMMEM = YesPlease
261 USE_ST_TIMESPEC = YesPlease
262 NEEDS_LIBICONV = YesPlease
263 BASIC_CFLAGS += -I/usr/local/include
264 BASIC_LDFLAGS += -L/usr/local/lib
265 HAVE_PATHS_H = YesPlease
266 HAVE_BSD_SYSCTL = YesPlease
267 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
268 PROCFS_EXECUTABLE_PATH = /proc/curproc/file
269 FREAD_READS_DIRECTORIES = UnfortunatelyYes
270 FILENO_IS_A_MACRO = UnfortunatelyYes
272 ifeq ($(uname_S),MirBSD)
273 NO_STRCASESTR = YesPlease
274 NO_MEMMEM = YesPlease
275 USE_ST_TIMESPEC = YesPlease
276 NEEDS_LIBICONV = YesPlease
277 HAVE_PATHS_H = YesPlease
278 HAVE_BSD_SYSCTL = YesPlease
280 ifeq ($(uname_S),NetBSD)
281 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
282 NEEDS_LIBICONV = YesPlease
284 BASIC_CFLAGS += -I/usr/pkg/include
285 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
286 USE_ST_TIMESPEC = YesPlease
287 HAVE_PATHS_H = YesPlease
288 HAVE_BSD_SYSCTL = YesPlease
289 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
290 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
292 ifeq ($(uname_S),AIX)
294 NO_STRCASESTR = YesPlease
295 NO_MEMMEM = YesPlease
296 NO_MKDTEMP = YesPlease
297 NO_STRLCPY = YesPlease
299 NO_REGEX = NeedsStartEnd
300 FREAD_READS_DIRECTORIES = UnfortunatelyYes
301 INTERNAL_QSORT = UnfortunatelyYes
302 NEEDS_LIBICONV = YesPlease
303 BASIC_CFLAGS += -D_LARGE_FILES
304 FILENO_IS_A_MACRO = UnfortunatelyYes
305 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
306 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
307 NO_PTHREADS = YesPlease
309 PTHREAD_LIBS = -lpthread
311 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
316 ifeq ($(uname_S),GNU)
318 HAVE_ALLOCA_H = YesPlease
319 NO_STRLCPY = YesPlease
320 HAVE_PATHS_H = YesPlease
321 LIBC_CONTAINS_LIBINTL = YesPlease
322 FREAD_READS_DIRECTORIES = UnfortunatelyYes
324 ifeq ($(uname_S),IRIX)
325 NO_SETENV = YesPlease
326 NO_UNSETENV = YesPlease
327 NO_STRCASESTR = YesPlease
328 NO_MEMMEM = YesPlease
329 NO_MKDTEMP = YesPlease
330 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
331 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
332 # git dies with a segmentation fault when trying to access the first
333 # entry of a reflog. The conservative choice is made to always set
334 # NO_MMAP. If you suspect that your compiler is not affected by this
335 # issue, comment out the NO_MMAP statement.
338 SNPRINTF_RETURNS_BOGUS = YesPlease
339 SHELL_PATH = /usr/gnu/bin/bash
340 NEEDS_LIBGEN = YesPlease
342 ifeq ($(uname_S),IRIX64)
343 NO_SETENV = YesPlease
344 NO_UNSETENV = YesPlease
345 NO_STRCASESTR = YesPlease
346 NO_MEMMEM = YesPlease
347 NO_MKDTEMP = YesPlease
348 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
349 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
350 # git dies with a segmentation fault when trying to access the first
351 # entry of a reflog. The conservative choice is made to always set
352 # NO_MMAP. If you suspect that your compiler is not affected by this
353 # issue, comment out the NO_MMAP statement.
356 SNPRINTF_RETURNS_BOGUS = YesPlease
357 SHELL_PATH = /usr/gnu/bin/bash
358 NEEDS_LIBGEN = YesPlease
360 ifeq ($(uname_S),HP-UX)
363 NO_SETENV = YesPlease
364 NO_STRCASESTR = YesPlease
365 NO_MEMMEM = YesPlease
366 NO_STRLCPY = YesPlease
367 NO_MKDTEMP = YesPlease
368 NO_UNSETENV = YesPlease
369 NO_HSTRERROR = YesPlease
370 NO_SYS_SELECT_H = YesPlease
371 SNPRINTF_RETURNS_BOGUS = YesPlease
373 ifeq ($(uname_R),B.11.00)
374 NO_INET_NTOP = YesPlease
375 NO_INET_PTON = YesPlease
377 ifeq ($(uname_R),B.10.20)
378 # Override HP-UX 11.x setting:
382 NO_INET_NTOP = YesPlease
383 NO_INET_PTON = YesPlease
387 ifeq ($(uname_S),Windows)
388 GIT_VERSION := $(GIT_VERSION).MSVC
390 # Assume that this is built in Git for Windows' SDK
391 ifeq (MINGW32,$(MSYSTEM))
396 # Prepend MSVC 64-bit tool-chain to PATH.
398 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
399 # link.exe next to, and required by, cl.exe, we have to prepend this
400 # onto the existing $PATH.
402 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
403 HAVE_ALLOCA_H = YesPlease
405 NEEDS_CRYPTO_WITH_SSL = YesPlease
406 NO_LIBGEN_H = YesPlease
408 NO_SYMLINK_HEAD = YesPlease
410 NO_UNIX_SOCKETS = YesPlease
411 NO_SETENV = YesPlease
412 NO_STRCASESTR = YesPlease
413 NO_STRLCPY = YesPlease
414 NO_MEMMEM = YesPlease
415 NEEDS_LIBICONV = YesPlease
416 NO_STRTOUMAX = YesPlease
417 NO_MKDTEMP = YesPlease
418 NO_INTTYPES_H = YesPlease
419 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
420 # so we don't need this:
422 # SNPRINTF_RETURNS_BOGUS = YesPlease
423 NO_SVN_TESTS = YesPlease
424 RUNTIME_PREFIX = YesPlease
425 HAVE_WPGMPTR = YesWeDo
426 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
427 USE_WIN32_IPC = YesPlease
428 USE_WIN32_MMAP = YesPlease
429 MMAP_PREVENTS_DELETE = UnfortunatelyYes
430 # USE_NED_ALLOCATOR = YesPlease
431 UNRELIABLE_FSTAT = UnfortunatelyYes
432 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
434 NO_GETTEXT = YesPlease
435 NO_PYTHON = YesPlease
437 NO_POSIX_GOODIES = UnfortunatelyYes
438 NATIVE_CRLF = YesPlease
439 DEFAULT_HELP_FORMAT = html
441 CC = compat/vcbuild/scripts/clink.pl
442 AR = compat/vcbuild/scripts/lib.pl
444 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
445 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
446 compat/win32/path-utils.o \
447 compat/win32/pthread.o compat/win32/syslog.o \
448 compat/win32/trace2_win32_process_info.o \
449 compat/win32/dirent.o
450 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
451 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
452 # invalidcontinue.obj allows Git's source code to close the same file
453 # handle twice, or to access the osfhandle of an already-closed stdout
454 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
455 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
458 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
460 BASIC_CFLAGS += $(vcpkg_rel_lib)
462 BASIC_CFLAGS += $(vcpkg_dbg_lib)
464 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
466 ifneq ($(USE_MSVC_CRTDBG),)
467 # Optionally enable memory leak reporting.
468 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
470 # Always give "-Zi" to the compiler and "-debug" to linker (even in
471 # release mode) to force a PDB to be generated (like RelWithDebInfo).
473 BASIC_LDFLAGS += -debug -Zf
476 LDFLAGS += -SAFESEH:NO
480 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
481 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
484 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
488 compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
490 ifeq ($(uname_S),Interix)
491 NO_INITGROUPS = YesPlease
493 NO_MEMMEM = YesPlease
494 NO_MKDTEMP = YesPlease
495 NO_STRTOUMAX = YesPlease
497 ifeq ($(uname_R),3.5)
498 NO_INET_NTOP = YesPlease
499 NO_INET_PTON = YesPlease
500 NO_SOCKADDR_STORAGE = YesPlease
502 ifeq ($(uname_R),5.2)
503 NO_INET_NTOP = YesPlease
504 NO_INET_PTON = YesPlease
505 NO_SOCKADDR_STORAGE = YesPlease
508 ifeq ($(uname_S),Minix)
510 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
513 NEEDS_CRYPTO_WITH_SSL = YesPlease
515 NO_HSTRERROR = YesPlease
520 ifeq ($(uname_S),NONSTOP_KERNEL)
521 # Needs some C99 features, "inline" is just one of them.
522 # INLINE='' would just replace one set of warnings with another and
523 # still not compile in c89 mode, due to non-const array initializations.
525 # Build down-rev compatible objects that don't use our new getopt_long.
526 ifeq ($(uname_R).$(uname_V),J06.21)
529 ifeq ($(uname_R).$(uname_V),L17.02)
532 # Disable all optimization, seems to result in bad code, with -O or -O2
533 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
534 # abends on "git push". Needs more investigation.
535 CFLAGS = -g -O0 -Winline
536 # We'd want it to be here.
538 # perl and python must be in /usr/bin on NonStop - supplied by HPE
539 # with operating system in that managed directory.
540 PERL_PATH = /usr/bin/perl
541 PYTHON_PATH = /usr/bin/python
542 # The current /usr/coreutils/rm at lowest support level does not work
543 # with the git test structure. Long paths as in
544 # 'trash directory...' cause rm to terminate prematurely without fully
545 # removing the directory at OS releases J06.21 and L17.02.
546 # Default to the older rm until those two releases are deprecated.
548 NEEDS_CRYPTO_WITH_SSL = YesPlease
549 HAVE_DEV_TTY = YesPlease
550 HAVE_LIBCHARSET_H = YesPlease
551 HAVE_STRINGS_H = YesPlease
552 NEEDS_LIBICONV = YesPlease
553 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
554 NO_SYS_SELECT_H = UnfortunatelyYes
555 NO_D_TYPE_IN_DIRENT = YesPlease
556 NO_GETTEXT = YesPlease
557 NO_HSTRERROR = YesPlease
558 NO_STRCASESTR = YesPlease
559 NO_MEMMEM = YesPlease
560 NO_STRLCPY = YesPlease
561 NO_SETENV = YesPlease
562 NO_UNSETENV = YesPlease
563 NO_MKDTEMP = YesPlease
564 # Currently libiconv-1.9.1.
565 OLD_ICONV = UnfortunatelyYes
566 NO_REGEX = NeedsStartEnd
567 NO_PTHREADS = UnfortunatelyYes
568 FREAD_READS_DIRECTORIES = UnfortunatelyYes
570 # Not detected (nor checked for) by './configure'.
571 # We don't have SA_RESTART on NonStop, unfortunalety.
572 COMPAT_CFLAGS += -DSA_RESTART=0
573 # Apparently needed in compat/fnmatch/fnmatch.c.
574 COMPAT_CFLAGS += -DHAVE_STRING_H=1
575 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
580 NO_INTPTR_T = UnfortunatelyYes
581 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
582 SHELL_PATH = /usr/coreutils/bin/bash
584 ifneq (,$(findstring MINGW,$(uname_S)))
586 HAVE_ALLOCA_H = YesPlease
588 NEEDS_CRYPTO_WITH_SSL = YesPlease
589 NO_LIBGEN_H = YesPlease
591 NO_SYMLINK_HEAD = YesPlease
592 NO_UNIX_SOCKETS = YesPlease
593 NO_SETENV = YesPlease
594 NO_STRCASESTR = YesPlease
595 NO_STRLCPY = YesPlease
596 NO_MEMMEM = YesPlease
597 NEEDS_LIBICONV = YesPlease
598 NO_STRTOUMAX = YesPlease
599 NO_MKDTEMP = YesPlease
600 NO_SVN_TESTS = YesPlease
601 RUNTIME_PREFIX = YesPlease
602 HAVE_WPGMPTR = YesWeDo
603 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
604 USE_WIN32_IPC = YesPlease
605 USE_WIN32_MMAP = YesPlease
606 MMAP_PREVENTS_DELETE = UnfortunatelyYes
607 USE_NED_ALLOCATOR = YesPlease
608 UNRELIABLE_FSTAT = UnfortunatelyYes
609 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
611 NO_PYTHON = YesPlease
613 NO_POSIX_GOODIES = UnfortunatelyYes
614 DEFAULT_HELP_FORMAT = html
615 BASIC_LDFLAGS += -municode
616 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
617 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
618 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
619 compat/win32/trace2_win32_process_info.o \
620 compat/win32/path-utils.o \
621 compat/win32/pthread.o compat/win32/syslog.o \
622 compat/win32/dirent.o
623 BASIC_CFLAGS += -DWIN32
628 NATIVE_CRLF = YesPlease
630 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
631 htmldir = doc/git/html/
633 INSTALL = /bin/install
634 EXTLIBS += /mingw/lib/libz.a
635 INTERNAL_QSORT = YesPlease
636 HAVE_LIBCHARSET_H = YesPlease
637 NO_GETTEXT = YesPlease
638 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
640 ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
644 BASIC_LDFLAGS += -Wl,--nxcompat
645 # Enable ASLR (unless debugging)
646 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
647 BASIC_LDFLAGS += -Wl,--dynamicbase
649 ifeq (MINGW32,$(MSYSTEM))
652 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
654 ifeq (MINGW64,$(MSYSTEM))
657 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
659 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
660 BASIC_LDFLAGS += -Wl,--large-address-aware
663 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
664 -fstack-protector-strong
666 INSTALL = /bin/install
667 INTERNAL_QSORT = YesPlease
668 HAVE_LIBCHARSET_H = YesPlease
670 USE_GETTEXT_SCHEME = fallthrough
671 USE_LIBPCRE= YesPlease
673 USE_NED_ALLOCATOR = YesPlease
675 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
680 ifeq ($(uname_S),QNX)
681 COMPAT_CFLAGS += -DSA_RESTART=0
682 EXPAT_NEEDS_XMLPARSE_H = YesPlease
683 HAVE_STRINGS_H = YesPlease
684 NEEDS_SOCKET = YesPlease
685 NO_GETPAGESIZE = YesPlease
687 NO_MEMMEM = YesPlease
688 NO_MKDTEMP = YesPlease
690 NO_PTHREADS = YesPlease
691 NO_STRCASESTR = YesPlease
692 NO_STRLCPY = YesPlease
696 # Require clean work tree
697 git update-index -q --refresh && \
698 git diff-files --quiet && \
699 git diff-index --cached --quiet HEAD --
701 # Make .vcxproj files and add them
702 unset QUIET_GEN QUIET_BUILT_IN; \
703 perl contrib/buildsystems/generate -g Vcxproj
704 git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
706 # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
707 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
708 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
709 for name in $(BUILT_INS);\
711 echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
713 echo ' </Target>' && \
714 echo '</Project>') >git/LinkOrCopyBuiltins.targets
715 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
716 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
717 for name in $(REMOTE_CURL_ALIASES); \
719 echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
721 echo ' </Target>' && \
722 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
723 git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
725 # Add command-list.h and config-list.h
726 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 config-list.h command-list.h
727 git add -f config-list.h command-list.h
731 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
732 # Strip out the sane tool path, needed only for building
733 sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
734 git add -f $(SCRIPT_LIB) $(SCRIPTS)
737 $(MAKE) $(LIB_PERL_GEN)
738 git add -f perl/build
740 # Add bin-wrappers, for testing
742 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
743 # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
744 # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
745 # by test-lib.sh according to the current setup)
746 sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
747 \1="$$(cygpath -u "$$\1")"/' \
748 -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
749 # Ensure that test-* helpers find the .dll files copied to top-level
750 sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
751 # We do not want to force hard-linking builtins
752 sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
753 bin-wrappers/git-{receive-pack,upload-archive}
754 git add -f $(test_bindir_programs)
755 # remote-ext is a builtin, but invoked as if it were external
756 sed 's|receive-pack|remote-ext|g' \
757 <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
758 git add -f bin-wrappers/git-remote-ext
762 git add -f templates/boilerplates.made templates/blt/
764 # Add the translated messages
765 make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
766 git add -f $(MOFILES)
769 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
770 git add -f GIT-BUILD-OPTIONS
772 # Commit the whole shebang
773 git commit -m "Generate Visual Studio solution" \
774 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"