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