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