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