summaryrefslogtreecommitdiff
path: root/config.mak.uname
blob: d63629fe807f59deda80ed780c1915df011bf862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
# Platform specific Makefile tweaks based on uname detection

# Define NO_SAFESEH if you need MSVC/Visual Studio to ignore the lack of
# Microsoft's Safe Exception Handling in libraries (such as zlib).
# Typically required for VS2013+/32-bit compilation on Vista+ versions.

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')

ifneq ($(findstring MINGW,$(uname_S)),)
	uname_S := MINGW
endif

ifdef MSVC
	# avoid the MingW and Cygwin configuration sections
	uname_S := Windows
	uname_O := Windows

	# Generate and include makefile variables that point to the
	# currently installed set of MSVC command line tools.
compat/vcbuild/MSVC-DEFS-GEN: compat/vcbuild/find_vs_env.bat
	@"$<" | tr '\\' / >"$@"
include compat/vcbuild/MSVC-DEFS-GEN

	# See if vcpkg and the vcpkg-build versions of the third-party
	# libraries that we use are installed.  We include the result
	# to get $(vcpkg_*) variables defined for the Makefile.
ifeq (,$(SKIP_VCPKG))
compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
	@"$<"
include compat/vcbuild/VCPKG-DEFS
endif
endif

# We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain.  If
# we had "elif" things would have been much nicer...

ifeq ($(uname_S),OSF1)
	# Need this for u_short definitions et al
	BASIC_CFLAGS += -D_OSF_SOURCE
	SOCKLEN_T = int
	NO_STRTOULL = YesPlease
	NO_NSEC = YesPlease
endif
ifeq ($(uname_S),Linux)
	HAVE_ALLOCA_H = YesPlease
	NO_STRLCPY = YesPlease
	HAVE_PATHS_H = YesPlease
	LIBC_CONTAINS_LIBINTL = YesPlease
	HAVE_DEV_TTY = YesPlease
	HAVE_CLOCK_GETTIME = YesPlease
	HAVE_CLOCK_MONOTONIC = YesPlease
	# -lrt is needed for clock_gettime on glibc <= 2.16
	NEEDS_LIBRT = YesPlease
	HAVE_SYNC_FILE_RANGE = YesPlease
	HAVE_GETDELIM = YesPlease
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
	BASIC_CFLAGS += -DHAVE_SYSINFO
	PROCFS_EXECUTABLE_PATH = /proc/self/exe
	HAVE_PLATFORM_PROCINFO = YesPlease
	COMPAT_OBJS += compat/linux/procinfo.o
	# centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
	ifneq ($(findstring .el7.,$(uname_R)),)
		BASIC_CFLAGS += -std=c99
	endif
endif
ifeq ($(uname_S),GNU/kFreeBSD)
	HAVE_ALLOCA_H = YesPlease
	NO_STRLCPY = YesPlease
	HAVE_PATHS_H = YesPlease
	DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
	LIBC_CONTAINS_LIBINTL = YesPlease
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
endif
ifeq ($(uname_S),UnixWare)
	CC = cc
	NEEDS_SOCKET = YesPlease
	NEEDS_NSL = YesPlease
	NEEDS_SSL_WITH_CRYPTO = YesPlease
	NEEDS_LIBICONV = YesPlease
	SHELL_PATH = /usr/local/bin/bash
	NO_IPV6 = YesPlease
	NO_HSTRERROR = YesPlease
	BASIC_CFLAGS += -Kthread
	BASIC_CFLAGS += -I/usr/local/include
	BASIC_LDFLAGS += -L/usr/local/lib
	INSTALL = ginstall
	TAR = gtar
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
endif
ifeq ($(uname_S),SCO_SV)
	ifeq ($(uname_R),3.2)
		CFLAGS = -O2
	endif
	ifeq ($(uname_R),5)
		CC = cc
		BASIC_CFLAGS += -Kthread
	endif
	NEEDS_SOCKET = YesPlease
	NEEDS_NSL = YesPlease
	NEEDS_SSL_WITH_CRYPTO = YesPlease
	NEEDS_LIBICONV = YesPlease
	SHELL_PATH = /usr/bin/bash
	NO_IPV6 = YesPlease
	NO_HSTRERROR = YesPlease
	BASIC_CFLAGS += -I/usr/local/include
	BASIC_LDFLAGS += -L/usr/local/lib
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	INSTALL = ginstall
	TAR = gtar
