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