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