| 1 | # Platform specific Makefile tweaks based on uname detection |
| 2 | |
| 3 | # Define NO_SAFESEH if you need MSVC/Visual Studio to ignore the lack of |
| 4 | # Microsoft's Safe Exception Handling in libraries (such as zlib). |
| 5 | # Typically required for VS2013+/32-bit compilation on Vista+ versions. |
| 6 | |
| 7 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
| 8 | uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') |
| 9 | uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') |
| 10 | uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') |
| 11 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
| 12 | |
| 13 | ifneq ($(findstring MINGW,$(uname_S)),) |
| 14 | uname_S := MINGW |
| 15 | endif |
| 16 | |
| 17 | ifdef MSVC |
| 18 | # avoid the MingW and Cygwin configuration sections |
| 19 | uname_S := Windows |
| 20 | uname_O := Windows |
| 21 | |
| 22 | # Generate and include makefile variables that point to the |
| 23 | # currently installed set of MSVC command line tools. |
| 24 | compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat |
| 25 | @"$<" | tr '\\' / >"$@" |
| 26 | include compat/vcbuild/MSVC-DEFS-GEN |
| 27 | |
| 28 | # See if vcpkg and the vcpkg-build versions of the third-party |
| 29 | # libraries that we use are installed. We include the result |
| 30 | # to get $(vcpkg_*) variables defined for the Makefile. |
| 31 | ifeq (,$(SKIP_VCPKG)) |
| 32 | compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat |
| 33 | @"$<" |
| 34 | include compat/vcbuild/VCPKG-DEFS |
| 35 | endif |
| 36 | endif |
| 37 | |
| 38 | # We choose to avoid "if .. else if .. else .. endif endif" |
| 39 | # because maintaining the nesting to match is a pain. If |
| 40 | # we had "elif" things would have been much nicer... |
| 41 | |
| 42 | ifeq ($(uname_S),OSF1) |
| 43 | # Need this for u_short definitions et al |
| 44 | BASIC_CFLAGS += -D_OSF_SOURCE |
| 45 | SOCKLEN_T = int |
| 46 | NO_STRTOULL = YesPlease |
| 47 | NO_NSEC = YesPlease |
| 48 | endif |
| 49 | ifeq ($(uname_S),Linux) |
| 50 | HAVE_ALLOCA_H = YesPlease |
| 51 | # override in config.mak if you have glibc >= 2.38 |
| 52 | NO_STRLCPY = YesPlease |
| 53 | CSPRNG_METHOD = getrandom |
| 54 | HAVE_PATHS_H = YesPlease |
| 55 | LIBC_CONTAINS_LIBINTL = YesPlease |
| 56 | HAVE_DEV_TTY = YesPlease |
| 57 | HAVE_CLOCK_GETTIME = YesPlease |
| 58 | HAVE_CLOCK_MONOTONIC = YesPlease |
| 59 | HAVE_SYNC_FILE_RANGE = YesPlease |
| 60 | HAVE_GETDELIM = YesPlease |
| 61 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 62 | HAVE_SYSINFO = YesPlease |
| 63 | PROCFS_EXECUTABLE_PATH = /proc/self/exe |
| 64 | HAVE_PLATFORM_PROCINFO = YesPlease |
| 65 | COMPAT_OBJS += compat/linux/procinfo.o |
| 66 | EXTLIBS += -ldl |
| 67 | # centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7. |
| 68 | ifneq ($(findstring .el7.,$(uname_R)),) |
| 69 | BASIC_CFLAGS += -std=c99 |
| 70 | endif |
| 71 | LINK_FUZZ_PROGRAMS = YesPlease |
| 72 | |
| 73 | # The builtin FSMonitor on Linux builds upon Simple-IPC. Both require |
| 74 | # Unix domain sockets and PThreads. |
| 75 | ifndef NO_PTHREADS |
| 76 | ifndef NO_UNIX_SOCKETS |
| 77 | FSMONITOR_DAEMON_BACKEND = linux |
| 78 | FSMONITOR_OS_SETTINGS = unix |
| 79 | BASIC_CFLAGS += -DHAVE_LINUX_MAGIC_H |
| 80 | endif |
| 81 | endif |
| 82 | endif |
| 83 | ifeq ($(uname_S),GNU/kFreeBSD) |
| 84 | HAVE_ALLOCA_H = YesPlease |
| 85 | NO_STRLCPY = YesPlease |
| 86 | HAVE_PATHS_H = YesPlease |
| 87 | DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease |
| 88 | LIBC_CONTAINS_LIBINTL = YesPlease |
| 89 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 90 | endif |
| 91 | ifeq ($(uname_S),UnixWare) |
| 92 | CC = cc |
| 93 | NEEDS_SOCKET = YesPlease |
| 94 | NEEDS_NSL = YesPlease |
| 95 | NEEDS_SSL_WITH_CRYPTO = YesPlease |
| 96 | NEEDS_LIBICONV = YesPlease |
| 97 | SHELL_PATH = /usr/local/bin/bash |
| 98 | NO_IPV6 = YesPlease |
| 99 | NO_HSTRERROR = YesPlease |
| 100 | BASIC_CFLAGS += -Kthread |
| 101 | BASIC_CFLAGS += -I/usr/local/include |
| 102 | BASIC_LDFLAGS += -L/usr/local/lib |
| 103 | INSTALL = ginstall |
| 104 | TAR = gtar |
| 105 | NO_STRCASESTR = YesPlease |
| 106 | NO_MEMMEM = YesPlease |
| 107 | endif |
| 108 | ifeq ($(uname_S),SCO_SV) |
| 109 | ifeq ($(uname_R),3.2) |
| 110 | CFLAGS = -O2 |
| 111 | endif |
| 112 | ifeq ($(uname_R),5) |
| 113 | CC = cc |
| 114 | BASIC_CFLAGS += -Kthread |
| 115 | endif |
| 116 | NEEDS_SOCKET = YesPlease |
| 117 | NEEDS_NSL = YesPlease |
| 118 | NEEDS_SSL_WITH_CRYPTO = YesPlease |
| 119 | NEEDS_LIBICONV = YesPlease |
| 120 | SHELL_PATH = /usr/bin/bash |
| 121 | NO_IPV6 = YesPlease |
| 122 | NO_HSTRERROR = YesPlease |
| 123 | BASIC_CFLAGS += -I/usr/local/include |
| 124 | BASIC_LDFLAGS += -L/usr/local/lib |
| 125 | NO_STRCASESTR = YesPlease |
| 126 | NO_MEMMEM = YesPlease |
| 127 | INSTALL = ginstall |
| 128 | TAR = gtar |
| 129 | endif |
| 130 | ifeq ($(uname_S),Darwin) |
| 131 | NEEDS_CRYPTO_WITH_SSL = YesPlease |
| 132 | NEEDS_SSL_WITH_CRYPTO = YesPlease |
| 133 | NEEDS_LIBICONV = YesPlease |
| 134 | # Note: $(uname_R) gives us the underlying Darwin version. |
| 135 | # - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.* |
| 136 | # - MacOS 10.x.* = Darwin (x+4).* for (1 <= x) |
| 137 | # i.e. "begins with [15678] and a dot" means "10.4.* or older". |
| 138 | DARWIN_MAJOR_VERSION = $(shell expr "$(uname_R)" : '\([0-9]*\)\.') |
| 139 | ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2) |
| 140 | OLD_ICONV = UnfortunatelyYes |
| 141 | NO_APPLE_COMMON_CRYPTO = YesPlease |
| 142 | endif |
| 143 | ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2) |
| 144 | NO_STRLCPY = YesPlease |
| 145 | endif |
| 146 | ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1) |
| 147 | HAVE_GETDELIM = YesPlease |
| 148 | endif |
| 149 | ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1) |
| 150 | OPEN_RETURNS_EINTR = UnfortunatelyYes |
| 151 | endif |
| 152 | NO_MEMMEM = YesPlease |
| 153 | USE_ST_TIMESPEC = YesPlease |
| 154 | HAVE_DEV_TTY = YesPlease |
| 155 | COMPAT_OBJS += compat/precompose_utf8.o |
| 156 | BASIC_CFLAGS += -DPRECOMPOSE_UNICODE |
| 157 | DARWIN_REGEXEC = YesPlease |
| 158 | BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1 |
| 159 | HAVE_BSD_SYSCTL = YesPlease |
| 160 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 161 | HAVE_NS_GET_EXECUTABLE_PATH = YesPlease |
| 162 | CSPRNG_METHOD = arc4random |
| 163 | USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease |
| 164 | HAVE_PLATFORM_PROCINFO = YesPlease |
| 165 | COMPAT_OBJS += compat/darwin/procinfo.o |
| 166 | |
| 167 | ifeq ($(uname_M),arm64) |
| 168 | HOMEBREW_PREFIX = /opt/homebrew |
| 169 | else |
| 170 | HOMEBREW_PREFIX = /usr/local |
| 171 | endif |
| 172 | ifeq ($(shell test "$(DARWIN_MAJOR_VERSION)" -ge 24 && echo 1),1) |
| 173 | USE_HOMEBREW_LIBICONV = UnfortunatelyYes |
| 174 | NEEDS_GOOD_LIBICONV = UnfortunatelyYes |
| 175 | endif |
| 176 | |
| 177 | # ld reports "PROJECT:{ld,ld64,dyld}-NNN", match any of the three. |
| 178 | LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:[^ ]*-\([0-9][0-9]*\).*/\1/p') |
| 179 | |
| 180 | # Silence the Xcode 15+ warning about archives listed more than once. |
| 181 | ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 907 && echo 1),1) |
| 182 | BASIC_LDFLAGS += -Wl,-no_warn_duplicate_libraries |
| 183 | endif |
| 184 | |
| 185 | # Silence the Xcode 16.3+ warning about __DATA,__common alignment. |
| 186 | ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 1167 && echo 1),1) |
| 187 | BASIC_CFLAGS += -fno-common |
| 188 | endif |
| 189 | |
| 190 | # The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require |
| 191 | # Unix domain sockets and PThreads. |
| 192 | ifndef NO_PTHREADS |
| 193 | ifndef NO_UNIX_SOCKETS |
| 194 | FSMONITOR_DAEMON_BACKEND = darwin |
| 195 | FSMONITOR_OS_SETTINGS = unix |
| 196 | endif |
| 197 | endif |
| 198 | |
| 199 | BASIC_LDFLAGS += -framework CoreServices |
| 200 | endif |
| 201 | ifeq ($(uname_S),SunOS) |
| 202 | NEEDS_SOCKET = YesPlease |
| 203 | NEEDS_NSL = YesPlease |
| 204 | SHELL_PATH = /bin/bash |
| 205 | SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin |
| 206 | HAVE_ALLOCA_H = YesPlease |
| 207 | NO_REGEX = YesPlease |
| 208 | NO_MSGFMT_EXTENDED_OPTIONS = YesPlease |
| 209 | HAVE_DEV_TTY = YesPlease |
| 210 | ifeq ($(uname_R),5.6) |
| 211 | SOCKLEN_T = int |
| 212 | NO_HSTRERROR = YesPlease |
| 213 | NO_IPV6 = YesPlease |
| 214 | NO_SOCKADDR_STORAGE = YesPlease |
| 215 | NO_UNSETENV = YesPlease |
| 216 | NO_MKDTEMP = YesPlease |
| 217 | NO_MEMMEM = YesPlease |
| 218 | NO_SETENV = YesPlease |
| 219 | NO_STRCASESTR = YesPlease |
| 220 | NO_STRLCPY = YesPlease |
| 221 | NO_STRTOUMAX = YesPlease |
| 222 | GIT_TEST_CMP = cmp |
| 223 | endif |
| 224 | ifeq ($(uname_R),5.7) |
| 225 | NEEDS_RESOLV = YesPlease |
| 226 | NO_IPV6 = YesPlease |
| 227 | NO_SOCKADDR_STORAGE = YesPlease |
| 228 | NO_UNSETENV = YesPlease |
| 229 | NO_MKDTEMP = YesPlease |
| 230 | NO_MEMMEM = YesPlease |
| 231 | NO_SETENV = YesPlease |
| 232 | NO_STRCASESTR = YesPlease |
| 233 | NO_STRLCPY = YesPlease |
| 234 | NO_STRTOUMAX = YesPlease |
| 235 | GIT_TEST_CMP = cmp |
| 236 | endif |
| 237 | ifeq ($(uname_R),5.8) |
| 238 | NO_UNSETENV = YesPlease |
| 239 | NO_MKDTEMP = YesPlease |
| 240 | NO_MEMMEM = YesPlease |
| 241 | NO_SETENV = YesPlease |
| 242 | NO_STRCASESTR = YesPlease |
| 243 | NO_STRTOUMAX = YesPlease |
| 244 | GIT_TEST_CMP = cmp |
| 245 | endif |
| 246 | ifeq ($(uname_R),5.9) |
| 247 | NO_UNSETENV = YesPlease |
| 248 | NO_MKDTEMP = YesPlease |
| 249 | NO_MEMMEM = YesPlease |
| 250 | NO_SETENV = YesPlease |
| 251 | NO_STRCASESTR = YesPlease |
| 252 | NO_STRTOUMAX = YesPlease |
| 253 | GIT_TEST_CMP = cmp |
| 254 | endif |
| 255 | ifeq ($(uname_R),5.10) |
| 256 | NO_UNSETENV = YesPlease |
| 257 | NO_MKDTEMP = YesPlease |
| 258 | NO_MEMMEM = YesPlease |
| 259 | NO_SETENV = YesPlease |
| 260 | NO_STRCASESTR = YesPlease |
| 261 | GIT_TEST_CMP = cmp |
| 262 | endif |
| 263 | ifeq ($(uname_R),5.11) |
| 264 | NO_UNSETENV = YesPlease |
| 265 | NO_SETENV = YesPlease |
| 266 | GIT_TEST_CMP = cmp |
| 267 | endif |
| 268 | INSTALL = /usr/ucb/install |
| 269 | TAR = gtar |
| 270 | BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ |
| 271 | endif |
| 272 | ifeq ($(uname_O),Cygwin) |
| 273 | ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4) |
| 274 | NO_D_TYPE_IN_DIRENT = YesPlease |
| 275 | NO_STRCASESTR = YesPlease |
| 276 | NO_MEMMEM = YesPlease |
| 277 | NO_SYMLINK_HEAD = YesPlease |
| 278 | NO_IPV6 = YesPlease |
| 279 | OLD_ICONV = UnfortunatelyYes |
| 280 | # There are conflicting reports about this. |
| 281 | # On some boxes NO_MMAP is needed, and not so elsewhere. |
| 282 | # Try commenting this out if you suspect MMAP is more efficient |
| 283 | NO_MMAP = YesPlease |
| 284 | else |
| 285 | ifeq ($(shell expr "$(uname_R)" : '1\.7\.'),4) |
| 286 | NO_REGEX = UnfortunatelyYes |
| 287 | endif |
| 288 | endif |
| 289 | HAVE_DEV_TTY = YesPlease |
| 290 | HAVE_GETDELIM = YesPlease |
| 291 | HAVE_CLOCK_GETTIME = YesPlease |
| 292 | HAVE_CLOCK_MONOTONIC = YesPlease |
| 293 | HAVE_SYSINFO = YesPlease |
| 294 | CSPRNG_METHOD = arc4random |
| 295 | HAVE_ALLOCA_H = YesPlease |
| 296 | NEEDS_LIBICONV = YesPlease |
| 297 | NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes |
| 298 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease |
| 299 | X = .exe |
| 300 | UNRELIABLE_FSTAT = UnfortunatelyYes |
| 301 | OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo |
| 302 | MMAP_PREVENTS_DELETE = UnfortunatelyYes |
| 303 | COMPAT_OBJS += compat/win32/path-utils.o |
| 304 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 305 | endif |
| 306 | ifeq ($(uname_S),FreeBSD) |
| 307 | NEEDS_LIBICONV = YesPlease |
| 308 | # Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't. |
| 309 | # A typical version string looks like "10.2-RELEASE". |
| 310 | ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2) |
| 311 | OLD_ICONV = YesPlease |
| 312 | endif |
| 313 | ifeq ($(firstword $(subst -, ,$(uname_R))),10.0) |
| 314 | OLD_ICONV = YesPlease |
| 315 | endif |
| 316 | ifeq ($(firstword $(subst -, ,$(uname_R))),10.1) |
| 317 | OLD_ICONV = YesPlease |
| 318 | endif |
| 319 | ifeq ($(shell v=$(uname_R) && test $${v%%.*} -lt 12 && echo 1),1) |
| 320 | NO_MEMMEM = UnfortunatelyYes |
| 321 | endif |
| 322 | BASIC_CFLAGS += -I/usr/local/include |
| 323 | BASIC_LDFLAGS += -L/usr/local/lib |
| 324 | DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease |
| 325 | USE_ST_TIMESPEC = YesPlease |
| 326 | PYTHON_PATH = /usr/local/bin/python |
| 327 | PERL_PATH = /usr/local/bin/perl |
| 328 | HAVE_PATHS_H = YesPlease |
| 329 | HAVE_BSD_SYSCTL = YesPlease |
| 330 | HAVE_BSD_KERN_PROC_SYSCTL = YesPlease |
| 331 | CSPRNG_METHOD = arc4random |
| 332 | PAGER_ENV = LESS=FRX LV=-c MORE=FRX |
| 333 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 334 | FILENO_IS_A_MACRO = UnfortunatelyYes |
| 335 | endif |
| 336 | ifeq ($(uname_S),OpenBSD) |
| 337 | DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease |
| 338 | USE_ST_TIMESPEC = YesPlease |
| 339 | NEEDS_LIBICONV = YesPlease |
| 340 | BASIC_CFLAGS += -I/usr/local/include |
| 341 | BASIC_LDFLAGS += -L/usr/local/lib |
| 342 | HAVE_PATHS_H = YesPlease |
| 343 | HAVE_BSD_SYSCTL = YesPlease |
| 344 | CSPRNG_METHOD = arc4random |
| 345 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 346 | FILENO_IS_A_MACRO = UnfortunatelyYes |
| 347 | endif |
| 348 | ifeq ($(uname_S),MirBSD) |
| 349 | NO_STRCASESTR = YesPlease |
| 350 | NO_MEMMEM = YesPlease |
| 351 | USE_ST_TIMESPEC = YesPlease |
| 352 | NEEDS_LIBICONV = YesPlease |
| 353 | HAVE_PATHS_H = YesPlease |
| 354 | HAVE_BSD_SYSCTL = YesPlease |
| 355 | CSPRNG_METHOD = arc4random |
| 356 | endif |
| 357 | ifeq ($(uname_S),NetBSD) |
| 358 | ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) |
| 359 | NEEDS_LIBICONV = YesPlease |
| 360 | endif |
| 361 | BASIC_CFLAGS += -I/usr/pkg/include |
| 362 | BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib |
| 363 | USE_ST_TIMESPEC = YesPlease |
| 364 | HAVE_PATHS_H = YesPlease |
| 365 | HAVE_BSD_SYSCTL = YesPlease |
| 366 | HAVE_BSD_KERN_PROC_SYSCTL = YesPlease |
| 367 | CSPRNG_METHOD = arc4random |
| 368 | PROCFS_EXECUTABLE_PATH = /proc/curproc/exe |
| 369 | endif |
| 370 | ifeq ($(uname_S),AIX) |
| 371 | DEFAULT_PAGER = more |
| 372 | NO_STRCASESTR = YesPlease |
| 373 | NO_MEMMEM = YesPlease |
| 374 | NO_MKDTEMP = YesPlease |
| 375 | NO_STRLCPY = YesPlease |
| 376 | NO_NSEC = YesPlease |
| 377 | NO_REGEX = NeedsStartEnd |
| 378 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 379 | INTERNAL_QSORT = UnfortunatelyYes |
| 380 | NEEDS_LIBICONV = YesPlease |
| 381 | BASIC_CFLAGS += -D_LARGE_FILES |
| 382 | FILENO_IS_A_MACRO = UnfortunatelyYes |
| 383 | NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes |
| 384 | ifeq ($(shell expr "$(uname_V)" : '[1234]'),1) |
| 385 | NO_PTHREADS = YesPlease |
| 386 | else |
| 387 | PTHREAD_LIBS = -lpthread |
| 388 | endif |
| 389 | ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3) |
| 390 | INLINE = '' |
| 391 | endif |
| 392 | GIT_TEST_CMP = cmp |
| 393 | endif |
| 394 | ifeq ($(uname_S),GNU) |
| 395 | # GNU/Hurd |
| 396 | HAVE_ALLOCA_H = YesPlease |
| 397 | NO_STRLCPY = YesPlease |
| 398 | HAVE_PATHS_H = YesPlease |
| 399 | LIBC_CONTAINS_LIBINTL = YesPlease |
| 400 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 401 | endif |
| 402 | ifeq ($(uname_S),IRIX) |
| 403 | NO_SETENV = YesPlease |
| 404 | NO_UNSETENV = YesPlease |
| 405 | NO_STRCASESTR = YesPlease |
| 406 | NO_MEMMEM = YesPlease |
| 407 | NO_MKDTEMP = YesPlease |
| 408 | # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads |
| 409 | # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set), |
| 410 | # git dies with a segmentation fault when trying to access the first |
| 411 | # entry of a reflog. The conservative choice is made to always set |
| 412 | # NO_MMAP. If you suspect that your compiler is not affected by this |
| 413 | # issue, comment out the NO_MMAP statement. |
| 414 | NO_MMAP = YesPlease |
| 415 | NO_REGEX = YesPlease |
| 416 | SNPRINTF_RETURNS_BOGUS = YesPlease |
| 417 | SHELL_PATH = /usr/gnu/bin/bash |
| 418 | NEEDS_LIBGEN = YesPlease |
| 419 | endif |
| 420 | ifeq ($(uname_S),IRIX64) |
| 421 | NO_SETENV = YesPlease |
| 422 | NO_UNSETENV = YesPlease |
| 423 | NO_STRCASESTR = YesPlease |
| 424 | NO_MEMMEM = YesPlease |
| 425 | NO_MKDTEMP = YesPlease |
| 426 | # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads |
| 427 | # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set), |
| 428 | # git dies with a segmentation fault when trying to access the first |
| 429 | # entry of a reflog. The conservative choice is made to always set |
| 430 | # NO_MMAP. If you suspect that your compiler is not affected by this |
| 431 | # issue, comment out the NO_MMAP statement. |
| 432 | NO_MMAP = YesPlease |
| 433 | NO_REGEX = YesPlease |
| 434 | SNPRINTF_RETURNS_BOGUS = YesPlease |
| 435 | SHELL_PATH = /usr/gnu/bin/bash |
| 436 | NEEDS_LIBGEN = YesPlease |
| 437 | endif |
| 438 | ifeq ($(uname_S),HP-UX) |
| 439 | INLINE = __inline |
| 440 | NO_IPV6 = YesPlease |
| 441 | NO_SETENV = YesPlease |
| 442 | NO_STRCASESTR = YesPlease |
| 443 | NO_MEMMEM = YesPlease |
| 444 | NO_STRLCPY = YesPlease |
| 445 | NO_MKDTEMP = YesPlease |
| 446 | NO_UNSETENV = YesPlease |
| 447 | NO_HSTRERROR = YesPlease |
| 448 | NO_SYS_SELECT_H = YesPlease |
| 449 | SNPRINTF_RETURNS_BOGUS = YesPlease |
| 450 | NO_NSEC = YesPlease |
| 451 | ifeq ($(uname_R),B.11.00) |
| 452 | NO_INET_NTOP = YesPlease |
| 453 | NO_INET_PTON = YesPlease |
| 454 | endif |
| 455 | ifeq ($(uname_R),B.10.20) |
| 456 | # Override HP-UX 11.x setting: |
| 457 | INLINE = |
| 458 | SOCKLEN_T = size_t |
| 459 | NO_PREAD = YesPlease |
| 460 | NO_INET_NTOP = YesPlease |
| 461 | NO_INET_PTON = YesPlease |
| 462 | endif |
| 463 | GIT_TEST_CMP = cmp |
| 464 | endif |
| 465 | ifeq ($(uname_S),Windows) |
| 466 | GIT_VERSION := $(GIT_VERSION).MSVC |
| 467 | pathsep = ; |
| 468 | # Assume that this is built in Git for Windows' SDK |
| 469 | ifeq (MINGW32,$(MSYSTEM)) |
| 470 | prefix = /mingw32 |
| 471 | else |
| 472 | ifeq (CLANGARM64,$(MSYSTEM)) |
| 473 | prefix = /clangarm64 |
| 474 | else |
| 475 | prefix = /mingw64 |
| 476 | endif |
| 477 | endif |
| 478 | # Prepend MSVC 64-bit tool-chain to PATH. |
| 479 | # |
| 480 | # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a |
| 481 | # link.exe next to, and required by, cl.exe, we have to prepend this |
| 482 | # onto the existing $PATH. |
| 483 | # |
| 484 | SANE_TOOL_PATH ?= $(msvc_bin_dir_msys) |
| 485 | HAVE_ALLOCA_H = YesPlease |
| 486 | NO_PREAD = YesPlease |
| 487 | NO_WRITEV = YesPlease |
| 488 | NEEDS_CRYPTO_WITH_SSL = YesPlease |
| 489 | NO_LIBGEN_H = YesPlease |
| 490 | NO_POLL = YesPlease |
| 491 | NO_SYMLINK_HEAD = YesPlease |
| 492 | NO_IPV6 = YesPlease |
| 493 | NO_SETENV = YesPlease |
| 494 | NO_STRCASESTR = YesPlease |
| 495 | NO_STRLCPY = YesPlease |
| 496 | NO_MEMMEM = YesPlease |
| 497 | NEEDS_LIBICONV = YesPlease |
| 498 | NO_STRTOUMAX = YesPlease |
| 499 | NO_MKDTEMP = YesPlease |
| 500 | NO_INTTYPES_H = YesPlease |
| 501 | CSPRNG_METHOD = rtlgenrandom |
| 502 | # VS2015 with UCRT claims that snprintf and friends are C99 compliant, |
| 503 | # so we don't need this: |
| 504 | # |
| 505 | # SNPRINTF_RETURNS_BOGUS = YesPlease |
| 506 | |
| 507 | # The builtin FSMonitor requires Named Pipes and Threads on Windows. |
| 508 | # These are always available, so we do not have to conditionally |
| 509 | # support it. |
| 510 | FSMONITOR_DAEMON_BACKEND = win32 |
| 511 | FSMONITOR_OS_SETTINGS = win32 |
| 512 | |
| 513 | NO_SVN_TESTS = YesPlease |
| 514 | RUNTIME_PREFIX = YesPlease |
| 515 | HAVE_WPGMPTR = YesWeDo |
| 516 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease |
| 517 | USE_WIN32_IPC = YesPlease |
| 518 | USE_WIN32_MMAP = YesPlease |
| 519 | MMAP_PREVENTS_DELETE = UnfortunatelyYes |
| 520 | UNRELIABLE_FSTAT = UnfortunatelyYes |
| 521 | OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo |
| 522 | NO_REGEX = YesPlease |
| 523 | NO_GETTEXT = YesPlease |
| 524 | NO_PYTHON = YesPlease |
| 525 | ETAGS_TARGET = ETAGS |
| 526 | NO_POSIX_GOODIES = UnfortunatelyYes |
| 527 | NATIVE_CRLF = YesPlease |
| 528 | DEFAULT_HELP_FORMAT = html |
| 529 | ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix)))) |
| 530 | # Move system config into top-level /etc/ |
| 531 | ETC_GITCONFIG = ../etc/gitconfig |
| 532 | ETC_GITATTRIBUTES = ../etc/gitattributes |
| 533 | endif |
| 534 | |
| 535 | CC = compat/vcbuild/scripts/clink.pl |
| 536 | AR = compat/vcbuild/scripts/lib.pl |
| 537 | CFLAGS = |
| 538 | BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE |
| 539 | COMPAT_OBJS = compat/msvc.o compat/winansi.o \ |
| 540 | compat/win32/flush.o \ |
| 541 | compat/win32/path-utils.o \ |
| 542 | compat/win32/pthread.o compat/win32/syslog.o \ |
| 543 | compat/win32/trace2_win32_process_info.o \ |
| 544 | compat/win32/dirent.o |
| 545 | COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" |
| 546 | BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE |
| 547 | # invalidcontinue.obj allows Git's source code to close the same file |
| 548 | # handle twice, or to access the osfhandle of an already-closed stdout |
| 549 | # See https://msdn.microsoft.com/en-us/library/ms235330.aspx |
| 550 | EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib |
| 551 | PTHREAD_LIBS = |
| 552 | lib = |
| 553 | BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes) |
| 554 | ifndef DEBUG |
| 555 | BASIC_CFLAGS += $(vcpkg_rel_lib) |
| 556 | else |
| 557 | BASIC_CFLAGS += $(vcpkg_dbg_lib) |
| 558 | endif |
| 559 | BASIC_CFLAGS += $(sdk_libs) $(msvc_libs) |
| 560 | |
| 561 | ifneq ($(USE_MSVC_CRTDBG),) |
| 562 | # Optionally enable memory leak reporting. |
| 563 | BASIC_CFLAGS += -DUSE_MSVC_CRTDBG |
| 564 | endif |
| 565 | # Always give "-Zi" to the compiler and "-debug" to linker (even in |
| 566 | # release mode) to force a PDB to be generated (like RelWithDebInfo). |
| 567 | BASIC_CFLAGS += -Zi |
| 568 | BASIC_LDFLAGS += -debug -Zf |
| 569 | |
| 570 | ifdef NO_SAFESEH |
| 571 | LDFLAGS += -SAFESEH:NO |
| 572 | endif |
| 573 | |
| 574 | ifndef DEBUG |
| 575 | BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG |
| 576 | BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP |
| 577 | AR += -LTCG |
| 578 | else |
| 579 | BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG |
| 580 | endif |
| 581 | X = .exe |
| 582 | |
| 583 | EXTRA_PROGRAMS += headless-git$X |
| 584 | |
| 585 | compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS |
| 586 | endif |
| 587 | ifeq ($(uname_S),Interix) |
| 588 | NO_INITGROUPS = YesPlease |
| 589 | NO_IPV6 = YesPlease |
| 590 | NO_MEMMEM = YesPlease |
| 591 | NO_MKDTEMP = YesPlease |
| 592 | NO_STRTOUMAX = YesPlease |
| 593 | NO_NSEC = YesPlease |
| 594 | ifeq ($(uname_R),3.5) |
| 595 | NO_INET_NTOP = YesPlease |
| 596 | NO_INET_PTON = YesPlease |
| 597 | NO_SOCKADDR_STORAGE = YesPlease |
| 598 | endif |
| 599 | ifeq ($(uname_R),5.2) |
| 600 | NO_INET_NTOP = YesPlease |
| 601 | NO_INET_PTON = YesPlease |
| 602 | NO_SOCKADDR_STORAGE = YesPlease |
| 603 | endif |
| 604 | endif |
| 605 | ifeq ($(uname_S),Minix) |
| 606 | NO_IPV6 = YesPlease |
| 607 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease |
| 608 | NO_NSEC = YesPlease |
| 609 | NEEDS_LIBGEN = |
| 610 | NEEDS_CRYPTO_WITH_SSL = YesPlease |
| 611 | NEEDS_RESOLV = |
| 612 | NO_HSTRERROR = YesPlease |
| 613 | NO_MMAP = YesPlease |
| 614 | NO_CURL = |
| 615 | NO_EXPAT = |
| 616 | endif |
| 617 | ifeq ($(uname_S),NONSTOP_KERNEL) |
| 618 | # Needs some C99 features, "inline" is just one of them. |
| 619 | # INLINE='' would just replace one set of warnings with another and |
| 620 | # still not compile in c89 mode, due to non-const array initializations. |
| 621 | CC = cc -c99 |
| 622 | # Build down-rev compatible objects that don't use our new getopt_long. |
| 623 | ifeq ($(uname_R).$(uname_V),J06.21) |
| 624 | CC += -WRVU=J06.20 |
| 625 | endif |
| 626 | ifeq ($(uname_R).$(uname_V),L17.02) |
| 627 | CC += -WRVU=L16.05 |
| 628 | endif |
| 629 | # Disable all optimization, seems to result in bad code, with -O or -O2 |
| 630 | # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects |
| 631 | # abends on "git push". Needs more investigation. |
| 632 | CFLAGS = -g -O0 -Winline |
| 633 | # We'd want it to be here. |
| 634 | prefix = /usr/local |
| 635 | # perl and python must be in /usr/bin on NonStop - supplied by HPE |
| 636 | # with operating system in that managed directory. |
| 637 | PERL_PATH = /usr/bin/perl |
| 638 | PYTHON_PATH = /usr/bin/python |
| 639 | # The current /usr/coreutils/rm at lowest support level does not work |
| 640 | # with the git test structure. Long paths as in |
| 641 | # 'trash directory...' cause rm to terminate prematurely without fully |
| 642 | # removing the directory at OS releases J06.21 and L17.02. |
| 643 | # Default to the older rm until those two releases are deprecated. |
| 644 | RM = /bin/rm -f |
| 645 | NEEDS_CRYPTO_WITH_SSL = YesPlease |
| 646 | HAVE_DEV_TTY = YesPlease |
| 647 | HAVE_LIBCHARSET_H = YesPlease |
| 648 | HAVE_STRINGS_H = YesPlease |
| 649 | NEEDS_LIBICONV = YesPlease |
| 650 | NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease |
| 651 | NO_SYS_SELECT_H = UnfortunatelyYes |
| 652 | NO_D_TYPE_IN_DIRENT = YesPlease |
| 653 | NO_GETTEXT = YesPlease |
| 654 | NO_HSTRERROR = YesPlease |
| 655 | NO_STRCASESTR = YesPlease |
| 656 | NO_MEMMEM = YesPlease |
| 657 | NO_STRLCPY = YesPlease |
| 658 | NO_SETENV = YesPlease |
| 659 | NO_UNSETENV = YesPlease |
| 660 | NO_MKDTEMP = YesPlease |
| 661 | # Currently libiconv-1.9.1. |
| 662 | OLD_ICONV = UnfortunatelyYes |
| 663 | NO_REGEX = NeedsStartEnd |
| 664 | NO_PTHREADS = UnfortunatelyYes |
| 665 | FREAD_READS_DIRECTORIES = UnfortunatelyYes |
| 666 | |
| 667 | # Not detected (nor checked for) by './configure'. |
| 668 | # We don't have SA_RESTART on NonStop, unfortunalety. |
| 669 | COMPAT_CFLAGS += -DSA_RESTART=0 |
| 670 | # Apparently needed in compat/fnmatch/fnmatch.c. |
| 671 | COMPAT_CFLAGS += -DHAVE_STRING_H=1 |
| 672 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease |
| 673 | NO_NSEC = YesPlease |
| 674 | NO_PREAD = YesPlease |
| 675 | NO_MMAP = YesPlease |
| 676 | NO_POLL = YesPlease |
| 677 | NO_INTPTR_T = UnfortunatelyYes |
| 678 | CSPRNG_METHOD = openssl |
| 679 | SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin |
| 680 | SHELL_PATH = /usr/coreutils/bin/bash |
| 681 | endif |
| 682 | ifeq ($(uname_S),OS/390) |
| 683 | NO_SYS_POLL_H = YesPlease |
| 684 | NO_STRCASESTR = YesPlease |
| 685 | NO_REGEX = YesPlease |
| 686 | NO_MMAP = YesPlease |
| 687 | NO_NSEC = YesPlease |
| 688 | NO_STRLCPY = YesPlease |
| 689 | NO_MEMMEM = YesPlease |
| 690 | NO_GECOS_IN_PWENT = YesPlease |
| 691 | HAVE_STRINGS_H = YesPlease |
| 692 | NEEDS_MODE_TRANSLATION = YesPlease |
| 693 | HAVE_ZOS_GET_EXECUTABLE_PATH = YesPlease |
| 694 | endif |
| 695 | ifeq ($(uname_S),MINGW) |
| 696 | ifeq ($(shell expr "$(uname_R)" : '1\.'),2) |
| 697 | $(error "Building with MSys is no longer supported") |
| 698 | endif |
| 699 | pathsep = ; |
| 700 | HAVE_ALLOCA_H = YesPlease |
| 701 | NO_PREAD = YesPlease |
| 702 | NO_WRITEV = YesPlease |
| 703 | NEEDS_CRYPTO_WITH_SSL = YesPlease |
| 704 | NO_LIBGEN_H = YesPlease |
| 705 | NO_POLL = YesPlease |
| 706 | NO_SYMLINK_HEAD = YesPlease |
| 707 | NO_SETENV = YesPlease |
| 708 | NO_STRCASESTR = YesPlease |
| 709 | NO_STRLCPY = YesPlease |
| 710 | NO_MEMMEM = YesPlease |
| 711 | NEEDS_LIBICONV = YesPlease |
| 712 | NO_STRTOUMAX = YesPlease |
| 713 | NO_MKDTEMP = YesPlease |
| 714 | NO_SVN_TESTS = YesPlease |
| 715 | |
| 716 | # The builtin FSMonitor requires Named Pipes and Threads on Windows. |
| 717 | # These are always available, so we do not have to conditionally |
| 718 | # support it. |
| 719 | FSMONITOR_DAEMON_BACKEND = win32 |
| 720 | FSMONITOR_OS_SETTINGS = win32 |
| 721 | |
| 722 | RUNTIME_PREFIX = YesPlease |
| 723 | HAVE_WPGMPTR = YesWeDo |
| 724 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease |
| 725 | USE_WIN32_IPC = YesPlease |
| 726 | USE_WIN32_MMAP = YesPlease |
| 727 | MMAP_PREVENTS_DELETE = UnfortunatelyYes |
| 728 | UNRELIABLE_FSTAT = UnfortunatelyYes |
| 729 | OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo |
| 730 | NO_REGEX = YesPlease |
| 731 | ETAGS_TARGET = ETAGS |
| 732 | NO_POSIX_GOODIES = UnfortunatelyYes |
| 733 | DEFAULT_HELP_FORMAT = html |
| 734 | HAVE_PLATFORM_PROCINFO = YesPlease |
| 735 | CSPRNG_METHOD = rtlgenrandom |
| 736 | BASIC_LDFLAGS += -municode |
| 737 | COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32 |
| 738 | COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" |
| 739 | COMPAT_OBJS += compat/mingw.o compat/winansi.o \ |
| 740 | compat/win32/trace2_win32_process_info.o \ |
| 741 | compat/win32/flush.o \ |
| 742 | compat/win32/path-utils.o \ |
| 743 | compat/win32/pthread.o compat/win32/syslog.o \ |
| 744 | compat/win32/dirent.o |
| 745 | BASIC_CFLAGS += -DWIN32 |
| 746 | EXTLIBS += -lws2_32 |
| 747 | GITLIBS += git.res |
| 748 | PTHREAD_LIBS = |
| 749 | RC = windres -O coff |
| 750 | NATIVE_CRLF = YesPlease |
| 751 | X = .exe |
| 752 | # MSys2 |
| 753 | prefix = /usr/ |
| 754 | # Enable DEP |
| 755 | BASIC_LDFLAGS += -Wl,--nxcompat |
| 756 | # Enable ASLR (unless debugging) |
| 757 | ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS)))) |
| 758 | BASIC_LDFLAGS += -Wl,--dynamicbase |
| 759 | endif |
| 760 | ifeq (MINGW32,$(MSYSTEM)) |
| 761 | prefix = /mingw32 |
| 762 | HOST_CPU = i686 |
| 763 | BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup |
| 764 | endif |
| 765 | ifeq (MINGW64,$(MSYSTEM)) |
| 766 | prefix = /mingw64 |
| 767 | HOST_CPU = x86_64 |
| 768 | BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup |
| 769 | else ifeq (CLANGARM64,$(MSYSTEM)) |
| 770 | prefix = /clangarm64 |
| 771 | HOST_CPU = aarch64 |
| 772 | BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup |
| 773 | else |
| 774 | COMPAT_CFLAGS += -D_USE_32BIT_TIME_T |
| 775 | BASIC_LDFLAGS += -Wl,--large-address-aware |
| 776 | endif |
| 777 | CC = gcc |
| 778 | COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \ |
| 779 | -fstack-protector-strong |
| 780 | EXTLIBS += -lntdll |
| 781 | EXTRA_PROGRAMS += headless-git$X |
| 782 | INSTALL = /bin/install |
| 783 | INTERNAL_QSORT = YesPlease |
| 784 | HAVE_LIBCHARSET_H = YesPlease |
| 785 | USE_GETTEXT_SCHEME = fallthrough |
| 786 | USE_LIBPCRE = YesPlease |
| 787 | ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix)))) |
| 788 | # Move system config into top-level /etc/ |
| 789 | ETC_GITCONFIG = ../etc/gitconfig |
| 790 | ETC_GITATTRIBUTES = ../etc/gitattributes |
| 791 | endif |
| 792 | endif |
| 793 | ifeq ($(uname_S),QNX) |
| 794 | COMPAT_CFLAGS += -DSA_RESTART=0 |
| 795 | EXPAT_NEEDS_XMLPARSE_H = YesPlease |
| 796 | HAVE_STRINGS_H = YesPlease |
| 797 | NEEDS_SOCKET = YesPlease |
| 798 | NO_GETPAGESIZE = YesPlease |
| 799 | NO_ICONV = YesPlease |
| 800 | NO_MEMMEM = YesPlease |
| 801 | NO_MKDTEMP = YesPlease |
| 802 | NO_NSEC = YesPlease |
| 803 | NO_PTHREADS = YesPlease |
| 804 | NO_STRCASESTR = YesPlease |
| 805 | NO_STRLCPY = YesPlease |
| 806 | endif |