-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.detect
88 lines (67 loc) · 1.33 KB
/
Makefile.detect
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
# -*- Makefile -*-
#
# Detect the PLATFORM with uname.
# Based on Chibi Scheme auto-detector
# Heavily revamped by John Cowan
# Copyright (c) 2009-2018 Alex Shinn, John Cowan
# BSD license at <https://github.com/ashinn/chibi-scheme/blob/master/COPYING>
ifndef PLATFORM
# First check is for pure MinGW, which doesn't have uname.
# In cmd.exe, echo "test" outputs "test", with quotes.
test:=$(shell echo "test")
quote:=$(findstring ",$(test))
ifeq ($(quote),")
PLATFORM=mingw
else
# Now we can use uname tests
uname_s:=$(shell uname)
uname_o:=$(shell uname -o)
# Check for specific platforms
ifeq ($(uname_o),Msys)
PLATFORM=mingw-msys
endif
ifeq ($(uname_s),Darwin)
PLATFORM=macosx
endif
ifeq ($(uname_s),FreeBSD)
PLATFORM=bsd
endif
ifeq ($(uname_s),NetBSD)
PLATFORM=bsd
endif
ifeq ($(uname_s),OpenBSD)
PLATFORM=bsd
endif
ifeq ($(uname_s),DragonFly)
PLATFORM=bsd
endif
ifeq ($(uname_o),Cygwin)
PLATFORM=cygwin
endif
ifeq ($(uname_o),Android)
PLATFORM=android
endif
ifeq ($(uname_o),GNU/Linux)
PLATFORM=linux
endif
ifeq ($(uname_o),Linux)
PLATFORM=linux
endif
ifeq ($(uname_s),SunOS)
PLATFORM=solaris
endif
ifeq ($(uname_s),Haiku)
PLATFORM=haiku
endif
ifeq ($(uname_s),BeOS)
PLATFORM=haiku
endif
ifeq ($(uname_s),GNU)
PLATFORM=hurd
endif
ifeq ($(uname_s),AIX)
PLATFORM=aix
endif
# add more options here
endif # have uname
endif # undef PLATFORM