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
110 HAVE_BSD_SYSCTL = YesPlease
112 ifeq ($(uname_S),SunOS)
113 NEEDS_SOCKET = YesPlease
114 NEEDS_NSL = YesPlease
115 SHELL_PATH = /bin/bash
116 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
117 HAVE_ALLOCA_H = YesPlease
118 NO_STRCASESTR = YesPlease
119 NO_MEMMEM = YesPlease
120 NO_MKDTEMP = YesPlease
121 NO_MKSTEMPS = YesPlease
123 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
124 HAVE_DEV_TTY = YesPlease
125 ifeq ($(uname_R),5.6)
127 NO_HSTRERROR = YesPlease
129 NO_SOCKADDR_STORAGE = YesPlease
130 NO_UNSETENV = YesPlease
131 NO_SETENV = YesPlease
132 NO_STRLCPY = YesPlease
133 NO_STRTOUMAX = YesPlease
136 ifeq ($(uname_R),5.7)
137 NEEDS_RESOLV = YesPlease
139 NO_SOCKADDR_STORAGE = YesPlease
140 NO_UNSETENV = YesPlease
141 NO_SETENV = YesPlease
142 NO_STRLCPY = YesPlease
143 NO_STRTOUMAX = YesPlease
146 ifeq ($(uname_R),5.8)
147 NO_UNSETENV = YesPlease
148 NO_SETENV = YesPlease
149 NO_STRTOUMAX = YesPlease
152 ifeq ($(uname_R),5.9)
153 NO_UNSETENV = YesPlease
154 NO_SETENV = YesPlease
155 NO_STRTOUMAX = YesPlease
158 INSTALL = /usr/ucb/install
160 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
162 ifeq ($(uname_O),Cygwin)
163 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
164 NO_D_TYPE_IN_DIRENT = YesPlease
165 NO_D_INO_IN_DIRENT = YesPlease
166 NO_STRCASESTR = YesPlease
167 NO_MEMMEM = YesPlease
168 NO_MKSTEMPS = YesPlease
169 NO_SYMLINK_HEAD = YesPlease
171 OLD_ICONV = UnfortunatelyYes
172 # There are conflicting reports about this.
173 # On some boxes NO_MMAP is needed, and not so elsewhere.
174 # Try commenting this out if you suspect MMAP is more efficient
177 NO_REGEX = UnfortunatelyYes
179 HAVE_ALLOCA_H = YesPlease
180 NEEDS_LIBICONV = YesPlease
181 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
182 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
184 UNRELIABLE_FSTAT = UnfortunatelyYes
185 SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
187 ifeq ($(uname_S),FreeBSD)
188 NEEDS_LIBICONV = YesPlease
189 OLD_ICONV = YesPlease
190 NO_MEMMEM = YesPlease
191 BASIC_CFLAGS += -I/usr/local/include
192 BASIC_LDFLAGS += -L/usr/local/lib
193 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
194 USE_ST_TIMESPEC = YesPlease
195 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
196 PTHREAD_LIBS = -pthread
197 NO_UINTMAX_T = YesPlease
198 NO_STRTOUMAX = YesPlease
200 PYTHON_PATH = /usr/local/bin/python
201 HAVE_PATHS_H = YesPlease
202 GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
203 HAVE_BSD_SYSCTL = YesPlease
205 ifeq ($(uname_S),OpenBSD)
206 NO_STRCASESTR = YesPlease
207 NO_MEMMEM = YesPlease
208 USE_ST_TIMESPEC = YesPlease
209 NEEDS_LIBICONV = YesPlease
210 BASIC_CFLAGS += -I/usr/local/include
211 BASIC_LDFLAGS += -L/usr/local/lib
212 HAVE_PATHS_H = YesPlease
213 HAVE_BSD_SYSCTL = YesPlease
215 ifeq ($(uname_S),MirBSD)
216 NO_STRCASESTR = YesPlease
217 NO_MEMMEM = YesPlease
218 USE_ST_TIMESPEC = YesPlease
219 NEEDS_LIBICONV = YesPlease
220 HAVE_PATHS_H = YesPlease
221 HAVE_BSD_SYSCTL = YesPlease
223 ifeq ($(uname_S),NetBSD)
224 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
225 NEEDS_LIBICONV = YesPlease
227 BASIC_CFLAGS += -I/usr/pkg/include
228 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
229 USE_ST_TIMESPEC = YesPlease
230 NO_MKSTEMPS = YesPlease
231 HAVE_PATHS_H = YesPlease
232 HAVE_BSD_SYSCTL = YesPlease
234 ifeq ($(uname_S),AIX)
236 NO_STRCASESTR = YesPlease
237 NO_MEMMEM = YesPlease
238 NO_MKDTEMP = YesPlease
239 NO_MKSTEMPS = YesPlease
240 NO_STRLCPY = YesPlease
242 FREAD_READS_DIRECTORIES = UnfortunatelyYes
243 INTERNAL_QSORT = UnfortunatelyYes
244 NEEDS_LIBICONV = YesPlease
245 BASIC_CFLAGS += -D_LARGE_FILES
246 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
247 NO_PTHREADS = YesPlease
249 PTHREAD_LIBS = -lpthread
251 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
256 ifeq ($(uname_S),GNU)
258 HAVE_ALLOCA_H = YesPlease
259 NO_STRLCPY = YesPlease
260 NO_MKSTEMPS = YesPlease
261 HAVE_PATHS_H = YesPlease
262 LIBC_CONTAINS_LIBINTL = YesPlease
264 ifeq ($(uname_S),IRIX)
265 NO_SETENV = YesPlease
266 NO_UNSETENV = YesPlease
267 NO_STRCASESTR = YesPlease
268 NO_MEMMEM = YesPlease
269 NO_MKSTEMPS = YesPlease
270 NO_MKDTEMP = YesPlease
271 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
272 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
273 # git dies with a segmentation fault when trying to access the first
274 # entry of a reflog. The conservative choice is made to always set
275 # NO_MMAP. If you suspect that your compiler is not affected by this
276 # issue, comment out the NO_MMAP statement.
279 SNPRINTF_RETURNS_BOGUS = YesPlease
280 SHELL_PATH = /usr/gnu/bin/bash
281 NEEDS_LIBGEN = YesPlease
283 ifeq ($(uname_S),IRIX64)
284 NO_SETENV = YesPlease
285 NO_UNSETENV = YesPlease
286 NO_STRCASESTR = YesPlease
287 NO_MEMMEM = YesPlease
288 NO_MKSTEMPS = YesPlease
289 NO_MKDTEMP = YesPlease
290 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
291 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
292 # git dies with a segmentation fault when trying to access the first
293 # entry of a reflog. The conservative choice is made to always set
294 # NO_MMAP. If you suspect that your compiler is not affected by this
295 # issue, comment out the NO_MMAP statement.
298 SNPRINTF_RETURNS_BOGUS = YesPlease
299 SHELL_PATH = /usr/gnu/bin/bash
300 NEEDS_LIBGEN = YesPlease
302 ifeq ($(uname_S),HP-UX)
305 NO_SETENV = YesPlease
306 NO_STRCASESTR = YesPlease
307 NO_MEMMEM = YesPlease
308 NO_MKSTEMPS = YesPlease
309 NO_STRLCPY = YesPlease
310 NO_MKDTEMP = YesPlease
311 NO_UNSETENV = YesPlease
312 NO_HSTRERROR = YesPlease
313 NO_SYS_SELECT_H = YesPlease
314 SNPRINTF_RETURNS_BOGUS = YesPlease
316 ifeq ($(uname_R),B.11.00)
317 NO_INET_NTOP = YesPlease
318 NO_INET_PTON = YesPlease
320 ifeq ($(uname_R),B.10.20)
321 # Override HP-UX 11.x setting:
325 NO_INET_NTOP = YesPlease
326 NO_INET_PTON = YesPlease
330 ifeq ($(uname_S),Windows)
331 GIT_VERSION := $(GIT_VERSION).MSVC
333 HAVE_ALLOCA_H = YesPlease
335 NEEDS_CRYPTO_WITH_SSL = YesPlease
336 NO_LIBGEN_H = YesPlease
338 NO_SYMLINK_HEAD = YesPlease
340 NO_UNIX_SOCKETS = YesPlease
341 NO_SETENV = YesPlease
342 NO_STRCASESTR = YesPlease
343 NO_STRLCPY = YesPlease
344 NO_MEMMEM = YesPlease
345 # NEEDS_LIBICONV = YesPlease
347 NO_STRTOUMAX = YesPlease
348 NO_MKDTEMP = YesPlease
349 NO_MKSTEMPS = YesPlease
350 SNPRINTF_RETURNS_BOGUS = YesPlease
351 NO_SVN_TESTS = YesPlease
352 RUNTIME_PREFIX = YesPlease
353 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
355 USE_WIN32_MMAP = YesPlease
356 # USE_NED_ALLOCATOR = YesPlease
357 UNRELIABLE_FSTAT = UnfortunatelyYes
358 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
360 NO_GETTEXT = YesPlease
361 NO_PYTHON = YesPlease
364 NO_INET_PTON = YesPlease
365 NO_INET_NTOP = YesPlease
366 NO_POSIX_GOODIES = UnfortunatelyYes
367 NATIVE_CRLF = YesPlease
368 DEFAULT_HELP_FORMAT = html
369 NO_D_INO_IN_DIRENT = YesPlease
371 CC = compat/vcbuild/scripts/clink.pl
372 AR = compat/vcbuild/scripts/lib.pl
374 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
375 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
376 compat/win32/pthread.o compat/win32/syslog.o \
377 compat/win32/dirent.o
378 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
379 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
380 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
383 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
385 BASIC_CFLAGS += -GL -Os -MD
386 BASIC_LDFLAGS += -LTCG
389 BASIC_CFLAGS += -Zi -MDd
393 ifeq ($(uname_S),Interix)
394 NO_INITGROUPS = YesPlease
396 NO_MEMMEM = YesPlease
397 NO_MKDTEMP = YesPlease
398 NO_STRTOUMAX = YesPlease
400 NO_MKSTEMPS = YesPlease
401 ifeq ($(uname_R),3.5)
402 NO_INET_NTOP = YesPlease
403 NO_INET_PTON = YesPlease
404 NO_SOCKADDR_STORAGE = YesPlease
406 ifeq ($(uname_R),5.2)
407 NO_INET_NTOP = YesPlease
408 NO_INET_PTON = YesPlease
409 NO_SOCKADDR_STORAGE = YesPlease
412 ifeq ($(uname_S),Minix)
414 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
417 NEEDS_CRYPTO_WITH_SSL = YesPlease
418 NEEDS_IDN_WITH_CURL = YesPlease
419 NEEDS_SSL_WITH_CURL = YesPlease
421 NO_HSTRERROR = YesPlease
426 ifeq ($(uname_S),NONSTOP_KERNEL)
427 # Needs some C99 features, "inline" is just one of them.
428 # INLINE='' would just replace one set of warnings with another and
429 # still not compile in c89 mode, due to non-const array initializations.
431 # Disable all optimization, seems to result in bad code, with -O or -O2
432 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
433 # abends on "git push". Needs more investigation.
435 # We'd want it to be here.
437 # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
438 PERL_PATH = ${prefix}/bin/perl
439 PYTHON_PATH = ${prefix}/bin/python
441 # As detected by './configure'.
442 # Missdetected, hence commented out, see below.
444 # Added manually, see above.
445 NEEDS_SSL_WITH_CURL = YesPlease
446 HAVE_LIBCHARSET_H = YesPlease
447 HAVE_STRINGS_H = YesPlease
448 NEEDS_LIBICONV = YesPlease
449 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
450 NO_SYS_SELECT_H = UnfortunatelyYes
451 NO_D_TYPE_IN_DIRENT = YesPlease
452 NO_HSTRERROR = YesPlease
453 NO_STRCASESTR = YesPlease
454 NO_MEMMEM = YesPlease
455 NO_STRLCPY = YesPlease
456 NO_SETENV = YesPlease
457 NO_UNSETENV = YesPlease
458 NO_MKDTEMP = YesPlease
459 NO_MKSTEMPS = YesPlease
460 # Currently libiconv-1.9.1.
461 OLD_ICONV = UnfortunatelyYes
463 NO_PTHREADS = UnfortunatelyYes
465 # Not detected (nor checked for) by './configure'.
466 # We don't have SA_RESTART on NonStop, unfortunalety.
467 COMPAT_CFLAGS += -DSA_RESTART=0
468 # Apparently needed in compat/fnmatch/fnmatch.c.
469 COMPAT_CFLAGS += -DHAVE_STRING_H=1
470 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
475 NO_INTPTR_T = UnfortunatelyYes
476 # Bug report 10-120822-4477 submitted to HP NonStop development.
477 MKDIR_WO_TRAILING_SLASH = YesPlease
478 # RFE 10-120912-4693 submitted to HP NonStop development.
479 NO_SETITIMER = UnfortunatelyYes
480 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
481 SHELL_PATH = /usr/local/bin/bash
482 # as of H06.25/J06.14, we might better use this
483 #SHELL_PATH = /usr/coreutils/bin/bash
485 ifneq (,$(findstring MINGW,$(uname_S)))
487 HAVE_ALLOCA_H = YesPlease
489 NEEDS_CRYPTO_WITH_SSL = YesPlease
490 NO_LIBGEN_H = YesPlease
492 NO_SYMLINK_HEAD = YesPlease
493 NO_UNIX_SOCKETS = YesPlease
494 NO_SETENV = YesPlease
495 NO_STRCASESTR = YesPlease
496 NO_STRLCPY = YesPlease
497 NO_MEMMEM = YesPlease
498 NEEDS_LIBICONV = YesPlease
499 NO_STRTOUMAX = YesPlease
500 NO_MKDTEMP = YesPlease
501 NO_MKSTEMPS = YesPlease
502 NO_SVN_TESTS = YesPlease
503 NO_PERL_MAKEMAKER = YesPlease
504 RUNTIME_PREFIX = YesPlease
505 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
507 USE_WIN32_MMAP = YesPlease
508 USE_NED_ALLOCATOR = YesPlease
509 UNRELIABLE_FSTAT = UnfortunatelyYes
510 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
512 NO_PYTHON = YesPlease
515 NO_INET_PTON = YesPlease
516 NO_INET_NTOP = YesPlease
517 NO_POSIX_GOODIES = UnfortunatelyYes
518 DEFAULT_HELP_FORMAT = html
519 NO_D_INO_IN_DIRENT = YesPlease
520 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
521 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
522 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
523 compat/win32/pthread.o compat/win32/syslog.o \
524 compat/win32/dirent.o
525 BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
526 BASIC_LDFLAGS += -Wl,--large-address-aware
531 NATIVE_CRLF = YesPlease
533 SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
534 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
535 htmldir = doc/git/html/
537 INSTALL = /bin/install
538 EXTLIBS += /mingw/lib/libz.a
539 NO_R_TO_GCC_LINKER = YesPlease
540 INTERNAL_QSORT = YesPlease
541 HAVE_LIBCHARSET_H = YesPlease
542 NO_GETTEXT = YesPlease
547 ifeq ($(uname_S),QNX)
548 COMPAT_CFLAGS += -DSA_RESTART=0
549 EXPAT_NEEDS_XMLPARSE_H = YesPlease
550 HAVE_STRINGS_H = YesPlease
551 NEEDS_SOCKET = YesPlease
552 NO_GETPAGESIZE = YesPlease
554 NO_MEMMEM = YesPlease
555 NO_MKDTEMP = YesPlease
556 NO_MKSTEMPS = YesPlease
558 NO_PTHREADS = YesPlease
559 NO_R_TO_GCC_LINKER = YesPlease
560 NO_STRCASESTR = YesPlease
561 NO_STRLCPY = YesPlease