endif
ifeq ($(uname_S),Darwin)
	NEEDS_CRYPTO_WITH_SSL = YesPlease
	NEEDS_SSL_WITH_CRYPTO = YesPlease
	NEEDS_LIBICONV = YesPlease
	# Note: $(uname_R) gives us the underlying Darwin version.
	# - MacOS 10.0.* and MacOS 10.1.0 = Darwin 1.*
	# - MacOS 10.x.* = Darwin (x+4).* for (1 <= x)
	# i.e. "begins with [15678] and a dot" means "10.4.* or older".
	ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
		OLD_ICONV = UnfortunatelyYes
		NO_APPLE_COMMON_CRYPTO = YesPlease
	endif
	ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
		NO_STRLCPY = YesPlease
	endif
	ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 11 && echo 1),1)
		HAVE_GETDELIM = YesPlease
	endif
	ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
		OPEN_RETURNS_EINTR = UnfortunatelyYes
	endif
	NO_MEMMEM = YesPlease
	USE_ST_TIMESPEC = YesPlease
	HAVE_DEV_TTY = YesPlease
	COMPAT_OBJS += compat/precompose_utf8.o
	BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
	BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
	HAVE_BSD_SYSCTL = YesPlease
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
	HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
	CSPRNG_METHOD = arc4random

	# Workaround for `gettext` being keg-only and not even being linked via
	# `brew link --force gettext`, should be obsolete as of
	# https://github.com/Homebrew/homebrew-core/pull/53489
	ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
		BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
		BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
		ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
			MSGFMT = /usr/local/opt/gettext/bin/msgfmt
		endif
	endif

	# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
	# Unix domain sockets and PThreads.
	ifndef NO_PTHREADS
	ifndef NO_UNIX_SOCKETS
	FSMONITOR_DAEMON_BACKEND = darwin
	FSMONITOR_OS_SETTINGS = darwin
	endif
	endif

	BASIC_LDFLAGS += -framework CoreServices
endif
ifeq ($(uname_S),SunOS)
	NEEDS_SOCKET = YesPlease
	NEEDS_NSL = YesPlease
	SHELL_PATH = /bin/bash
	SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
	HAVE_ALLOCA_H = YesPlease
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	NO_MKDTEMP = YesPlease
	NO_REGEX = YesPlease
	NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
	HAVE_DEV_TTY = YesPlease
	ifeq ($(uname_R),5.6)
		SOCKLEN_T = int
		NO_HSTRERROR = YesPlease
		NO_IPV6 = YesPlease
		NO_SOCKADDR_STORAGE = YesPlease
		NO_UNSETENV = YesPlease
		NO_SETENV = YesPlease
		NO_STRLCPY = YesPlease
		NO_STRTOUMAX = YesPlease
		GIT_TEST_CMP = cmp
	endif
	ifeq ($(uname_R),5.7)
		NEEDS_RESOLV = YesPlease
		NO_IPV6 = YesPlease
		NO_SOCKADDR_STORAGE = YesPlease
		NO_UNSETENV = YesPlease
		NO_SETENV = YesPlease
		NO_STRLCPY = YesPlease
		NO_STRTOUMAX = YesPlease
		GIT_TEST_CMP = cmp
	endif
	ifeq ($(uname_R),5.8)
		NO_UNSETENV = YesPlease
		NO_SETENV = YesPlease
		NO_STRTOUMAX = YesPlease
		GIT_TEST_CMP = cmp
	endif
	ifeq ($(uname_R),5.9)
		NO_UNSETENV = YesPlease
		NO_SETENV = YesPlease
		NO_STRTOUMAX = YesPlease
		GIT_TEST_CMP = cmp
	endif
	INSTALL = /usr/ucb/install
	TAR = gtar
	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
