]> git.ipfire.org Git - thirdparty/git.git/blame - config.mak.uname
fsmonitor-settings: VFS for Git virtual repos are incompatible
[thirdparty/git.git] / config.mak.uname
CommitLineData
e1b6dbb5
JK
1# Platform specific Makefile tweaks based on uname detection
2
dce7d295
JH
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
e1b6dbb5
JK
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_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
12uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
13
ebd2e4a1
CMAB
14ifneq ($(findstring MINGW,$(uname_S)),)
15 uname_S := MINGW
16endif
17
e1b6dbb5
JK
18ifdef MSVC
19 # avoid the MingW and Cygwin configuration sections
20 uname_S := Windows
21 uname_O := Windows
dce7d295
JH
22
23 # Generate and include makefile variables that point to the
24 # currently installed set of MSVC command line tools.
25compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
26 @"$<" | tr '\\' / >"$@"
27include compat/vcbuild/MSVC-DEFS-GEN
28
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.
976aaedc 32ifeq (,$(SKIP_VCPKG))
dce7d295
JH
33compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
34 @"$<"
35include compat/vcbuild/VCPKG-DEFS
e1b6dbb5 36endif
976aaedc 37endif
e1b6dbb5
JK
38
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...
42
e1b6dbb5
JK
43ifeq ($(uname_S),OSF1)
44 # Need this for u_short definitions et al
45 BASIC_CFLAGS += -D_OSF_SOURCE
46 SOCKLEN_T = int
47 NO_STRTOULL = YesPlease
48 NO_NSEC = YesPlease
49endif
50ifeq ($(uname_S),Linux)
61f76a36 51 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 52 NO_STRLCPY = YesPlease
e1b6dbb5
JK
53 HAVE_PATHS_H = YesPlease
54 LIBC_CONTAINS_LIBINTL = YesPlease
55 HAVE_DEV_TTY = YesPlease
148d6771 56 HAVE_CLOCK_GETTIME = YesPlease
a6c3c638 57 HAVE_CLOCK_MONOTONIC = YesPlease
52fcec75
EW
58 # -lrt is needed for clock_gettime on glibc <= 2.16
59 NEEDS_LIBRT = YesPlease
0cc30e0e 60 HAVE_GETDELIM = YesPlease
e2d90fd1 61 FREAD_READS_DIRECTORIES = UnfortunatelyYes
9806f5a7 62 BASIC_CFLAGS += -DHAVE_SYSINFO
226c0ddd 63 PROCFS_EXECUTABLE_PATH = /proc/self/exe
2f732bf1
ES
64 HAVE_PLATFORM_PROCINFO = YesPlease
65 COMPAT_OBJS += compat/linux/procinfo.o
ffb9f298
DA
66 # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
67 ifneq ($(findstring .el7.,$(uname_R)),)
68 BASIC_CFLAGS += -std=c99
ffb9f298 69 endif
e1b6dbb5
JK
70endif
71ifeq ($(uname_S),GNU/kFreeBSD)
61f76a36 72 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 73 NO_STRLCPY = YesPlease
e1b6dbb5
JK
74 HAVE_PATHS_H = YesPlease
75 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
76 LIBC_CONTAINS_LIBINTL = YesPlease
e2d90fd1 77 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
78endif
79ifeq ($(uname_S),UnixWare)
80 CC = cc
81 NEEDS_SOCKET = YesPlease
82 NEEDS_NSL = YesPlease
83 NEEDS_SSL_WITH_CRYPTO = YesPlease
84 NEEDS_LIBICONV = YesPlease
85 SHELL_PATH = /usr/local/bin/bash
86 NO_IPV6 = YesPlease
87 NO_HSTRERROR = YesPlease
e1b6dbb5
JK
88 BASIC_CFLAGS += -Kthread
89 BASIC_CFLAGS += -I/usr/local/include
90 BASIC_LDFLAGS += -L/usr/local/lib
91 INSTALL = ginstall
92 TAR = gtar
93 NO_STRCASESTR = YesPlease
94 NO_MEMMEM = YesPlease
95endif
96ifeq ($(uname_S),SCO_SV)
97 ifeq ($(uname_R),3.2)
98 CFLAGS = -O2
99 endif
100 ifeq ($(uname_R),5)
101 CC = cc
102 BASIC_CFLAGS += -Kthread
103 endif
104 NEEDS_SOCKET = YesPlease
105 NEEDS_NSL = YesPlease
106 NEEDS_SSL_WITH_CRYPTO = YesPlease
107 NEEDS_LIBICONV = YesPlease
108 SHELL_PATH = /usr/bin/bash
109 NO_IPV6 = YesPlease
110 NO_HSTRERROR = YesPlease
e1b6dbb5
JK
111 BASIC_CFLAGS += -I/usr/local/include
112 BASIC_LDFLAGS += -L/usr/local/lib
113 NO_STRCASESTR = YesPlease
114 NO_MEMMEM = YesPlease
115 INSTALL = ginstall
116 TAR = gtar
117endif
118ifeq ($(uname_S),Darwin)
119 NEEDS_CRYPTO_WITH_SSL = YesPlease
120 NEEDS_SSL_WITH_CRYPTO = YesPlease
121 NEEDS_LIBICONV = YesPlease
9eeff2f6
JH
122 # Note: $(uname_R) gives us the underlying Darwin version.
123 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
124 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
125 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
e1b6dbb5
JK
126 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
127 OLD_ICONV = UnfortunatelyYes
9c7a0bee 128 NO_APPLE_COMMON_CRYPTO = YesPlease
e1b6dbb5
JK
129 endif
130 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
131 NO_STRLCPY = YesPlease
132 endif
4e368785
ES
133 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
134 HAVE_GETDELIM = YesPlease
135 endif
bbabaad2
JK
136 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
137 OPEN_RETURNS_EINTR = UnfortunatelyYes
138 endif
e1b6dbb5
JK
139 NO_MEMMEM = YesPlease
140 USE_ST_TIMESPEC = YesPlease
141 HAVE_DEV_TTY = YesPlease
142 COMPAT_OBJS += compat/precompose_utf8.o
143 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
a42643aa 144 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
9529080d 145 HAVE_BSD_SYSCTL = YesPlease
8e178ec4 146 FREAD_READS_DIRECTORIES = UnfortunatelyYes
226c0ddd 147 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
05cd988d 148 CSPRNG_METHOD = arc4random
a0b31086
JS
149
150 # Workaround for `gettext` being keg-only and not even being linked via
151 # `brew link --force gettext`, should be obsolete as of
152 # https://github.com/Homebrew/homebrew-core/pull/53489
153 ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
154 BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
155 BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
156 ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
157 MSGFMT = /usr/local/opt/gettext/bin/msgfmt
158 endif
159 endif
f67df255
JH
160
161 # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
162 # Unix domain sockets and PThreads.
163 ifndef NO_PTHREADS
164 ifndef NO_UNIX_SOCKETS
165 FSMONITOR_DAEMON_BACKEND = darwin
166 endif
167 endif
168
169 BASIC_LDFLAGS += -framework CoreServices
e1b6dbb5
JK
170endif
171ifeq ($(uname_S),SunOS)
172 NEEDS_SOCKET = YesPlease
173 NEEDS_NSL = YesPlease
174 SHELL_PATH = /bin/bash
175 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
61f76a36 176 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
177 NO_STRCASESTR = YesPlease
178 NO_MEMMEM = YesPlease
179 NO_MKDTEMP = YesPlease
e1b6dbb5 180 NO_REGEX = YesPlease
e1b6dbb5
JK
181 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
182 HAVE_DEV_TTY = YesPlease
183 ifeq ($(uname_R),5.6)
184 SOCKLEN_T = int
185 NO_HSTRERROR = YesPlease
186 NO_IPV6 = YesPlease
187 NO_SOCKADDR_STORAGE = YesPlease
188 NO_UNSETENV = YesPlease
189 NO_SETENV = YesPlease
190 NO_STRLCPY = YesPlease
191 NO_STRTOUMAX = YesPlease
192 GIT_TEST_CMP = cmp
193 endif
194 ifeq ($(uname_R),5.7)
195 NEEDS_RESOLV = YesPlease
196 NO_IPV6 = YesPlease
197 NO_SOCKADDR_STORAGE = YesPlease
198 NO_UNSETENV = YesPlease
199 NO_SETENV = YesPlease
200 NO_STRLCPY = YesPlease
201 NO_STRTOUMAX = YesPlease
202 GIT_TEST_CMP = cmp
203 endif
204 ifeq ($(uname_R),5.8)
205 NO_UNSETENV = YesPlease
206 NO_SETENV = YesPlease
207 NO_STRTOUMAX = YesPlease
208 GIT_TEST_CMP = cmp
209 endif
210 ifeq ($(uname_R),5.9)
211 NO_UNSETENV = YesPlease
212 NO_SETENV = YesPlease
213 NO_STRTOUMAX = YesPlease
214 GIT_TEST_CMP = cmp
215 endif
216 INSTALL = /usr/ucb/install
217 TAR = gtar
61f76a36 218 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
e1b6dbb5
JK
219endif
220ifeq ($(uname_O),Cygwin)
221 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
222 NO_D_TYPE_IN_DIRENT = YesPlease
e1b6dbb5
JK
223 NO_STRCASESTR = YesPlease
224 NO_MEMMEM = YesPlease
e1b6dbb5
JK
225 NO_SYMLINK_HEAD = YesPlease
226 NO_IPV6 = YesPlease
227 OLD_ICONV = UnfortunatelyYes
f593ef77
ML
228 # There are conflicting reports about this.
229 # On some boxes NO_MMAP is needed, and not so elsewhere.
230 # Try commenting this out if you suspect MMAP is more efficient
231 NO_MMAP = YesPlease
92f63d2b
ML
232 else
233 NO_REGEX = UnfortunatelyYes
e1b6dbb5 234 endif
61f76a36 235 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
236 NEEDS_LIBICONV = YesPlease
237 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
e1b6dbb5 238 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
e1b6dbb5 239 X = .exe
e1b6dbb5 240 UNRELIABLE_FSTAT = UnfortunatelyYes
e53a64b9 241 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
5b633610 242 MMAP_PREVENTS_DELETE = UnfortunatelyYes
1cadad6f 243 COMPAT_OBJS += compat/win32/path-utils.o
a5956d6a 244 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
245endif
246ifeq ($(uname_S),FreeBSD)
247 NEEDS_LIBICONV = YesPlease
6c6ce21b
ES
248 # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
249 # A typical version string looks like "10.2-RELEASE".
250 ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
251 OLD_ICONV = YesPlease
252 endif
253 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
254 OLD_ICONV = YesPlease
255 endif
256 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
257 OLD_ICONV = YesPlease
258 endif
e1b6dbb5
JK
259 NO_MEMMEM = YesPlease
260 BASIC_CFLAGS += -I/usr/local/include
261 BASIC_LDFLAGS += -L/usr/local/lib
262 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
263 USE_ST_TIMESPEC = YesPlease
264 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
265 PTHREAD_LIBS = -pthread
266 NO_UINTMAX_T = YesPlease
267 NO_STRTOUMAX = YesPlease
268 endif
269 PYTHON_PATH = /usr/local/bin/python
259f22af 270 PERL_PATH = /usr/local/bin/perl
e1b6dbb5 271 HAVE_PATHS_H = YesPlease
9529080d 272 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 273 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 274 CSPRNG_METHOD = arc4random
995bc22d 275 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
e2d90fd1 276 FREAD_READS_DIRECTORIES = UnfortunatelyYes
18a4f6be 277 FILENO_IS_A_MACRO = UnfortunatelyYes
e1b6dbb5
JK
278endif
279ifeq ($(uname_S),OpenBSD)
280 NO_STRCASESTR = YesPlease
281 NO_MEMMEM = YesPlease
282 USE_ST_TIMESPEC = YesPlease
283 NEEDS_LIBICONV = YesPlease
284 BASIC_CFLAGS += -I/usr/local/include
285 BASIC_LDFLAGS += -L/usr/local/lib
286 HAVE_PATHS_H = YesPlease
9529080d 287 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 288 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 289 CSPRNG_METHOD = arc4random
226c0ddd 290 PROCFS_EXECUTABLE_PATH = /proc/curproc/file
4e3ecbd4 291 FREAD_READS_DIRECTORIES = UnfortunatelyYes
18a4f6be 292 FILENO_IS_A_MACRO = UnfortunatelyYes
92164af9
BS
293endif
294ifeq ($(uname_S),MirBSD)
295 NO_STRCASESTR = YesPlease
296 NO_MEMMEM = YesPlease
297 USE_ST_TIMESPEC = YesPlease
298 NEEDS_LIBICONV = YesPlease
299 HAVE_PATHS_H = YesPlease
9529080d 300 HAVE_BSD_SYSCTL = YesPlease
05cd988d 301 CSPRNG_METHOD = arc4random
e1b6dbb5
JK
302endif
303ifeq ($(uname_S),NetBSD)
304 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
305 NEEDS_LIBICONV = YesPlease
306 endif
307 BASIC_CFLAGS += -I/usr/pkg/include
308 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
309 USE_ST_TIMESPEC = YesPlease
e1b6dbb5 310 HAVE_PATHS_H = YesPlease
9529080d 311 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 312 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 313 CSPRNG_METHOD = arc4random
226c0ddd 314 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
e1b6dbb5
JK
315endif
316ifeq ($(uname_S),AIX)
317 DEFAULT_PAGER = more
318 NO_STRCASESTR = YesPlease
319 NO_MEMMEM = YesPlease
320 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
321 NO_STRLCPY = YesPlease
322 NO_NSEC = YesPlease
0e6d899f 323 NO_REGEX = NeedsStartEnd
e1b6dbb5
JK
324 FREAD_READS_DIRECTORIES = UnfortunatelyYes
325 INTERNAL_QSORT = UnfortunatelyYes
326 NEEDS_LIBICONV = YesPlease
327 BASIC_CFLAGS += -D_LARGE_FILES
ee662bf5 328 FILENO_IS_A_MACRO = UnfortunatelyYes
400caafb 329 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
e1b6dbb5
JK
330 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
331 NO_PTHREADS = YesPlease
332 else
333 PTHREAD_LIBS = -lpthread
334 endif
335 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
336 INLINE = ''
337 endif
338 GIT_TEST_CMP = cmp
339endif
340ifeq ($(uname_S),GNU)
341 # GNU/Hurd
61f76a36 342 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 343 NO_STRLCPY = YesPlease
e1b6dbb5
JK
344 HAVE_PATHS_H = YesPlease
345 LIBC_CONTAINS_LIBINTL = YesPlease
274a1328 346 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
347endif
348ifeq ($(uname_S),IRIX)
349 NO_SETENV = YesPlease
350 NO_UNSETENV = YesPlease
351 NO_STRCASESTR = YesPlease
352 NO_MEMMEM = YesPlease
e1b6dbb5
JK
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.
360 NO_MMAP = YesPlease
361 NO_REGEX = YesPlease
e1b6dbb5
JK
362 SNPRINTF_RETURNS_BOGUS = YesPlease
363 SHELL_PATH = /usr/gnu/bin/bash
364 NEEDS_LIBGEN = YesPlease
365endif
366ifeq ($(uname_S),IRIX64)
367 NO_SETENV = YesPlease
368 NO_UNSETENV = YesPlease
369 NO_STRCASESTR = YesPlease
370 NO_MEMMEM = YesPlease
e1b6dbb5
JK
371 NO_MKDTEMP = YesPlease
372 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
373 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
374 # git dies with a segmentation fault when trying to access the first
375 # entry of a reflog. The conservative choice is made to always set
376 # NO_MMAP. If you suspect that your compiler is not affected by this
377 # issue, comment out the NO_MMAP statement.
378 NO_MMAP = YesPlease
379 NO_REGEX = YesPlease
e1b6dbb5
JK
380 SNPRINTF_RETURNS_BOGUS = YesPlease
381 SHELL_PATH = /usr/gnu/bin/bash
382 NEEDS_LIBGEN = YesPlease
383endif
384ifeq ($(uname_S),HP-UX)
385 INLINE = __inline
386 NO_IPV6 = YesPlease
387 NO_SETENV = YesPlease
388 NO_STRCASESTR = YesPlease
389 NO_MEMMEM = YesPlease
e1b6dbb5
JK
390 NO_STRLCPY = YesPlease
391 NO_MKDTEMP = YesPlease
392 NO_UNSETENV = YesPlease
393 NO_HSTRERROR = YesPlease
394 NO_SYS_SELECT_H = YesPlease
e1b6dbb5
JK
395 SNPRINTF_RETURNS_BOGUS = YesPlease
396 NO_NSEC = YesPlease
397 ifeq ($(uname_R),B.11.00)
398 NO_INET_NTOP = YesPlease
399 NO_INET_PTON = YesPlease
400 endif
401 ifeq ($(uname_R),B.10.20)
402 # Override HP-UX 11.x setting:
403 INLINE =
404 SOCKLEN_T = size_t
405 NO_PREAD = YesPlease
406 NO_INET_NTOP = YesPlease
407 NO_INET_PTON = YesPlease
408 endif
409 GIT_TEST_CMP = cmp
410endif
411ifeq ($(uname_S),Windows)
412 GIT_VERSION := $(GIT_VERSION).MSVC
413 pathsep = ;
dce7d295
JH
414 # Assume that this is built in Git for Windows' SDK
415 ifeq (MINGW32,$(MSYSTEM))
416 prefix = /mingw32
417 else
418 prefix = /mingw64
419 endif
420 # Prepend MSVC 64-bit tool-chain to PATH.
421 #
422 # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
423 # link.exe next to, and required by, cl.exe, we have to prepend this
424 # onto the existing $PATH.
425 #
426 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
61f76a36 427 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
428 NO_PREAD = YesPlease
429 NEEDS_CRYPTO_WITH_SSL = YesPlease
430 NO_LIBGEN_H = YesPlease
431 NO_POLL = YesPlease
432 NO_SYMLINK_HEAD = YesPlease
433 NO_IPV6 = YesPlease
434 NO_UNIX_SOCKETS = YesPlease
435 NO_SETENV = YesPlease
e1b6dbb5
JK
436 NO_STRCASESTR = YesPlease
437 NO_STRLCPY = YesPlease
e1b6dbb5 438 NO_MEMMEM = YesPlease
dce7d295 439 NEEDS_LIBICONV = YesPlease
e1b6dbb5 440 NO_STRTOUMAX = YesPlease
e1b6dbb5 441 NO_MKDTEMP = YesPlease
dce7d295 442 NO_INTTYPES_H = YesPlease
05cd988d 443 CSPRNG_METHOD = rtlgenrandom
dce7d295
JH
444 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
445 # so we don't need this:
446 #
447 # SNPRINTF_RETURNS_BOGUS = YesPlease
62c73671
JH
448
449 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
450 # These are always available, so we do not have to conditionally
451 # support it.
452 FSMONITOR_DAEMON_BACKEND = win32
d33c804d
JH
453 FSMONITOR_OS_SETTINGS = win32
454
e1b6dbb5 455 NO_SVN_TESTS = YesPlease
e1b6dbb5 456 RUNTIME_PREFIX = YesPlease
86e25458 457 HAVE_WPGMPTR = YesWeDo
e1b6dbb5 458 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
59c7b881 459 USE_WIN32_IPC = YesPlease
e1b6dbb5 460 USE_WIN32_MMAP = YesPlease
5b633610 461 MMAP_PREVENTS_DELETE = UnfortunatelyYes
e1b6dbb5
JK
462 # USE_NED_ALLOCATOR = YesPlease
463 UNRELIABLE_FSTAT = UnfortunatelyYes
464 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
465 NO_REGEX = YesPlease
bad866a2 466 NO_GETTEXT = YesPlease
e1b6dbb5 467 NO_PYTHON = YesPlease
e0492c5b 468 ETAGS_TARGET = ETAGS
e1b6dbb5
JK
469 NO_POSIX_GOODIES = UnfortunatelyYes
470 NATIVE_CRLF = YesPlease
471 DEFAULT_HELP_FORMAT = html
fb5e3378
JS
472ifeq (/mingw64,$(subst 32,64,$(prefix)))
473 # Move system config into top-level /etc/
474 ETC_GITCONFIG = ../etc/gitconfig
475 ETC_GITATTRIBUTES = ../etc/gitattributes
476endif
e1b6dbb5
JK
477
478 CC = compat/vcbuild/scripts/clink.pl
479 AR = compat/vcbuild/scripts/lib.pl
480 CFLAGS =
dce7d295 481 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
e1b6dbb5 482 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
22c3634c 483 compat/win32/path-utils.o \
e1b6dbb5 484 compat/win32/pthread.o compat/win32/syslog.o \
353d3d77 485 compat/win32/trace2_win32_process_info.o \
e1b6dbb5 486 compat/win32/dirent.o
dce7d295 487 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
396ff754 488 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
dce7d295
JH
489 # invalidcontinue.obj allows Git's source code to close the same file
490 # handle twice, or to access the osfhandle of an already-closed stdout
491 # See https://msdn.microsoft.com/en-us/library/ms235330.aspx
492 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
e1b6dbb5
JK
493 PTHREAD_LIBS =
494 lib =
dce7d295
JH
495 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
496ifndef DEBUG
497 BASIC_CFLAGS += $(vcpkg_rel_lib)
498else
499 BASIC_CFLAGS += $(vcpkg_dbg_lib)
500endif
501 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
502
556702f8
JH
503ifneq ($(USE_MSVC_CRTDBG),)
504 # Optionally enable memory leak reporting.
505 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
506endif
dce7d295
JH
507 # Always give "-Zi" to the compiler and "-debug" to linker (even in
508 # release mode) to force a PDB to be generated (like RelWithDebInfo).
509 BASIC_CFLAGS += -Zi
510 BASIC_LDFLAGS += -debug -Zf
511
512ifdef NO_SAFESEH
513 LDFLAGS += -SAFESEH:NO
514endif
515
e1b6dbb5 516ifndef DEBUG
dce7d295
JH
517 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
518 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
e1b6dbb5
JK
519 AR += -LTCG
520else
dce7d295 521 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
e1b6dbb5
JK
522endif
523 X = .exe
963e1543
JS
524
525compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
e1b6dbb5
JK
526endif
527ifeq ($(uname_S),Interix)
528 NO_INITGROUPS = YesPlease
529 NO_IPV6 = YesPlease
530 NO_MEMMEM = YesPlease
531 NO_MKDTEMP = YesPlease
532 NO_STRTOUMAX = YesPlease
533 NO_NSEC = YesPlease
e1b6dbb5
JK
534 ifeq ($(uname_R),3.5)
535 NO_INET_NTOP = YesPlease
536 NO_INET_PTON = YesPlease
537 NO_SOCKADDR_STORAGE = YesPlease
e1b6dbb5
JK
538 endif
539 ifeq ($(uname_R),5.2)
540 NO_INET_NTOP = YesPlease
541 NO_INET_PTON = YesPlease
542 NO_SOCKADDR_STORAGE = YesPlease
e1b6dbb5
JK
543 endif
544endif
545ifeq ($(uname_S),Minix)
546 NO_IPV6 = YesPlease
547 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
548 NO_NSEC = YesPlease
549 NEEDS_LIBGEN =
550 NEEDS_CRYPTO_WITH_SSL = YesPlease
e1b6dbb5
JK
551 NEEDS_RESOLV =
552 NO_HSTRERROR = YesPlease
553 NO_MMAP = YesPlease
554 NO_CURL =
555 NO_EXPAT =
556endif
557ifeq ($(uname_S),NONSTOP_KERNEL)
558 # Needs some C99 features, "inline" is just one of them.
559 # INLINE='' would just replace one set of warnings with another and
560 # still not compile in c89 mode, due to non-const array initializations.
561 CC = cc -c99
71fb089c
RB
562 # Build down-rev compatible objects that don't use our new getopt_long.
563 ifeq ($(uname_R).$(uname_V),J06.21)
564 CC += -WRVU=J06.20
565 endif
566 ifeq ($(uname_R).$(uname_V),L17.02)
567 CC += -WRVU=L16.05
568 endif
e1b6dbb5
JK
569 # Disable all optimization, seems to result in bad code, with -O or -O2
570 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
571 # abends on "git push". Needs more investigation.
71fb089c 572 CFLAGS = -g -O0 -Winline
e1b6dbb5
JK
573 # We'd want it to be here.
574 prefix = /usr/local
71fb089c
RB
575 # perl and python must be in /usr/bin on NonStop - supplied by HPE
576 # with operating system in that managed directory.
577 PERL_PATH = /usr/bin/perl
578 PYTHON_PATH = /usr/bin/python
579 # The current /usr/coreutils/rm at lowest support level does not work
580 # with the git test structure. Long paths as in
581 # 'trash directory...' cause rm to terminate prematurely without fully
582 # removing the directory at OS releases J06.21 and L17.02.
583 # Default to the older rm until those two releases are deprecated.
584 RM = /bin/rm -f
71fb089c
RB
585 NEEDS_CRYPTO_WITH_SSL = YesPlease
586 HAVE_DEV_TTY = YesPlease
e1b6dbb5
JK
587 HAVE_LIBCHARSET_H = YesPlease
588 HAVE_STRINGS_H = YesPlease
589 NEEDS_LIBICONV = YesPlease
590 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
591 NO_SYS_SELECT_H = UnfortunatelyYes
592 NO_D_TYPE_IN_DIRENT = YesPlease
71fb089c 593 NO_GETTEXT = YesPlease
e1b6dbb5
JK
594 NO_HSTRERROR = YesPlease
595 NO_STRCASESTR = YesPlease
e1b6dbb5
JK
596 NO_MEMMEM = YesPlease
597 NO_STRLCPY = YesPlease
598 NO_SETENV = YesPlease
599 NO_UNSETENV = YesPlease
600 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
601 # Currently libiconv-1.9.1.
602 OLD_ICONV = UnfortunatelyYes
71fb089c 603 NO_REGEX = NeedsStartEnd
e1b6dbb5 604 NO_PTHREADS = UnfortunatelyYes
243a4c7e 605 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
606
607 # Not detected (nor checked for) by './configure'.
608 # We don't have SA_RESTART on NonStop, unfortunalety.
609 COMPAT_CFLAGS += -DSA_RESTART=0
610 # Apparently needed in compat/fnmatch/fnmatch.c.
611 COMPAT_CFLAGS += -DHAVE_STRING_H=1
612 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
613 NO_NSEC = YesPlease
614 NO_PREAD = YesPlease
615 NO_MMAP = YesPlease
616 NO_POLL = YesPlease
617 NO_INTPTR_T = UnfortunatelyYes
05cd988d 618 CSPRNG_METHOD = openssl
e1b6dbb5 619 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
f0ec22bb 620 SHELL_PATH = /usr/coreutils/bin/bash
e1b6dbb5 621endif
ebd2e4a1 622ifeq ($(uname_S),MINGW)
e1b6dbb5 623 pathsep = ;
22f4c27e 624 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
625 NO_PREAD = YesPlease
626 NEEDS_CRYPTO_WITH_SSL = YesPlease
627 NO_LIBGEN_H = YesPlease
628 NO_POLL = YesPlease
629 NO_SYMLINK_HEAD = YesPlease
630 NO_UNIX_SOCKETS = YesPlease
631 NO_SETENV = YesPlease
e1b6dbb5
JK
632 NO_STRCASESTR = YesPlease
633 NO_STRLCPY = YesPlease
e1b6dbb5
JK
634 NO_MEMMEM = YesPlease
635 NEEDS_LIBICONV = YesPlease
e1b6dbb5
JK
636 NO_STRTOUMAX = YesPlease
637 NO_MKDTEMP = YesPlease
e1b6dbb5 638 NO_SVN_TESTS = YesPlease
62c73671
JH
639
640 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
641 # These are always available, so we do not have to conditionally
642 # support it.
643 FSMONITOR_DAEMON_BACKEND = win32
d33c804d
JH
644 FSMONITOR_OS_SETTINGS = win32
645
e1b6dbb5 646 RUNTIME_PREFIX = YesPlease
86e25458 647 HAVE_WPGMPTR = YesWeDo
e1b6dbb5 648 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
59c7b881 649 USE_WIN32_IPC = YesPlease
e1b6dbb5 650 USE_WIN32_MMAP = YesPlease
5b633610 651 MMAP_PREVENTS_DELETE = UnfortunatelyYes
e1b6dbb5
JK
652 USE_NED_ALLOCATOR = YesPlease
653 UNRELIABLE_FSTAT = UnfortunatelyYes
654 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
655 NO_REGEX = YesPlease
656 NO_PYTHON = YesPlease
e1b6dbb5 657 ETAGS_TARGET = ETAGS
e1b6dbb5 658 NO_POSIX_GOODIES = UnfortunatelyYes
65db0443 659 DEFAULT_HELP_FORMAT = html
b7e6a416 660 HAVE_PLATFORM_PROCINFO = YesPlease
05cd988d 661 CSPRNG_METHOD = rtlgenrandom
396ff754 662 BASIC_LDFLAGS += -municode
7b40ae86 663 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
e1b6dbb5
JK
664 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
665 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
353d3d77 666 compat/win32/trace2_win32_process_info.o \
1cadad6f 667 compat/win32/path-utils.o \
e1b6dbb5
JK
668 compat/win32/pthread.o compat/win32/syslog.o \
669 compat/win32/dirent.o
7c9fbda6 670 BASIC_CFLAGS += -DWIN32
e1b6dbb5 671 EXTLIBS += -lws2_32
ce39c2e0 672 GITLIBS += git.res
e1b6dbb5 673 PTHREAD_LIBS =
ce39c2e0 674 RC = windres -O coff
95f31e9a 675 NATIVE_CRLF = YesPlease
e1b6dbb5 676 X = .exe
e1b6dbb5
JK
677ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
678 htmldir = doc/git/html/
679 prefix =
680 INSTALL = /bin/install
681 EXTLIBS += /mingw/lib/libz.a
e1b6dbb5
JK
682 INTERNAL_QSORT = YesPlease
683 HAVE_LIBCHARSET_H = YesPlease
ca354871 684 NO_GETTEXT = YesPlease
6a1ce2ed 685 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
e1b6dbb5 686else
aeb582a9 687 ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
df5218b4 688 # MSys2
7b40ae86 689 prefix = /usr/
ce6a1585
İD
690 # Enable DEP
691 BASIC_LDFLAGS += -Wl,--nxcompat
692 # Enable ASLR (unless debugging)
693 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
694 BASIC_LDFLAGS += -Wl,--dynamicbase
695 endif
7b40ae86
JS
696 ifeq (MINGW32,$(MSYSTEM))
697 prefix = /mingw32
bb02e7a5 698 HOST_CPU = i686
598b6c3a 699 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
7b40ae86
JS
700 endif
701 ifeq (MINGW64,$(MSYSTEM))
702 prefix = /mingw64
bb02e7a5 703 HOST_CPU = x86_64
598b6c3a 704 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
7b40ae86
JS
705 else
706 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
707 BASIC_LDFLAGS += -Wl,--large-address-aware
708 endif
df5218b4 709 CC = gcc
a1c5e906
JS
710 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
711 -fstack-protector-strong
f7f90e0f 712 EXTLIBS += -lntdll
df5218b4 713 INSTALL = /bin/install
df5218b4
JS
714 INTERNAL_QSORT = YesPlease
715 HAVE_LIBCHARSET_H = YesPlease
f9206ce2 716 NO_GETTEXT =
b640b77f 717 USE_GETTEXT_SCHEME = fallthrough
ebbf5d2b 718 USE_LIBPCRE = YesPlease
df5218b4
JS
719 NO_CURL =
720 USE_NED_ALLOCATOR = YesPlease
fb5e3378
JS
721 ifeq (/mingw64,$(subst 32,64,$(prefix)))
722 # Move system config into top-level /etc/
723 ETC_GITCONFIG = ../etc/gitconfig
724 ETC_GITATTRIBUTES = ../etc/gitattributes
725 endif
df5218b4
JS
726 else
727 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
728 NO_CURL = YesPlease
729 endif
e1b6dbb5
JK
730endif
731endif
732ifeq ($(uname_S),QNX)
733 COMPAT_CFLAGS += -DSA_RESTART=0
081fd8d0 734 EXPAT_NEEDS_XMLPARSE_H = YesPlease
e1b6dbb5
JK
735 HAVE_STRINGS_H = YesPlease
736 NEEDS_SOCKET = YesPlease
e1b6dbb5
JK
737 NO_GETPAGESIZE = YesPlease
738 NO_ICONV = YesPlease
739 NO_MEMMEM = YesPlease
740 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
741 NO_NSEC = YesPlease
742 NO_PTHREADS = YesPlease
e1b6dbb5
JK
743 NO_STRCASESTR = YesPlease
744 NO_STRLCPY = YesPlease
745endif
976aaedc
JS
746
747vcxproj:
748 # Require clean work tree
749 git update-index -q --refresh && \
750 git diff-files --quiet && \
751 git diff-index --cached --quiet HEAD --
752
753 # Make .vcxproj files and add them
754 unset QUIET_GEN QUIET_BUILT_IN; \
755 perl contrib/buildsystems/generate -g Vcxproj
756 git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
757
030a628b 758 # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
b18ae14a
JS
759 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
760 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
761 for name in $(BUILT_INS);\
762 do \
763 echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
764 done && \
030a628b
JS
765 echo ' </Target>' && \
766 echo '</Project>') >git/LinkOrCopyBuiltins.targets
767 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
768 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
b18ae14a
JS
769 for name in $(REMOTE_CURL_ALIASES); \
770 do \
771 echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
772 done && \
773 echo ' </Target>' && \
030a628b
JS
774 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
775 git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
b18ae14a 776
7c3c0a99
ÆAB
777 # Add generated headers
778 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
779 git add -f $(GENERATED_H)
976aaedc
JS
780
781 # Add scripts
782 rm -f perl/perl.mak
5d65ad17 783 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
976aaedc
JS
784 # Strip out the sane tool path, needed only for building
785 sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
5d65ad17 786 git add -f $(SCRIPT_LIB) $(SCRIPTS)
976aaedc
JS
787
788 # Add Perl module
789 $(MAKE) $(LIB_PERL_GEN)
790 git add -f perl/build
791
792 # Add bin-wrappers, for testing
793 rm -rf bin-wrappers/
794 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
795 # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
796 # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
797 # by test-lib.sh according to the current setup)
798 sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
799 \1="$$(cygpath -u "$$\1")"/' \
800 -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
801 # Ensure that test-* helpers find the .dll files copied to top-level
802 sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
803 # We do not want to force hard-linking builtins
804 sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
805 bin-wrappers/git-{receive-pack,upload-archive}
806 git add -f $(test_bindir_programs)
807 # remote-ext is a builtin, but invoked as if it were external
808 sed 's|receive-pack|remote-ext|g' \
809 <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
810 git add -f bin-wrappers/git-remote-ext
811
812 # Add templates
813 $(MAKE) -C templates
814 git add -f templates/boilerplates.made templates/blt/
815
5d65ad17
JS
816 # Add the translated messages
817 make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
818 git add -f $(MOFILES)
819
976aaedc
JS
820 # Add build options
821 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
822 git add -f GIT-BUILD-OPTIONS
823
824 # Commit the whole shebang
825 git commit -m "Generate Visual Studio solution" \
826 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"