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