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