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