THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

775 lines
24KB

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