~ chicken-core (chicken-5) /Makefile.detect
Trap1# -*- Makefile -*-
2#
3# Detect the PLATFORM with uname.
4# Based on Chibi Scheme auto-detector
5# Heavily revamped by John Cowan
6# Copyright (c) 2009-2018 Alex Shinn, John Cowan
7# BSD license at <https://github.com/ashinn/chibi-scheme/blob/master/COPYING>
8
9ifndef PLATFORM
10
11# First check is for pure MinGW, which doesn't have uname.
12# In cmd.exe, echo "test" outputs "test", with quotes.
13test:=$(shell echo "test")
14quote:=$(findstring ",$(test))
15
16ifeq ($(quote),")
17PLATFORM=mingw
18else
19
20# Now we can use uname tests
21uname_s:=$(shell uname)
22uname_o:=$(shell uname -o 2>/dev/null)
23
24# Check for specific platforms
25ifeq ($(uname_o),Msys)
26PLATFORM=mingw-msys
27endif
28
29ifeq ($(uname_s),Darwin)
30PLATFORM=macosx
31endif
32
33ifeq ($(uname_s),FreeBSD)
34PLATFORM=bsd
35endif
36
37ifeq ($(uname_s),NetBSD)
38PLATFORM=bsd
39endif
40
41ifeq ($(uname_s),OpenBSD)
42PLATFORM=bsd
43endif
44
45ifeq ($(uname_s),DragonFly)
46PLATFORM=bsd
47endif
48
49ifeq ($(uname_o),Cygwin)
50PLATFORM=cygwin
51endif
52
53ifeq ($(uname_o),Android)
54PLATFORM=android
55endif
56
57ifeq ($(uname_o),GNU/Linux)
58PLATFORM=linux
59endif
60
61ifeq ($(uname_o),Linux)
62PLATFORM=linux
63endif
64
65ifeq ($(uname_s),SunOS)
66PLATFORM=solaris
67endif
68
69ifeq ($(uname_s),Haiku)
70PLATFORM=haiku
71endif
72
73ifeq ($(uname_s),BeOS)
74PLATFORM=haiku
75endif
76
77ifeq ($(uname_s),GNU)
78PLATFORM=hurd
79endif
80
81ifeq ($(uname_s),AIX)
82PLATFORM=aix
83endif
84
85# add more options here
86
87endif # have uname
88endif # undef PLATFORM