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