t1092: replace 'read-cache --table' with 'ls-files --sparse'
[git/debian.git] / config.mak.uname
bloba3a779327f8d5f4a523bb7b9a0b9d8905151a996
1 # Platform specific Makefile tweaks based on uname detection
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.
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')
14 ifneq ($(findstring MINGW,$(uname_S)),)
15         uname_S := MINGW
16 endif
18 ifdef MSVC
19         # avoid the MingW and Cygwin configuration sections
20         uname_S := Windows
21         uname_O := Windows
23         # Generate and include makefile variables that point to the
24         # currently installed set of MSVC command line tools.
25 compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
26         @"$<" | tr '\\' / >"$@"
27 include compat/vcbuild/MSVC-DEFS-GEN
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.
32 ifeq (,$(SKIP_VCPKG))
33 compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
34         @"$<"
35 include compat/vcbuild/VCPKG-DEFS
36 endif
37 endif
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...
43 ifeq ($(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
49 endif
50 ifeq ($(uname_S),Linux)
51         HAVE_ALLOCA_H = YesPlease
52         NO_STRLCPY = YesPlease
53         HAVE_PATHS_H = YesPlease
54         LIBC_CONTAINS_LIBINTL = YesPlease
55         HAVE_DEV_TTY = YesPlease
56         HAVE_CLOCK_GETTIME = YesPlease
57         HAVE_CLOCK_MONOTONIC = YesPlease
58         # -lrt is needed for clock_gettime on glibc <= 2.16
59         NEEDS_LIBRT = YesPlease
60         HAVE_GETDELIM = YesPlease
61         FREAD_READS_DIRECTORIES = UnfortunatelyYes
62         BASIC_CFLAGS += -DHAVE_SYSINFO
63         PROCFS_EXECUTABLE_PATH = /proc/self/exe
64         HAVE_PLATFORM_PROCINFO = YesPlease
65         COMPAT_OBJS += compat/linux/procinfo.o
66 endif
67 ifeq ($(uname_S),GNU/kFreeBSD)
68         HAVE_ALLOCA_H = YesPlease
69         NO_STRLCPY = YesPlease
70         HAVE_PATHS_H = YesPlease
71         DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
72         LIBC_CONTAINS_LIBINTL = YesPlease
73         FREAD_READS_DIRECTORIES = UnfortunatelyYes
74 endif
75 ifeq ($(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
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
91 endif
92 ifeq ($(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
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
113 endif
114 ifeq ($(uname_S),Darwin)
115         NEEDS_CRYPTO_WITH_SSL = YesPlease
116         NEEDS_SSL_WITH_CRYPTO = YesPlease
117         NEEDS_LIBICONV = YesPlease
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".
122         ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
123                 OLD_ICONV = UnfortunatelyYes
124                 NO_APPLE_COMMON_CRYPTO = YesPlease
125         endif
126         ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
127                 NO_STRLCPY = YesPlease
128         endif
129         ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
130                 HAVE_GETDELIM = YesPlease
131         endif
132         ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
133                 OPEN_RETURNS_EINTR = UnfortunatelyYes
134         endif
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
140         BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
141         HAVE_BSD_SYSCTL = YesPlease
142         FREAD_READS_DIRECTORIES = UnfortunatelyYes
143         HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
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
155 endif
156 ifeq ($(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
161         HAVE_ALLOCA_H = YesPlease
162         NO_STRCASESTR = YesPlease
163         NO_MEMMEM = YesPlease
164         NO_MKDTEMP = YesPlease
165         NO_REGEX = YesPlease
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
203         BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
204 endif
205 ifeq ($(uname_O),Cygwin)
206         ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
207                 NO_D_TYPE_IN_DIRENT = YesPlease
208                 NO_STRCASESTR = YesPlease
209                 NO_MEMMEM = YesPlease
210                 NO_SYMLINK_HEAD = YesPlease
211                 NO_IPV6 = YesPlease
212                 OLD_ICONV = UnfortunatelyYes
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
217         else
218                 NO_REGEX = UnfortunatelyYes
219         endif
220         HAVE_ALLOCA_H = YesPlease
221         NEEDS_LIBICONV = YesPlease
222         NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
223         NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
224         X = .exe
225         UNRELIABLE_FSTAT = UnfortunatelyYes
226         OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
227         MMAP_PREVENTS_DELETE = UnfortunatelyYes
228         COMPAT_OBJS += compat/win32/path-utils.o
229         FREAD_READS_DIRECTORIES = UnfortunatelyYes
230 endif
231 ifeq ($(uname_S),FreeBSD)
232         NEEDS_LIBICONV = YesPlease
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
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
255         PERL_PATH = /usr/local/bin/perl
256         HAVE_PATHS_H = YesPlease
257         HAVE_BSD_SYSCTL = YesPlease
258         HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
259         PAGER_ENV = LESS=FRX LV=-c MORE=FRX
260         FREAD_READS_DIRECTORIES = UnfortunatelyYes
261         FILENO_IS_A_MACRO = UnfortunatelyYes
262 endif
263 ifeq ($(uname_S),OpenBSD)
264         # Versions < 7.0 need compatibility layer
265         ifeq ($(shell expr "$(uname_R)" : "[1-6]\."),2)
266                 NO_UNCOMPRESS2 = UnfortunatelyYes
267         endif
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
275         HAVE_BSD_SYSCTL = YesPlease
276         HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
277         PROCFS_EXECUTABLE_PATH = /proc/curproc/file
278         FREAD_READS_DIRECTORIES = UnfortunatelyYes
279         FILENO_IS_A_MACRO = UnfortunatelyYes
280 endif
281 ifeq ($(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
287         HAVE_BSD_SYSCTL = YesPlease
288 endif
289 ifeq ($(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
296         HAVE_PATHS_H = YesPlease
297         HAVE_BSD_SYSCTL = YesPlease
298         HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
299         PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
300 endif
301 ifeq ($(uname_S),AIX)
302         DEFAULT_PAGER = more
303         NO_STRCASESTR = YesPlease
304         NO_MEMMEM = YesPlease
305         NO_MKDTEMP = YesPlease
306         NO_STRLCPY = YesPlease
307         NO_NSEC = YesPlease
308         NO_REGEX = NeedsStartEnd
309         FREAD_READS_DIRECTORIES = UnfortunatelyYes
310         INTERNAL_QSORT = UnfortunatelyYes
311         NEEDS_LIBICONV = YesPlease
312         BASIC_CFLAGS += -D_LARGE_FILES
313         FILENO_IS_A_MACRO = UnfortunatelyYes
314         NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
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
324 endif
325 ifeq ($(uname_S),GNU)
326         # GNU/Hurd
327         HAVE_ALLOCA_H = YesPlease
328         NO_STRLCPY = YesPlease
329         HAVE_PATHS_H = YesPlease
330         LIBC_CONTAINS_LIBINTL = YesPlease
331         FREAD_READS_DIRECTORIES = UnfortunatelyYes
332 endif
333 ifeq ($(uname_S),IRIX)
334         NO_SETENV = YesPlease
335         NO_UNSETENV = YesPlease
336         NO_STRCASESTR = YesPlease
337         NO_MEMMEM = YesPlease
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
347         SNPRINTF_RETURNS_BOGUS = YesPlease
348         SHELL_PATH = /usr/gnu/bin/bash
349         NEEDS_LIBGEN = YesPlease
350 endif
351 ifeq ($(uname_S),IRIX64)
352         NO_SETENV = YesPlease
353         NO_UNSETENV = YesPlease
354         NO_STRCASESTR = YesPlease
355         NO_MEMMEM = YesPlease
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
365         SNPRINTF_RETURNS_BOGUS = YesPlease
366         SHELL_PATH = /usr/gnu/bin/bash
367         NEEDS_LIBGEN = YesPlease
368 endif
369 ifeq ($(uname_S),HP-UX)
370         INLINE = __inline
371         NO_IPV6 = YesPlease
372         NO_SETENV = YesPlease
373         NO_STRCASESTR = YesPlease
374         NO_MEMMEM = YesPlease
375         NO_STRLCPY = YesPlease
376         NO_MKDTEMP = YesPlease
377         NO_UNSETENV = YesPlease
378         NO_HSTRERROR = YesPlease
379         NO_SYS_SELECT_H = YesPlease
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
395 endif
396 ifeq ($(uname_S),Windows)
397         GIT_VERSION := $(GIT_VERSION).MSVC
398         pathsep = ;
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)
412         HAVE_ALLOCA_H = YesPlease
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
421         NO_STRCASESTR = YesPlease
422         NO_STRLCPY = YesPlease
423         NO_MEMMEM = YesPlease
424         NEEDS_LIBICONV = YesPlease
425         NO_STRTOUMAX = YesPlease
426         NO_MKDTEMP = YesPlease
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
432         NO_SVN_TESTS = YesPlease
433         RUNTIME_PREFIX = YesPlease
434         HAVE_WPGMPTR = YesWeDo
435         NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
436         USE_WIN32_IPC = YesPlease
437         USE_WIN32_MMAP = YesPlease
438         MMAP_PREVENTS_DELETE = UnfortunatelyYes
439         # USE_NED_ALLOCATOR = YesPlease
440         UNRELIABLE_FSTAT = UnfortunatelyYes
441         OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
442         NO_REGEX = YesPlease
443         NO_GETTEXT = YesPlease
444         NO_PYTHON = YesPlease
445         ETAGS_TARGET = ETAGS
446         NO_POSIX_GOODIES = UnfortunatelyYes
447         NATIVE_CRLF = YesPlease
448         DEFAULT_HELP_FORMAT = html
449 ifeq (/mingw64,$(subst 32,64,$(prefix)))
450         # Move system config into top-level /etc/
451         ETC_GITCONFIG = ../etc/gitconfig
452         ETC_GITATTRIBUTES = ../etc/gitattributes
453 endif
455         CC = compat/vcbuild/scripts/clink.pl
456         AR = compat/vcbuild/scripts/lib.pl
457         CFLAGS =
458         BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
459         COMPAT_OBJS = compat/msvc.o compat/winansi.o \
460                 compat/win32/path-utils.o \
461                 compat/win32/pthread.o compat/win32/syslog.o \
462                 compat/win32/trace2_win32_process_info.o \
463                 compat/win32/dirent.o
464         COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
465         BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
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
470         PTHREAD_LIBS =
471         lib =
472         BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
473 ifndef DEBUG
474         BASIC_CFLAGS += $(vcpkg_rel_lib)
475 else
476         BASIC_CFLAGS += $(vcpkg_dbg_lib)
477 endif
478         BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)
480 ifneq ($(USE_MSVC_CRTDBG),)
481         # Optionally enable memory leak reporting.
482         BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
483 endif
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
489 ifdef NO_SAFESEH
490         LDFLAGS += -SAFESEH:NO
491 endif
493 ifndef DEBUG
494         BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
495         BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
496         AR += -LTCG
497 else
498         BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
499 endif
500         X = .exe
502 compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
503 endif
504 ifeq ($(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
511         ifeq ($(uname_R),3.5)
512                 NO_INET_NTOP = YesPlease
513                 NO_INET_PTON = YesPlease
514                 NO_SOCKADDR_STORAGE = YesPlease
515         endif
516         ifeq ($(uname_R),5.2)
517                 NO_INET_NTOP = YesPlease
518                 NO_INET_PTON = YesPlease
519                 NO_SOCKADDR_STORAGE = YesPlease
520         endif
521 endif
522 ifeq ($(uname_S),Minix)
523         NO_UNCOMPRESS2 = YesPlease
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
529         NEEDS_RESOLV =
530         NO_HSTRERROR = YesPlease
531         NO_MMAP = YesPlease
532         NO_CURL =
533         NO_EXPAT =
534 endif
535 ifeq ($(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
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
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.
550         CFLAGS = -g -O0 -Winline
551         # We'd want it to be here.
552         prefix = /usr/local
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
563         NEEDS_CRYPTO_WITH_SSL = YesPlease
564         HAVE_DEV_TTY = YesPlease
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
571         NO_GETTEXT = YesPlease
572         NO_HSTRERROR = YesPlease
573         NO_STRCASESTR = YesPlease
574         NO_MEMMEM = YesPlease
575         NO_STRLCPY = YesPlease
576         NO_SETENV = YesPlease
577         NO_UNSETENV = YesPlease
578         NO_MKDTEMP = YesPlease
579         # Currently libiconv-1.9.1.
580         OLD_ICONV = UnfortunatelyYes
581         NO_REGEX = NeedsStartEnd
582         NO_PTHREADS = UnfortunatelyYes
583         FREAD_READS_DIRECTORIES = UnfortunatelyYes
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
596         SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
597         SHELL_PATH = /usr/coreutils/bin/bash
598 endif
599 ifeq ($(uname_S),MINGW)
600         pathsep = ;
601         HAVE_ALLOCA_H = YesPlease
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
609         NO_STRCASESTR = YesPlease
610         NO_STRLCPY = YesPlease
611         NO_MEMMEM = YesPlease
612         NEEDS_LIBICONV = YesPlease
613         NO_STRTOUMAX = YesPlease
614         NO_MKDTEMP = YesPlease
615         NO_SVN_TESTS = YesPlease
616         RUNTIME_PREFIX = YesPlease
617         HAVE_WPGMPTR = YesWeDo
618         NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
619         USE_WIN32_IPC = YesPlease
620         USE_WIN32_MMAP = YesPlease
621         MMAP_PREVENTS_DELETE = UnfortunatelyYes
622         USE_NED_ALLOCATOR = YesPlease
623         UNRELIABLE_FSTAT = UnfortunatelyYes
624         OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
625         NO_REGEX = YesPlease
626         NO_PYTHON = YesPlease
627         ETAGS_TARGET = ETAGS
628         NO_POSIX_GOODIES = UnfortunatelyYes
629         DEFAULT_HELP_FORMAT = html
630         HAVE_PLATFORM_PROCINFO = YesPlease
631         BASIC_LDFLAGS += -municode
632         COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
633         COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
634         COMPAT_OBJS += compat/mingw.o compat/winansi.o \
635                 compat/win32/trace2_win32_process_info.o \
636                 compat/win32/path-utils.o \
637                 compat/win32/pthread.o compat/win32/syslog.o \
638                 compat/win32/dirent.o
639         BASIC_CFLAGS += -DWIN32
640         EXTLIBS += -lws2_32
641         GITLIBS += git.res
642         PTHREAD_LIBS =
643         RC = windres -O coff
644         NATIVE_CRLF = YesPlease
645         X = .exe
646 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
647         htmldir = doc/git/html/
648         prefix =
649         INSTALL = /bin/install
650         EXTLIBS += /mingw/lib/libz.a
651         INTERNAL_QSORT = YesPlease
652         HAVE_LIBCHARSET_H = YesPlease
653         NO_GETTEXT = YesPlease
654         COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
655 else
656         ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
657                 # MSys2
658                 prefix = /usr/
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
665                 ifeq (MINGW32,$(MSYSTEM))
666                         prefix = /mingw32
667                         HOST_CPU = i686
668                         BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
669                 endif
670                 ifeq (MINGW64,$(MSYSTEM))
671                         prefix = /mingw64
672                         HOST_CPU = x86_64
673                         BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
674                 else
675                         COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
676                         BASIC_LDFLAGS += -Wl,--large-address-aware
677                 endif
678                 CC = gcc
679                 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
680                         -fstack-protector-strong
681                 EXTLIBS += -lntdll
682                 INSTALL = /bin/install
683                 INTERNAL_QSORT = YesPlease
684                 HAVE_LIBCHARSET_H = YesPlease
685                 NO_GETTEXT =
686                 USE_GETTEXT_SCHEME = fallthrough
687                 USE_LIBPCRE = YesPlease
688                 NO_CURL =
689                 USE_NED_ALLOCATOR = YesPlease
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
695         else
696                 COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
697                 NO_CURL = YesPlease
698         endif
699 endif
700 endif
701 ifeq ($(uname_S),QNX)
702         COMPAT_CFLAGS += -DSA_RESTART=0
703         EXPAT_NEEDS_XMLPARSE_H = YesPlease
704         HAVE_STRINGS_H = YesPlease
705         NEEDS_SOCKET = YesPlease
706         NO_GETPAGESIZE = YesPlease
707         NO_ICONV = YesPlease
708         NO_MEMMEM = YesPlease
709         NO_MKDTEMP = YesPlease
710         NO_NSEC = YesPlease
711         NO_PTHREADS = YesPlease
712         NO_STRCASESTR = YesPlease
713         NO_STRLCPY = YesPlease
714 endif
716 vcxproj:
717         # Require clean work tree
718         git update-index -q --refresh && \
719         git diff-files --quiet && \
720         git diff-index --cached --quiet HEAD --
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
727         # Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
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 && \
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">' && \
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>' && \
743          echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
744         git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets
746         # Add generated headers
747         $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
748         git add -f $(GENERATED_H)
750         # Add scripts
751         rm -f perl/perl.mak
752         $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
753         # Strip out the sane tool path, needed only for building
754         sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
755         git add -f $(SCRIPT_LIB) $(SCRIPTS)
757         # Add Perl module
758         $(MAKE) $(LIB_PERL_GEN)
759         git add -f perl/build
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
781         # Add templates
782         $(MAKE) -C templates
783         git add -f templates/boilerplates.made templates/blt/
785         # Add the translated messages
786         make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
787         git add -f $(MOFILES)
789         # Add build options
790         $(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
791         git add -f GIT-BUILD-OPTIONS
793         # Commit the whole shebang
794         git commit -m "Generate Visual Studio solution" \
795                 -m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"