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