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