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