endif
ifeq ($(uname_O),Cygwin)
	ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
		NO_D_TYPE_IN_DIRENT = YesPlease
		NO_STRCASESTR = YesPlease
		NO_MEMMEM = YesPlease
		NO_SYMLINK_HEAD = YesPlease
		NO_IPV6 = YesPlease
		OLD_ICONV = UnfortunatelyYes
		# There are conflicting reports about this.
		# On some boxes NO_MMAP is needed, and not so elsewhere.
		# Try commenting this out if you suspect MMAP is more efficient
		NO_MMAP = YesPlease
	else
		NO_REGEX = UnfortunatelyYes
	endif
	HAVE_ALLOCA_H = YesPlease
	NEEDS_LIBICONV = YesPlease
	NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
	X = .exe
	UNRELIABLE_FSTAT = UnfortunatelyYes
	OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
	MMAP_PREVENTS_DELETE = UnfortunatelyYes
	COMPAT_OBJS += compat/win32/path-utils.o
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
endif
ifeq ($(uname_S),FreeBSD)
	NEEDS_LIBICONV = YesPlease
	# Versions up to 10.1 require OLD_ICONV; 10.2 and beyond don't.
	# A typical version string looks like "10.2-RELEASE".
	ifeq ($(shell expr "$(uname_R)" : '[1-9]\.'),2)
		OLD_ICONV = YesPlease
	endif
	ifeq ($(firstword $(subst -, ,$(uname_R))),10.0)
		OLD_ICONV = YesPlease
	endif
	ifeq ($(firstword $(subst -, ,$(uname_R))),10.1)
		OLD_ICONV = YesPlease
	endif
	NO_MEMMEM = YesPlease
	BASIC_CFLAGS += -I/usr/local/include
	BASIC_LDFLAGS += -L/usr/local/lib
	DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
	USE_ST_TIMESPEC = YesPlease
	ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
		PTHREAD_LIBS = -pthread
		NO_UINTMAX_T = YesPlease
		NO_STRTOUMAX = YesPlease
	endif
	PYTHON_PATH = /usr/local/bin/python
	PERL_PATH = /usr/local/bin/perl
	HAVE_PATHS_H = YesPlease
	HAVE_BSD_SYSCTL = YesPlease
	HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
	CSPRNG_METHOD = arc4random
	PAGER_ENV = LESS=FRX LV=-c MORE=FRX
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
	FILENO_IS_A_MACRO = UnfortunatelyYes
endif
ifeq ($(uname_S),OpenBSD)
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	USE_ST_TIMESPEC = YesPlease
	NEEDS_LIBICONV = YesPlease
	BASIC_CFLAGS += -I/usr/local/include
	BASIC_LDFLAGS += -L/usr/local/lib
	HAVE_PATHS_H = YesPlease
	HAVE_BSD_SYSCTL = YesPlease
	HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
	CSPRNG_METHOD = arc4random
	PROCFS_EXECUTABLE_PATH = /proc/curproc/file
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
	FILENO_IS_A_MACRO = UnfortunatelyYes
endif
ifeq ($(uname_S),MirBSD)
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	USE_ST_TIMESPEC = YesPlease
	NEEDS_LIBICONV = YesPlease
	HAVE_PATHS_H = YesPlease
	HAVE_BSD_SYSCTL = YesPlease
	CSPRNG_METHOD = arc4random
endif
ifeq ($(uname_S),NetBSD)
	ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
		NEEDS_LIBICONV = YesPlease
	endif
	BASIC_CFLAGS += -I/usr/pkg/include
	BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
	USE_ST_TIMESPEC = YesPlease
	HAVE_PATHS_H = YesPlease
	HAVE_BSD_SYSCTL = YesPlease
	HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
	CSPRNG_METHOD = arc4random
	PROCFS_EXECUTABLE_PATH = /proc/curproc/exe
