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