1 # Platform specific Makefile tweaks based on uname detection
3 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
4 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
5 uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
6 uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
7 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
8 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
11 # avoid the MingW and Cygwin configuration sections
16 # We choose to avoid "if .. else if .. else .. endif endif"
17 # because maintaining the nesting to match is a pain. If
18 # we had "elif" things would have been much nicer...
20 ifeq ($(uname_M),x86_64)
21 XDL_FAST_HASH = YesPlease
23 ifeq ($(uname_S),OSF1)
24 # Need this for u_short definitions et al
25 BASIC_CFLAGS += -D_OSF_SOURCE
27 NO_STRTOULL = YesPlease
30 ifeq ($(uname_S),Linux)
31 HAVE_ALLOCA_H = YesPlease
32 NO_STRLCPY = YesPlease
33 NO_MKSTEMPS = YesPlease
34 HAVE_PATHS_H = YesPlease
35 LIBC_CONTAINS_LIBINTL = YesPlease
36 HAVE_DEV_TTY = YesPlease
37 HAVE_CLOCK_GETTIME = YesPlease
38 HAVE_CLOCK_MONOTONIC = YesPlease
39 HAVE_GETDELIM = YesPlease
41 ifeq ($(uname_S),GNU/kFreeBSD)
42 HAVE_ALLOCA_H = YesPlease
43 NO_STRLCPY = YesPlease
44 NO_MKSTEMPS = YesPlease
45 HAVE_PATHS_H = YesPlease
46 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
47 LIBC_CONTAINS_LIBINTL = YesPlease
49 ifeq ($(uname_S),UnixWare)
51 NEEDS_SOCKET = YesPlease
53 NEEDS_SSL_WITH_CRYPTO = YesPlease
54 NEEDS_LIBICONV = YesPlease
55 SHELL_PATH = /usr/local/bin/bash
57 NO_HSTRERROR = YesPlease
58 NO_MKSTEMPS = YesPlease
59 BASIC_CFLAGS += -Kthread
60 BASIC_CFLAGS += -I/usr/local/include
61 BASIC_LDFLAGS += -L/usr/local/lib
64 NO_STRCASESTR = YesPlease
67 ifeq ($(uname_S),SCO_SV)
73 BASIC_CFLAGS += -Kthread
75 NEEDS_SOCKET = YesPlease
77 NEEDS_SSL_WITH_CRYPTO = YesPlease
78 NEEDS_LIBICONV = YesPlease
79 SHELL_PATH = /usr/bin/bash
81 NO_HSTRERROR = YesPlease
82 NO_MKSTEMPS = YesPlease
83 BASIC_CFLAGS += -I/usr/local/include
84 BASIC_LDFLAGS += -L/usr/local/lib
85 NO_STRCASESTR = YesPlease
90 ifeq ($(uname_S),Darwin)
91 NEEDS_CRYPTO_WITH_SSL = YesPlease
92 NEEDS_SSL_WITH_CRYPTO = YesPlease
93 NEEDS_LIBICONV = YesPlease
94 # Note: $(uname_R) gives us the underlying Darwin version.
95 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
96 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
97 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
98 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
99 OLD_ICONV = UnfortunatelyYes
100 NO_APPLE_COMMON_CRYPTO = YesPlease
102 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
103 NO_STRLCPY = YesPlease
105 NO_MEMMEM = YesPlease
106 USE_ST_TIMESPEC = YesPlease
107 HAVE_DEV_TTY = YesPlease
108 COMPAT_OBJS += compat/precompose_utf8.o
109 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
110 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
111 HAVE_BSD_SYSCTL = YesPlease
113 ifeq ($(uname_S),SunOS)
114 NEEDS_SOCKET = YesPlease
115 NEEDS_NSL = YesPlease
116 SHELL_PATH = /bin/bash
117 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
118 HAVE_ALLOCA_H = YesPlease
119 NO_STRCASESTR = YesPlease
120 NO_MEMMEM = YesPlease
121 NO_MKDTEMP = YesPlease
122 NO_MKSTEMPS = YesPlease
124 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
125 HAVE_DEV_TTY = YesPlease
126 ifeq ($(uname_R),5.6)
128 NO_HSTRERROR = YesPlease
130 NO_SOCKADDR_STORAGE = YesPlease
131 NO_UNSETENV = YesPlease
132 NO_SETENV = YesPlease
133 NO_STRLCPY = YesPlease
134 NO_STRTOUMAX = YesPlease
137 ifeq ($(uname_R),5.7)
138 NEEDS_RESOLV = YesPlease
140 NO_SOCKADDR_STORAGE = YesPlease
141 NO_UNSETENV = YesPlease
142 NO_SETENV = YesPlease
143 NO_STRLCPY = YesPlease
144 NO_STRTOUMAX = YesPlease
147 ifeq ($(uname_R),5.8)
148 NO_UNSETENV = YesPlease
149 NO_SETENV = YesPlease
150 NO_STRTOUMAX = YesPlease
153 ifeq ($(uname_R),5.9)
154 NO_UNSETENV = YesPlease
155 NO_SETENV = YesPlease
156 NO_STRTOUMAX = YesPlease
159 INSTALL = /usr/ucb/install
161 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
163 ifeq ($(uname_O),Cygwin)
164 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
165 NO_D_TYPE_IN_DIRENT = YesPlease
166 NO_D_INO_IN_DIRENT = YesPlease
167 NO_STRCASESTR = YesPlease
168 NO_MEMMEM = YesPlease
169 NO_MKSTEMPS = YesPlease
170 NO_SYMLINK_HEAD = YesPlease
172 OLD_ICONV = UnfortunatelyYes
173 # There are conflicting reports about this.
174 # On some boxes NO_MMAP is needed, and not so elsewhere.
175 # Try commenting this out if you suspect MMAP is more efficient
178 NO_REGEX = UnfortunatelyYes
180 HAVE_ALLOCA_H = YesPlease
181 NEEDS_LIBICONV = YesPlease
182 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
183 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
185 UNRELIABLE_FSTAT = UnfortunatelyYes
186 SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
188 ifeq ($(uname_S),FreeBSD)
189 NEEDS_LIBICONV = YesPlease
190 OLD_ICONV = YesPlease
191 NO_MEMMEM = YesPlease
192 BASIC_CFLAGS += -I/usr/local/include
193 BASIC_LDFLAGS += -L/usr/local/lib
194 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
195 USE_ST_TIMESPEC = YesPlease
196 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
197 PTHREAD_LIBS = -pthread
198 NO_UINTMAX_T = YesPlease
199 NO_STRTOUMAX = YesPlease
201 PYTHON_PATH = /usr/local/bin/python
202 HAVE_PATHS_H = YesPlease
203 GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
204 HAVE_BSD_SYSCTL = YesPlease
206 ifeq ($(uname_S),OpenBSD)
207 NO_STRCASESTR = YesPlease
208 NO_MEMMEM = YesPlease
209 USE_ST_TIMESPEC = YesPlease
210 NEEDS_LIBICONV = YesPlease
211 BASIC_CFLAGS += -I/usr/local/include
212 BASIC_LDFLAGS += -L/usr/local/lib
213 HAVE_PATHS_H = YesPlease
214 HAVE_BSD_SYSCTL = YesPlease
216 ifeq ($(uname_S),MirBSD)
217 NO_STRCASESTR = YesPlease
218 NO_MEMMEM = YesPlease
219 USE_ST_TIMESPEC = YesPlease
220 NEEDS_LIBICONV = YesPlease
221 HAVE_PATHS_H = YesPlease
222 HAVE_BSD_SYSCTL = YesPlease
224 ifeq ($(uname_S),NetBSD)
225 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
226 NEEDS_LIBICONV = YesPlease
228 BASIC_CFLAGS += -I/usr/pkg/include
229 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
230 USE_ST_TIMESPEC = YesPlease
231 NO_MKSTEMPS = YesPlease
232 HAVE_PATHS_H = YesPlease
233 HAVE_BSD_SYSCTL = YesPlease
235 ifeq ($(uname_S),AIX)
237 NO_STRCASESTR = YesPlease
238 NO_MEMMEM = YesPlease
239 NO_MKDTEMP = YesPlease
240 NO_MKSTEMPS = YesPlease
241 NO_STRLCPY = YesPlease
243 FREAD_READS_DIRECTORIES = UnfortunatelyYes
244 INTERNAL_QSORT = UnfortunatelyYes
245 NEEDS_LIBICONV = YesPlease
246 BASIC_CFLAGS += -D_LARGE_FILES
247 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
248 NO_PTHREADS = YesPlease
250 PTHREAD_LIBS = -lpthread
252 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
257 ifeq ($(uname_S),GNU)
259 HAVE_ALLOCA_H = YesPlease
260 NO_STRLCPY = YesPlease
261 NO_MKSTEMPS = YesPlease
262 HAVE_PATHS_H = YesPlease
263 LIBC_CONTAINS_LIBINTL = YesPlease
265 ifeq ($(uname_S),IRIX)
266 NO_SETENV = YesPlease
267 NO_UNSETENV = YesPlease
268 NO_STRCASESTR = YesPlease
269 NO_MEMMEM = YesPlease
270 NO_MKSTEMPS = YesPlease
271 NO_MKDTEMP = YesPlease
272 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
273 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
274 # git dies with a segmentation fault when trying to access the first
275 # entry of a reflog. The conservative choice is made to always set
276 # NO_MMAP. If you suspect that your compiler is not affected by this
277 # issue, comment out the NO_MMAP statement.
280 SNPRINTF_RETURNS_BOGUS = YesPlease
281 SHELL_PATH = /usr/gnu/bin/bash
282 NEEDS_LIBGEN = YesPlease
284 ifeq ($(uname_S),IRIX64)
285 NO_SETENV = YesPlease
286 NO_UNSETENV = YesPlease
287 NO_STRCASESTR = YesPlease
288 NO_MEMMEM = YesPlease
289 NO_MKSTEMPS = YesPlease
290 NO_MKDTEMP = YesPlease
291 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
292 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
293 # git dies with a segmentation fault when trying to access the first
294 # entry of a reflog. The conservative choice is made to always set
295 # NO_MMAP. If you suspect that your compiler is not affected by this
296 # issue, comment out the NO_MMAP statement.
299 SNPRINTF_RETURNS_BOGUS = YesPlease
300 SHELL_PATH = /usr/gnu/bin/bash
301 NEEDS_LIBGEN = YesPlease
303 ifeq ($(uname_S),HP-UX)
306 NO_SETENV = YesPlease
307 NO_STRCASESTR = YesPlease
308 NO_MEMMEM = YesPlease
309 NO_MKSTEMPS = YesPlease
310 NO_STRLCPY = YesPlease
311 NO_MKDTEMP = YesPlease
312 NO_UNSETENV = YesPlease
313 NO_HSTRERROR = YesPlease
314 NO_SYS_SELECT_H = YesPlease
315 SNPRINTF_RETURNS_BOGUS = YesPlease
317 ifeq ($(uname_R),B.11.00)
318 NO_INET_NTOP = YesPlease
319 NO_INET_PTON = YesPlease
321 ifeq ($(uname_R),B.10.20)
322 # Override HP-UX 11.x setting:
326 NO_INET_NTOP = YesPlease
327 NO_INET_PTON = YesPlease
331 ifeq ($(uname_S),Windows)
332 GIT_VERSION := $(GIT_VERSION).MSVC
334 HAVE_ALLOCA_H = YesPlease
336 NEEDS_CRYPTO_WITH_SSL = YesPlease
337 NO_LIBGEN_H = YesPlease
339 NO_SYMLINK_HEAD = YesPlease
341 NO_UNIX_SOCKETS = YesPlease
342 NO_SETENV = YesPlease
343 NO_STRCASESTR = YesPlease
344 NO_STRLCPY = YesPlease
345 NO_MEMMEM = YesPlease
346 # NEEDS_LIBICONV = YesPlease
348 NO_STRTOUMAX = YesPlease
349 NO_MKDTEMP = YesPlease
350 NO_MKSTEMPS = YesPlease
351 SNPRINTF_RETURNS_BOGUS = YesPlease
352 NO_SVN_TESTS = YesPlease
353 RUNTIME_PREFIX = YesPlease
354 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
356 USE_WIN32_MMAP = YesPlease
357 # USE_NED_ALLOCATOR = YesPlease
358 UNRELIABLE_FSTAT = UnfortunatelyYes
359 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
361 NO_GETTEXT = YesPlease
362 NO_PYTHON = YesPlease
365 NO_INET_PTON = YesPlease
366 NO_INET_NTOP = YesPlease
367 NO_POSIX_GOODIES = UnfortunatelyYes
368 NATIVE_CRLF = YesPlease
369 DEFAULT_HELP_FORMAT = html
370 NO_D_INO_IN_DIRENT = YesPlease
372 CC = compat/vcbuild/scripts/clink.pl
373 AR = compat/vcbuild/scripts/lib.pl
375 BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
376 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
377 compat/win32/pthread.o compat/win32/syslog.o \
378 compat/win32/dirent.o
379 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
380 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
381 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
384 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
386 BASIC_CFLAGS += -GL -Os -MD
387 BASIC_LDFLAGS += -LTCG
390 BASIC_CFLAGS += -Zi -MDd
394 ifeq ($(uname_S),Interix)
395 NO_INITGROUPS = YesPlease
397 NO_MEMMEM = YesPlease
398 NO_MKDTEMP = YesPlease
399 NO_STRTOUMAX = YesPlease
401 NO_MKSTEMPS = YesPlease
402 ifeq ($(uname_R),3.5)
403 NO_INET_NTOP = YesPlease
404 NO_INET_PTON = YesPlease
405 NO_SOCKADDR_STORAGE = YesPlease
407 ifeq ($(uname_R),5.2)
408 NO_INET_NTOP = YesPlease
409 NO_INET_PTON = YesPlease
410 NO_SOCKADDR_STORAGE = YesPlease
413 ifeq ($(uname_S),Minix)
415 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
418 NEEDS_CRYPTO_WITH_SSL = YesPlease
419 NEEDS_IDN_WITH_CURL = YesPlease
420 NEEDS_SSL_WITH_CURL = YesPlease
422 NO_HSTRERROR = YesPlease
427 ifeq ($(uname_S),NONSTOP_KERNEL)
428 # Needs some C99 features, "inline" is just one of them.
429 # INLINE='' would just replace one set of warnings with another and
430 # still not compile in c89 mode, due to non-const array initializations.
432 # Disable all optimization, seems to result in bad code, with -O or -O2
433 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
434 # abends on "git push". Needs more investigation.
436 # We'd want it to be here.
438 # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
439 PERL_PATH = ${prefix}/bin/perl
440 PYTHON_PATH = ${prefix}/bin/python
442 # As detected by './configure'.
443 # Missdetected, hence commented out, see below.
445 # Added manually, see above.
446 NEEDS_SSL_WITH_CURL = YesPlease
447 HAVE_LIBCHARSET_H = YesPlease
448 HAVE_STRINGS_H = YesPlease
449 NEEDS_LIBICONV = YesPlease
450 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
451 NO_SYS_SELECT_H = UnfortunatelyYes
452 NO_D_TYPE_IN_DIRENT = YesPlease
453 NO_HSTRERROR = YesPlease
454 NO_STRCASESTR = YesPlease
455 NO_MEMMEM = YesPlease
456 NO_STRLCPY = YesPlease
457 NO_SETENV = YesPlease
458 NO_UNSETENV = YesPlease
459 NO_MKDTEMP = YesPlease
460 NO_MKSTEMPS = YesPlease
461 # Currently libiconv-1.9.1.
462 OLD_ICONV = UnfortunatelyYes
464 NO_PTHREADS = UnfortunatelyYes
466 # Not detected (nor checked for) by './configure'.
467 # We don't have SA_RESTART on NonStop, unfortunalety.
468 COMPAT_CFLAGS += -DSA_RESTART=0
469 # Apparently needed in compat/fnmatch/fnmatch.c.
470 COMPAT_CFLAGS += -DHAVE_STRING_H=1
471 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
476 NO_INTPTR_T = UnfortunatelyYes
477 # Bug report 10-120822-4477 submitted to HP NonStop development.
478 MKDIR_WO_TRAILING_SLASH = YesPlease
479 # RFE 10-120912-4693 submitted to HP NonStop development.
480 NO_SETITIMER = UnfortunatelyYes
481 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
482 SHELL_PATH = /usr/local/bin/bash
483 # as of H06.25/J06.14, we might better use this
484 #SHELL_PATH = /usr/coreutils/bin/bash
486 ifneq (,$(findstring MINGW,$(uname_S)))
488 HAVE_ALLOCA_H = YesPlease
490 NEEDS_CRYPTO_WITH_SSL = YesPlease
491 NO_LIBGEN_H = YesPlease
493 NO_SYMLINK_HEAD = YesPlease
494 NO_UNIX_SOCKETS = YesPlease
495 NO_SETENV = YesPlease
496 NO_STRCASESTR = YesPlease
497 NO_STRLCPY = YesPlease
498 NO_MEMMEM = YesPlease
499 NEEDS_LIBICONV = YesPlease
500 NO_STRTOUMAX = YesPlease
501 NO_MKDTEMP = YesPlease
502 NO_MKSTEMPS = YesPlease
503 NO_SVN_TESTS = YesPlease
504 NO_PERL_MAKEMAKER = YesPlease
505 RUNTIME_PREFIX = YesPlease
506 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
508 USE_WIN32_MMAP = YesPlease
509 USE_NED_ALLOCATOR = YesPlease
510 UNRELIABLE_FSTAT = UnfortunatelyYes
511 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
513 NO_PYTHON = YesPlease
516 NO_INET_PTON = YesPlease
517 NO_INET_NTOP = YesPlease
518 NO_POSIX_GOODIES = UnfortunatelyYes
519 DEFAULT_HELP_FORMAT = html
520 NO_D_INO_IN_DIRENT = YesPlease
521 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
522 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
523 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
524 compat/win32/pthread.o compat/win32/syslog.o \
525 compat/win32/dirent.o
526 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
527 BASIC_LDFLAGS += -Wl,--large-address-aware
532 NATIVE_CRLF = YesPlease
534 SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
535 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
536 htmldir = doc/git/html/
538 INSTALL = /bin/install
539 EXTLIBS += /mingw/lib/libz.a
540 NO_R_TO_GCC_LINKER = YesPlease
541 INTERNAL_QSORT = YesPlease
542 HAVE_LIBCHARSET_H = YesPlease
543 NO_GETTEXT = YesPlease
548 ifeq ($(uname_S),QNX)
549 COMPAT_CFLAGS += -DSA_RESTART=0
550 EXPAT_NEEDS_XMLPARSE_H = YesPlease
551 HAVE_STRINGS_H = YesPlease
552 NEEDS_SOCKET = YesPlease
553 NO_GETPAGESIZE = YesPlease
555 NO_MEMMEM = YesPlease
556 NO_MKDTEMP = YesPlease
557 NO_MKSTEMPS = YesPlease
559 NO_PTHREADS = YesPlease
560 NO_R_TO_GCC_LINKER = YesPlease
561 NO_STRCASESTR = YesPlease
562 NO_STRLCPY = YesPlease