endif
ifeq ($(uname_S),AIX)
	DEFAULT_PAGER = more
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	NO_MKDTEMP = YesPlease
	NO_STRLCPY = YesPlease
	NO_NSEC = YesPlease
	NO_REGEX = NeedsStartEnd
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
	INTERNAL_QSORT = UnfortunatelyYes
	NEEDS_LIBICONV = YesPlease
	BASIC_CFLAGS += -D_LARGE_FILES
	FILENO_IS_A_MACRO = UnfortunatelyYes
	NEED_ACCESS_ROOT_HANDLER = UnfortunatelyYes
	ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
		NO_PTHREADS = YesPlease
	else
		PTHREAD_LIBS = -lpthread
	endif
	ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
		INLINE = ''
	endif
	GIT_TEST_CMP = cmp
endif
ifeq ($(uname_S),GNU)
	# GNU/Hurd
	HAVE_ALLOCA_H = YesPlease
	NO_STRLCPY = YesPlease
	HAVE_PATHS_H = YesPlease
	LIBC_CONTAINS_LIBINTL = YesPlease
	FREAD_READS_DIRECTORIES = UnfortunatelyYes
endif
ifeq ($(uname_S),IRIX)
	NO_SETENV = YesPlease
	NO_UNSETENV = YesPlease
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	NO_MKDTEMP = YesPlease
	# When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
	# (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
	# git dies with a segmentation fault when trying to access the first
	# entry of a reflog.  The conservative choice is made to always set
	# NO_MMAP.  If you suspect that your compiler is not affected by this
	# issue, comment out the NO_MMAP statement.
	NO_MMAP = YesPlease
	NO_REGEX = YesPlease
	SNPRINTF_RETURNS_BOGUS = YesPlease
	SHELL_PATH = /usr/gnu/bin/bash
	NEEDS_LIBGEN = YesPlease
endif
ifeq ($(uname_S),IRIX64)
	NO_SETENV = YesPlease
	NO_UNSETENV = YesPlease
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	NO_MKDTEMP = YesPlease
	# When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
	# (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
	# git dies with a segmentation fault when trying to access the first
	# entry of a reflog.  The conservative choice is made to always set
	# NO_MMAP.  If you suspect that your compiler is not affected by this
	# issue, comment out the NO_MMAP statement.
	NO_MMAP = YesPlease
	NO_REGEX = YesPlease
	SNPRINTF_RETURNS_BOGUS = YesPlease
	SHELL_PATH = /usr/gnu/bin/bash
	NEEDS_LIBGEN = YesPlease
endif
ifeq ($(uname_S),HP-UX)
	INLINE = __inline
	NO_IPV6 = YesPlease
	NO_SETENV = YesPlease
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	NO_STRLCPY = YesPlease
	NO_MKDTEMP = YesPlease
	NO_UNSETENV = YesPlease
	NO_HSTRERROR = YesPlease
	NO_SYS_SELECT_H = YesPlease
	SNPRINTF_RETURNS_BOGUS = YesPlease
	NO_NSEC = YesPlease
	ifeq ($(uname_R),B.11.00)
		NO_INET_NTOP = YesPlease
		NO_INET_PTON = YesPlease
	endif
	ifeq ($(uname_R),B.10.20)
		# Override HP-UX 11.x setting:
		INLINE =
		SOCKLEN_T = size_t
		NO_PREAD = YesPlease
		NO_INET_NTOP = YesPlease
		NO_INET_PTON = YesPlease
	endif
	GIT_TEST_CMP = cmp
