]> git.ipfire.org Git - thirdparty/git.git/blame - config.mak.uname
artifacts-tar: when including `.dll` files, don't forget the unit-tests
[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
abf38abe 60 HAVE_SYNC_FILE_RANGE = YesPlease
0cc30e0e 61 HAVE_GETDELIM = YesPlease
e2d90fd1 62 FREAD_READS_DIRECTORIES = UnfortunatelyYes
9806f5a7 63 BASIC_CFLAGS += -DHAVE_SYSINFO
226c0ddd 64 PROCFS_EXECUTABLE_PATH = /proc/self/exe
2f732bf1
ES
65 HAVE_PLATFORM_PROCINFO = YesPlease
66 COMPAT_OBJS += compat/linux/procinfo.o
ffb9f298
DA
67 # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
68 ifneq ($(findstring .el7.,$(uname_R)),)
69 BASIC_CFLAGS += -std=c99
ffb9f298 70 endif
e1b6dbb5
JK
71endif
72ifeq ($(uname_S),GNU/kFreeBSD)
61f76a36 73 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 74 NO_STRLCPY = YesPlease
e1b6dbb5
JK
75 HAVE_PATHS_H = YesPlease
76 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
77 LIBC_CONTAINS_LIBINTL = YesPlease
e2d90fd1 78 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
79endif
80ifeq ($(uname_S),UnixWare)
81 CC = cc
82 NEEDS_SOCKET = YesPlease
83 NEEDS_NSL = YesPlease
84 NEEDS_SSL_WITH_CRYPTO = YesPlease
85 NEEDS_LIBICONV = YesPlease
86 SHELL_PATH = /usr/local/bin/bash
87 NO_IPV6 = YesPlease
88 NO_HSTRERROR = YesPlease
e1b6dbb5
JK
89 BASIC_CFLAGS += -Kthread
90 BASIC_CFLAGS += -I/usr/local/include
91 BASIC_LDFLAGS += -L/usr/local/lib
92 INSTALL = ginstall
93 TAR = gtar
94 NO_STRCASESTR = YesPlease
95 NO_MEMMEM = YesPlease
96endif
97ifeq ($(uname_S),SCO_SV)
98 ifeq ($(uname_R),3.2)
99 CFLAGS = -O2
100 endif
101 ifeq ($(uname_R),5)
102 CC = cc
103 BASIC_CFLAGS += -Kthread
104 endif
105 NEEDS_SOCKET = YesPlease
106 NEEDS_NSL = YesPlease
107 NEEDS_SSL_WITH_CRYPTO = YesPlease
108 NEEDS_LIBICONV = YesPlease
109 SHELL_PATH = /usr/bin/bash
110 NO_IPV6 = YesPlease
111 NO_HSTRERROR = YesPlease
e1b6dbb5
JK
112 BASIC_CFLAGS += -I/usr/local/include
113 BASIC_LDFLAGS += -L/usr/local/lib
114 NO_STRCASESTR = YesPlease
115 NO_MEMMEM = YesPlease
116 INSTALL = ginstall
117 TAR = gtar
118endif
119ifeq ($(uname_S),Darwin)
120 NEEDS_CRYPTO_WITH_SSL = YesPlease
121 NEEDS_SSL_WITH_CRYPTO = YesPlease
122 NEEDS_LIBICONV = YesPlease
9eeff2f6
JH
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".
e1b6dbb5
JK
127 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
128 OLD_ICONV = UnfortunatelyYes
9c7a0bee 129 NO_APPLE_COMMON_CRYPTO = YesPlease
e1b6dbb5
JK
130 endif
131 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
132 NO_STRLCPY = YesPlease
133 endif
4e368785
ES
134 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
135 HAVE_GETDELIM = YesPlease
136 endif
bbabaad2
JK
137 ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
138 OPEN_RETURNS_EINTR = UnfortunatelyYes
139 endif
e1b6dbb5
JK
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
a42643aa 145 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
9529080d 146 HAVE_BSD_SYSCTL = YesPlease
8e178ec4 147 FREAD_READS_DIRECTORIES = UnfortunatelyYes
226c0ddd 148 HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
05cd988d 149 CSPRNG_METHOD = arc4random
54463d32 150 USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease
a0b31086
JS
151
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
160 endif
161 endif
f67df255
JH
162
163 # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
164 # Unix domain sockets and PThreads.
165 ifndef NO_PTHREADS
166 ifndef NO_UNIX_SOCKETS
167 FSMONITOR_DAEMON_BACKEND = darwin
a85ad67b 168 FSMONITOR_OS_SETTINGS = darwin
f67df255
JH
169 endif
170 endif
171
172 BASIC_LDFLAGS += -framework CoreServices
e1b6dbb5
JK
173endif
174ifeq ($(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
61f76a36 179 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
180 NO_STRCASESTR = YesPlease
181 NO_MEMMEM = YesPlease
182 NO_MKDTEMP = YesPlease
e1b6dbb5 183 NO_REGEX = YesPlease
e1b6dbb5
JK
184 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
185 HAVE_DEV_TTY = YesPlease
186 ifeq ($(uname_R),5.6)
187 SOCKLEN_T = int
188 NO_HSTRERROR = YesPlease
189 NO_IPV6 = YesPlease
190 NO_SOCKADDR_STORAGE = YesPlease
191 NO_UNSETENV = YesPlease
192 NO_SETENV = YesPlease
193 NO_STRLCPY = YesPlease
194 NO_STRTOUMAX = YesPlease
195 GIT_TEST_CMP = cmp
196 endif
197 ifeq ($(uname_R),5.7)
198 NEEDS_RESOLV = YesPlease
199 NO_IPV6 = YesPlease
200 NO_SOCKADDR_STORAGE = YesPlease
201 NO_UNSETENV = YesPlease
202 NO_SETENV = YesPlease
203 NO_STRLCPY = YesPlease
204 NO_STRTOUMAX = YesPlease
205 GIT_TEST_CMP = cmp
206 endif
207 ifeq ($(uname_R),5.8)
208 NO_UNSETENV = YesPlease
209 NO_SETENV = YesPlease
210 NO_STRTOUMAX = YesPlease
211 GIT_TEST_CMP = cmp
212 endif
213 ifeq ($(uname_R),5.9)
214 NO_UNSETENV = YesPlease
215 NO_SETENV = YesPlease
216 NO_STRTOUMAX = YesPlease
217 GIT_TEST_CMP = cmp
218 endif
219 INSTALL = /usr/ucb/install
220 TAR = gtar
61f76a36 221 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
e1b6dbb5
JK
222endif
223ifeq ($(uname_O),Cygwin)
224 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
225 NO_D_TYPE_IN_DIRENT = YesPlease
e1b6dbb5
JK
226 NO_STRCASESTR = YesPlease
227 NO_MEMMEM = YesPlease
e1b6dbb5
JK
228 NO_SYMLINK_HEAD = YesPlease
229 NO_IPV6 = YesPlease
230 OLD_ICONV = UnfortunatelyYes
f593ef77
ML
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
234 NO_MMAP = YesPlease
92f63d2b
ML
235 else
236 NO_REGEX = UnfortunatelyYes
e1b6dbb5 237 endif
61f76a36 238 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
239 NEEDS_LIBICONV = YesPlease
240 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
e1b6dbb5 241 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
e1b6dbb5 242 X = .exe
e1b6dbb5 243 UNRELIABLE_FSTAT = UnfortunatelyYes
e53a64b9 244 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
5b633610 245 MMAP_PREVENTS_DELETE = UnfortunatelyYes
1cadad6f 246 COMPAT_OBJS += compat/win32/path-utils.o
a5956d6a 247 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
248endif
249ifeq ($(uname_S),FreeBSD)
250 NEEDS_LIBICONV = YesPlease
6c6ce21b
ES
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
255 endif
256 ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
257 OLD_ICONV = YesPlease
258 endif
259 ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
260 OLD_ICONV = YesPlease
261 endif
e1b6dbb5
JK
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
271 endif
272 PYTHON_PATH = /usr/local/bin/python
259f22af 273 PERL_PATH = /usr/local/bin/perl
e1b6dbb5 274 HAVE_PATHS_H = YesPlease
9529080d 275 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 276 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 277 CSPRNG_METHOD = arc4random
995bc22d 278 PAGER_ENV = LESS=FRX LV=-c MORE=FRX
e2d90fd1 279 FREAD_READS_DIRECTORIES = UnfortunatelyYes
18a4f6be 280 FILENO_IS_A_MACRO = UnfortunatelyYes
e1b6dbb5
JK
281endif
282ifeq ($(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
9529080d 290 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 291 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 292 CSPRNG_METHOD = arc4random
226c0ddd 293 PROCFS_EXECUTABLE_PATH = /proc/curproc/file
4e3ecbd4 294 FREAD_READS_DIRECTORIES = UnfortunatelyYes
18a4f6be 295 FILENO_IS_A_MACRO = UnfortunatelyYes
92164af9
BS
296endif
297ifeq ($(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
9529080d 303 HAVE_BSD_SYSCTL = YesPlease
05cd988d 304 CSPRNG_METHOD = arc4random
e1b6dbb5
JK
305endif
306ifeq ($(uname_S),NetBSD)
307 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
308 NEEDS_LIBICONV = YesPlease
309 endif
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
e1b6dbb5 313 HAVE_PATHS_H = YesPlease
9529080d 314 HAVE_BSD_SYSCTL = YesPlease
226c0ddd 315 HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
05cd988d 316 CSPRNG_METHOD = arc4random
226c0ddd 317 PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
e1b6dbb5
JK
318endif
319ifeq ($(uname_S),AIX)
320 DEFAULT_PAGER = more
321 NO_STRCASESTR = YesPlease
322 NO_MEMMEM = YesPlease
323 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
324 NO_STRLCPY = YesPlease
325 NO_NSEC = YesPlease
0e6d899f 326 NO_REGEX = NeedsStartEnd
e1b6dbb5
JK
327 FREAD_READS_DIRECTORIES = UnfortunatelyYes
328 INTERNAL_QSORT = UnfortunatelyYes
329 NEEDS_LIBICONV = YesPlease
330 BASIC_CFLAGS += -D_LARGE_FILES
ee662bf5 331 FILENO_IS_A_MACRO = UnfortunatelyYes
400caafb 332 NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
e1b6dbb5
JK
333 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
334 NO_PTHREADS = YesPlease
335 else
336 PTHREAD_LIBS = -lpthread
337 endif
338 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
339 INLINE = ''
340 endif
341 GIT_TEST_CMP = cmp
342endif
343ifeq ($(uname_S),GNU)
344 # GNU/Hurd
61f76a36 345 HAVE_ALLOCA_H = YesPlease
e1b6dbb5 346 NO_STRLCPY = YesPlease
e1b6dbb5
JK
347 HAVE_PATHS_H = YesPlease
348 LIBC_CONTAINS_LIBINTL = YesPlease
274a1328 349 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
350endif
351ifeq ($(uname_S),IRIX)
352 NO_SETENV = YesPlease
353 NO_UNSETENV = YesPlease
354 NO_STRCASESTR = YesPlease
355 NO_MEMMEM = YesPlease
e1b6dbb5
JK
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.
363 NO_MMAP = YesPlease
364 NO_REGEX = YesPlease
e1b6dbb5
JK
365 SNPRINTF_RETURNS_BOGUS = YesPlease
366 SHELL_PATH = /usr/gnu/bin/bash
367 NEEDS_LIBGEN = YesPlease
368endif
369ifeq ($(uname_S),IRIX64)
370 NO_SETENV = YesPlease
371 NO_UNSETENV = YesPlease
372 NO_STRCASESTR = YesPlease
373 NO_MEMMEM = YesPlease
e1b6dbb5
JK
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.
381 NO_MMAP = YesPlease
382 NO_REGEX = YesPlease
e1b6dbb5
JK
383 SNPRINTF_RETURNS_BOGUS = YesPlease
384 SHELL_PATH = /usr/gnu/bin/bash
385 NEEDS_LIBGEN = YesPlease
386endif
387ifeq ($(uname_S),HP-UX)
388 INLINE = __inline
389 NO_IPV6 = YesPlease
390 NO_SETENV = YesPlease
391 NO_STRCASESTR = YesPlease
392 NO_MEMMEM = YesPlease
e1b6dbb5
JK
393 NO_STRLCPY = YesPlease
394 NO_MKDTEMP = YesPlease
395 NO_UNSETENV = YesPlease
396 NO_HSTRERROR = YesPlease
397 NO_SYS_SELECT_H = YesPlease
e1b6dbb5
JK
398 SNPRINTF_RETURNS_BOGUS = YesPlease
399 NO_NSEC = YesPlease
400 ifeq ($(uname_R),B.11.00)
401 NO_INET_NTOP = YesPlease
402 NO_INET_PTON = YesPlease
403 endif
404 ifeq ($(uname_R),B.10.20)
405 # Override HP-UX 11.x setting:
406 INLINE =
407 SOCKLEN_T = size_t
408 NO_PREAD = YesPlease
409 NO_INET_NTOP = YesPlease
410 NO_INET_PTON = YesPlease
411 endif
412 GIT_TEST_CMP = cmp
413endif
414ifeq ($(uname_S),Windows)
415 GIT_VERSION := $(GIT_VERSION).MSVC
416 pathsep = ;
dce7d295
JH
417 # Assume that this is built in Git for Windows' SDK
418 ifeq (MINGW32,$(MSYSTEM))
419 prefix = /mingw32
420 else
421 prefix = /mingw64
422 endif
423 # Prepend MSVC 64-bit tool-chain to PATH.
424 #
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.
428 #
429 SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
61f76a36 430 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
431 NO_PREAD = YesPlease
432 NEEDS_CRYPTO_WITH_SSL = YesPlease
433 NO_LIBGEN_H = YesPlease
434 NO_POLL = YesPlease
435 NO_SYMLINK_HEAD = YesPlease
436 NO_IPV6 = YesPlease
437 NO_UNIX_SOCKETS = YesPlease
438 NO_SETENV = YesPlease
e1b6dbb5
JK
439 NO_STRCASESTR = YesPlease
440 NO_STRLCPY = YesPlease
e1b6dbb5 441 NO_MEMMEM = YesPlease
dce7d295 442 NEEDS_LIBICONV = YesPlease
e1b6dbb5 443 NO_STRTOUMAX = YesPlease
e1b6dbb5 444 NO_MKDTEMP = YesPlease
dce7d295 445 NO_INTTYPES_H = YesPlease
05cd988d 446 CSPRNG_METHOD = rtlgenrandom
dce7d295
JH
447 # VS2015 with UCRT claims that snprintf and friends are C99 compliant,
448 # so we don't need this:
449 #
450 # SNPRINTF_RETURNS_BOGUS = YesPlease
62c73671
JH
451
452 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
453 # These are always available, so we do not have to conditionally
454 # support it.
455 FSMONITOR_DAEMON_BACKEND = win32
d33c804d
JH
456 FSMONITOR_OS_SETTINGS = win32
457
e1b6dbb5 458 NO_SVN_TESTS = YesPlease
e1b6dbb5 459 RUNTIME_PREFIX = YesPlease
86e25458 460 HAVE_WPGMPTR = YesWeDo
e1b6dbb5 461 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
59c7b881 462 USE_WIN32_IPC = YesPlease
e1b6dbb5 463 USE_WIN32_MMAP = YesPlease
5b633610 464 MMAP_PREVENTS_DELETE = UnfortunatelyYes
e1b6dbb5
JK
465 # USE_NED_ALLOCATOR = YesPlease
466 UNRELIABLE_FSTAT = UnfortunatelyYes
467 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
468 NO_REGEX = YesPlease
bad866a2 469 NO_GETTEXT = YesPlease
e1b6dbb5 470 NO_PYTHON = YesPlease
e0492c5b 471 ETAGS_TARGET = ETAGS
e1b6dbb5
JK
472 NO_POSIX_GOODIES = UnfortunatelyYes
473 NATIVE_CRLF = YesPlease
474 DEFAULT_HELP_FORMAT = html
fb5e3378
JS
475ifeq (/mingw64,$(subst 32,64,$(prefix)))
476 # Move system config into top-level /etc/
477 ETC_GITCONFIG = ../etc/gitconfig
478 ETC_GITATTRIBUTES = ../etc/gitattributes
479endif
e1b6dbb5
JK
480
481 CC = compat/vcbuild/scripts/clink.pl
482 AR = compat/vcbuild/scripts/lib.pl
483 CFLAGS =
dce7d295 484 BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
e1b6dbb5 485 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
abf38abe 486 compat/win32/flush.o \
22c3634c 487 compat/win32/path-utils.o \
e1b6dbb5 488 compat/win32/pthread.o compat/win32/syslog.o \
353d3d77 489 compat/win32/trace2_win32_process_info.o \
e1b6dbb5 490 compat/win32/dirent.o
dce7d295 491 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
396ff754 492 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
dce7d295
JH
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
e1b6dbb5
JK
497 PTHREAD_LIBS =
498 lib =
dce7d295
JH
499 BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
500ifndef DEBUG
501 BASIC_CFLAGS += $(vcpkg_rel_lib)
502else
503 BASIC_CFLAGS += $(vcpkg_dbg_lib)
504endif
505 BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
506
556702f8
JH
507ifneq ($(USE_MSVC_CRTDBG),)
508 # Optionally enable memory leak reporting.
509 BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
510endif
dce7d295
JH
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).
513 BASIC_CFLAGS += -Zi
514 BASIC_LDFLAGS += -debug -Zf
515
516ifdef NO_SAFESEH
517 LDFLAGS += -SAFESEH:NO
518endif
519
e1b6dbb5 520ifndef DEBUG
dce7d295
JH
521 BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
522 BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
e1b6dbb5
JK
523 AR += -LTCG
524else
dce7d295 525 BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
e1b6dbb5
JK
526endif
527 X = .exe
963e1543
JS
528
529compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
e1b6dbb5
JK
530endif
531ifeq ($(uname_S),Interix)
532 NO_INITGROUPS = YesPlease
533 NO_IPV6 = YesPlease
534 NO_MEMMEM = YesPlease
535 NO_MKDTEMP = YesPlease
536 NO_STRTOUMAX = YesPlease
537 NO_NSEC = YesPlease
e1b6dbb5
JK
538 ifeq ($(uname_R),3.5)
539 NO_INET_NTOP = YesPlease
540 NO_INET_PTON = YesPlease
541 NO_SOCKADDR_STORAGE = YesPlease
e1b6dbb5
JK
542 endif
543 ifeq ($(uname_R),5.2)
544 NO_INET_NTOP = YesPlease
545 NO_INET_PTON = YesPlease
546 NO_SOCKADDR_STORAGE = YesPlease
e1b6dbb5
JK
547 endif
548endif
549ifeq ($(uname_S),Minix)
550 NO_IPV6 = YesPlease
551 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
552 NO_NSEC = YesPlease
553 NEEDS_LIBGEN =
554 NEEDS_CRYPTO_WITH_SSL = YesPlease
e1b6dbb5
JK
555 NEEDS_RESOLV =
556 NO_HSTRERROR = YesPlease
557 NO_MMAP = YesPlease
558 NO_CURL =
559 NO_EXPAT =
560endif
561ifeq ($(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.
565 CC = cc -c99
71fb089c
RB
566 # Build down-rev compatible objects that don't use our new getopt_long.
567 ifeq ($(uname_R).$(uname_V),J06.21)
568 CC += -WRVU=J06.20
569 endif
570 ifeq ($(uname_R).$(uname_V),L17.02)
571 CC += -WRVU=L16.05
572 endif
e1b6dbb5
JK
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.
71fb089c 576 CFLAGS = -g -O0 -Winline
e1b6dbb5
JK
577 # We'd want it to be here.
578 prefix = /usr/local
71fb089c
RB
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.
588 RM = /bin/rm -f
71fb089c
RB
589 NEEDS_CRYPTO_WITH_SSL = YesPlease
590 HAVE_DEV_TTY = YesPlease
e1b6dbb5
JK
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
71fb089c 597 NO_GETTEXT = YesPlease
e1b6dbb5
JK
598 NO_HSTRERROR = YesPlease
599 NO_STRCASESTR = YesPlease
e1b6dbb5
JK
600 NO_MEMMEM = YesPlease
601 NO_STRLCPY = YesPlease
602 NO_SETENV = YesPlease
603 NO_UNSETENV = YesPlease
604 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
605 # Currently libiconv-1.9.1.
606 OLD_ICONV = UnfortunatelyYes
71fb089c 607 NO_REGEX = NeedsStartEnd
e1b6dbb5 608 NO_PTHREADS = UnfortunatelyYes
243a4c7e 609 FREAD_READS_DIRECTORIES = UnfortunatelyYes
e1b6dbb5
JK
610
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
617 NO_NSEC = YesPlease
618 NO_PREAD = YesPlease
619 NO_MMAP = YesPlease
620 NO_POLL = YesPlease
621 NO_INTPTR_T = UnfortunatelyYes
05cd988d 622 CSPRNG_METHOD = openssl
e1b6dbb5 623 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
f0ec22bb 624 SHELL_PATH = /usr/coreutils/bin/bash
e1b6dbb5 625endif
ebd2e4a1 626ifeq ($(uname_S),MINGW)
2987407f
HJ
627 ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
628 $(error "Building with MSys is no longer supported")
629 endif
e1b6dbb5 630 pathsep = ;
22f4c27e 631 HAVE_ALLOCA_H = YesPlease
e1b6dbb5
JK
632 NO_PREAD = YesPlease
633 NEEDS_CRYPTO_WITH_SSL = YesPlease
634 NO_LIBGEN_H = YesPlease
635 NO_POLL = YesPlease
636 NO_SYMLINK_HEAD = YesPlease
637 NO_UNIX_SOCKETS = YesPlease
638 NO_SETENV = YesPlease
e1b6dbb5
JK
639 NO_STRCASESTR = YesPlease
640 NO_STRLCPY = YesPlease
e1b6dbb5
JK
641 NO_MEMMEM = YesPlease
642 NEEDS_LIBICONV = YesPlease
e1b6dbb5
JK
643 NO_STRTOUMAX = YesPlease
644 NO_MKDTEMP = YesPlease
e1b6dbb5 645 NO_SVN_TESTS = YesPlease
62c73671
JH
646
647 # The builtin FSMonitor requires Named Pipes and Threads on Windows.
648 # These are always available, so we do not have to conditionally
649 # support it.
650 FSMONITOR_DAEMON_BACKEND = win32
d33c804d
JH
651 FSMONITOR_OS_SETTINGS = win32
652
e1b6dbb5 653 RUNTIME_PREFIX = YesPlease
86e25458 654 HAVE_WPGMPTR = YesWeDo
e1b6dbb5 655 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
59c7b881 656 USE_WIN32_IPC = YesPlease
e1b6dbb5 657 USE_WIN32_MMAP = YesPlease
5b633610 658 MMAP_PREVENTS_DELETE = UnfortunatelyYes
e1b6dbb5
JK
659 UNRELIABLE_FSTAT = UnfortunatelyYes
660 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
661 NO_REGEX = YesPlease
e1b6dbb5 662 ETAGS_TARGET = ETAGS
e1b6dbb5 663 NO_POSIX_GOODIES = UnfortunatelyYes
65db0443 664 DEFAULT_HELP_FORMAT = html
b7e6a416 665 HAVE_PLATFORM_PROCINFO = YesPlease
05cd988d 666 CSPRNG_METHOD = rtlgenrandom
396ff754 667 BASIC_LDFLAGS += -municode
7b40ae86 668 COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
e1b6dbb5
JK
669 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
670 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
353d3d77 671 compat/win32/trace2_win32_process_info.o \
abf38abe 672 compat/win32/flush.o \
1cadad6f 673 compat/win32/path-utils.o \
e1b6dbb5
JK
674 compat/win32/pthread.o compat/win32/syslog.o \
675 compat/win32/dirent.o
7c9fbda6 676 BASIC_CFLAGS += -DWIN32
e1b6dbb5 677 EXTLIBS += -lws2_32
ce39c2e0 678 GITLIBS += git.res
e1b6dbb5 679 PTHREAD_LIBS =
ce39c2e0 680 RC = windres -O coff
95f31e9a 681 NATIVE_CRLF = YesPlease
e1b6dbb5 682 X = .exe
2987407f
HJ
683 # MSys2
684 prefix = /usr/
685 # Enable DEP
686 BASIC_LDFLAGS += -Wl,--nxcompat
687 # Enable ASLR (unless debugging)
688 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
689 BASIC_LDFLAGS += -Wl,--dynamicbase
690 endif
691 ifeq (MINGW32,$(MSYSTEM))
692 prefix = /mingw32
693 HOST_CPU = i686
694 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
695 endif
696 ifeq (MINGW64,$(MSYSTEM))
697 prefix = /mingw64
698 HOST_CPU = x86_64
699 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
700 else
701 COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
702 BASIC_LDFLAGS += -Wl,--large-address-aware
703 endif
704 CC = gcc
705 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
706 -fstack-protector-strong
707 EXTLIBS += -lntdll
e1b6dbb5 708 INSTALL = /bin/install
e1b6dbb5
JK
709 INTERNAL_QSORT = YesPlease
710 HAVE_LIBCHARSET_H = YesPlease
2987407f
HJ
711 USE_GETTEXT_SCHEME = fallthrough
712 USE_LIBPCRE = YesPlease
713 USE_NED_ALLOCATOR = YesPlease
714 ifeq (/mingw64,$(subst 32,64,$(prefix)))
715 # Move system config into top-level /etc/
716 ETC_GITCONFIG = ../etc/gitconfig
717 ETC_GITATTRIBUTES = ../etc/gitattributes
df5218b4 718 endif
e1b6dbb5 719endif
e1b6dbb5
JK
720ifeq ($(uname_S),QNX)
721 COMPAT_CFLAGS += -DSA_RESTART=0
081fd8d0 722 EXPAT_NEEDS_XMLPARSE_H = YesPlease
e1b6dbb5
JK
723 HAVE_STRINGS_H = YesPlease
724 NEEDS_SOCKET = YesPlease
e1b6dbb5
JK
725 NO_GETPAGESIZE = YesPlease
726 NO_ICONV = YesPlease
727 NO_MEMMEM = YesPlease
728 NO_MKDTEMP = YesPlease
e1b6dbb5
JK
729 NO_NSEC = YesPlease
730 NO_PTHREADS = YesPlease
e1b6dbb5
JK
731 NO_STRCASESTR = YesPlease
732 NO_STRLCPY = YesPlease
733endif
976aaedc
JS
734
735vcxproj:
736 # Require clean work tree
737 git update-index -q --refresh && \
738 git diff-files --quiet && \
739 git diff-index --cached --quiet HEAD --
740
741 # Make .vcxproj files and add them
976aaedc
JS
742 perl contrib/buildsystems/generate -g Vcxproj
743 git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
744
030a628b 745 # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
b18ae14a
JS
746 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
747 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
748 for name in $(BUILT_INS);\
749 do \
750 echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
751 done && \
030a628b
JS
752 echo ' </Target>' && \
753 echo '</Project>') >git/LinkOrCopyBuiltins.targets
754 (echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
755 echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
b18ae14a
JS
756 for name in $(REMOTE_CURL_ALIASES); \
757 do \
758 echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
759 done && \
760 echo ' </Target>' && \
030a628b
JS
761 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
762 git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
b18ae14a 763
7c3c0a99
ÆAB
764 # Add generated headers
765 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
766 git add -f $(GENERATED_H)
976aaedc
JS
767
768 # Add scripts
769 rm -f perl/perl.mak
5d65ad17 770 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
976aaedc
JS
771 # Strip out the sane tool path, needed only for building
772 sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
5d65ad17 773 git add -f $(SCRIPT_LIB) $(SCRIPTS)
976aaedc
JS
774
775 # Add Perl module
776 $(MAKE) $(LIB_PERL_GEN)
777 git add -f perl/build
778
779 # Add bin-wrappers, for testing
780 rm -rf bin-wrappers/
781 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
782 # Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
783 # path of the repository is not hard-coded (GIT_EXEC_PATH will be set
784 # by test-lib.sh according to the current setup)
785 sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
786 \1="$$(cygpath -u "$$\1")"/' \
787 -e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
788 # Ensure that test-* helpers find the .dll files copied to top-level
789 sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
790 # We do not want to force hard-linking builtins
791 sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
792 bin-wrappers/git-{receive-pack,upload-archive}
793 git add -f $(test_bindir_programs)
794 # remote-ext is a builtin, but invoked as if it were external
795 sed 's|receive-pack|remote-ext|g' \
796 <bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
797 git add -f bin-wrappers/git-remote-ext
798
799 # Add templates
800 $(MAKE) -C templates
801 git add -f templates/boilerplates.made templates/blt/
802
5d65ad17
JS
803 # Add the translated messages
804 make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
805 git add -f $(MOFILES)
806
976aaedc
JS
807 # Add build options
808 $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
809 git add -f GIT-BUILD-OPTIONS
810
811 # Commit the whole shebang
812 git commit -m "Generate Visual Studio solution" \
813 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"