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