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
39 ifeq ($(uname_S),GNU/kFreeBSD)
40 HAVE_ALLOCA_H = YesPlease
41 NO_STRLCPY = YesPlease
42 NO_MKSTEMPS = YesPlease
43 HAVE_PATHS_H = YesPlease
44 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
45 LIBC_CONTAINS_LIBINTL = YesPlease
47 ifeq ($(uname_S),UnixWare)
49 NEEDS_SOCKET = YesPlease
51 NEEDS_SSL_WITH_CRYPTO = YesPlease
52 NEEDS_LIBICONV = YesPlease
53 SHELL_PATH = /usr/local/bin/bash
55 NO_HSTRERROR = YesPlease
56 NO_MKSTEMPS = YesPlease
57 BASIC_CFLAGS += -Kthread
58 BASIC_CFLAGS += -I/usr/local/include
59 BASIC_LDFLAGS += -L/usr/local/lib
62 NO_STRCASESTR = YesPlease
65 ifeq ($(uname_S),SCO_SV)
71 BASIC_CFLAGS += -Kthread
73 NEEDS_SOCKET = YesPlease
75 NEEDS_SSL_WITH_CRYPTO = YesPlease
76 NEEDS_LIBICONV = YesPlease
77 SHELL_PATH = /usr/bin/bash
79 NO_HSTRERROR = YesPlease
80 NO_MKSTEMPS = YesPlease
81 BASIC_CFLAGS += -I/usr/local/include
82 BASIC_LDFLAGS += -L/usr/local/lib
83 NO_STRCASESTR = YesPlease
88 ifeq ($(uname_S),Darwin)
89 NEEDS_CRYPTO_WITH_SSL = YesPlease
90 NEEDS_SSL_WITH_CRYPTO = YesPlease
91 NEEDS_LIBICONV = YesPlease
92 # Note: $(uname_R) gives us the underlying Darwin version.
93 # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
94 # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
95 # i.e. "begins with [15678] and a dot" means "10.4.* or older".
96 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
97 OLD_ICONV = UnfortunatelyYes
98 NO_APPLE_COMMON_CRYPTO = YesPlease
100 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
101 NO_STRLCPY = YesPlease
103 NO_MEMMEM = YesPlease
104 USE_ST_TIMESPEC = YesPlease
105 HAVE_DEV_TTY = YesPlease
106 COMPAT_OBJS += compat/precompose_utf8.o
107 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
108 BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
110 ifeq ($(uname_S),SunOS)
111 NEEDS_SOCKET = YesPlease
112 NEEDS_NSL = YesPlease
113 SHELL_PATH = /bin/bash
114 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
115 HAVE_ALLOCA_H = YesPlease
116 NO_STRCASESTR = YesPlease
117 NO_MEMMEM = YesPlease
118 NO_MKDTEMP = YesPlease
119 NO_MKSTEMPS = YesPlease
121 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
122 HAVE_DEV_TTY = YesPlease
123 ifeq ($(uname_R),5.6)
125 NO_HSTRERROR = YesPlease
127 NO_SOCKADDR_STORAGE = YesPlease
128 NO_UNSETENV = YesPlease
129 NO_SETENV = YesPlease
130 NO_STRLCPY = YesPlease
131 NO_STRTOUMAX = YesPlease
134 ifeq ($(uname_R),5.7)
135 NEEDS_RESOLV = YesPlease
137 NO_SOCKADDR_STORAGE = YesPlease
138 NO_UNSETENV = YesPlease
139 NO_SETENV = YesPlease
140 NO_STRLCPY = YesPlease
141 NO_STRTOUMAX = YesPlease
144 ifeq ($(uname_R),5.8)
145 NO_UNSETENV = YesPlease
146 NO_SETENV = YesPlease
147 NO_STRTOUMAX = YesPlease
150 ifeq ($(uname_R),5.9)
151 NO_UNSETENV = YesPlease
152 NO_SETENV = YesPlease
153 NO_STRTOUMAX = YesPlease
156 INSTALL = /usr/ucb/install
158 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
160 ifeq ($(uname_O),Cygwin)
161 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
162 NO_D_TYPE_IN_DIRENT = YesPlease
163 NO_D_INO_IN_DIRENT = YesPlease
164 NO_STRCASESTR = YesPlease
165 NO_MEMMEM = YesPlease
166 NO_MKSTEMPS = YesPlease
167 NO_SYMLINK_HEAD = YesPlease
169 OLD_ICONV = UnfortunatelyYes
170 # There are conflicting reports about this.
171 # On some boxes NO_MMAP is needed, and not so elsewhere.
172 # Try commenting this out if you suspect MMAP is more efficient
175 NO_REGEX = UnfortunatelyYes
177 HAVE_ALLOCA_H = YesPlease
178 NEEDS_LIBICONV = YesPlease
179 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
180 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
182 UNRELIABLE_FSTAT = UnfortunatelyYes
183 SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
185 ifeq ($(uname_S),FreeBSD)
186 NEEDS_LIBICONV = YesPlease
187 OLD_ICONV = YesPlease
188 NO_MEMMEM = YesPlease
189 BASIC_CFLAGS += -I/usr/local/include
190 BASIC_LDFLAGS += -L/usr/local/lib
191 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
192 USE_ST_TIMESPEC = YesPlease
193 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
194 PTHREAD_LIBS = -pthread
195 NO_UINTMAX_T = YesPlease
196 NO_STRTOUMAX = YesPlease
198 PYTHON_PATH = /usr/local/bin/python
199 HAVE_PATHS_H = YesPlease
200 GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
202 ifeq ($(uname_S),OpenBSD)
203 NO_STRCASESTR = YesPlease
204 NO_MEMMEM = YesPlease
205 USE_ST_TIMESPEC = YesPlease
206 NEEDS_LIBICONV = YesPlease
207 BASIC_CFLAGS += -I/usr/local/include
208 BASIC_LDFLAGS += -L/usr/local/lib
209 HAVE_PATHS_H = YesPlease
211 ifeq ($(uname_S),MirBSD)
212 NO_STRCASESTR = YesPlease
213 NO_MEMMEM = YesPlease
214 USE_ST_TIMESPEC = YesPlease
215 NEEDS_LIBICONV = YesPlease
216 HAVE_PATHS_H = YesPlease
218 ifeq ($(uname_S),NetBSD)
219 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
220 NEEDS_LIBICONV = YesPlease
222 BASIC_CFLAGS += -I/usr/pkg/include
223 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
224 USE_ST_TIMESPEC = YesPlease
225 NO_MKSTEMPS = YesPlease
226 HAVE_PATHS_H = YesPlease
228 ifeq ($(uname_S),AIX)
230 NO_STRCASESTR = YesPlease
231 NO_MEMMEM = YesPlease
232 NO_MKDTEMP = YesPlease
233 NO_MKSTEMPS = YesPlease
234 NO_STRLCPY = YesPlease
236 FREAD_READS_DIRECTORIES = UnfortunatelyYes
237 INTERNAL_QSORT = UnfortunatelyYes
238 NEEDS_LIBICONV = YesPlease
239 BASIC_CFLAGS += -D_LARGE_FILES
240 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
241 NO_PTHREADS = YesPlease
243 PTHREAD_LIBS = -lpthread
245 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
250 ifeq ($(uname_S),GNU)
252 HAVE_ALLOCA_H = YesPlease
253 NO_STRLCPY = YesPlease
254 NO_MKSTEMPS = YesPlease
255 HAVE_PATHS_H = YesPlease
256 LIBC_CONTAINS_LIBINTL = YesPlease
258 ifeq ($(uname_S),IRIX)
259 NO_SETENV = YesPlease
260 NO_UNSETENV = YesPlease
261 NO_STRCASESTR = YesPlease
262 NO_MEMMEM = YesPlease
263 NO_MKSTEMPS = YesPlease
264 NO_MKDTEMP = YesPlease
265 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
266 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
267 # git dies with a segmentation fault when trying to access the first
268 # entry of a reflog. The conservative choice is made to always set
269 # NO_MMAP. If you suspect that your compiler is not affected by this
270 # issue, comment out the NO_MMAP statement.
273 SNPRINTF_RETURNS_BOGUS = YesPlease
274 SHELL_PATH = /usr/gnu/bin/bash
275 NEEDS_LIBGEN = YesPlease
277 ifeq ($(uname_S),IRIX64)
278 NO_SETENV = YesPlease
279 NO_UNSETENV = YesPlease
280 NO_STRCASESTR = YesPlease
281 NO_MEMMEM = YesPlease
282 NO_MKSTEMPS = YesPlease
283 NO_MKDTEMP = YesPlease
284 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
285 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
286 # git dies with a segmentation fault when trying to access the first
287 # entry of a reflog. The conservative choice is made to always set
288 # NO_MMAP. If you suspect that your compiler is not affected by this
289 # issue, comment out the NO_MMAP statement.
292 SNPRINTF_RETURNS_BOGUS = YesPlease
293 SHELL_PATH = /usr/gnu/bin/bash
294 NEEDS_LIBGEN = YesPlease
296 ifeq ($(uname_S),HP-UX)
299 NO_SETENV = YesPlease
300 NO_STRCASESTR = YesPlease
301 NO_MEMMEM = YesPlease
302 NO_MKSTEMPS = YesPlease
303 NO_STRLCPY = YesPlease
304 NO_MKDTEMP = YesPlease
305 NO_UNSETENV = YesPlease
306 NO_HSTRERROR = YesPlease
307 NO_SYS_SELECT_H = YesPlease
308 SNPRINTF_RETURNS_BOGUS = YesPlease
310 ifeq ($(uname_R),B.11.00)
311 NO_INET_NTOP = YesPlease
312 NO_INET_PTON = YesPlease
314 ifeq ($(uname_R),B.10.20)
315 # Override HP-UX 11.x setting:
319 NO_INET_NTOP = YesPlease
320 NO_INET_PTON = YesPlease
324 ifeq ($(uname_S),Windows)
325 GIT_VERSION := $(GIT_VERSION).MSVC
327 HAVE_ALLOCA_H = YesPlease
329 NEEDS_CRYPTO_WITH_SSL = YesPlease
330 NO_LIBGEN_H = YesPlease
332 NO_SYMLINK_HEAD = YesPlease
334 NO_UNIX_SOCKETS = YesPlease
335 NO_SETENV = YesPlease
336 NO_STRCASESTR = YesPlease
337 NO_STRLCPY = YesPlease
338 NO_MEMMEM = YesPlease
339 # NEEDS_LIBICONV = YesPlease
341 NO_STRTOUMAX = YesPlease
342 NO_MKDTEMP = YesPlease
343 NO_MKSTEMPS = YesPlease
344 SNPRINTF_RETURNS_BOGUS = YesPlease
345 NO_SVN_TESTS = YesPlease
346 RUNTIME_PREFIX = YesPlease
347 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
349 USE_WIN32_MMAP = YesPlease
350 # USE_NED_ALLOCATOR = YesPlease
351 UNRELIABLE_FSTAT = UnfortunatelyYes
352 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
354 NO_GETTEXT = YesPlease
355 NO_PYTHON = YesPlease
358 NO_INET_PTON = YesPlease
359 NO_INET_NTOP = YesPlease
360 NO_POSIX_GOODIES = UnfortunatelyYes
361 NATIVE_CRLF = YesPlease
362 DEFAULT_HELP_FORMAT = html
363 NO_D_INO_IN_DIRENT = YesPlease
365 CC = compat/vcbuild/scripts/clink.pl
366 AR = compat/vcbuild/scripts/lib.pl
368 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
369 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
370 compat/win32/pthread.o compat/win32/syslog.o \
371 compat/win32/dirent.o
372 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
373 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
374 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
377 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
379 BASIC_CFLAGS += -GL -Os -MD
380 BASIC_LDFLAGS += -LTCG
383 BASIC_CFLAGS += -Zi -MDd
387 ifeq ($(uname_S),Interix)
388 NO_INITGROUPS = YesPlease
390 NO_MEMMEM = YesPlease
391 NO_MKDTEMP = YesPlease
392 NO_STRTOUMAX = YesPlease
394 NO_MKSTEMPS = YesPlease
395 ifeq ($(uname_R),3.5)
396 NO_INET_NTOP = YesPlease
397 NO_INET_PTON = YesPlease
398 NO_SOCKADDR_STORAGE = YesPlease
400 ifeq ($(uname_R),5.2)
401 NO_INET_NTOP = YesPlease
402 NO_INET_PTON = YesPlease
403 NO_SOCKADDR_STORAGE = YesPlease
406 ifeq ($(uname_S),Minix)
408 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
411 NEEDS_CRYPTO_WITH_SSL = YesPlease
412 NEEDS_IDN_WITH_CURL = YesPlease
413 NEEDS_SSL_WITH_CURL = YesPlease
415 NO_HSTRERROR = YesPlease
420 ifeq ($(uname_S),NONSTOP_KERNEL)
421 # Needs some C99 features, "inline" is just one of them.
422 # INLINE='' would just replace one set of warnings with another and
423 # still not compile in c89 mode, due to non-const array initializations.
425 # Disable all optimization, seems to result in bad code, with -O or -O2
426 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
427 # abends on "git push". Needs more investigation.
429 # We'd want it to be here.
431 # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
432 PERL_PATH = ${prefix}/bin/perl
433 PYTHON_PATH = ${prefix}/bin/python
435 # As detected by './configure'.
436 # Missdetected, hence commented out, see below.
438 # Added manually, see above.
439 NEEDS_SSL_WITH_CURL = YesPlease
440 HAVE_LIBCHARSET_H = YesPlease
441 HAVE_STRINGS_H = YesPlease
442 NEEDS_LIBICONV = YesPlease
443 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
444 NO_SYS_SELECT_H = UnfortunatelyYes
445 NO_D_TYPE_IN_DIRENT = YesPlease
446 NO_HSTRERROR = YesPlease
447 NO_STRCASESTR = YesPlease
448 NO_MEMMEM = YesPlease
449 NO_STRLCPY = YesPlease
450 NO_SETENV = YesPlease
451 NO_UNSETENV = YesPlease
452 NO_MKDTEMP = YesPlease
453 NO_MKSTEMPS = YesPlease
454 # Currently libiconv-1.9.1.
455 OLD_ICONV = UnfortunatelyYes
457 NO_PTHREADS = UnfortunatelyYes
459 # Not detected (nor checked for) by './configure'.
460 # We don't have SA_RESTART on NonStop, unfortunalety.
461 COMPAT_CFLAGS += -DSA_RESTART=0
462 # Apparently needed in compat/fnmatch/fnmatch.c.
463 COMPAT_CFLAGS += -DHAVE_STRING_H=1
464 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
469 NO_INTPTR_T = UnfortunatelyYes
470 # Bug report 10-120822-4477 submitted to HP NonStop development.
471 MKDIR_WO_TRAILING_SLASH = YesPlease
472 # RFE 10-120912-4693 submitted to HP NonStop development.
473 NO_SETITIMER = UnfortunatelyYes
474 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
475 SHELL_PATH = /usr/local/bin/bash
476 # as of H06.25/J06.14, we might better use this
477 #SHELL_PATH = /usr/coreutils/bin/bash
479 ifneq (,$(findstring MINGW,$(uname_S)))
481 HAVE_ALLOCA_H = YesPlease
483 NEEDS_CRYPTO_WITH_SSL = YesPlease
484 NO_LIBGEN_H = YesPlease
486 NO_SYMLINK_HEAD = YesPlease
487 NO_UNIX_SOCKETS = YesPlease
488 NO_SETENV = YesPlease
489 NO_STRCASESTR = YesPlease
490 NO_STRLCPY = YesPlease
491 NO_MEMMEM = YesPlease
492 NEEDS_LIBICONV = YesPlease
493 NO_STRTOUMAX = YesPlease
494 NO_MKDTEMP = YesPlease
495 NO_MKSTEMPS = YesPlease
496 NO_SVN_TESTS = YesPlease
497 NO_PERL_MAKEMAKER = YesPlease
498 RUNTIME_PREFIX = YesPlease
499 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
501 USE_WIN32_MMAP = YesPlease
502 USE_NED_ALLOCATOR = YesPlease
503 UNRELIABLE_FSTAT = UnfortunatelyYes
504 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
506 NO_PYTHON = YesPlease
509 NO_INET_PTON = YesPlease
510 NO_INET_NTOP = YesPlease
511 NO_POSIX_GOODIES = UnfortunatelyYes
512 DEFAULT_HELP_FORMAT = html
513 NO_D_INO_IN_DIRENT = YesPlease
514 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
515 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
516 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
517 compat/win32/pthread.o compat/win32/syslog.o \
518 compat/win32/dirent.o
519 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
520 BASIC_LDFLAGS += -Wl,--large-address-aware
525 NATIVE_CRLF = YesPlease
527 SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
528 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
529 htmldir = doc/git/html/
531 INSTALL = /bin/install
532 EXTLIBS += /mingw/lib/libz.a
533 NO_R_TO_GCC_LINKER = YesPlease
534 INTERNAL_QSORT = YesPlease
535 HAVE_LIBCHARSET_H = YesPlease
536 NO_GETTEXT = YesPlease
541 ifeq ($(uname_S),QNX)
542 COMPAT_CFLAGS += -DSA_RESTART=0
543 EXPAT_NEEDS_XMLPARSE_H = YesPlease
544 HAVE_STRINGS_H = YesPlease
545 NEEDS_SOCKET = YesPlease
546 NO_GETPAGESIZE = YesPlease
548 NO_MEMMEM = YesPlease
549 NO_MKDTEMP = YesPlease
550 NO_MKSTEMPS = YesPlease
552 NO_PTHREADS = YesPlease
553 NO_R_TO_GCC_LINKER = YesPlease
554 NO_STRCASESTR = YesPlease
555 NO_STRLCPY = YesPlease