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_SYNC_FILE_RANGE = YesPlease
61 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
67 # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
68 ifneq ($(findstring .el7.,$(uname_R)),)
69 BASIC_CFLAGS += -std=c99
72 ifeq ($(uname_S),GNU/kFreeBSD)
73 HAVE_ALLOCA_H = YesPlease
74 NO_STRLCPY = YesPlease
75 HAVE_PATHS_H = YesPlease
76 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
77 LIBC_CONTAINS_LIBINTL = YesPlease
78 FREAD_READS_DIRECTORIES = UnfortunatelyYes
80 ifeq ($(uname_S),UnixWare)
82 NEEDS_SOCKET = YesPlease
84 NEEDS_SSL_WITH_CRYPTO = YesPlease
85 NEEDS_LIBICONV = YesPlease
86 SHELL_PATH = /usr/local/bin/bash
88 NO_HSTRERROR = YesPlease
89 BASIC_CFLAGS += -Kthread
90 BASIC_CFLAGS += -I/usr/local/include
91 BASIC_LDFLAGS += -L/usr/local/lib
94 NO_STRCASESTR = YesPlease
97 ifeq ($(uname_S),SCO_SV)
103 BASIC_CFLAGS += -Kthread
105 NEEDS_SOCKET = YesPlease
106 NEEDS_NSL = YesPlease
107 NEEDS_SSL_WITH_CRYPTO = YesPlease
108 NEEDS_LIBICONV = YesPlease
109 SHELL_PATH = /usr/bin/bash
111 NO_HSTRERROR = YesPlease
112 BASIC_CFLAGS += -I/usr/local/include
113 BASIC_LDFLAGS += -L/usr/local/lib
114 NO_STRCASESTR = YesPlease
115 NO_MEMMEM = YesPlease
119 ifeq ($(uname_S),Darwin)
120 NEEDS_CRYPTO_WITH_SSL = YesPlease
121 NEEDS_SSL_WITH_CRYPTO = YesPlease
122 NEEDS_LIBICONV = YesPlease
123 # Note: $(uname_R) gives us the underlying Darwin version.
124 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
125 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
126 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
127 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
128 OLD_ICONV = UnfortunatelyYes
129 NO_APPLE_COMMON_CRYPTO = YesPlease
131 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
132 NO_STRLCPY = YesPlease
134 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
135 HAVE_GETDELIM = YesPlease
137 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
138 OPEN_RETURNS_EINTR = UnfortunatelyYes
140 NO_MEMMEM = YesPlease
141 USE_ST_TIMESPEC = YesPlease
142 HAVE_DEV_TTY = YesPlease
143 COMPAT_OBJS += compat/precompose_utf8.o
144 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
145 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
146 HAVE_BSD_SYSCTL = YesPlease
147 FREAD_READS_DIRECTORIES = UnfortunatelyYes
148 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
149 CSPRNG_METHOD = arc4random
150 USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease
152 # Workaround for `gettext` being keg-only and not even being linked via
153 # `brew link --force gettext`, should be obsolete as of
154 # https://github.com/Homebrew/homebrew-core/pull/53489
155 ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
156 BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
157 BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
158 ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
159 MSGFMT = /usr/local/opt/gettext/bin/msgfmt
163 # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
164 # Unix domain sockets and PThreads.
166 ifndef NO_UNIX_SOCKETS
167 FSMONITOR_DAEMON_BACKEND = darwin
168 FSMONITOR_OS_SETTINGS = darwin
172 BASIC_LDFLAGS += -framework CoreServices
174 ifeq ($(uname_S),SunOS)
175 NEEDS_SOCKET = YesPlease
176 NEEDS_NSL = YesPlease
177 SHELL_PATH = /bin/bash
178 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
179 HAVE_ALLOCA_H = YesPlease
180 NO_STRCASESTR = YesPlease
181 NO_MEMMEM = YesPlease
182 NO_MKDTEMP = YesPlease
184 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
185 HAVE_DEV_TTY = YesPlease
186 ifeq ($(uname_R),5.6)
188 NO_HSTRERROR = YesPlease
190 NO_SOCKADDR_STORAGE = YesPlease
191 NO_UNSETENV = YesPlease
192 NO_SETENV = YesPlease
193 NO_STRLCPY = YesPlease
194 NO_STRTOUMAX = YesPlease
197 ifeq ($(uname_R),5.7)
198 NEEDS_RESOLV = YesPlease
200 NO_SOCKADDR_STORAGE = YesPlease
201 NO_UNSETENV = YesPlease
202 NO_SETENV = YesPlease
203 NO_STRLCPY = YesPlease
204 NO_STRTOUMAX = YesPlease
207 ifeq ($(uname_R),5.8)
208 NO_UNSETENV = YesPlease
209 NO_SETENV = YesPlease
210 NO_STRTOUMAX = YesPlease
213 ifeq ($(uname_R),5.9)
214 NO_UNSETENV = YesPlease
215 NO_SETENV = YesPlease
216 NO_STRTOUMAX = YesPlease
219 INSTALL = /usr/ucb/install
221 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
223 ifeq ($(uname_O),Cygwin)
224 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
225 NO_D_TYPE_IN_DIRENT = YesPlease
226 NO_STRCASESTR = YesPlease
227 NO_MEMMEM = YesPlease
228 NO_SYMLINK_HEAD = YesPlease
230 OLD_ICONV = UnfortunatelyYes
231 # There are conflicting reports about this.
232 # On some boxes NO_MMAP is needed, and not so elsewhere.
233 # Try commenting this out if you suspect MMAP is more efficient
236 NO_REGEX = UnfortunatelyYes
238 HAVE_ALLOCA_H = YesPlease
239 NEEDS_LIBICONV = YesPlease
240 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
241 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
243 UNRELIABLE_FSTAT = UnfortunatelyYes
244 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
245 MMAP_PREVENTS_DELETE = UnfortunatelyYes
246 COMPAT_OBJS += compat/win32/path-utils.o
247 FREAD_READS_DIRECTORIES = UnfortunatelyYes
249 ifeq ($(uname_S),FreeBSD)
250 NEEDS_LIBICONV = YesPlease
251 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
252 # A typical version string looks like "10.2-RELEASE".
253 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
254 OLD_ICONV = YesPlease
256 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
257 OLD_ICONV = YesPlease
259 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
260 OLD_ICONV = YesPlease
262 NO_MEMMEM = YesPlease
263 BASIC_CFLAGS += -I/usr/local/include
264 BASIC_LDFLAGS += -L/usr/local/lib
265 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
266 USE_ST_TIMESPEC = YesPlease
267 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
268 PTHREAD_LIBS = -pthread
269 NO_UINTMAX_T = YesPlease
270 NO_STRTOUMAX = YesPlease
272 PYTHON_PATH = /usr/local/bin/python
273 PERL_PATH = /usr/local/bin/perl
274 HAVE_PATHS_H = YesPlease
275 HAVE_BSD_SYSCTL = YesPlease
276 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
277 CSPRNG_METHOD = arc4random
278 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
279 FREAD_READS_DIRECTORIES = UnfortunatelyYes
280 FILENO_IS_A_MACRO = UnfortunatelyYes
282 ifeq ($(uname_S),OpenBSD)
283 NO_STRCASESTR = YesPlease
284 NO_MEMMEM = YesPlease
285 USE_ST_TIMESPEC = YesPlease
286 NEEDS_LIBICONV = YesPlease
287 BASIC_CFLAGS += -I/usr/local/include
288 BASIC_LDFLAGS += -L/usr/local/lib
289 HAVE_PATHS_H = YesPlease
290 HAVE_BSD_SYSCTL = YesPlease
291 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
292 CSPRNG_METHOD = arc4random
293 PROCFS_EXECUTABLE_PATH = /proc/curproc/file
294 FREAD_READS_DIRECTORIES = UnfortunatelyYes
295 FILENO_IS_A_MACRO = UnfortunatelyYes
297 ifeq ($(uname_S),MirBSD)
298 NO_STRCASESTR = YesPlease
299 NO_MEMMEM = YesPlease
300 USE_ST_TIMESPEC = YesPlease
301 NEEDS_LIBICONV = YesPlease
302 HAVE_PATHS_H = YesPlease
303 HAVE_BSD_SYSCTL = YesPlease
304 CSPRNG_METHOD = arc4random
306 ifeq ($(uname_S),NetBSD)
307 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
308 NEEDS_LIBICONV = YesPlease
310 BASIC_CFLAGS += -I/usr/pkg/include
311 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
312 USE_ST_TIMESPEC = YesPlease
313 HAVE_PATHS_H = YesPlease
314 HAVE_BSD_SYSCTL = YesPlease
315 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
316 CSPRNG_METHOD = arc4random
317 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
319 ifeq ($(uname_S),AIX)
321 NO_STRCASESTR = YesPlease
322 NO_MEMMEM = YesPlease
323 NO_MKDTEMP = YesPlease
324 NO_STRLCPY = YesPlease
326 NO_REGEX = NeedsStartEnd
327 FREAD_READS_DIRECTORIES = UnfortunatelyYes
328 INTERNAL_QSORT = UnfortunatelyYes
329 NEEDS_LIBICONV = YesPlease
330 BASIC_CFLAGS += -D_LARGE_FILES
331 FILENO_IS_A_MACRO = UnfortunatelyYes
332 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
333 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
334 NO_PTHREADS = YesPlease
336 PTHREAD_LIBS = -lpthread
338 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
343 ifeq ($(uname_S),GNU)
345 HAVE_ALLOCA_H = YesPlease
346 NO_STRLCPY = YesPlease
347 HAVE_PATHS_H = YesPlease
348 LIBC_CONTAINS_LIBINTL = YesPlease
349 FREAD_READS_DIRECTORIES = UnfortunatelyYes
351 ifeq ($(uname_S),IRIX)
352 NO_SETENV = YesPlease
353 NO_UNSETENV = YesPlease
354 NO_STRCASESTR = YesPlease
355 NO_MEMMEM = YesPlease
356 NO_MKDTEMP = YesPlease
357 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
358 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
359 # git dies with a segmentation fault when trying to access the first
360 # entry of a reflog. The conservative choice is made to always set
361 # NO_MMAP. If you suspect that your compiler is not affected by this
362 # issue, comment out the NO_MMAP statement.
365 SNPRINTF_RETURNS_BOGUS = YesPlease
366 SHELL_PATH = /usr/gnu/bin/bash
367 NEEDS_LIBGEN = YesPlease
369 ifeq ($(uname_S),IRIX64)
370 NO_SETENV = YesPlease
371 NO_UNSETENV = YesPlease
372 NO_STRCASESTR = YesPlease
373 NO_MEMMEM = YesPlease
374 NO_MKDTEMP = YesPlease
375 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
376 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
377 # git dies with a segmentation fault when trying to access the first
378 # entry of a reflog. The conservative choice is made to always set
379 # NO_MMAP. If you suspect that your compiler is not affected by this
380 # issue, comment out the NO_MMAP statement.
383 SNPRINTF_RETURNS_BOGUS = YesPlease
384 SHELL_PATH = /usr/gnu/bin/bash
385 NEEDS_LIBGEN = YesPlease
387 ifeq ($(uname_S),HP-UX)
390 NO_SETENV = YesPlease
391 NO_STRCASESTR = YesPlease
392 NO_MEMMEM = YesPlease
393 NO_STRLCPY = YesPlease
394 NO_MKDTEMP = YesPlease
395 NO_UNSETENV = YesPlease
396 NO_HSTRERROR = YesPlease
397 NO_SYS_SELECT_H = YesPlease
398 SNPRINTF_RETURNS_BOGUS = YesPlease
400 ifeq ($(uname_R),B.11.00)
401 NO_INET_NTOP = YesPlease
402 NO_INET_PTON = YesPlease
404 ifeq ($(uname_R),B.10.20)
405 # Override HP-UX 11.x setting:
409 NO_INET_NTOP = YesPlease
410 NO_INET_PTON = YesPlease
414 ifeq ($(uname_S),Windows)
415 GIT_VERSION := $(GIT_VERSION).MSVC
417 # Assume that this is built in Git for Windows' SDK
418 ifeq (MINGW32,$(MSYSTEM))
423 # Prepend MSVC 64-bit tool-chain to PATH.
425 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
426 # link.exe next to, and required by, cl.exe, we have to prepend this
427 # onto the existing $PATH.
429 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
430 HAVE_ALLOCA_H = YesPlease
432 NEEDS_CRYPTO_WITH_SSL = YesPlease
433 NO_LIBGEN_H = YesPlease
435 NO_SYMLINK_HEAD = YesPlease
437 NO_UNIX_SOCKETS = YesPlease
438 NO_SETENV = YesPlease
439 NO_STRCASESTR = YesPlease
440 NO_STRLCPY = YesPlease
441 NO_MEMMEM = YesPlease
442 NEEDS_LIBICONV = YesPlease
443 NO_STRTOUMAX = YesPlease
444 NO_MKDTEMP = YesPlease
445 NO_INTTYPES_H = YesPlease
446 CSPRNG_METHOD = rtlgenrandom
447 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
448 # so we don't need this:
450 # SNPRINTF_RETURNS_BOGUS = YesPlease
452 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
453 # These are always available, so we do not have to conditionally
455 FSMONITOR_DAEMON_BACKEND = win32
456 FSMONITOR_OS_SETTINGS = win32
458 NO_SVN_TESTS = YesPlease
459 RUNTIME_PREFIX = YesPlease
460 HAVE_WPGMPTR = YesWeDo
461 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
462 USE_WIN32_IPC = YesPlease
463 USE_WIN32_MMAP = YesPlease
464 MMAP_PREVENTS_DELETE = UnfortunatelyYes
465 # USE_NED_ALLOCATOR = YesPlease
466 UNRELIABLE_FSTAT = UnfortunatelyYes
467 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
469 NO_GETTEXT = YesPlease
470 NO_PYTHON = YesPlease
472 NO_POSIX_GOODIES = UnfortunatelyYes
473 NATIVE_CRLF = YesPlease
474 DEFAULT_HELP_FORMAT = html
475 ifeq (/mingw64,$(subst 32,64,$(prefix)))
476 # Move system config into top-level /etc/
477 ETC_GITCONFIG = ../etc/gitconfig
478 ETC_GITATTRIBUTES = ../etc/gitattributes
481 CC = compat/vcbuild/scripts/clink.pl
482 AR = compat/vcbuild/scripts/lib.pl
484 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
485 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
486 compat/win32/flush.o \
487 compat/win32/path-utils.o \
488 compat/win32/pthread.o compat/win32/syslog.o \
489 compat/win32/trace2_win32_process_info.o \
490 compat/win32/dirent.o
491 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
492 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
493 # invalidcontinue.obj allows Git's source code to close the same file
494 # handle twice, or to access the osfhandle of an already-closed stdout
495 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
496 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
499 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
501 BASIC_CFLAGS += $(vcpkg_rel_lib)
503 BASIC_CFLAGS += $(vcpkg_dbg_lib)
505 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
507 ifneq ($(USE_MSVC_CRTDBG),)
508 # Optionally enable memory leak reporting.
509 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
511 # Always give "-Zi" to the compiler and "-debug" to linker (even in
512 # release mode) to force a PDB to be generated (like RelWithDebInfo).
514 BASIC_LDFLAGS += -debug -Zf
517 LDFLAGS += -SAFESEH:NO
521 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
522 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
525 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
529 compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
531 ifeq ($(uname_S),Interix)
532 NO_INITGROUPS = YesPlease
534 NO_MEMMEM = YesPlease
535 NO_MKDTEMP = YesPlease
536 NO_STRTOUMAX = YesPlease
538 ifeq ($(uname_R),3.5)
539 NO_INET_NTOP = YesPlease
540 NO_INET_PTON = YesPlease
541 NO_SOCKADDR_STORAGE = YesPlease
543 ifeq ($(uname_R),5.2)
544 NO_INET_NTOP = YesPlease
545 NO_INET_PTON = YesPlease
546 NO_SOCKADDR_STORAGE = YesPlease
549 ifeq ($(uname_S),Minix)
551 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
554 NEEDS_CRYPTO_WITH_SSL = YesPlease
556 NO_HSTRERROR = YesPlease
561 ifeq ($(uname_S),NONSTOP_KERNEL)
562 # Needs some C99 features, "inline" is just one of them.
563 # INLINE='' would just replace one set of warnings with another and
564 # still not compile in c89 mode, due to non-const array initializations.
566 # Build down-rev compatible objects that don't use our new getopt_long.
567 ifeq ($(uname_R).$(uname_V),J06.21)
570 ifeq ($(uname_R).$(uname_V),L17.02)
573 # Disable all optimization, seems to result in bad code, with -O or -O2
574 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
575 # abends on "git push". Needs more investigation.
576 CFLAGS = -g -O0 -Winline
577 # We'd want it to be here.
579 # perl and python must be in /usr/bin on NonStop - supplied by HPE
580 # with operating system in that managed directory.
581 PERL_PATH = /usr/bin/perl
582 PYTHON_PATH = /usr/bin/python
583 # The current /usr/coreutils/rm at lowest support level does not work
584 # with the git test structure. Long paths as in
585 # 'trash directory...' cause rm to terminate prematurely without fully
586 # removing the directory at OS releases J06.21 and L17.02.
587 # Default to the older rm until those two releases are deprecated.
589 NEEDS_CRYPTO_WITH_SSL = YesPlease
590 HAVE_DEV_TTY = YesPlease
591 HAVE_LIBCHARSET_H = YesPlease
592 HAVE_STRINGS_H = YesPlease
593 NEEDS_LIBICONV = YesPlease
594 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
595 NO_SYS_SELECT_H = UnfortunatelyYes
596 NO_D_TYPE_IN_DIRENT = YesPlease
597 NO_GETTEXT = YesPlease
598 NO_HSTRERROR = YesPlease
599 NO_STRCASESTR = YesPlease
600 NO_MEMMEM = YesPlease
601 NO_STRLCPY = YesPlease
602 NO_SETENV = YesPlease
603 NO_UNSETENV = YesPlease
604 NO_MKDTEMP = YesPlease
605 # Currently libiconv-1.9.1.
606 OLD_ICONV = UnfortunatelyYes
607 NO_REGEX = NeedsStartEnd
608 NO_PTHREADS = UnfortunatelyYes
609 FREAD_READS_DIRECTORIES = UnfortunatelyYes
611 # Not detected (nor checked for) by './configure'.
612 # We don't have SA_RESTART on NonStop, unfortunalety.
613 COMPAT_CFLAGS += -DSA_RESTART=0
614 # Apparently needed in compat/fnmatch/fnmatch.c.
615 COMPAT_CFLAGS += -DHAVE_STRING_H=1
616 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
621 NO_INTPTR_T = UnfortunatelyYes
622 CSPRNG_METHOD = openssl
623 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
624 SHELL_PATH = /usr/coreutils/bin/bash
626 ifeq ($(uname_S),MINGW)
628 HAVE_ALLOCA_H = YesPlease
630 NEEDS_CRYPTO_WITH_SSL = YesPlease
631 NO_LIBGEN_H = YesPlease
633 NO_SYMLINK_HEAD = YesPlease
634 NO_UNIX_SOCKETS = YesPlease
635 NO_SETENV = YesPlease
636 NO_STRCASESTR = YesPlease
637 NO_STRLCPY = YesPlease
638 NO_MEMMEM = YesPlease
639 NEEDS_LIBICONV = YesPlease
640 NO_STRTOUMAX = YesPlease
641 NO_MKDTEMP = YesPlease
642 NO_SVN_TESTS = YesPlease
644 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
645 # These are always available, so we do not have to conditionally
647 FSMONITOR_DAEMON_BACKEND = win32
648 FSMONITOR_OS_SETTINGS = win32
650 RUNTIME_PREFIX = YesPlease
651 HAVE_WPGMPTR = YesWeDo
652 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
653 USE_WIN32_IPC = YesPlease
654 USE_WIN32_MMAP = YesPlease
655 MMAP_PREVENTS_DELETE = UnfortunatelyYes
656 USE_NED_ALLOCATOR = YesPlease
657 UNRELIABLE_FSTAT = UnfortunatelyYes
658 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
661 NO_POSIX_GOODIES = UnfortunatelyYes
662 DEFAULT_HELP_FORMAT = html
663 HAVE_PLATFORM_PROCINFO = YesPlease
664 CSPRNG_METHOD = rtlgenrandom
665 BASIC_LDFLAGS += -municode
666 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
667 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
668 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
669 compat/win32/trace2_win32_process_info.o \
670 compat/win32/flush.o \
671 compat/win32/path-utils.o \
672 compat/win32/pthread.o compat/win32/syslog.o \
673 compat/win32/dirent.o
674 BASIC_CFLAGS += -DWIN32
679 NATIVE_CRLF = YesPlease
681 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
682 htmldir = doc/git/html/
684 INSTALL = /bin/install
685 EXTLIBS += /mingw/lib/libz.a
686 INTERNAL_QSORT = YesPlease
687 HAVE_LIBCHARSET_H = YesPlease
688 NO_GETTEXT = YesPlease
689 NO_PYTHON = YesPlease
690 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
692 ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
696 BASIC_LDFLAGS += -Wl,--nxcompat
697 # Enable ASLR (unless debugging)
698 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
699 BASIC_LDFLAGS += -Wl,--dynamicbase
701 ifeq (MINGW32,$(MSYSTEM))
704 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
706 ifeq (MINGW64,$(MSYSTEM))
709 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
711 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
712 BASIC_LDFLAGS += -Wl,--large-address-aware
715 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
716 -fstack-protector-strong
718 INSTALL = /bin/install
719 INTERNAL_QSORT = YesPlease
720 HAVE_LIBCHARSET_H = YesPlease
721 USE_GETTEXT_SCHEME = fallthrough
722 USE_LIBPCRE = YesPlease
723 USE_NED_ALLOCATOR = YesPlease
724 ifeq (/mingw64,$(subst 32,64,$(prefix)))
725 # Move system config into top-level /etc/
726 ETC_GITCONFIG = ../etc/gitconfig
727 ETC_GITATTRIBUTES = ../etc/gitattributes
730 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
732 NO_PYTHON = YesPlease
736 ifeq ($(uname_S),QNX)
737 COMPAT_CFLAGS += -DSA_RESTART=0
738 EXPAT_NEEDS_XMLPARSE_H = YesPlease
739 HAVE_STRINGS_H = YesPlease
740 NEEDS_SOCKET = YesPlease
741 NO_GETPAGESIZE = YesPlease
743 NO_MEMMEM = YesPlease
744 NO_MKDTEMP = YesPlease
746 NO_PTHREADS = YesPlease
747 NO_STRCASESTR = YesPlease
748 NO_STRLCPY = YesPlease
752 # Require clean work tree
753 git update-index -q --refresh && \
754 git diff-files --quiet && \
755 git diff-index --cached --quiet HEAD --
757 # Make .vcxproj files and add them
758 perl contrib/buildsystems/generate -g Vcxproj
759 git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
761 # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
762 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
763 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
764 for name in $(BUILT_INS);\
766 echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
768 echo ' </Target>' && \
769 echo '</Project>') >git/LinkOrCopyBuiltins.targets
770 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
771 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
772 for name in $(REMOTE_CURL_ALIASES); \
774 echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
776 echo ' </Target>' && \
777 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
778 git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
780 # Add generated headers
781 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
782 git add -f $(GENERATED_H)
786 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
787 # Strip out the sane tool path, needed only for building
788 sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
789 git add -f $(SCRIPT_LIB) $(SCRIPTS)
792 $(MAKE) $(LIB_PERL_GEN)
793 git add -f perl/build
795 # Add bin-wrappers, for testing
797 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
798 # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
799 # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
800 # by test-lib.sh according to the current setup)
801 sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
802 \1="$$(cygpath -u "$$\1")"/' \
803 -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
804 # Ensure that test-* helpers find the .dll files copied to top-level
805 sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
806 # We do not want to force hard-linking builtins
807 sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
808 bin-wrappers/git-{receive-pack,upload-archive}
809 git add -f $(test_bindir_programs)
810 # remote-ext is a builtin, but invoked as if it were external
811 sed 's|receive-pack|remote-ext|g' \
812 <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
813 git add -f bin-wrappers/git-remote-ext
817 git add -f templates/boilerplates.made templates/blt/
819 # Add the translated messages
820 make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
821 git add -f $(MOFILES)
824 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
825 git add -f GIT-BUILD-OPTIONS
827 # Commit the whole shebang
828 git commit -m "Generate Visual Studio solution" \
829 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"