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 NEEDS_CLIPPED_WRITE = YesPlease
99 COMPAT_OBJS += compat/precompose_utf8.o
100 BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
102 ifeq ($(uname_S),SunOS)
103 NEEDS_SOCKET = YesPlease
104 NEEDS_NSL = YesPlease
105 SHELL_PATH = /bin/bash
106 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
107 NO_STRCASESTR = YesPlease
108 NO_MEMMEM = YesPlease
109 NO_MKDTEMP = YesPlease
110 NO_MKSTEMPS = YesPlease
112 NO_FNMATCH_CASEFOLD = YesPlease
113 NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
114 HAVE_DEV_TTY = YesPlease
115 ifeq ($(uname_R),5.6)
117 NO_HSTRERROR = YesPlease
119 NO_SOCKADDR_STORAGE = YesPlease
120 NO_UNSETENV = YesPlease
121 NO_SETENV = YesPlease
122 NO_STRLCPY = YesPlease
123 NO_STRTOUMAX = YesPlease
126 ifeq ($(uname_R),5.7)
127 NEEDS_RESOLV = 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.8)
137 NO_UNSETENV = YesPlease
138 NO_SETENV = YesPlease
139 NO_STRTOUMAX = YesPlease
142 ifeq ($(uname_R),5.9)
143 NO_UNSETENV = YesPlease
144 NO_SETENV = YesPlease
145 NO_STRTOUMAX = YesPlease
148 INSTALL = /usr/ucb/install
150 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
152 ifeq ($(uname_O),Cygwin)
153 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
154 NO_D_TYPE_IN_DIRENT = YesPlease
155 NO_D_INO_IN_DIRENT = YesPlease
156 NO_STRCASESTR = YesPlease
157 NO_MEMMEM = YesPlease
158 NO_MKSTEMPS = YesPlease
159 NO_SYMLINK_HEAD = YesPlease
161 OLD_ICONV = UnfortunatelyYes
162 CYGWIN_V15_WIN32API = YesPlease
164 NO_THREAD_SAFE_PREAD = YesPlease
165 NEEDS_LIBICONV = YesPlease
166 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
167 NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
168 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
169 # There are conflicting reports about this.
170 # On some boxes NO_MMAP is needed, and not so elsewhere.
171 # Try commenting this out if you suspect MMAP is more efficient
174 COMPAT_OBJS += compat/cygwin.o
175 UNRELIABLE_FSTAT = UnfortunatelyYes
176 SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
178 ifeq ($(uname_S),FreeBSD)
179 NEEDS_LIBICONV = YesPlease
180 OLD_ICONV = YesPlease
181 NO_MEMMEM = YesPlease
182 BASIC_CFLAGS += -I/usr/local/include
183 BASIC_LDFLAGS += -L/usr/local/lib
184 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
185 USE_ST_TIMESPEC = YesPlease
186 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
187 PTHREAD_LIBS = -pthread
188 NO_UINTMAX_T = YesPlease
189 NO_STRTOUMAX = YesPlease
191 PYTHON_PATH = /usr/local/bin/python
192 HAVE_PATHS_H = YesPlease
194 ifeq ($(uname_S),OpenBSD)
195 NO_STRCASESTR = YesPlease
196 NO_MEMMEM = YesPlease
197 USE_ST_TIMESPEC = YesPlease
198 NEEDS_LIBICONV = YesPlease
199 BASIC_CFLAGS += -I/usr/local/include
200 BASIC_LDFLAGS += -L/usr/local/lib
201 HAVE_PATHS_H = YesPlease
203 ifeq ($(uname_S),NetBSD)
204 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
205 NEEDS_LIBICONV = YesPlease
207 BASIC_CFLAGS += -I/usr/pkg/include
208 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
209 USE_ST_TIMESPEC = YesPlease
210 NO_MKSTEMPS = YesPlease
211 HAVE_PATHS_H = YesPlease
213 ifeq ($(uname_S),AIX)
215 NO_STRCASESTR = YesPlease
216 NO_MEMMEM = YesPlease
217 NO_MKDTEMP = YesPlease
218 NO_MKSTEMPS = YesPlease
219 NO_STRLCPY = YesPlease
221 FREAD_READS_DIRECTORIES = UnfortunatelyYes
222 INTERNAL_QSORT = UnfortunatelyYes
223 NEEDS_LIBICONV = YesPlease
224 BASIC_CFLAGS += -D_LARGE_FILES
225 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
226 NO_PTHREADS = YesPlease
228 PTHREAD_LIBS = -lpthread
230 ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
235 ifeq ($(uname_S),GNU)
237 NO_STRLCPY = YesPlease
238 NO_MKSTEMPS = YesPlease
239 HAVE_PATHS_H = YesPlease
240 LIBC_CONTAINS_LIBINTL = YesPlease
242 ifeq ($(uname_S),IRIX)
243 NO_SETENV = YesPlease
244 NO_UNSETENV = YesPlease
245 NO_STRCASESTR = YesPlease
246 NO_MEMMEM = YesPlease
247 NO_MKSTEMPS = YesPlease
248 NO_MKDTEMP = YesPlease
249 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
250 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
251 # git dies with a segmentation fault when trying to access the first
252 # entry of a reflog. The conservative choice is made to always set
253 # NO_MMAP. If you suspect that your compiler is not affected by this
254 # issue, comment out the NO_MMAP statement.
257 NO_FNMATCH_CASEFOLD = YesPlease
258 SNPRINTF_RETURNS_BOGUS = YesPlease
259 SHELL_PATH = /usr/gnu/bin/bash
260 NEEDS_LIBGEN = YesPlease
262 ifeq ($(uname_S),IRIX64)
263 NO_SETENV = YesPlease
264 NO_UNSETENV = YesPlease
265 NO_STRCASESTR = YesPlease
266 NO_MEMMEM = YesPlease
267 NO_MKSTEMPS = YesPlease
268 NO_MKDTEMP = YesPlease
269 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
270 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
271 # git dies with a segmentation fault when trying to access the first
272 # entry of a reflog. The conservative choice is made to always set
273 # NO_MMAP. If you suspect that your compiler is not affected by this
274 # issue, comment out the NO_MMAP statement.
277 NO_FNMATCH_CASEFOLD = YesPlease
278 SNPRINTF_RETURNS_BOGUS = YesPlease
279 SHELL_PATH = /usr/gnu/bin/bash
280 NEEDS_LIBGEN = YesPlease
282 ifeq ($(uname_S),HP-UX)
285 NO_SETENV = YesPlease
286 NO_STRCASESTR = YesPlease
287 NO_MEMMEM = YesPlease
288 NO_MKSTEMPS = YesPlease
289 NO_STRLCPY = YesPlease
290 NO_MKDTEMP = YesPlease
291 NO_UNSETENV = YesPlease
292 NO_HSTRERROR = YesPlease
293 NO_SYS_SELECT_H = YesPlease
294 NO_FNMATCH_CASEFOLD = YesPlease
295 SNPRINTF_RETURNS_BOGUS = YesPlease
297 ifeq ($(uname_R),B.11.00)
298 NO_INET_NTOP = YesPlease
299 NO_INET_PTON = YesPlease
301 ifeq ($(uname_R),B.10.20)
302 # Override HP-UX 11.x setting:
306 NO_INET_NTOP = YesPlease
307 NO_INET_PTON = YesPlease
311 ifeq ($(uname_S),Windows)
312 GIT_VERSION := $(GIT_VERSION).MSVC
315 NEEDS_CRYPTO_WITH_SSL = YesPlease
316 NO_LIBGEN_H = YesPlease
318 NO_SYMLINK_HEAD = YesPlease
320 NO_UNIX_SOCKETS = YesPlease
321 NO_SETENV = YesPlease
322 NO_UNSETENV = YesPlease
323 NO_STRCASESTR = YesPlease
324 NO_STRLCPY = YesPlease
325 NO_FNMATCH = YesPlease
326 NO_MEMMEM = YesPlease
327 # NEEDS_LIBICONV = YesPlease
329 NO_STRTOUMAX = YesPlease
330 NO_STRTOULL = YesPlease
331 NO_MKDTEMP = YesPlease
332 NO_MKSTEMPS = YesPlease
333 SNPRINTF_RETURNS_BOGUS = YesPlease
334 NO_SVN_TESTS = YesPlease
335 NO_PERL_MAKEMAKER = YesPlease
336 RUNTIME_PREFIX = YesPlease
337 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
339 USE_WIN32_MMAP = YesPlease
340 # USE_NED_ALLOCATOR = YesPlease
341 UNRELIABLE_FSTAT = UnfortunatelyYes
342 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
345 NO_PYTHON = YesPlease
347 NO_POSIX_GOODIES = UnfortunatelyYes
348 NATIVE_CRLF = YesPlease
349 DEFAULT_HELP_FORMAT = html
351 CC = compat/vcbuild/scripts/clink.pl
352 AR = compat/vcbuild/scripts/lib.pl
354 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
355 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
356 compat/win32/pthread.o compat/win32/syslog.o \
357 compat/win32/dirent.o
358 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
359 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
360 EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
364 BASIC_CFLAGS += -GL -Os -MT
365 BASIC_LDFLAGS += -LTCG
368 BASIC_CFLAGS += -Zi -MTd
372 ifeq ($(uname_S),Interix)
373 NO_INITGROUPS = YesPlease
375 NO_MEMMEM = YesPlease
376 NO_MKDTEMP = YesPlease
377 NO_STRTOUMAX = YesPlease
379 NO_MKSTEMPS = YesPlease
380 ifeq ($(uname_R),3.5)
381 NO_INET_NTOP = YesPlease
382 NO_INET_PTON = YesPlease
383 NO_SOCKADDR_STORAGE = YesPlease
384 NO_FNMATCH_CASEFOLD = YesPlease
386 ifeq ($(uname_R),5.2)
387 NO_INET_NTOP = YesPlease
388 NO_INET_PTON = YesPlease
389 NO_SOCKADDR_STORAGE = YesPlease
390 NO_FNMATCH_CASEFOLD = 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_FNMATCH_CASEFOLD = YesPlease
436 NO_MEMMEM = YesPlease
437 NO_STRLCPY = YesPlease
438 NO_SETENV = YesPlease
439 NO_UNSETENV = YesPlease
440 NO_MKDTEMP = YesPlease
441 NO_MKSTEMPS = YesPlease
442 # Currently libiconv-1.9.1.
443 OLD_ICONV = UnfortunatelyYes
445 NO_PTHREADS = UnfortunatelyYes
447 # Not detected (nor checked for) by './configure'.
448 # We don't have SA_RESTART on NonStop, unfortunalety.
449 COMPAT_CFLAGS += -DSA_RESTART=0
450 # Apparently needed in compat/fnmatch/fnmatch.c.
451 COMPAT_CFLAGS += -DHAVE_STRING_H=1
452 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
457 NO_INTPTR_T = UnfortunatelyYes
458 # Bug report 10-120822-4477 submitted to HP NonStop development.
459 MKDIR_WO_TRAILING_SLASH = YesPlease
460 # RFE 10-120912-4693 submitted to HP NonStop development.
461 NO_SETITIMER = UnfortunatelyYes
462 SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
463 SHELL_PATH = /usr/local/bin/bash
464 # as of H06.25/J06.14, we might better use this
465 #SHELL_PATH = /usr/coreutils/bin/bash
467 ifneq (,$(findstring MINGW,$(uname_S)))
470 NEEDS_CRYPTO_WITH_SSL = YesPlease
471 NO_LIBGEN_H = YesPlease
473 NO_SYMLINK_HEAD = YesPlease
474 NO_UNIX_SOCKETS = YesPlease
475 NO_SETENV = YesPlease
476 NO_UNSETENV = YesPlease
477 NO_STRCASESTR = YesPlease
478 NO_STRLCPY = YesPlease
479 NO_FNMATCH = YesPlease
480 NO_MEMMEM = YesPlease
481 NEEDS_LIBICONV = YesPlease
482 OLD_ICONV = YesPlease
483 NO_STRTOUMAX = YesPlease
484 NO_MKDTEMP = YesPlease
485 NO_MKSTEMPS = YesPlease
486 NO_SVN_TESTS = YesPlease
487 NO_PERL_MAKEMAKER = YesPlease
488 RUNTIME_PREFIX = YesPlease
489 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
491 USE_WIN32_MMAP = YesPlease
492 USE_NED_ALLOCATOR = YesPlease
493 UNRELIABLE_FSTAT = UnfortunatelyYes
494 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
496 NO_PYTHON = YesPlease
499 NO_INET_PTON = YesPlease
500 NO_INET_NTOP = YesPlease
501 NO_POSIX_GOODIES = UnfortunatelyYes
502 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
503 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
504 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
505 compat/win32/pthread.o compat/win32/syslog.o \
506 compat/win32/dirent.o
510 SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
511 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
512 htmldir = doc/git/html/
514 INSTALL = /bin/install
515 EXTLIBS += /mingw/lib/libz.a
516 NO_R_TO_GCC_LINKER = YesPlease
517 INTERNAL_QSORT = YesPlease
518 HAVE_LIBCHARSET_H = YesPlease
523 ifeq ($(uname_S),QNX)
524 COMPAT_CFLAGS += -DSA_RESTART=0
525 EXPAT_NEEDS_XMLPARSE_H = YesPlease
526 HAVE_STRINGS_H = YesPlease
527 NEEDS_SOCKET = YesPlease
528 NO_FNMATCH_CASEFOLD = YesPlease
529 NO_GETPAGESIZE = YesPlease
531 NO_MEMMEM = YesPlease
532 NO_MKDTEMP = YesPlease
533 NO_MKSTEMPS = YesPlease
535 NO_PTHREADS = YesPlease
536 NO_R_TO_GCC_LINKER = YesPlease
537 NO_STRCASESTR = YesPlease
538 NO_STRLCPY = YesPlease