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