endif
ifeq ($(uname_S),Windows)
	GIT_VERSION := $(GIT_VERSION).MSVC
	pathsep = ;
	# Assume that this is built in Git for Windows' SDK
	ifeq (MINGW32,$(MSYSTEM))
		prefix = /mingw32
	else
		prefix = /mingw64
	endif
	# Prepend MSVC 64-bit tool-chain to PATH.
	#
	# A regular Git Bash *does not* have cl.exe in its $PATH. As there is a
	# link.exe next to, and required by, cl.exe, we have to prepend this
	# onto the existing $PATH.
	#
	SANE_TOOL_PATH ?= $(msvc_bin_dir_msys)
	HAVE_ALLOCA_H = YesPlease
	NO_PREAD = YesPlease
	NEEDS_CRYPTO_WITH_SSL = YesPlease
	NO_LIBGEN_H = YesPlease
	NO_POLL = YesPlease
	NO_SYMLINK_HEAD = YesPlease
	NO_IPV6 = YesPlease
	NO_UNIX_SOCKETS = YesPlease
	NO_SETENV = YesPlease
	NO_STRCASESTR = YesPlease
	NO_STRLCPY = YesPlease
	NO_MEMMEM = YesPlease
	NEEDS_LIBICONV = YesPlease
	NO_STRTOUMAX = YesPlease
	NO_MKDTEMP = YesPlease
	NO_INTTYPES_H = YesPlease
	CSPRNG_METHOD = rtlgenrandom
	# VS2015 with UCRT claims that snprintf and friends are C99 compliant,
	# so we don't need this:
	#
	#   SNPRINTF_RETURNS_BOGUS = YesPlease

	# The builtin FSMonitor requires Named Pipes and Threads on Windows.
	# These are always available, so we do not have to conditionally
	# support it.
	FSMONITOR_DAEMON_BACKEND = win32
	FSMONITOR_OS_SETTINGS = win32

	NO_SVN_TESTS = YesPlease
	RUNTIME_PREFIX = YesPlease
	HAVE_WPGMPTR = YesWeDo
	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
	USE_WIN32_IPC = YesPlease
	USE_WIN32_MMAP = YesPlease
	MMAP_PREVENTS_DELETE = UnfortunatelyYes
	# USE_NED_ALLOCATOR = YesPlease
	UNRELIABLE_FSTAT = UnfortunatelyYes
	OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
	NO_REGEX = YesPlease
	NO_GETTEXT = YesPlease
	NO_PYTHON = YesPlease
	ETAGS_TARGET = ETAGS
	NO_POSIX_GOODIES = UnfortunatelyYes
	NATIVE_CRLF = YesPlease
	DEFAULT_HELP_FORMAT = html
ifeq (/mingw64,$(subst 32,64,$(prefix)))
	# Move system config into top-level /etc/
	ETC_GITCONFIG = ../etc/gitconfig
	ETC_GITATTRIBUTES = ../etc/gitattributes
endif

	CC = compat/vcbuild/scripts/clink.pl
	AR = compat/vcbuild/scripts/lib.pl
	CFLAGS =
	BASIC_CFLAGS = -nologo -I. -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
	COMPAT_OBJS = compat/msvc.o compat/winansi.o \
		compat/win32/flush.o \
		compat/win32/path-utils.o \
		compat/win32/pthread.o compat/win32/syslog.o \
		compat/win32/trace2_win32_process_info.o \
		compat/win32/dirent.o
	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
	BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
	# invalidcontinue.obj allows Git's source code to close the same file
	# handle twice, or to access the osfhandle of an already-closed stdout
	# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
	EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj kernel32.lib ntdll.lib
	PTHREAD_LIBS =
	lib =
	BASIC_CFLAGS += $(vcpkg_inc) $(sdk_includes) $(msvc_includes)
ifndef DEBUG
	BASIC_CFLAGS += $(vcpkg_rel_lib)
else
	BASIC_CFLAGS += $(vcpkg_dbg_lib)
endif
	BASIC_CFLAGS += $(sdk_libs) $(msvc_libs)

ifneq ($(USE_MSVC_CRTDBG),)
	# Optionally enable memory leak reporting.
	BASIC_CFLAGS += -DUSE_MSVC_CRTDBG
