]>
Commit | Line | Data |
---|---|---|
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 | # 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 | |
71 | endif | |
72 | ifeq ($(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 | |
79 | endif | |
80 | ifeq ($(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 | |
96 | endif | |
97 | ifeq ($(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 | |
118 | endif | |
119 | ifeq ($(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 | |
186 | endif | |
187 | ifeq ($(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__ | |
257 | endif | |
258 | ifeq ($(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 | |
291 | endif | |
292 | ifeq ($(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 | NO_MEMMEM = YesPlease | |
306 | BASIC_CFLAGS += -I/usr/local/include | |
307 | BASIC_LDFLAGS += -L/usr/local/lib | |
308 | DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease | |
309 | USE_ST_TIMESPEC = YesPlease | |
310 | ifeq ($(shell expr "$(uname_R)" : '4\.'),2) | |
311 | PTHREAD_LIBS = -pthread | |
312 | NO_UINTMAX_T = YesPlease | |
313 | NO_STRTOUMAX = YesPlease | |
314 | endif | |
315 | PYTHON_PATH = /usr/local/bin/python | |
316 | PERL_PATH = /usr/local/bin/perl | |
317 | HAVE_PATHS_H = YesPlease | |
318 | HAVE_BSD_SYSCTL = YesPlease | |
319 | HAVE_BSD_KERN_PROC_SYSCTL = YesPlease | |
320 | CSPRNG_METHOD = arc4random | |
321 | PAGER_ENV = LESS=FRX LV=-c MORE=FRX | |
322 | FREAD_READS_DIRECTORIES = UnfortunatelyYes | |
323 | FILENO_IS_A_MACRO = UnfortunatelyYes | |
324 | endif | |
325 | ifeq ($(uname_S),OpenBSD) | |
326 | DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease | |
327 | USE_ST_TIMESPEC = YesPlease | |
328 | NEEDS_LIBICONV = YesPlease | |
329 | BASIC_CFLAGS += -I/usr/local/include | |
330 | BASIC_LDFLAGS += -L/usr/local/lib | |
331 | HAVE_PATHS_H = YesPlease | |
332 | HAVE_BSD_SYSCTL = YesPlease | |
333 | CSPRNG_METHOD = arc4random | |
334 | FREAD_READS_DIRECTORIES = UnfortunatelyYes | |
335 | FILENO_IS_A_MACRO = UnfortunatelyYes | |
336 | endif | |
337 | ifeq ($(uname_S),MirBSD) | |
338 | NO_STRCASESTR = YesPlease | |
339 | NO_MEMMEM = YesPlease | |
340 | USE_ST_TIMESPEC = YesPlease | |
341 | NEEDS_LIBICONV = YesPlease | |
342 | HAVE_PATHS_H = YesPlease | |
343 | HAVE_BSD_SYSCTL = YesPlease | |
344 | CSPRNG_METHOD = arc4random | |
345 | endif | |
346 | ifeq ($(uname_S),NetBSD) | |
347 | ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) | |
348 | NEEDS_LIBICONV = YesPlease | |
349 | endif | |
350 | BASIC_CFLAGS += -I/usr/pkg/include | |
351 | BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib | |
352 | USE_ST_TIMESPEC = YesPlease | |
353 | HAVE_PATHS_H = YesPlease | |
354 | HAVE_BSD_SYSCTL = YesPlease | |
355 | HAVE_BSD_KERN_PROC_SYSCTL = YesPlease | |
356 | CSPRNG_METHOD = arc4random | |
357 | PROCFS_EXECUTABLE_PATH = /proc/curproc/exe | |
358 | endif | |
359 | ifeq ($(uname_S),AIX) | |
360 | DEFAULT_PAGER = more | |
361 | NO_STRCASESTR = YesPlease | |
362 | NO_MEMMEM = YesPlease | |
363 | NO_MKDTEMP = YesPlease | |
364 | NO_STRLCPY = YesPlease | |
365 | NO_NSEC = YesPlease | |
366 | NO_REGEX = NeedsStartEnd | |
367 | FREAD_READS_DIRECTORIES = UnfortunatelyYes | |
368 | INTERNAL_QSORT = UnfortunatelyYes | |
369 | NEEDS_LIBICONV = YesPlease | |
370 | BASIC_CFLAGS += -D_LARGE_FILES | |
371 | FILENO_IS_A_MACRO = UnfortunatelyYes | |
372 | NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes | |
373 | ifeq ($(shell expr "$(uname_V)" : '[1234]'),1) | |
374 | NO_PTHREADS = YesPlease | |
375 | else | |
376 | PTHREAD_LIBS = -lpthread | |
377 | endif | |
378 | ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3) | |
379 | INLINE = '' | |
380 | endif | |
381 | GIT_TEST_CMP = cmp | |
382 | endif | |
383 | ifeq ($(uname_S),GNU) | |
384 | # GNU/Hurd | |
385 | HAVE_ALLOCA_H = YesPlease | |
386 | NO_STRLCPY = YesPlease | |
387 | HAVE_PATHS_H = YesPlease | |
388 | LIBC_CONTAINS_LIBINTL = YesPlease | |
389 | FREAD_READS_DIRECTORIES = UnfortunatelyYes | |
390 | endif | |
391 | ifeq ($(uname_S),IRIX) | |
392 | NO_SETENV = YesPlease | |
393 | NO_UNSETENV = YesPlease | |
394 | NO_STRCASESTR = YesPlease | |
395 | NO_MEMMEM = YesPlease | |
396 | NO_MKDTEMP = YesPlease | |
397 | # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads | |
398 | # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set), | |
399 | # git dies with a segmentation fault when trying to access the first | |
400 | # entry of a reflog. The conservative choice is made to always set | |
401 | # NO_MMAP. If you suspect that your compiler is not affected by this | |
402 | # issue, comment out the NO_MMAP statement. | |
403 | NO_MMAP = YesPlease | |
404 | NO_REGEX = YesPlease | |
405 | SNPRINTF_RETURNS_BOGUS = YesPlease | |
406 | SHELL_PATH = /usr/gnu/bin/bash | |
407 | NEEDS_LIBGEN = YesPlease | |
408 | endif | |
409 | ifeq ($(uname_S),IRIX64) | |
410 | NO_SETENV = YesPlease | |
411 | NO_UNSETENV = YesPlease | |
412 | NO_STRCASESTR = YesPlease | |
413 | NO_MEMMEM = YesPlease | |
414 | NO_MKDTEMP = YesPlease | |
415 | # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads | |
416 | # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set), | |
417 | # git dies with a segmentation fault when trying to access the first | |
418 | # entry of a reflog. The conservative choice is made to always set | |
419 | # NO_MMAP. If you suspect that your compiler is not affected by this | |
420 | # issue, comment out the NO_MMAP statement. | |
421 | NO_MMAP = YesPlease | |
422 | NO_REGEX = YesPlease | |
423 | SNPRINTF_RETURNS_BOGUS = YesPlease | |
424 | SHELL_PATH = /usr/gnu/bin/bash | |
425 | NEEDS_LIBGEN = YesPlease | |
426 | endif | |
427 | ifeq ($(uname_S),HP-UX) | |
428 | INLINE = __inline | |
429 | NO_IPV6 = YesPlease | |
430 | NO_SETENV = YesPlease | |
431 | NO_STRCASESTR = YesPlease | |
432 | NO_MEMMEM = YesPlease | |
433 | NO_STRLCPY = YesPlease | |
434 | NO_MKDTEMP = YesPlease | |
435 | NO_UNSETENV = YesPlease | |
436 | NO_HSTRERROR = YesPlease | |
437 | NO_SYS_SELECT_H = YesPlease | |
438 | SNPRINTF_RETURNS_BOGUS = YesPlease | |
439 | NO_NSEC = YesPlease | |
440 | ifeq ($(uname_R),B.11.00) | |
441 | NO_INET_NTOP = YesPlease | |
442 | NO_INET_PTON = YesPlease | |
443 | endif | |
444 | ifeq ($(uname_R),B.10.20) | |
445 | # Override HP-UX 11.x setting: | |
446 | INLINE = | |
447 | SOCKLEN_T = size_t | |
448 | NO_PREAD = YesPlease | |
449 | NO_INET_NTOP = YesPlease | |
450 | NO_INET_PTON = YesPlease | |
451 | endif | |
452 | GIT_TEST_CMP = cmp | |
453 | endif | |
454 | ifeq ($(uname_S),Windows) | |
455 | GIT_VERSION := $(GIT_VERSION).MSVC | |
456 | pathsep = ; | |
457 | # Assume that this is built in Git for Windows' SDK | |
458 | ifeq (MINGW32,$(MSYSTEM)) | |
459 | prefix = /mingw32 | |
460 | else | |
461 | ifeq (CLANGARM64,$(MSYSTEM)) | |
462 | prefix = /clangarm64 | |
463 | else | |
464 | prefix = /mingw64 | |
465 | endif | |
466 | endif | |
467 | # Prepend MSVC 64-bit tool-chain to PATH. | |
468 | # | |
469 | # A regular Git Bash *does not* have cl.exe in its $PATH. As there is a | |
470 | # link.exe next to, and required by, cl.exe, we have to prepend this | |
471 | # onto the existing $PATH. | |
472 | # | |
473 | SANE_TOOL_PATH ?= $(msvc_bin_dir_msys) | |
474 | HAVE_ALLOCA_H = YesPlease | |
475 | NO_PREAD = YesPlease | |
476 | NEEDS_CRYPTO_WITH_SSL = YesPlease | |
477 | NO_LIBGEN_H = YesPlease | |
478 | NO_POLL = YesPlease | |
479 | NO_SYMLINK_HEAD = YesPlease | |
480 | NO_IPV6 = YesPlease | |
481 | NO_SETENV = YesPlease | |
482 | NO_STRCASESTR = YesPlease | |
483 | NO_STRLCPY = YesPlease | |
484 | NO_MEMMEM = YesPlease | |
485 | NEEDS_LIBICONV = YesPlease | |
486 | NO_STRTOUMAX = YesPlease | |
487 | NO_MKDTEMP = YesPlease | |
488 | NO_INTTYPES_H = YesPlease | |
489 | CSPRNG_METHOD = rtlgenrandom | |
490 | # VS2015 with UCRT claims that snprintf and friends are C99 compliant, | |
491 | # so we don't need this: | |
492 | # | |
493 | # SNPRINTF_RETURNS_BOGUS = YesPlease | |
494 | ||
495 | # The builtin FSMonitor requires Named Pipes and Threads on Windows. | |
496 | # These are always available, so we do not have to conditionally | |
497 | # support it. | |
498 | FSMONITOR_DAEMON_BACKEND = win32 | |
499 | FSMONITOR_OS_SETTINGS = win32 | |
500 | ||
501 | NO_SVN_TESTS = YesPlease | |
502 | RUNTIME_PREFIX = YesPlease | |
503 | HAVE_WPGMPTR = YesWeDo | |
504 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease | |
505 | USE_WIN32_IPC = YesPlease | |
506 | USE_WIN32_MMAP = YesPlease | |
507 | MMAP_PREVENTS_DELETE = UnfortunatelyYes | |
508 | # USE_NED_ALLOCATOR = YesPlease | |
509 | UNRELIABLE_FSTAT = UnfortunatelyYes | |
510 | OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo | |
511 | NO_REGEX = YesPlease | |
512 | NO_GETTEXT = YesPlease | |
513 | NO_PYTHON = YesPlease | |
514 | ETAGS_TARGET = ETAGS | |
515 | NO_POSIX_GOODIES = UnfortunatelyYes | |
516 | NATIVE_CRLF = YesPlease | |
517 | DEFAULT_HELP_FORMAT = html | |
518 | ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix)))) | |
519 | # Move system config into top-level /etc/ | |
520 | ETC_GITCONFIG = ../etc/gitconfig | |
521 | ETC_GITATTRIBUTES = ../etc/gitattributes | |
522 | endif | |
523 | ||
524 | CC = compat/vcbuild/scripts/clink.pl | |
525 | AR = compat/vcbuild/scripts/lib.pl | |
526 | CFLAGS = | |
527 | BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE | |
528 | COMPAT_OBJS = compat/msvc.o compat/winansi.o \ | |
529 | compat/win32/flush.o \ | |
530 | compat/win32/path-utils.o \ | |
531 | compat/win32/pthread.o compat/win32/syslog.o \ | |
532 | compat/win32/trace2_win32_process_info.o \ | |
533 | compat/win32/dirent.o | |
534 | COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\" | |
535 | BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE | |
536 | # invalidcontinue.obj allows Git's source code to close the same file | |
537 | # handle twice, or to access the osfhandle of an already-closed stdout | |
538 | # See https://msdn.microsoft.com/en-us/library/ms235330.aspx | |
539 | EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib | |
540 | PTHREAD_LIBS = | |
541 | lib = | |
542 | BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes) | |
543 | ifndef DEBUG | |
544 | BASIC_CFLAGS += $(vcpkg_rel_lib) | |
545 | else | |
546 | BASIC_CFLAGS += $(vcpkg_dbg_lib) | |
547 | endif | |
548 | BASIC_CFLAGS += $(sdk_libs) $(msvc_libs) | |
549 | ||
550 | ifneq ($(USE_MSVC_CRTDBG),) | |
551 | # Optionally enable memory leak reporting. | |
552 | BASIC_CFLAGS += -DUSE_MSVC_CRTDBG | |
553 | endif | |
554 | # Always give "-Zi" to the compiler and "-debug" to linker (even in | |
555 | # release mode) to force a PDB to be generated (like RelWithDebInfo). | |
556 | BASIC_CFLAGS += -Zi | |
557 | BASIC_LDFLAGS += -debug -Zf | |
558 | ||
559 | ifdef NO_SAFESEH | |
560 | LDFLAGS += -SAFESEH:NO | |
561 | endif | |
562 | ||
563 | ifndef DEBUG | |
564 | BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG | |
565 | BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP | |
566 | AR += -LTCG | |
567 | else | |
568 | BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG | |
569 | endif | |
570 | X = .exe | |
571 | ||
572 | EXTRA_PROGRAMS += headless-git$X | |
573 | ||
574 | compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS | |
575 | endif | |
576 | ifeq ($(uname_S),Interix) | |
577 | NO_INITGROUPS = YesPlease | |
578 | NO_IPV6 = YesPlease | |
579 | NO_MEMMEM = YesPlease | |
580 | NO_MKDTEMP = YesPlease | |
581 | NO_STRTOUMAX = YesPlease | |
582 | NO_NSEC = YesPlease | |
583 | ifeq ($(uname_R),3.5) | |
584 | NO_INET_NTOP = YesPlease | |
585 | NO_INET_PTON = YesPlease | |
586 | NO_SOCKADDR_STORAGE = YesPlease | |
587 | endif | |
588 | ifeq ($(uname_R),5.2) | |
589 | NO_INET_NTOP = YesPlease | |
590 | NO_INET_PTON = YesPlease | |
591 | NO_SOCKADDR_STORAGE = YesPlease | |
592 | endif | |
593 | endif | |
594 | ifeq ($(uname_S),Minix) | |
595 | NO_IPV6 = YesPlease | |
596 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease | |
597 | NO_NSEC = YesPlease | |
598 | NEEDS_LIBGEN = | |
599 | NEEDS_CRYPTO_WITH_SSL = YesPlease | |
600 | NEEDS_RESOLV = | |
601 | NO_HSTRERROR = YesPlease | |
602 | NO_MMAP = YesPlease | |
603 | NO_CURL = | |
604 | NO_EXPAT = | |
605 | endif | |
606 | ifeq ($(uname_S),NONSTOP_KERNEL) | |
607 | # Needs some C99 features, "inline" is just one of them. | |
608 | # INLINE='' would just replace one set of warnings with another and | |
609 | # still not compile in c89 mode, due to non-const array initializations. | |
610 | CC = cc -c99 | |
611 | # Build down-rev compatible objects that don't use our new getopt_long. | |
612 | ifeq ($(uname_R).$(uname_V),J06.21) | |
613 | CC += -WRVU=J06.20 | |
614 | endif | |
615 | ifeq ($(uname_R).$(uname_V),L17.02) | |
616 | CC += -WRVU=L16.05 | |
617 | endif | |
618 | # Disable all optimization, seems to result in bad code, with -O or -O2 | |
619 | # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects | |
620 | # abends on "git push". Needs more investigation. | |
621 | CFLAGS = -g -O0 -Winline | |
622 | # We'd want it to be here. | |
623 | prefix = /usr/local | |
624 | # perl and python must be in /usr/bin on NonStop - supplied by HPE | |
625 | # with operating system in that managed directory. | |
626 | PERL_PATH = /usr/bin/perl | |
627 | PYTHON_PATH = /usr/bin/python | |
628 | # The current /usr/coreutils/rm at lowest support level does not work | |
629 | # with the git test structure. Long paths as in | |
630 | # 'trash directory...' cause rm to terminate prematurely without fully | |
631 | # removing the directory at OS releases J06.21 and L17.02. | |
632 | # Default to the older rm until those two releases are deprecated. | |
633 | RM = /bin/rm -f | |
634 | NEEDS_CRYPTO_WITH_SSL = YesPlease | |
635 | HAVE_DEV_TTY = YesPlease | |
636 | HAVE_LIBCHARSET_H = YesPlease | |
637 | HAVE_STRINGS_H = YesPlease | |
638 | NEEDS_LIBICONV = YesPlease | |
639 | NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease | |
640 | NO_SYS_SELECT_H = UnfortunatelyYes | |
641 | NO_D_TYPE_IN_DIRENT = YesPlease | |
642 | NO_GETTEXT = YesPlease | |
643 | NO_HSTRERROR = YesPlease | |
644 | NO_STRCASESTR = YesPlease | |
645 | NO_MEMMEM = YesPlease | |
646 | NO_STRLCPY = YesPlease | |
647 | NO_SETENV = YesPlease | |
648 | NO_UNSETENV = YesPlease | |
649 | NO_MKDTEMP = YesPlease | |
650 | # Currently libiconv-1.9.1. | |
651 | OLD_ICONV = UnfortunatelyYes | |
652 | NO_REGEX = NeedsStartEnd | |
653 | NO_PTHREADS = UnfortunatelyYes | |
654 | FREAD_READS_DIRECTORIES = UnfortunatelyYes | |
655 | ||
656 | # Not detected (nor checked for) by './configure'. | |
657 | # We don't have SA_RESTART on NonStop, unfortunalety. | |
658 | COMPAT_CFLAGS += -DSA_RESTART=0 | |
659 | # Apparently needed in compat/fnmatch/fnmatch.c. | |
660 | COMPAT_CFLAGS += -DHAVE_STRING_H=1 | |
661 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease | |
662 | NO_NSEC = YesPlease | |
663 | NO_PREAD = YesPlease | |
664 | NO_MMAP = YesPlease | |
665 | NO_POLL = YesPlease | |
666 | NO_INTPTR_T = UnfortunatelyYes | |
667 | CSPRNG_METHOD = openssl | |
668 | SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin | |
669 | SHELL_PATH = /usr/coreutils/bin/bash | |
670 | endif | |
671 | ifeq ($(uname_S),OS/390) | |
672 | NO_SYS_POLL_H = YesPlease | |
673 | NO_STRCASESTR = YesPlease | |
674 | NO_REGEX = YesPlease | |
675 | NO_MMAP = YesPlease | |
676 | NO_NSEC = YesPlease | |
677 | NO_STRLCPY = YesPlease | |
678 | NO_MEMMEM = YesPlease | |
679 | NO_GECOS_IN_PWENT = YesPlease | |
680 | HAVE_STRINGS_H = YesPlease | |
681 | NEEDS_MODE_TRANSLATION = YesPlease | |
682 | HAVE_ZOS_GET_EXECUTABLE_PATH = YesPlease | |
683 | endif | |
684 | ifeq ($(uname_S),MINGW) | |
685 | ifeq ($(shell expr "$(uname_R)" : '1\.'),2) | |
686 | $(error "Building with MSys is no longer supported") | |
687 | endif | |
688 | pathsep = ; | |
689 | HAVE_ALLOCA_H = YesPlease | |
690 | NO_PREAD = YesPlease | |
691 | NEEDS_CRYPTO_WITH_SSL = YesPlease | |
692 | NO_LIBGEN_H = YesPlease | |
693 | NO_POLL = YesPlease | |
694 | NO_SYMLINK_HEAD = YesPlease | |
695 | NO_SETENV = YesPlease | |
696 | NO_STRCASESTR = YesPlease | |
697 | NO_STRLCPY = YesPlease | |
698 | NO_MEMMEM = YesPlease | |
699 | NEEDS_LIBICONV = YesPlease | |
700 | NO_STRTOUMAX = YesPlease | |
701 | NO_MKDTEMP = YesPlease | |
702 | NO_SVN_TESTS = YesPlease | |
703 | ||
704 | # The builtin FSMonitor requires Named Pipes and Threads on Windows. | |
705 | # These are always available, so we do not have to conditionally | |
706 | # support it. | |
707 | FSMONITOR_DAEMON_BACKEND = win32 | |
708 | FSMONITOR_OS_SETTINGS = win32 | |
709 | ||
710 | RUNTIME_PREFIX = YesPlease | |
711 | HAVE_WPGMPTR = YesWeDo | |
712 | NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease | |
713 | USE_WIN32_IPC = YesPlease | |
714 | USE_WIN32_MMAP = YesPlease | |
715 | MMAP_PREVENTS_DELETE = UnfortunatelyYes | |
716 | UNRELIABLE_FSTAT = UnfortunatelyYes | |
717 | OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo | |
718 | NO_REGEX = YesPlease | |
719 | ETAGS_TARGET = ETAGS | |
720 | NO_POSIX_GOODIES = UnfortunatelyYes | |
721 | DEFAULT_HELP_FORMAT = html | |
722 | HAVE_PLATFORM_PROCINFO = YesPlease | |
723 | CSPRNG_METHOD = rtlgenrandom | |
724 | BASIC_LDFLAGS += -municode | |
725 | COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32 | |
726 | COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" | |
727 | COMPAT_OBJS += compat/mingw.o compat/winansi.o \ | |
728 | compat/win32/trace2_win32_process_info.o \ | |
729 | compat/win32/flush.o \ | |
730 | compat/win32/path-utils.o \ | |
731 | compat/win32/pthread.o compat/win32/syslog.o \ | |
732 | compat/win32/dirent.o | |
733 | BASIC_CFLAGS += -DWIN32 | |
734 | EXTLIBS += -lws2_32 | |
735 | GITLIBS += git.res | |
736 | PTHREAD_LIBS = | |
737 | RC = windres -O coff | |
738 | NATIVE_CRLF = YesPlease | |
739 | X = .exe | |
740 | # MSys2 | |
741 | prefix = /usr/ | |
742 | # Enable DEP | |
743 | BASIC_LDFLAGS += -Wl,--nxcompat | |
744 | # Enable ASLR (unless debugging) | |
745 | ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS)))) | |
746 | BASIC_LDFLAGS += -Wl,--dynamicbase | |
747 | endif | |
748 | ifeq (MINGW32,$(MSYSTEM)) | |
749 | prefix = /mingw32 | |
750 | HOST_CPU = i686 | |
751 | BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup | |
752 | endif | |
753 | ifeq (MINGW64,$(MSYSTEM)) | |
754 | prefix = /mingw64 | |
755 | HOST_CPU = x86_64 | |
756 | BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup | |
757 | else ifeq (CLANGARM64,$(MSYSTEM)) | |
758 | prefix = /clangarm64 | |
759 | HOST_CPU = aarch64 | |
760 | BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup | |
761 | else | |
762 | COMPAT_CFLAGS += -D_USE_32BIT_TIME_T | |
763 | BASIC_LDFLAGS += -Wl,--large-address-aware | |
764 | endif | |
765 | CC = gcc | |
766 | COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \ | |
767 | -fstack-protector-strong | |
768 | EXTLIBS += -lntdll | |
769 | EXTRA_PROGRAMS += headless-git$X | |
770 | INSTALL = /bin/install | |
771 | INTERNAL_QSORT = YesPlease | |
772 | HAVE_LIBCHARSET_H = YesPlease | |
773 | USE_GETTEXT_SCHEME = fallthrough | |
774 | USE_LIBPCRE = YesPlease | |
775 | ifneq (CLANGARM64,$(MSYSTEM)) | |
776 | USE_NED_ALLOCATOR = YesPlease | |
777 | endif | |
778 | ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix)))) | |
779 | # Move system config into top-level /etc/ | |
780 | ETC_GITCONFIG = ../etc/gitconfig | |
781 | ETC_GITATTRIBUTES = ../etc/gitattributes | |
782 | endif | |
783 | endif | |
784 | ifeq ($(uname_S),QNX) | |
785 | COMPAT_CFLAGS += -DSA_RESTART=0 | |
786 | EXPAT_NEEDS_XMLPARSE_H = YesPlease | |
787 | HAVE_STRINGS_H = YesPlease | |
788 | NEEDS_SOCKET = YesPlease | |
789 | NO_GETPAGESIZE = YesPlease | |
790 | NO_ICONV = YesPlease | |
791 | NO_MEMMEM = YesPlease | |
792 | NO_MKDTEMP = YesPlease | |
793 | NO_NSEC = YesPlease | |
794 | NO_PTHREADS = YesPlease | |
795 | NO_STRCASESTR = YesPlease | |
796 | NO_STRLCPY = YesPlease | |
797 | endif |