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
40 ifeq ($(uname_S),GNU/kFreeBSD)
41 HAVE_ALLOCA_H = YesPlease
42 NO_STRLCPY = YesPlease
43 NO_MKSTEMPS = YesPlease
44 HAVE_PATHS_H = YesPlease
45 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
46 LIBC_CONTAINS_LIBINTL = YesPlease
48 ifeq ($(uname_S),UnixWare)
50 NEEDS_SOCKET = YesPlease
52 NEEDS_SSL_WITH_CRYPTO = YesPlease
53 NEEDS_LIBICONV = YesPlease
54 SHELL_PATH = /usr/local/bin/bash
56 NO_HSTRERROR = YesPlease
57 NO_MKSTEMPS = YesPlease
58 BASIC_CFLAGS += -Kthread
59 BASIC_CFLAGS += -I/usr/local/include
60 BASIC_LDFLAGS += -L/usr/local/lib
63 NO_STRCASESTR = YesPlease
66 ifeq ($(uname_S),SCO_SV)
72 BASIC_CFLAGS += -Kthread
74 NEEDS_SOCKET = YesPlease
76 NEEDS_SSL_WITH_CRYPTO = YesPlease
77 NEEDS_LIBICONV = YesPlease
78 SHELL_PATH = /usr/bin/bash
80 NO_HSTRERROR = YesPlease
81 NO_MKSTEMPS = YesPlease
82 BASIC_CFLAGS += -I/usr/local/include
83 BASIC_LDFLAGS += -L/usr/local/lib
84 NO_STRCASESTR = YesPlease
89 ifeq ($(uname_S),Darwin)
90 NEEDS_CRYPTO_WITH_SSL = YesPlease
91 NEEDS_SSL_WITH_CRYPTO = YesPlease
92 NEEDS_LIBICONV = YesPlease
93 # Note: $(uname_R) gives us the underlying Darwin version.
94 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
95 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
96 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
97 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
98 OLD_ICONV = UnfortunatelyYes
99 NO_APPLE_COMMON_CRYPTO = YesPlease
101 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
102 NO_STRLCPY = YesPlease
104 NO_MEMMEM = YesPlease
105 USE_ST_TIMESPEC = YesPlease
106 HAVE_DEV_TTY = YesPlease
107 COMPAT_OBJS += compat/precompose_utf8.o
108 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
109 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
111 ifeq ($(uname_S),SunOS)
112 NEEDS_SOCKET = YesPlease
113 NEEDS_NSL = YesPlease
114 SHELL_PATH = /bin/bash
115 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
116 HAVE_ALLOCA_H = YesPlease
117 NO_STRCASESTR = YesPlease
118 NO_MEMMEM = YesPlease
119 NO_MKDTEMP = YesPlease
120 NO_MKSTEMPS = YesPlease
122 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
123 HAVE_DEV_TTY = YesPlease
124 ifeq ($(uname_R),5.6)
126 NO_HSTRERROR = YesPlease
128 NO_SOCKADDR_STORAGE = YesPlease
129 NO_UNSETENV = YesPlease
130 NO_SETENV = YesPlease
131 NO_STRLCPY = YesPlease
132 NO_STRTOUMAX = YesPlease
135 ifeq ($(uname_R),5.7)
136 NEEDS_RESOLV = YesPlease
138 NO_SOCKADDR_STORAGE = YesPlease
139 NO_UNSETENV = YesPlease
140 NO_SETENV = YesPlease
141 NO_STRLCPY = YesPlease
142 NO_STRTOUMAX = YesPlease
145 ifeq ($(uname_R),5.8)
146 NO_UNSETENV = YesPlease
147 NO_SETENV = YesPlease
148 NO_STRTOUMAX = YesPlease
151 ifeq ($(uname_R),5.9)
152 NO_UNSETENV = YesPlease
153 NO_SETENV = YesPlease
154 NO_STRTOUMAX = YesPlease
157 INSTALL = /usr/ucb/install
159 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
161 ifeq ($(uname_O),Cygwin)
162 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
163 NO_D_TYPE_IN_DIRENT = YesPlease
164 NO_D_INO_IN_DIRENT = YesPlease
165 NO_STRCASESTR = YesPlease
166 NO_MEMMEM = YesPlease
167 NO_MKSTEMPS = YesPlease
168 NO_SYMLINK_HEAD = YesPlease
170 OLD_ICONV = UnfortunatelyYes
171 # There are conflicting reports about this.
172 # On some boxes NO_MMAP is needed, and not so elsewhere.
173 # Try commenting this out if you suspect MMAP is more efficient
176 NO_REGEX = UnfortunatelyYes
178 HAVE_ALLOCA_H = YesPlease
179 NEEDS_LIBICONV = YesPlease
180 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
181 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
183 UNRELIABLE_FSTAT = UnfortunatelyYes
184 SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
186 ifeq ($(uname_S),FreeBSD)
187 NEEDS_LIBICONV = YesPlease
188 OLD_ICONV = YesPlease
189 NO_MEMMEM = YesPlease
190 BASIC_CFLAGS += -I/usr/local/include
191 BASIC_LDFLAGS += -L/usr/local/lib
192 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
193 USE_ST_TIMESPEC = YesPlease
194 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
195 PTHREAD_LIBS = -pthread
196 NO_UINTMAX_T = YesPlease
197 NO_STRTOUMAX = YesPlease
199 PYTHON_PATH = /usr/local/bin/python
200 HAVE_PATHS_H = YesPlease
201 GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
203 ifeq ($(uname_S),OpenBSD)
204 NO_STRCASESTR = YesPlease
205 NO_MEMMEM = YesPlease
206 USE_ST_TIMESPEC = YesPlease
207 NEEDS_LIBICONV = YesPlease
208 BASIC_CFLAGS += -I/usr/local/include
209 BASIC_LDFLAGS += -L/usr/local/lib
210 HAVE_PATHS_H = YesPlease
212 ifeq ($(uname_S),MirBSD)
213 NO_STRCASESTR = YesPlease
214 NO_MEMMEM = YesPlease
215 USE_ST_TIMESPEC = YesPlease
216 NEEDS_LIBICONV = YesPlease
217 HAVE_PATHS_H = YesPlease
219 ifeq ($(uname_S),NetBSD)
220 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
221 NEEDS_LIBICONV = YesPlease
223 BASIC_CFLAGS += -I/usr/pkg/include
224 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
225 USE_ST_TIMESPEC = YesPlease
226 NO_MKSTEMPS = YesPlease
227 HAVE_PATHS_H = YesPlease
229 ifeq ($(uname_S),AIX)
231 NO_STRCASESTR = YesPlease
232 NO_MEMMEM = YesPlease
233 NO_MKDTEMP = YesPlease
234 NO_MKSTEMPS = YesPlease
235 NO_STRLCPY = YesPlease
237 FREAD_READS_DIRECTORIES = UnfortunatelyYes
238 INTERNAL_QSORT = UnfortunatelyYes
239 NEEDS_LIBICONV = YesPlease
240 BASIC_CFLAGS += -D_LARGE_FILES
241 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
242 NO_PTHREADS = YesPlease
244 PTHREAD_LIBS = -lpthread
246 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
251 ifeq ($(uname_S),GNU)
253 HAVE_ALLOCA_H = YesPlease
254 NO_STRLCPY = YesPlease
255 NO_MKSTEMPS = YesPlease
256 HAVE_PATHS_H = YesPlease
257 LIBC_CONTAINS_LIBINTL = YesPlease
259 ifeq ($(uname_S),IRIX)
260 NO_SETENV = YesPlease
261 NO_UNSETENV = YesPlease
262 NO_STRCASESTR = YesPlease
263 NO_MEMMEM = YesPlease
264 NO_MKSTEMPS = YesPlease
265 NO_MKDTEMP = YesPlease
266 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
267 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
268 # git dies with a segmentation fault when trying to access the first
269 # entry of a reflog. The conservative choice is made to always set
270 # NO_MMAP. If you suspect that your compiler is not affected by this
271 # issue, comment out the NO_MMAP statement.
274 SNPRINTF_RETURNS_BOGUS = YesPlease
275 SHELL_PATH = /usr/gnu/bin/bash
276 NEEDS_LIBGEN = YesPlease
278 ifeq ($(uname_S),IRIX64)
279 NO_SETENV = YesPlease
280 NO_UNSETENV = YesPlease
281 NO_STRCASESTR = YesPlease
282 NO_MEMMEM = YesPlease
283 NO_MKSTEMPS = YesPlease
284 NO_MKDTEMP = YesPlease
285 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
286 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
287 # git dies with a segmentation fault when trying to access the first
288 # entry of a reflog. The conservative choice is made to always set
289 # NO_MMAP. If you suspect that your compiler is not affected by this
290 # issue, comment out the NO_MMAP statement.
293 SNPRINTF_RETURNS_BOGUS = YesPlease
294 SHELL_PATH = /usr/gnu/bin/bash
295 NEEDS_LIBGEN = YesPlease
297 ifeq ($(uname_S),HP-UX)
300 NO_SETENV = YesPlease
301 NO_STRCASESTR = YesPlease
302 NO_MEMMEM = YesPlease
303 NO_MKSTEMPS = YesPlease
304 NO_STRLCPY = YesPlease
305 NO_MKDTEMP = YesPlease
306 NO_UNSETENV = YesPlease
307 NO_HSTRERROR = YesPlease
308 NO_SYS_SELECT_H = YesPlease
309 SNPRINTF_RETURNS_BOGUS = YesPlease
311 ifeq ($(uname_R),B.11.00)
312 NO_INET_NTOP = YesPlease
313 NO_INET_PTON = YesPlease
315 ifeq ($(uname_R),B.10.20)
316 # Override HP-UX 11.x setting:
320 NO_INET_NTOP = YesPlease
321 NO_INET_PTON = YesPlease
325 ifeq ($(uname_S),Windows)
326 GIT_VERSION := $(GIT_VERSION).MSVC
328 HAVE_ALLOCA_H = YesPlease
330 NEEDS_CRYPTO_WITH_SSL = YesPlease
331 NO_LIBGEN_H = YesPlease
333 NO_SYMLINK_HEAD = YesPlease
335 NO_UNIX_SOCKETS = YesPlease
336 NO_SETENV = YesPlease
337 NO_STRCASESTR = YesPlease
338 NO_STRLCPY = YesPlease
339 NO_MEMMEM = YesPlease
340 # NEEDS_LIBICONV = YesPlease
342 NO_STRTOUMAX = YesPlease
343 NO_MKDTEMP = YesPlease
344 NO_MKSTEMPS = YesPlease
345 SNPRINTF_RETURNS_BOGUS = YesPlease
346 NO_SVN_TESTS = YesPlease
347 RUNTIME_PREFIX = YesPlease
348 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
350 USE_WIN32_MMAP = YesPlease
351 # USE_NED_ALLOCATOR = YesPlease
352 UNRELIABLE_FSTAT = UnfortunatelyYes
353 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
355 NO_GETTEXT = YesPlease
356 NO_PYTHON = YesPlease
359 NO_INET_PTON = YesPlease
360 NO_INET_NTOP = YesPlease
361 NO_POSIX_GOODIES = UnfortunatelyYes
362 NATIVE_CRLF = YesPlease
363 DEFAULT_HELP_FORMAT = html
364 NO_D_INO_IN_DIRENT = YesPlease
366 CC = compat/vcbuild/scripts/clink.pl
367 AR = compat/vcbuild/scripts/lib.pl
369 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
370 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
371 compat/win32/pthread.o compat/win32/syslog.o \
372 compat/win32/dirent.o
373 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
374 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
375 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
378 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
380 BASIC_CFLAGS += -GL -Os -MD
381 BASIC_LDFLAGS += -LTCG
384 BASIC_CFLAGS += -Zi -MDd
388 ifeq ($(uname_S),Interix)
389 NO_INITGROUPS = YesPlease
391 NO_MEMMEM = YesPlease
392 NO_MKDTEMP = YesPlease
393 NO_STRTOUMAX = YesPlease
395 NO_MKSTEMPS = YesPlease
396 ifeq ($(uname_R),3.5)
397 NO_INET_NTOP = YesPlease
398 NO_INET_PTON = YesPlease
399 NO_SOCKADDR_STORAGE = YesPlease
401 ifeq ($(uname_R),5.2)
402 NO_INET_NTOP = YesPlease
403 NO_INET_PTON = YesPlease
404 NO_SOCKADDR_STORAGE = YesPlease
407 ifeq ($(uname_S),Minix)
409 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
412 NEEDS_CRYPTO_WITH_SSL = YesPlease
413 NEEDS_IDN_WITH_CURL = YesPlease
414 NEEDS_SSL_WITH_CURL = YesPlease
416 NO_HSTRERROR = YesPlease
421 ifeq ($(uname_S),NONSTOP_KERNEL)
422 # Needs some C99 features, "inline" is just one of them.
423 # INLINE='' would just replace one set of warnings with another and
424 # still not compile in c89 mode, due to non-const array initializations.
426 # Disable all optimization, seems to result in bad code, with -O or -O2
427 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
428 # abends on "git push". Needs more investigation.
430 # We'd want it to be here.
432 # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
433 PERL_PATH = ${prefix}/bin/perl
434 PYTHON_PATH = ${prefix}/bin/python
436 # As detected by './configure'.
437 # Missdetected, hence commented out, see below.
439 # Added manually, see above.
440 NEEDS_SSL_WITH_CURL = YesPlease
441 HAVE_LIBCHARSET_H = YesPlease
442 HAVE_STRINGS_H = YesPlease
443 NEEDS_LIBICONV = YesPlease
444 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
445 NO_SYS_SELECT_H = UnfortunatelyYes
446 NO_D_TYPE_IN_DIRENT = YesPlease
447 NO_HSTRERROR = YesPlease
448 NO_STRCASESTR = YesPlease
449 NO_MEMMEM = YesPlease
450 NO_STRLCPY = YesPlease
451 NO_SETENV = YesPlease
452 NO_UNSETENV = YesPlease
453 NO_MKDTEMP = YesPlease
454 NO_MKSTEMPS = YesPlease
455 # Currently libiconv-1.9.1.
456 OLD_ICONV = UnfortunatelyYes
458 NO_PTHREADS = UnfortunatelyYes
460 # Not detected (nor checked for) by './configure'.
461 # We don't have SA_RESTART on NonStop, unfortunalety.
462 COMPAT_CFLAGS += -DSA_RESTART=0
463 # Apparently needed in compat/fnmatch/fnmatch.c.
464 COMPAT_CFLAGS += -DHAVE_STRING_H=1
465 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
470 NO_INTPTR_T = UnfortunatelyYes
471 # Bug report 10-120822-4477 submitted to HP NonStop development.
472 MKDIR_WO_TRAILING_SLASH = YesPlease
473 # RFE 10-120912-4693 submitted to HP NonStop development.
474 NO_SETITIMER = UnfortunatelyYes
475 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
476 SHELL_PATH = /usr/local/bin/bash
477 # as of H06.25/J06.14, we might better use this
478 #SHELL_PATH = /usr/coreutils/bin/bash
480 ifneq (,$(findstring MINGW,$(uname_S)))
482 HAVE_ALLOCA_H = YesPlease
484 NEEDS_CRYPTO_WITH_SSL = YesPlease
485 NO_LIBGEN_H = YesPlease
487 NO_SYMLINK_HEAD = YesPlease
488 NO_UNIX_SOCKETS = YesPlease
489 NO_SETENV = YesPlease
490 NO_STRCASESTR = YesPlease
491 NO_STRLCPY = YesPlease
492 NO_MEMMEM = YesPlease
493 NEEDS_LIBICONV = YesPlease
494 NO_STRTOUMAX = YesPlease
495 NO_MKDTEMP = YesPlease
496 NO_MKSTEMPS = YesPlease
497 NO_SVN_TESTS = YesPlease
498 NO_PERL_MAKEMAKER = YesPlease
499 RUNTIME_PREFIX = YesPlease
500 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
502 USE_WIN32_MMAP = YesPlease
503 USE_NED_ALLOCATOR = YesPlease
504 UNRELIABLE_FSTAT = UnfortunatelyYes
505 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
507 NO_PYTHON = YesPlease
510 NO_INET_PTON = YesPlease
511 NO_INET_NTOP = YesPlease
512 NO_POSIX_GOODIES = UnfortunatelyYes
513 DEFAULT_HELP_FORMAT = html
514 NO_D_INO_IN_DIRENT = YesPlease
515 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
516 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
517 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
518 compat/win32/pthread.o compat/win32/syslog.o \
519 compat/win32/dirent.o
520 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
521 BASIC_LDFLAGS += -Wl,--large-address-aware
526 NATIVE_CRLF = YesPlease
528 SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
529 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
530 htmldir = doc/git/html/
532 INSTALL = /bin/install
533 EXTLIBS += /mingw/lib/libz.a
534 NO_R_TO_GCC_LINKER = YesPlease
535 INTERNAL_QSORT = YesPlease
536 HAVE_LIBCHARSET_H = YesPlease
537 NO_GETTEXT = YesPlease
542 ifeq ($(uname_S),QNX)
543 COMPAT_CFLAGS += -DSA_RESTART=0
544 EXPAT_NEEDS_XMLPARSE_H = YesPlease
545 HAVE_STRINGS_H = YesPlease
546 NEEDS_SOCKET = YesPlease
547 NO_GETPAGESIZE = YesPlease
549 NO_MEMMEM = YesPlease
550 NO_MKDTEMP = YesPlease
551 NO_MKSTEMPS = YesPlease
553 NO_PTHREADS = YesPlease
554 NO_R_TO_GCC_LINKER = YesPlease
555 NO_STRCASESTR = YesPlease
556 NO_STRLCPY = YesPlease