endif
	# Always give "-Zi" to the compiler and "-debug" to linker (even in
	# release mode) to force a PDB to be generated (like RelWithDebInfo).
	BASIC_CFLAGS += -Zi
	BASIC_LDFLAGS += -debug -Zf

ifdef NO_SAFESEH
	LDFLAGS += -SAFESEH:NO
endif

ifndef DEBUG
	BASIC_CFLAGS += -GL -Gy -O2 -Oy- -MD -DNDEBUG
	BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
	AR += -LTCG
else
	BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
endif
	X = .exe

compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
endif
ifeq ($(uname_S),Interix)
	NO_INITGROUPS = YesPlease
	NO_IPV6 = YesPlease
	NO_MEMMEM = YesPlease
	NO_MKDTEMP = YesPlease
	NO_STRTOUMAX = YesPlease
	NO_NSEC = YesPlease
	ifeq ($(uname_R),3.5)
		NO_INET_NTOP = YesPlease
		NO_INET_PTON = YesPlease
		NO_SOCKADDR_STORAGE = YesPlease
	endif
	ifeq ($(uname_R),5.2)
		NO_INET_NTOP = YesPlease
		NO_INET_PTON = YesPlease
		NO_SOCKADDR_STORAGE = YesPlease
	endif
endif
ifeq ($(uname_S),Minix)
	NO_IPV6 = YesPlease
	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
	NO_NSEC = YesPlease
	NEEDS_LIBGEN =
	NEEDS_CRYPTO_WITH_SSL = YesPlease
	NEEDS_RESOLV =
	NO_HSTRERROR = YesPlease
	NO_MMAP = YesPlease
	NO_CURL =
	NO_EXPAT =
endif
ifeq ($(uname_S),NONSTOP_KERNEL)
	# Needs some C99 features, "inline" is just one of them.
	# INLINE='' would just replace one set of warnings with another and
	# still not compile in c89 mode, due to non-const array initializations.
	CC = cc -c99
	# Build down-rev compatible objects that don't use our new getopt_long.
	ifeq ($(uname_R).$(uname_V),J06.21)
		CC += -WRVU=J06.20
	endif
	ifeq ($(uname_R).$(uname_V),L17.02)
		CC += -WRVU=L16.05
	endif
	# Disable all optimization, seems to result in bad code, with -O or -O2
	# or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
	# abends on "git push". Needs more investigation.
	CFLAGS = -g -O0 -Winline
	# We'd want it to be here.
	prefix = /usr/local
	# perl and python must be in /usr/bin on NonStop - supplied by HPE
	# with operating system in that managed directory.
	PERL_PATH = /usr/bin/perl
	PYTHON_PATH = /usr/bin/python
	# The current /usr/coreutils/rm at lowest support level does not work
	# with the git test structure. Long paths as in
	# 'trash directory...' cause rm to terminate prematurely without fully
	# removing the directory at OS releases J06.21 and L17.02.
	# Default to the older rm until those two releases are deprecated.
	RM = /bin/rm -f
	NEEDS_CRYPTO_WITH_SSL = YesPlease
	HAVE_DEV_TTY = YesPlease
	HAVE_LIBCHARSET_H = YesPlease
	HAVE_STRINGS_H = YesPlease
	NEEDS_LIBICONV = YesPlease
	NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
	NO_SYS_SELECT_H = UnfortunatelyYes
	NO_D_TYPE_IN_DIRENT = YesPlease
	NO_GETTEXT = YesPlease
	NO_HSTRERROR = YesPlease
	NO_STRCASESTR = YesPlease
	NO_MEMMEM = YesPlease
	NO_STRLCPY = YesPlease
	NO_SETENV = YesPlease
	NO_UNSETENV = YesPlease
	NO_MKDTEMP = YesPlease
	# Currently libiconv-1.9.1.
	OLD_ICONV = UnfortunatelyYes
	NO_REGEX = NeedsStartEnd
	NO_PTHREADS = UnfortunatelyYes
	FREAD_READS_DIRECTORIES = UnfortunatelyYes

	# Not detected (nor checked for) by './configure'.
	# We don't have SA_RESTART on NonStop, unfortunalety.
	COMPAT_CFLAGS += -DSA_RESTART=0
	# Apparently needed in compat/fnmatch/fnmatch.c.
	COMPAT_CFLAGS += -DHAVE_STRING_H=1
	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
	NO_NSEC = YesPlease
	NO_PREAD = YesPlease
	NO_MMAP = YesPlease
	NO_POLL = YesPlease
	NO_INTPTR_T = UnfortunatelyYes
	CSPRNG_METHOD = openssl
	SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
	SHELL_PATH = /usr/coreutils/bin/bash
