interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / config.mak.uname

821 lines · 25937 bytes Raw Blame History
1# Platform specific Makefile tweaks based on uname detection
2
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.
6
7uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
8uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
9uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
10uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
11uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
12
13ifneq ($(findstring MINGW,$(uname_S)),)
14 uname_S := MINGW
15endif
16
17ifdef MSVC
18 # avoid the MingW and Cygwin configuration sections
19 uname_S := Windows
20 uname_O := Windows
21
22 # Generate and include makefile variables that point to the
23 # currently installed set of MSVC command line tools.
24compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
25 @"$<" | tr '\\' / >"$@"
26include compat/vcbuild/MSVC-DEFS-GEN
27
28 # See if vcpkg and the vcpkg-build versions of the third-party
29 # libraries that we use are installed. We include the result
30 # to get $(vcpkg_*) variables defined for the Makefile.
31ifeq (,$(SKIP_VCPKG))
32compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
33 @"$<"
34include compat/vcbuild/VCPKG-DEFS
35endif
36endif
37
38# We choose to avoid "if .. else if .. else .. endif endif"
39# because maintaining the nesting to match is a pain. If
40# we had "elif" things would have been much nicer...
41
42ifeq ($(uname_S),OSF1)
43 # Need this for u_short definitions et al
44 BASIC_CFLAGS += -D_OSF_SOURCE
45 SOCKLEN_T = int
46 NO_STRTOULL = YesPlease
47 NO_NSEC = YesPlease
48endif
49ifeq ($(uname_S),Linux)
50 HAVE_ALLOCA_H = YesPlease
51 # override in config.mak if you have glibc >= 2.38
52 NO_STRLCPY = YesPlease
53 CSPRNG_METHOD = getrandom
54 HAVE_PATHS_H = YesPlease
55 LIBC_CONTAINS_LIBINTL = YesPlease
56 HAVE_DEV_TTY = YesPlease
57 HAVE_CLOCK_GETTIME = YesPlease
58 HAVE_CLOCK_MONOTONIC = YesPlease
59 HAVE_SYNC_FILE_RANGE = YesPlease
60 HAVE_GETDELIM = YesPlease
61 FREAD_READS_DIRECTORIES = UnfortunatelyYes
62 HAVE_SYSINFO = YesPlease
63 PROCFS_EXECUTABLE_PATH = /proc/self/exe
64 HAVE_PLATFORM_PROCINFO = YesPlease
65 COMPAT_OBJS += compat/linux/procinfo.o
66 EXTLIBS += -ldl
67 # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
68 ifneq ($(findstring .el7.,$(uname_R)),)
69 BASIC_CFLAGS += -std=c99
70 endif
71 LINK_FUZZ_PROGRAMS = YesPlease
72
73 # The builtin FSMonitor on Linux builds upon Simple-IPC. Both require
74 # Unix domain sockets and PThreads.
75 ifndef NO_PTHREADS
76 ifndef NO_UNIX_SOCKETS
77 FSMONITOR_DAEMON_BACKEND = linux
78 FSMONITOR_OS_SETTINGS = unix
79 BASIC_CFLAGS += -DHAVE_LINUX_MAGIC_H
80 endif
81 endif
82endif
83ifeq ($(uname_S),GNU/kFreeBSD)
84 HAVE_ALLOCA_H = YesPlease
85 NO_STRLCPY = YesPlease
86 HAVE_PATHS_H = YesPlease
87 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
88 LIBC_CONTAINS_LIBINTL = YesPlease
89 FREAD_READS_DIRECTORIES = UnfortunatelyYes
90endif
91ifeq ($(uname_S),UnixWare)
92 CC = cc
93 NEEDS_SOCKET = YesPlease
94 NEEDS_NSL = YesPlease
95 NEEDS_SSL_WITH_CRYPTO = YesPlease
96 NEEDS_LIBICONV = YesPlease
97 SHELL_PATH = /usr/local/bin/bash
98 NO_IPV6 = YesPlease
99 NO_HSTRERROR = YesPlease
100 BASIC_CFLAGS += -Kthread
101 BASIC_CFLAGS += -I/usr/local/include
102 BASIC_LDFLAGS += -L/usr/local/lib
103 INSTALL = ginstall
104 TAR = gtar
105 NO_STRCASESTR = YesPlease
106 NO_MEMMEM = YesPlease
107endif
108ifeq ($(uname_S),SCO_SV)
109 ifeq ($(uname_R),3.2)
110 CFLAGS = -O2
111 endif
112 ifeq ($(uname_R),5)
113 CC = cc
114 BASIC_CFLAGS += -Kthread
115 endif
116 NEEDS_SOCKET = YesPlease
117 NEEDS_NSL = YesPlease
118 NEEDS_SSL_WITH_CRYPTO = YesPlease
119 NEEDS_LIBICONV = YesPlease
120 SHELL_PATH = /usr/bin/bash
121 NO_IPV6 = YesPlease
122 NO_HSTRERROR = YesPlease
123 BASIC_CFLAGS += -I/usr/local/include
124 BASIC_LDFLAGS += -L/usr/local/lib
125 NO_STRCASESTR = YesPlease
126 NO_MEMMEM = YesPlease
127 INSTALL = ginstall
128 TAR = gtar
129endif
130ifeq ($(uname_S),Darwin)
131 NEEDS_CRYPTO_WITH_SSL = YesPlease
132 NEEDS_SSL_WITH_CRYPTO = YesPlease
133 NEEDS_LIBICONV = YesPlease
134 # Note: $(uname_R) gives us the underlying Darwin version.
135 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
136 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
137 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
138 DARWIN_MAJOR_VERSION = $(shell expr "$(uname_R)" : '\([0-9]*\)\.')
139 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
140 OLD_ICONV = UnfortunatelyYes
141 NO_APPLE_COMMON_CRYPTO = YesPlease
142 endif
143 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
144 NO_STRLCPY = YesPlease
145 endif
146 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
147 HAVE_GETDELIM = YesPlease
148 endif
149 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
150 OPEN_RETURNS_EINTR = UnfortunatelyYes
151 endif
152 NO_MEMMEM = YesPlease
153 USE_ST_TIMESPEC = YesPlease
154 HAVE_DEV_TTY = YesPlease
155 COMPAT_OBJS += compat/precompose_utf8.o
156 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
157 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
158 HAVE_BSD_SYSCTL = YesPlease
159 FREAD_READS_DIRECTORIES = UnfortunatelyYes
160 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
161 CSPRNG_METHOD = arc4random
162 USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease
163 HAVE_PLATFORM_PROCINFO = YesPlease
164 COMPAT_OBJS += compat/darwin/procinfo.o
165
166 ifeq ($(uname_M),arm64)
167 HOMEBREW_PREFIX = /opt/homebrew
168 else
169 HOMEBREW_PREFIX = /usr/local
170 endif
171 ifeq ($(shell test "$(DARWIN_MAJOR_VERSION)" -ge 24 && echo 1),1)
172 USE_HOMEBREW_LIBICONV = UnfortunatelyYes
173 NEEDS_GOOD_LIBICONV = UnfortunatelyYes
174 endif
175
176 # ld reports "PROJECT:{ld,ld64,dyld}-NNN", match any of the three.
177 LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:[^ ]*-\([0-9][0-9]*\).*/\1/p')
178
179 # Silence the Xcode 15+ warning about archives listed more than once.
180 ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 907 && echo 1),1)
181 BASIC_LDFLAGS += -Wl,-no_warn_duplicate_libraries
182 endif
183
184 # Silence the Xcode 16.3+ warning about __DATA,__common alignment.
185 ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 1167 && echo 1),1)
186 BASIC_CFLAGS += -fno-common
187 endif
188
189 # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
190 # Unix domain sockets and PThreads.
191 ifndef NO_PTHREADS
192 ifndef NO_UNIX_SOCKETS
193 FSMONITOR_DAEMON_BACKEND = darwin
194 FSMONITOR_OS_SETTINGS = unix
195 endif
196 endif
197
198 BASIC_LDFLAGS += -framework CoreServices
199endif
200ifeq ($(uname_S),SunOS)
201 NEEDS_SOCKET = YesPlease
202 NEEDS_NSL = YesPlease
203 SHELL_PATH = /bin/bash
204 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
205 HAVE_ALLOCA_H = YesPlease
206 NO_REGEX = YesPlease
207 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
208 HAVE_DEV_TTY = YesPlease
209 ifeq ($(uname_R),5.6)
210 SOCKLEN_T = int
211 NO_HSTRERROR = YesPlease
212 NO_IPV6 = YesPlease
213 NO_SOCKADDR_STORAGE = YesPlease
214 NO_UNSETENV = YesPlease
215 NO_MKDTEMP = YesPlease
216 NO_MEMMEM = YesPlease
217 NO_SETENV = YesPlease
218 NO_STRCASESTR = YesPlease
219 NO_STRLCPY = YesPlease
220 NO_STRTOUMAX = YesPlease
221 GIT_TEST_CMP = cmp
222 endif
223 ifeq ($(uname_R),5.7)
224 NEEDS_RESOLV = YesPlease
225 NO_IPV6 = YesPlease
226 NO_SOCKADDR_STORAGE = YesPlease
227 NO_UNSETENV = YesPlease
228 NO_MKDTEMP = YesPlease
229 NO_MEMMEM = YesPlease
230 NO_SETENV = YesPlease
231 NO_STRCASESTR = YesPlease
232 NO_STRLCPY = YesPlease
233 NO_STRTOUMAX = YesPlease
234 GIT_TEST_CMP = cmp
235 endif
236 ifeq ($(uname_R),5.8)
237 NO_UNSETENV = YesPlease
238 NO_MKDTEMP = YesPlease
239 NO_MEMMEM = YesPlease
240 NO_SETENV = YesPlease
241 NO_STRCASESTR = YesPlease
242 NO_STRTOUMAX = YesPlease
243 GIT_TEST_CMP = cmp
244 endif
245 ifeq ($(uname_R),5.9)
246 NO_UNSETENV = YesPlease
247 NO_MKDTEMP = YesPlease
248 NO_MEMMEM = YesPlease
249 NO_SETENV = YesPlease
250 NO_STRCASESTR = YesPlease
251 NO_STRTOUMAX = YesPlease
252 GIT_TEST_CMP = cmp
253 endif
254 ifeq ($(uname_R),5.10)
255 NO_UNSETENV = YesPlease
256 NO_MKDTEMP = YesPlease
257 NO_MEMMEM = YesPlease
258 NO_SETENV = YesPlease
259 NO_STRCASESTR = YesPlease
260 GIT_TEST_CMP = cmp
261 endif
262 ifeq ($(uname_R),5.11)
263 NO_UNSETENV = YesPlease
264 NO_SETENV = YesPlease
265 GIT_TEST_CMP = cmp
266 endif
267 INSTALL = /usr/ucb/install
268 TAR = gtar
269 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
270endif
271ifeq ($(uname_O),Cygwin)
272 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
273 NO_D_TYPE_IN_DIRENT = YesPlease
274 NO_STRCASESTR = YesPlease
275 NO_MEMMEM = YesPlease
276 NO_SYMLINK_HEAD = YesPlease
277 NO_IPV6 = YesPlease
278 OLD_ICONV = UnfortunatelyYes
279 # There are conflicting reports about this.
280 # On some boxes NO_MMAP is needed, and not so elsewhere.
281 # Try commenting this out if you suspect MMAP is more efficient
282 NO_MMAP = YesPlease
283 else
284 ifeq ($(shell expr "$(uname_R)" : '1\.7\.'),4)
285 NO_REGEX = UnfortunatelyYes
286 endif
287 endif
288 HAVE_DEV_TTY = YesPlease
289 HAVE_GETDELIM = YesPlease
290 HAVE_CLOCK_GETTIME = YesPlease
291 HAVE_CLOCK_MONOTONIC = YesPlease
292 HAVE_SYSINFO = YesPlease
293 CSPRNG_METHOD = arc4random
294 HAVE_ALLOCA_H = YesPlease
295 NEEDS_LIBICONV = YesPlease
296 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
297 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
298 X = .exe
299 UNRELIABLE_FSTAT = UnfortunatelyYes
300 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
301 MMAP_PREVENTS_DELETE = UnfortunatelyYes
302 COMPAT_OBJS += compat/win32/path-utils.o
303 FREAD_READS_DIRECTORIES = UnfortunatelyYes
304endif
305ifeq ($(uname_S),FreeBSD)
306 NEEDS_LIBICONV = YesPlease
307 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
308 # A typical version string looks like "10.2-RELEASE".
309 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
310 OLD_ICONV = YesPlease
311 endif
312 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
313 OLD_ICONV = YesPlease
314 endif
315 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
316 OLD_ICONV = YesPlease
317 endif
318 ifeq ($(shell v=$(uname_R) && test $${v%%.*} -lt 12 && echo 1),1)
319 NO_MEMMEM = UnfortunatelyYes
320 endif
321 BASIC_CFLAGS += -I/usr/local/include
322 BASIC_LDFLAGS += -L/usr/local/lib
323 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
324 USE_ST_TIMESPEC = YesPlease
325 PYTHON_PATH = /usr/local/bin/python
326 PERL_PATH = /usr/local/bin/perl
327 HAVE_PATHS_H = YesPlease
328 HAVE_BSD_SYSCTL = YesPlease
329 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
330 CSPRNG_METHOD = arc4random
331 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
332 FREAD_READS_DIRECTORIES = UnfortunatelyYes
333 FILENO_IS_A_MACRO = UnfortunatelyYes
334endif
335ifeq ($(uname_S),OpenBSD)
336 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
337 USE_ST_TIMESPEC = YesPlease
338 NEEDS_LIBICONV = YesPlease
339 BASIC_CFLAGS += -I/usr/local/include
340 BASIC_LDFLAGS += -L/usr/local/lib
341 HAVE_PATHS_H = YesPlease
342 HAVE_BSD_SYSCTL = YesPlease
343 CSPRNG_METHOD = arc4random
344 FREAD_READS_DIRECTORIES = UnfortunatelyYes
345 FILENO_IS_A_MACRO = UnfortunatelyYes
346endif
347ifeq ($(uname_S),MirBSD)
348 NO_STRCASESTR = YesPlease
349 NO_MEMMEM = YesPlease
350 USE_ST_TIMESPEC = YesPlease
351 NEEDS_LIBICONV = YesPlease
352 HAVE_PATHS_H = YesPlease
353 HAVE_BSD_SYSCTL = YesPlease
354 CSPRNG_METHOD = arc4random
355endif
356ifeq ($(uname_S),NetBSD)
357 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
358 NEEDS_LIBICONV = YesPlease
359 endif
360 BASIC_CFLAGS += -I/usr/pkg/include
361 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
362 USE_ST_TIMESPEC = YesPlease
363 HAVE_PATHS_H = YesPlease
364 HAVE_BSD_SYSCTL = YesPlease
365 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
366 CSPRNG_METHOD = arc4random
367 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
368endif
369ifeq ($(uname_S),AIX)
370 DEFAULT_PAGER = more
371 NO_STRCASESTR = YesPlease
372 NO_MEMMEM = YesPlease
373 NO_MKDTEMP = YesPlease
374 NO_STRLCPY = YesPlease
375 NO_NSEC = YesPlease
376 NO_REGEX = NeedsStartEnd
377 FREAD_READS_DIRECTORIES = UnfortunatelyYes
378 INTERNAL_QSORT = UnfortunatelyYes
379 NEEDS_LIBICONV = YesPlease
380 BASIC_CFLAGS += -D_LARGE_FILES
381 FILENO_IS_A_MACRO = UnfortunatelyYes
382 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
383 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
384 NO_PTHREADS = YesPlease
385 else
386 PTHREAD_LIBS = -lpthread
387 endif
388 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
389 INLINE = ''
390 endif
391 GIT_TEST_CMP = cmp
392endif
393ifeq ($(uname_S),GNU)
394 # GNU/Hurd
395 HAVE_ALLOCA_H = YesPlease
396 NO_STRLCPY = YesPlease
397 HAVE_PATHS_H = YesPlease
398 LIBC_CONTAINS_LIBINTL = YesPlease
399 FREAD_READS_DIRECTORIES = UnfortunatelyYes
400endif
401ifeq ($(uname_S),IRIX)
402 NO_SETENV = YesPlease
403 NO_UNSETENV = YesPlease
404 NO_STRCASESTR = YesPlease
405 NO_MEMMEM = YesPlease
406 NO_MKDTEMP = YesPlease
407 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
408 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
409 # git dies with a segmentation fault when trying to access the first
410 # entry of a reflog. The conservative choice is made to always set
411 # NO_MMAP. If you suspect that your compiler is not affected by this
412 # issue, comment out the NO_MMAP statement.
413 NO_MMAP = YesPlease
414 NO_REGEX = YesPlease
415 SNPRINTF_RETURNS_BOGUS = YesPlease
416 SHELL_PATH = /usr/gnu/bin/bash
417 NEEDS_LIBGEN = YesPlease
418endif
419ifeq ($(uname_S),IRIX64)
420 NO_SETENV = YesPlease
421 NO_UNSETENV = YesPlease
422 NO_STRCASESTR = YesPlease
423 NO_MEMMEM = YesPlease
424 NO_MKDTEMP = YesPlease
425 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
426 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
427 # git dies with a segmentation fault when trying to access the first
428 # entry of a reflog. The conservative choice is made to always set
429 # NO_MMAP. If you suspect that your compiler is not affected by this
430 # issue, comment out the NO_MMAP statement.
431 NO_MMAP = YesPlease
432 NO_REGEX = YesPlease
433 SNPRINTF_RETURNS_BOGUS = YesPlease
434 SHELL_PATH = /usr/gnu/bin/bash
435 NEEDS_LIBGEN = YesPlease
436endif
437ifeq ($(uname_S),HP-UX)
438 INLINE = __inline
439 NO_IPV6 = YesPlease
440 NO_SETENV = YesPlease
441 NO_STRCASESTR = YesPlease
442 NO_MEMMEM = YesPlease
443 NO_STRLCPY = YesPlease
444 NO_MKDTEMP = YesPlease
445 NO_UNSETENV = YesPlease
446 NO_HSTRERROR = YesPlease
447 NO_SYS_SELECT_H = YesPlease
448 SNPRINTF_RETURNS_BOGUS = YesPlease
449 NO_NSEC = YesPlease
450 ifeq ($(uname_R),B.11.00)
451 NO_INET_NTOP = YesPlease
452 NO_INET_PTON = YesPlease
453 endif
454 ifeq ($(uname_R),B.10.20)
455 # Override HP-UX 11.x setting:
456 INLINE =
457 SOCKLEN_T = size_t
458 NO_PREAD = YesPlease
459 NO_INET_NTOP = YesPlease
460 NO_INET_PTON = YesPlease
461 endif
462 GIT_TEST_CMP = cmp
463endif
464ifeq ($(uname_S),Windows)
465 GIT_VERSION := $(GIT_VERSION).MSVC
466 pathsep = ;
467 # Assume that this is built in Git for Windows' SDK
468 ifneq (,$(MSYSTEM))
469 prefix = $(MINGW_PREFIX)
470 endif
471 # Prepend MSVC 64-bit tool-chain to PATH.
472 #
473 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
474 # link.exe next to, and required by, cl.exe, we have to prepend this
475 # onto the existing $PATH.
476 #
477 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
478 HAVE_ALLOCA_H = YesPlease
479 NO_PREAD = YesPlease
480 NO_WRITEV = YesPlease
481 NEEDS_CRYPTO_WITH_SSL = YesPlease
482 NO_LIBGEN_H = YesPlease
483 NO_POLL = YesPlease
484 NO_SYMLINK_HEAD = YesPlease
485 NO_IPV6 = YesPlease
486 NO_SETENV = YesPlease
487 NO_STRCASESTR = YesPlease
488 NO_STRLCPY = YesPlease
489 NO_MEMMEM = YesPlease
490 NEEDS_LIBICONV = YesPlease
491 NO_STRTOUMAX = YesPlease
492 NO_MKDTEMP = YesPlease
493 NO_INTTYPES_H = YesPlease
494 CSPRNG_METHOD = rtlgenrandom
495 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
496 # so we don't need this:
497 #
498 # SNPRINTF_RETURNS_BOGUS = YesPlease
499
500 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
501 # These are always available, so we do not have to conditionally
502 # support it.
503 FSMONITOR_DAEMON_BACKEND = win32
504 FSMONITOR_OS_SETTINGS = win32
505
506 NO_SVN_TESTS = YesPlease
507 RUNTIME_PREFIX = YesPlease
508 HAVE_WPGMPTR = YesWeDo
509 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
510 USE_WIN32_IPC = YesPlease
511 USE_WIN32_MMAP = YesPlease
512 MMAP_PREVENTS_DELETE = UnfortunatelyYes
513 UNRELIABLE_FSTAT = UnfortunatelyYes
514 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
515 NO_REGEX = YesPlease
516 NO_GETTEXT = YesPlease
517 NO_PYTHON = YesPlease
518 ETAGS_TARGET = ETAGS
519 NO_POSIX_GOODIES = UnfortunatelyYes
520 NATIVE_CRLF = YesPlease
521 DEFAULT_HELP_FORMAT = html
522 SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
523ifneq (,$(MINGW_PREFIX))
524 # Move system config into top-level /etc/
525 ETC_GITCONFIG = ../etc/gitconfig
526 ETC_GITATTRIBUTES = ../etc/gitattributes
527endif
528
529 CC = compat/vcbuild/scripts/clink.pl
530 AR = compat/vcbuild/scripts/lib.pl
531 CFLAGS =
532 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
533 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
534 compat/win32/flush.o \
535 compat/win32/path-utils.o \
536 compat/win32/pthread.o compat/win32/syslog.o \
537 compat/win32/trace2_win32_process_info.o \
538 compat/win32/dirent.o
539 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \
540 -DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" -DMINGW_PREFIX="\"$(patsubst /%,%,$(MINGW_PREFIX))\"" \
541 -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
542 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
543 # invalidcontinue.obj allows Git's source code to close the same file
544 # handle twice, or to access the osfhandle of an already-closed stdout
545 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
546 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
547 PTHREAD_LIBS =
548 lib =
549 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
550ifndef DEBUG
551 BASIC_CFLAGS += $(vcpkg_rel_lib)
552else
553 BASIC_CFLAGS += $(vcpkg_dbg_lib)
554endif
555 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
556
557ifneq ($(USE_MSVC_CRTDBG),)
558 # Optionally enable memory leak reporting.
559 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
560endif
561 # Always give "-Zi" to the compiler and "-debug" to linker (even in
562 # release mode) to force a PDB to be generated (like RelWithDebInfo).
563 BASIC_CFLAGS += -Zi
564 BASIC_LDFLAGS += -debug -Zf
565
566ifdef NO_SAFESEH
567 LDFLAGS += -SAFESEH:NO
568endif
569
570ifndef DEBUG
571 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
572 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
573 AR += -LTCG
574else
575 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
576endif
577 X = .exe
578
579 EXTRA_PROGRAMS += headless-git$X
580
581compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
582endif
583ifeq ($(uname_S),Interix)
584 NO_INITGROUPS = YesPlease
585 NO_IPV6 = YesPlease
586 NO_MEMMEM = YesPlease
587 NO_MKDTEMP = YesPlease
588 NO_STRTOUMAX = YesPlease
589 NO_NSEC = YesPlease
590 ifeq ($(uname_R),3.5)
591 NO_INET_NTOP = YesPlease
592 NO_INET_PTON = YesPlease
593 NO_SOCKADDR_STORAGE = YesPlease
594 endif
595 ifeq ($(uname_R),5.2)
596 NO_INET_NTOP = YesPlease
597 NO_INET_PTON = YesPlease
598 NO_SOCKADDR_STORAGE = YesPlease
599 endif
600endif
601ifeq ($(uname_S),Minix)
602 NO_IPV6 = YesPlease
603 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
604 NO_NSEC = YesPlease
605 NEEDS_LIBGEN =
606 NEEDS_CRYPTO_WITH_SSL = YesPlease
607 NEEDS_RESOLV =
608 NO_HSTRERROR = YesPlease
609 NO_MMAP = YesPlease
610 NO_CURL =
611 NO_EXPAT =
612endif
613ifeq ($(uname_S),NONSTOP_KERNEL)
614 # Needs some C99 features, "inline" is just one of them.
615 # INLINE='' would just replace one set of warnings with another and
616 # still not compile in c89 mode, due to non-const array initializations.
617 CC = cc -c99
618 # Build down-rev compatible objects that don't use our new getopt_long.
619 ifeq ($(uname_R).$(uname_V),J06.21)
620 CC += -WRVU=J06.20
621 endif
622 ifeq ($(uname_R).$(uname_V),L17.02)
623 CC += -WRVU=L16.05
624 endif
625 # Disable all optimization, seems to result in bad code, with -O or -O2
626 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
627 # abends on "git push". Needs more investigation.
628 CFLAGS = -g -O0 -Winline
629 # We'd want it to be here.
630 prefix = /usr/local
631 # perl and python must be in /usr/bin on NonStop - supplied by HPE
632 # with operating system in that managed directory.
633 PERL_PATH = /usr/bin/perl
634 PYTHON_PATH = /usr/bin/python
635 # The current /usr/coreutils/rm at lowest support level does not work
636 # with the git test structure. Long paths as in
637 # 'trash directory...' cause rm to terminate prematurely without fully
638 # removing the directory at OS releases J06.21 and L17.02.
639 # Default to the older rm until those two releases are deprecated.
640 RM = /bin/rm -f
641 NEEDS_CRYPTO_WITH_SSL = YesPlease
642 HAVE_DEV_TTY = YesPlease
643 HAVE_LIBCHARSET_H = YesPlease
644 HAVE_STRINGS_H = YesPlease
645 NEEDS_LIBICONV = YesPlease
646 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
647 NO_SYS_SELECT_H = UnfortunatelyYes
648 NO_D_TYPE_IN_DIRENT = YesPlease
649 NO_GETTEXT = YesPlease
650 NO_HSTRERROR = YesPlease
651 NO_STRCASESTR = YesPlease
652 NO_MEMMEM = YesPlease
653 NO_STRLCPY = YesPlease
654 NO_SETENV = YesPlease
655 NO_UNSETENV = YesPlease
656 NO_MKDTEMP = YesPlease
657 # Currently libiconv-1.9.1.
658 OLD_ICONV = UnfortunatelyYes
659 NO_REGEX = NeedsStartEnd
660 NO_PTHREADS = UnfortunatelyYes
661 FREAD_READS_DIRECTORIES = UnfortunatelyYes
662
663 # Not detected (nor checked for) by './configure'.
664 # We don't have SA_RESTART on NonStop, unfortunalety.
665 COMPAT_CFLAGS += -DSA_RESTART=0
666 # Apparently needed in compat/fnmatch/fnmatch.c.
667 COMPAT_CFLAGS += -DHAVE_STRING_H=1
668 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
669 NO_NSEC = YesPlease
670 NO_PREAD = YesPlease
671 NO_MMAP = YesPlease
672 NO_POLL = YesPlease
673 NO_INTPTR_T = UnfortunatelyYes
674 CSPRNG_METHOD = openssl
675 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
676 SHELL_PATH = /usr/coreutils/bin/bash
677endif
678ifeq ($(uname_S),OS/390)
679 NO_SYS_POLL_H = YesPlease
680 NO_STRCASESTR = YesPlease
681 NO_REGEX = YesPlease
682 NO_MMAP = YesPlease
683 NO_NSEC = YesPlease
684 NO_STRLCPY = YesPlease
685 NO_MEMMEM = YesPlease
686 NO_GECOS_IN_PWENT = YesPlease
687 HAVE_STRINGS_H = YesPlease
688 NEEDS_MODE_TRANSLATION = YesPlease
689 HAVE_ZOS_GET_EXECUTABLE_PATH = YesPlease
690endif
691ifeq ($(uname_S),MINGW)
692 ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
693 $(error "Building with MSys is no longer supported")
694 endif
695 pathsep = ;
696 HAVE_ALLOCA_H = YesPlease
697 NO_PREAD = YesPlease
698 NO_WRITEV = YesPlease
699 NEEDS_CRYPTO_WITH_SSL = YesPlease
700 NO_LIBGEN_H = YesPlease
701 NO_POLL = YesPlease
702 NO_SYMLINK_HEAD = YesPlease
703 NO_SETENV = YesPlease
704 NO_STRCASESTR = YesPlease
705 NO_STRLCPY = YesPlease
706 NO_MEMMEM = YesPlease
707 NEEDS_LIBICONV = YesPlease
708 NO_STRTOUMAX = YesPlease
709 NO_MKDTEMP = YesPlease
710 NO_SVN_TESTS = YesPlease
711
712 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
713 # These are always available, so we do not have to conditionally
714 # support it.
715 FSMONITOR_DAEMON_BACKEND = win32
716 FSMONITOR_OS_SETTINGS = win32
717
718 SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
719 RUNTIME_PREFIX = YesPlease
720 HAVE_WPGMPTR = YesWeDo
721 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
722 USE_WIN32_IPC = YesPlease
723 USE_WIN32_MMAP = YesPlease
724 MMAP_PREVENTS_DELETE = UnfortunatelyYes
725 UNRELIABLE_FSTAT = UnfortunatelyYes
726 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
727 NO_REGEX = YesPlease
728 ETAGS_TARGET = ETAGS
729 NO_POSIX_GOODIES = UnfortunatelyYes
730 DEFAULT_HELP_FORMAT = html
731 HAVE_PLATFORM_PROCINFO = YesPlease
732 CSPRNG_METHOD = rtlgenrandom
733 BASIC_LDFLAGS += -municode
734 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
735 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
736 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
737 compat/win32/trace2_win32_process_info.o \
738 compat/win32/flush.o \
739 compat/win32/path-utils.o \
740 compat/win32/pthread.o compat/win32/syslog.o \
741 compat/win32/dirent.o
742 BASIC_CFLAGS += -DWIN32
743 EXTLIBS += -lws2_32
744 GITLIBS += git.res
745 PTHREAD_LIBS =
746 RC = windres -O coff
747 NATIVE_CRLF = YesPlease
748 X = .exe
749 # MSys2
750 prefix = /usr/
751 # Enable DEP
752 BASIC_LDFLAGS += -Wl,--nxcompat
753 # Enable ASLR (unless debugging)
754 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
755 BASIC_LDFLAGS += -Wl,--dynamicbase
756 endif
757 ifneq (,$(MSYSTEM))
758 ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))
759 # Override if empty or does not start with a slash
760 MINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)
761 endif
762 prefix = $(MINGW_PREFIX)
763
764 # A rustup-managed Rust on Windows defaults to the MSVC ABI and
765 # produces a `gitcore.lib` that the MinGW `ld.exe` cannot link.
766 # Pick a GCC-compatible Rust target triple matching the MSYS2
767 # subsystem instead: `*-pc-windows-gnullvm` for the Clang/LLVM
768 # subsystems (which on Windows is also the only choice for
769 # ARM64, where no MinGW-GCC port exists) and `*-pc-windows-gnu`
770 # for the MSVCRT-based MinGW subsystems. For a `staticlib`
771 # crate-type Cargo does not invoke an external linker, so
772 # `rustup target add <triple>` is sufficient.
773 ifneq (,$(filter %ARM64, $(MSYSTEM)))
774 HOST_CPU = aarch64
775 else ifneq (,$(filter %32, $(MSYSTEM)))
776 HOST_CPU = i686
777 else
778 HOST_CPU = x86_64
779 endif
780 ifneq (,$(filter CLANG%, $(MSYSTEM)))
781 CARGO_BUILD_TARGET = $(HOST_CPU)-pc-windows-gnullvm
782 else
783 CARGO_BUILD_TARGET = $(HOST_CPU)-pc-windows-gnu
784 endif
785 export CARGO_BUILD_TARGET
786
787 BASIC_LDFLAGS += -Wl,--pic-executable
788 COMPAT_CFLAGS += -DDETECT_MSYS_TTY \
789 -DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" \
790 -DMINGW_PREFIX="\"$(patsubst /%,%,$(MINGW_PREFIX))\""
791 ifeq (MINGW32,$(MSYSTEM))
792 BASIC_LDFLAGS += -Wl,--large-address-aware
793 endif
794 # Move system config into top-level /etc/
795 ETC_GITCONFIG = ../etc/gitconfig
796 ETC_GITATTRIBUTES = ../etc/gitattributes
797 endif
798 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong
799 EXTLIBS += -lntdll
800 EXTRA_PROGRAMS += headless-git$X
801 INSTALL = /bin/install
802 INTERNAL_QSORT = YesPlease
803 HAVE_LIBCHARSET_H = YesPlease
804 USE_GETTEXT_SCHEME = fallthrough
805 USE_LIBPCRE = YesPlease
806 NO_PYTHON =
807endif
808ifeq ($(uname_S),QNX)
809 COMPAT_CFLAGS += -DSA_RESTART=0
810 EXPAT_NEEDS_XMLPARSE_H = YesPlease
811 HAVE_STRINGS_H = YesPlease
812 NEEDS_SOCKET = YesPlease
813 NO_GETPAGESIZE = YesPlease
814 NO_ICONV = YesPlease
815 NO_MEMMEM = YesPlease
816 NO_MKDTEMP = YesPlease
817 NO_NSEC = YesPlease
818 NO_PTHREADS = YesPlease
819 NO_STRCASESTR = YesPlease
820 NO_STRLCPY = YesPlease
821endif