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 NO_STRLCPY = YesPlease
32 NO_MKSTEMPS = YesPlease
33 HAVE_PATHS_H = YesPlease
34 LIBC_CONTAINS_LIBINTL = YesPlease
35 HAVE_DEV_TTY = YesPlease
37 ifeq ($(uname_S),GNU/kFreeBSD)
38 NO_STRLCPY = YesPlease
39 NO_MKSTEMPS = YesPlease
40 HAVE_PATHS_H = YesPlease
41 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
42 LIBC_CONTAINS_LIBINTL = YesPlease
44 ifeq ($(uname_S),UnixWare)
46 NEEDS_SOCKET = YesPlease
48 NEEDS_SSL_WITH_CRYPTO = YesPlease
49 NEEDS_LIBICONV = YesPlease
50 SHELL_PATH = /usr/local/bin/bash
52 NO_HSTRERROR = YesPlease
53 NO_MKSTEMPS = YesPlease
54 BASIC_CFLAGS += -Kthread
55 BASIC_CFLAGS += -I/usr/local/include
56 BASIC_LDFLAGS += -L/usr/local/lib
59 NO_STRCASESTR = YesPlease
62 ifeq ($(uname_S),SCO_SV)
68 BASIC_CFLAGS += -Kthread
70 NEEDS_SOCKET = YesPlease
72 NEEDS_SSL_WITH_CRYPTO = YesPlease
73 NEEDS_LIBICONV = YesPlease
74 SHELL_PATH = /usr/bin/bash
76 NO_HSTRERROR = YesPlease
77 NO_MKSTEMPS = YesPlease
78 BASIC_CFLAGS += -I/usr/local/include
79 BASIC_LDFLAGS += -L/usr/local/lib
80 NO_STRCASESTR = YesPlease
85 ifeq ($(uname_S),Darwin)
86 NEEDS_CRYPTO_WITH_SSL = YesPlease
87 NEEDS_SSL_WITH_CRYPTO = YesPlease
88 NEEDS_LIBICONV = YesPlease
89 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
90 OLD_ICONV = UnfortunatelyYes
92 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
93 NO_STRLCPY = YesPlease
96 USE_ST_TIMESPEC = YesPlease
97 HAVE_DEV_TTY = YesPlease
98 COMPAT_OBJS += compat/precompose_utf8.o
99 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
101 ifeq ($(uname_S),SunOS)
102 NEEDS_SOCKET = YesPlease
103 NEEDS_NSL = YesPlease
104 SHELL_PATH = /bin/bash
105 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
106 NO_STRCASESTR = YesPlease
107 NO_MEMMEM = YesPlease
108 NO_MKDTEMP = YesPlease
109 NO_MKSTEMPS = YesPlease
111 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
112 HAVE_DEV_TTY = YesPlease
113 ifeq ($(uname_R),5.6)
115 NO_HSTRERROR = YesPlease
117 NO_SOCKADDR_STORAGE = YesPlease
118 NO_UNSETENV = YesPlease
119 NO_SETENV = YesPlease
120 NO_STRLCPY = YesPlease
121 NO_STRTOUMAX = YesPlease
124 ifeq ($(uname_R),5.7)
125 NEEDS_RESOLV = 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.8)
135 NO_UNSETENV = YesPlease
136 NO_SETENV = YesPlease
137 NO_STRTOUMAX = YesPlease
140 ifeq ($(uname_R),5.9)
141 NO_UNSETENV = YesPlease
142 NO_SETENV = YesPlease
143 NO_STRTOUMAX = YesPlease
146 INSTALL = /usr/ucb/install
148 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
150 ifeq ($(uname_O),Cygwin)
151 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
152 NO_D_TYPE_IN_DIRENT = YesPlease
153 NO_D_INO_IN_DIRENT = YesPlease
154 NO_STRCASESTR = YesPlease
155 NO_MEMMEM = YesPlease
156 NO_MKSTEMPS = YesPlease
157 NO_SYMLINK_HEAD = YesPlease
159 OLD_ICONV = UnfortunatelyYes
160 NO_THREAD_SAFE_PREAD = YesPlease
161 # There are conflicting reports about this.
162 # On some boxes NO_MMAP is needed, and not so elsewhere.
163 # Try commenting this out if you suspect MMAP is more efficient
166 NO_REGEX = UnfortunatelyYes
168 NEEDS_LIBICONV = YesPlease
169 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
170 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
172 UNRELIABLE_FSTAT = UnfortunatelyYes
173 SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
175 ifeq ($(uname_S),FreeBSD)
176 NEEDS_LIBICONV = YesPlease
177 OLD_ICONV = YesPlease
178 NO_MEMMEM = YesPlease
179 BASIC_CFLAGS += -I/usr/local/include
180 BASIC_LDFLAGS += -L/usr/local/lib
181 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
182 USE_ST_TIMESPEC = YesPlease
183 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
184 PTHREAD_LIBS = -pthread
185 NO_UINTMAX_T = YesPlease
186 NO_STRTOUMAX = YesPlease
188 PYTHON_PATH = /usr/local/bin/python
189 HAVE_PATHS_H = YesPlease
190 GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
192 ifeq ($(uname_S),OpenBSD)
193 NO_STRCASESTR = YesPlease
194 NO_MEMMEM = YesPlease
195 USE_ST_TIMESPEC = YesPlease
196 NEEDS_LIBICONV = YesPlease
197 BASIC_CFLAGS += -I/usr/local/include
198 BASIC_LDFLAGS += -L/usr/local/lib
199 HAVE_PATHS_H = YesPlease
201 ifeq ($(uname_S),MirBSD)
202 NO_STRCASESTR = YesPlease
203 NO_MEMMEM = YesPlease
204 USE_ST_TIMESPEC = YesPlease
205 NEEDS_LIBICONV = YesPlease
206 HAVE_PATHS_H = YesPlease
208 ifeq ($(uname_S),NetBSD)
209 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
210 NEEDS_LIBICONV = YesPlease
212 BASIC_CFLAGS += -I/usr/pkg/include
213 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
214 USE_ST_TIMESPEC = YesPlease
215 NO_MKSTEMPS = YesPlease
216 HAVE_PATHS_H = YesPlease
218 ifeq ($(uname_S),AIX)
220 NO_STRCASESTR = YesPlease
221 NO_MEMMEM = YesPlease
222 NO_MKDTEMP = YesPlease
223 NO_MKSTEMPS = YesPlease
224 NO_STRLCPY = YesPlease
226 FREAD_READS_DIRECTORIES = UnfortunatelyYes
227 INTERNAL_QSORT = UnfortunatelyYes
228 NEEDS_LIBICONV = YesPlease
229 BASIC_CFLAGS += -D_LARGE_FILES
230 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
231 NO_PTHREADS = YesPlease
233 PTHREAD_LIBS = -lpthread
235 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
240 ifeq ($(uname_S),GNU)
242 NO_STRLCPY = YesPlease
243 NO_MKSTEMPS = YesPlease
244 HAVE_PATHS_H = YesPlease
245 LIBC_CONTAINS_LIBINTL = YesPlease
247 ifeq ($(uname_S),IRIX)
248 NO_SETENV = YesPlease
249 NO_UNSETENV = YesPlease
250 NO_STRCASESTR = YesPlease
251 NO_MEMMEM = YesPlease
252 NO_MKSTEMPS = YesPlease
253 NO_MKDTEMP = YesPlease
254 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
255 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
256 # git dies with a segmentation fault when trying to access the first
257 # entry of a reflog. The conservative choice is made to always set
258 # NO_MMAP. If you suspect that your compiler is not affected by this
259 # issue, comment out the NO_MMAP statement.
262 SNPRINTF_RETURNS_BOGUS = YesPlease
263 SHELL_PATH = /usr/gnu/bin/bash
264 NEEDS_LIBGEN = YesPlease
266 ifeq ($(uname_S),IRIX64)
267 NO_SETENV = YesPlease
268 NO_UNSETENV = YesPlease
269 NO_STRCASESTR = YesPlease
270 NO_MEMMEM = YesPlease
271 NO_MKSTEMPS = YesPlease
272 NO_MKDTEMP = YesPlease
273 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
274 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
275 # git dies with a segmentation fault when trying to access the first
276 # entry of a reflog. The conservative choice is made to always set
277 # NO_MMAP. If you suspect that your compiler is not affected by this
278 # issue, comment out the NO_MMAP statement.
281 SNPRINTF_RETURNS_BOGUS = YesPlease
282 SHELL_PATH = /usr/gnu/bin/bash
283 NEEDS_LIBGEN = YesPlease
285 ifeq ($(uname_S),HP-UX)
288 NO_SETENV = YesPlease
289 NO_STRCASESTR = YesPlease
290 NO_MEMMEM = YesPlease
291 NO_MKSTEMPS = YesPlease
292 NO_STRLCPY = YesPlease
293 NO_MKDTEMP = YesPlease
294 NO_UNSETENV = YesPlease
295 NO_HSTRERROR = YesPlease
296 NO_SYS_SELECT_H = YesPlease
297 SNPRINTF_RETURNS_BOGUS = YesPlease
299 ifeq ($(uname_R),B.11.00)
300 NO_INET_NTOP = YesPlease
301 NO_INET_PTON = YesPlease
303 ifeq ($(uname_R),B.10.20)
304 # Override HP-UX 11.x setting:
308 NO_INET_NTOP = YesPlease
309 NO_INET_PTON = YesPlease
313 ifeq ($(uname_S),Windows)
314 GIT_VERSION := $(GIT_VERSION).MSVC
317 NEEDS_CRYPTO_WITH_SSL = YesPlease
318 NO_LIBGEN_H = YesPlease
320 NO_SYMLINK_HEAD = YesPlease
322 NO_UNIX_SOCKETS = YesPlease
323 NO_SETENV = YesPlease
324 NO_STRCASESTR = YesPlease
325 NO_STRLCPY = YesPlease
326 NO_MEMMEM = YesPlease
327 # NEEDS_LIBICONV = YesPlease
329 NO_STRTOUMAX = YesPlease
330 NO_MKDTEMP = YesPlease
331 NO_MKSTEMPS = YesPlease
332 SNPRINTF_RETURNS_BOGUS = YesPlease
333 NO_SVN_TESTS = YesPlease
334 RUNTIME_PREFIX = YesPlease
335 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
337 USE_WIN32_MMAP = YesPlease
338 # USE_NED_ALLOCATOR = YesPlease
339 UNRELIABLE_FSTAT = UnfortunatelyYes
340 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
342 NO_GETTEXT = YesPlease
343 NO_PYTHON = YesPlease
346 NO_INET_PTON = YesPlease
347 NO_INET_NTOP = YesPlease
348 NO_POSIX_GOODIES = UnfortunatelyYes
349 NATIVE_CRLF = YesPlease
350 DEFAULT_HELP_FORMAT = html
351 NO_D_INO_IN_DIRENT = YesPlease
353 CC = compat/vcbuild/scripts/clink.pl
354 AR = compat/vcbuild/scripts/lib.pl
356 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
357 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
358 compat/win32/pthread.o compat/win32/syslog.o \
359 compat/win32/dirent.o
360 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
361 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
362 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
366 BASIC_CFLAGS += -GL -Os -MT
367 BASIC_LDFLAGS += -LTCG
370 BASIC_CFLAGS += -Zi -MTd
374 ifeq ($(uname_S),Interix)
375 NO_INITGROUPS = YesPlease
377 NO_MEMMEM = YesPlease
378 NO_MKDTEMP = YesPlease
379 NO_STRTOUMAX = YesPlease
381 NO_MKSTEMPS = YesPlease
382 ifeq ($(uname_R),3.5)
383 NO_INET_NTOP = YesPlease
384 NO_INET_PTON = YesPlease
385 NO_SOCKADDR_STORAGE = YesPlease
387 ifeq ($(uname_R),5.2)
388 NO_INET_NTOP = YesPlease
389 NO_INET_PTON = YesPlease
390 NO_SOCKADDR_STORAGE = YesPlease
393 ifeq ($(uname_S),Minix)
395 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
398 NEEDS_CRYPTO_WITH_SSL = YesPlease
399 NEEDS_IDN_WITH_CURL = YesPlease
400 NEEDS_SSL_WITH_CURL = YesPlease
402 NO_HSTRERROR = YesPlease
407 ifeq ($(uname_S),NONSTOP_KERNEL)
408 # Needs some C99 features, "inline" is just one of them.
409 # INLINE='' would just replace one set of warnings with another and
410 # still not compile in c89 mode, due to non-const array initializations.
412 # Disable all optimization, seems to result in bad code, with -O or -O2
413 # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
414 # abends on "git push". Needs more investigation.
416 # We'd want it to be here.
418 # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
419 PERL_PATH = ${prefix}/bin/perl
420 PYTHON_PATH = ${prefix}/bin/python
422 # As detected by './configure'.
423 # Missdetected, hence commented out, see below.
425 # Added manually, see above.
426 NEEDS_SSL_WITH_CURL = YesPlease
427 HAVE_LIBCHARSET_H = YesPlease
428 HAVE_STRINGS_H = YesPlease
429 NEEDS_LIBICONV = YesPlease
430 NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
431 NO_SYS_SELECT_H = UnfortunatelyYes
432 NO_D_TYPE_IN_DIRENT = YesPlease
433 NO_HSTRERROR = YesPlease
434 NO_STRCASESTR = YesPlease
435 NO_MEMMEM = YesPlease
436 NO_STRLCPY = YesPlease
437 NO_SETENV = YesPlease
438 NO_UNSETENV = YesPlease
439 NO_MKDTEMP = YesPlease
440 NO_MKSTEMPS = YesPlease
441 # Currently libiconv-1.9.1.
442 OLD_ICONV = UnfortunatelyYes
444 NO_PTHREADS = UnfortunatelyYes
446 # Not detected (nor checked for) by './configure'.
447 # We don't have SA_RESTART on NonStop, unfortunalety.
448 COMPAT_CFLAGS += -DSA_RESTART=0
449 # Apparently needed in compat/fnmatch/fnmatch.c.
450 COMPAT_CFLAGS += -DHAVE_STRING_H=1
451 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
456 NO_INTPTR_T = UnfortunatelyYes
457 # Bug report 10-120822-4477 submitted to HP NonStop development.
458 MKDIR_WO_TRAILING_SLASH = YesPlease
459 # RFE 10-120912-4693 submitted to HP NonStop development.
460 NO_SETITIMER = UnfortunatelyYes
461 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
462 SHELL_PATH = /usr/local/bin/bash
463 # as of H06.25/J06.14, we might better use this
464 #SHELL_PATH = /usr/coreutils/bin/bash
466 ifneq (,$(findstring MINGW,$(uname_S)))
469 NEEDS_CRYPTO_WITH_SSL = YesPlease
470 NO_LIBGEN_H = YesPlease
472 NO_SYMLINK_HEAD = YesPlease
473 NO_UNIX_SOCKETS = YesPlease
474 NO_SETENV = YesPlease
475 NO_STRCASESTR = YesPlease
476 NO_STRLCPY = YesPlease
477 NO_MEMMEM = YesPlease
478 NEEDS_LIBICONV = YesPlease
479 NO_STRTOUMAX = YesPlease
480 NO_MKDTEMP = YesPlease
481 NO_MKSTEMPS = YesPlease
482 NO_SVN_TESTS = YesPlease
483 NO_PERL_MAKEMAKER = YesPlease
484 RUNTIME_PREFIX = YesPlease
485 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
487 USE_WIN32_MMAP = YesPlease
488 USE_NED_ALLOCATOR = YesPlease
489 UNRELIABLE_FSTAT = UnfortunatelyYes
490 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
492 NO_PYTHON = YesPlease
495 NO_INET_PTON = YesPlease
496 NO_INET_NTOP = YesPlease
497 NO_POSIX_GOODIES = UnfortunatelyYes
498 DEFAULT_HELP_FORMAT = html
499 NO_D_INO_IN_DIRENT = YesPlease
500 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32
501 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
502 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
503 compat/win32/pthread.o compat/win32/syslog.o \
504 compat/win32/dirent.o
505 BASIC_LDFLAGS += -Wl,--large-address-aware
510 NATIVE_CRLF = YesPlease
512 SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
513 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
514 htmldir = doc/git/html/
516 INSTALL = /bin/install
517 EXTLIBS += /mingw/lib/libz.a
518 NO_R_TO_GCC_LINKER = YesPlease
519 INTERNAL_QSORT = YesPlease
520 HAVE_LIBCHARSET_H = YesPlease
521 NO_GETTEXT = YesPlease
526 ifeq ($(uname_S),QNX)
527 COMPAT_CFLAGS += -DSA_RESTART=0
528 EXPAT_NEEDS_XMLPARSE_H = YesPlease
529 HAVE_STRINGS_H = YesPlease
530 NEEDS_SOCKET = YesPlease
531 NO_GETPAGESIZE = YesPlease
533 NO_MEMMEM = YesPlease
534 NO_MKDTEMP = YesPlease
535 NO_MKSTEMPS = YesPlease
537 NO_PTHREADS = YesPlease
538 NO_R_TO_GCC_LINKER = YesPlease
539 NO_STRCASESTR = YesPlease
540 NO_STRLCPY = YesPlease