endif
ifeq ($(uname_S),MINGW)
	pathsep = ;
	HAVE_ALLOCA_H = YesPlease
	NO_PREAD = YesPlease
	NEEDS_CRYPTO_WITH_SSL = YesPlease
	NO_LIBGEN_H = YesPlease
	NO_POLL = YesPlease
	NO_SYMLINK_HEAD = YesPlease
	NO_UNIX_SOCKETS = YesPlease
	NO_SETENV = YesPlease
	NO_STRCASESTR = YesPlease
	NO_STRLCPY = YesPlease
	NO_MEMMEM = YesPlease
	NEEDS_LIBICONV = YesPlease
	NO_STRTOUMAX = YesPlease
	NO_MKDTEMP = YesPlease
	NO_SVN_TESTS = YesPlease

	# The builtin FSMonitor requires Named Pipes and Threads on Windows.
	# These are always available, so we do not have to conditionally
	# support it.
	FSMONITOR_DAEMON_BACKEND = win32
	FSMONITOR_OS_SETTINGS = win32

	RUNTIME_PREFIX = YesPlease
	HAVE_WPGMPTR = YesWeDo
	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
	USE_WIN32_IPC = YesPlease
	USE_WIN32_MMAP = YesPlease
	MMAP_PREVENTS_DELETE = UnfortunatelyYes
	USE_NED_ALLOCATOR = YesPlease
	UNRELIABLE_FSTAT = UnfortunatelyYes
	OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
	NO_REGEX = YesPlease
	ETAGS_TARGET = ETAGS
	NO_POSIX_GOODIES = UnfortunatelyYes
	DEFAULT_HELP_FORMAT = html
	HAVE_PLATFORM_PROCINFO = YesPlease
	CSPRNG_METHOD = rtlgenrandom
	BASIC_LDFLAGS += -municode
	COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
	COMPAT_OBJS += compat/mingw.o compat/winansi.o \
		compat/win32/trace2_win32_process_info.o \
		compat/win32/flush.o \
		compat/win32/path-utils.o \
		compat/win32/pthread.o compat/win32/syslog.o \
		compat/win32/dirent.o
	BASIC_CFLAGS += -DWIN32
	EXTLIBS += -lws2_32
	GITLIBS += git.res
	PTHREAD_LIBS =
	RC = windres -O coff
	NATIVE_CRLF = YesPlease
	X = .exe
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
	htmldir = doc/git/html/
	prefix =
	INSTALL = /bin/install
	EXTLIBS += /mingw/lib/libz.a
	INTERNAL_QSORT = YesPlease
	HAVE_LIBCHARSET_H = YesPlease
	NO_GETTEXT = YesPlease
	NO_PYTHON = YesPlease
	COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
