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