else
	ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
		# MSys2
		prefix = /usr/
		# Enable DEP
		BASIC_LDFLAGS += -Wl,--nxcompat
		# Enable ASLR (unless debugging)
		ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
			BASIC_LDFLAGS += -Wl,--dynamicbase
		endif
		ifeq (MINGW32,$(MSYSTEM))
			prefix = /mingw32
			HOST_CPU = i686
			BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
		endif
		ifeq (MINGW64,$(MSYSTEM))
			prefix = /mingw64
			HOST_CPU = x86_64
			BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
		else
			COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
			BASIC_LDFLAGS += -Wl,--large-address-aware
		endif
		CC = gcc
		COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
			-fstack-protector-strong
		EXTLIBS += -lntdll
		INSTALL = /bin/install
		INTERNAL_QSORT = YesPlease
		HAVE_LIBCHARSET_H = YesPlease
		USE_GETTEXT_SCHEME = fallthrough
		USE_LIBPCRE = YesPlease
		USE_NED_ALLOCATOR = YesPlease
		ifeq (/mingw64,$(subst 32,64,$(prefix)))
			# Move system config into top-level /etc/
			ETC_GITCONFIG = ../etc/gitconfig
			ETC_GITATTRIBUTES = ../etc/gitattributes
		endif
	else
		COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
		NO_CURL = YesPlease
		NO_PYTHON = YesPlease
	endif
endif
endif
ifeq ($(uname_S),QNX)
	COMPAT_CFLAGS += -DSA_RESTART=0
	EXPAT_NEEDS_XMLPARSE_H = YesPlease
	HAVE_STRINGS_H = YesPlease
	NEEDS_SOCKET = YesPlease
	NO_GETPAGESIZE = YesPlease
	NO_ICONV = YesPlease
	NO_MEMMEM = YesPlease
	NO_MKDTEMP = YesPlease
	NO_NSEC = YesPlease
	NO_PTHREADS = YesPlease
	NO_STRCASESTR = YesPlease
	NO_STRLCPY = YesPlease
endif

vcxproj:
	# Require clean work tree
	git update-index -q --refresh && \
	git diff-files --quiet && \
	git diff-index --cached --quiet HEAD --

	# Make .vcxproj files and add them
	perl contrib/buildsystems/generate -g Vcxproj
	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj

	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
	 echo '  <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
	 for name in $(BUILT_INS);\
	 do \
	   echo '    <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
	 done && \
	 echo '  </Target>' && \
	 echo '</Project>') >git/LinkOrCopyBuiltins.targets
	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
	 echo '  <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
	 for name in $(REMOTE_CURL_ALIASES); \
	 do \
	   echo '    <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
	 done && \
	 echo '  </Target>' && \
	 echo '</Project>') >git-remote-http/LinkOrCopyRemoteHttp.targets
	git add -f git/LinkOrCopyBuiltins.targets git-remote-http/LinkOrCopyRemoteHttp.targets

	# Add generated headers
	$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(GENERATED_H)
	git add -f $(GENERATED_H)

	# Add scripts
	rm -f perl/perl.mak
	$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(SCRIPT_LIB) $(SCRIPTS)
	# Strip out the sane tool path, needed only for building
	sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
	git add -f $(SCRIPT_LIB) $(SCRIPTS)

	# Add Perl module
	$(MAKE) $(LIB_PERL_GEN)
	git add -f perl/build

	# Add bin-wrappers, for testing
	rm -rf bin-wrappers/
	$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
	# Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
	# path of the repository is not hard-coded (GIT_EXEC_PATH will be set
	# by test-lib.sh according to the current setup)
	sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
			\1="$$(cygpath -u "$$\1")"/' \
		-e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
	# Ensure that test-* helpers find the .dll files copied to top-level
	sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
	# We do not want to force hard-linking builtins
	sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
		bin-wrappers/git-{receive-pack,upload-archive}
	git add -f $(test_bindir_programs)
	# remote-ext is a builtin, but invoked as if it were external
	sed 's|receive-pack|remote-ext|g' \
		<bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
	git add -f bin-wrappers/git-remote-ext

	# Add templates
	$(MAKE) -C templates
	git add -f templates/boilerplates.made templates/blt/

	# Add the translated messages
	make MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(MOFILES)
	git add -f $(MOFILES)

	# Add build options
	$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
	git add -f GIT-BUILD-OPTIONS

	# Commit the whole shebang
	git commit -m "Generate Visual Studio solution" \
		-m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"