-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathcommon.mk
76 lines (72 loc) · 1.48 KB
/
common.mk
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
# common.mk
# This file is part of the FreeBASIC test suite
#
# Guess HOST and TARGET_OS if not already set;
# it would far cleaner and robust to reuse the detection code in root makefile,
# but we our requirements here are much simpler.
# HOST takes possible values dos|unix|win32, TARGET_OS may be dos|unix|win32|js.
# OS has possible values DOS and Windows_NT.
#
HOST :=
ifeq ($(OS),DOS)
HOST := dos
else
ifeq ($(OS),Windows_NT)
HOST := win32
else
ifdef WINDIR
HOST := win32
else
ifdef windir
HOST := win32
else
ifdef HOME
HOST := unix
endif
endif
endif
endif
endif
ifndef TARGET_OS
triplet := $(subst -, ,$(TARGET))
ifdef TARGET
ifneq ($(filter djgpp%,$(triplet)),)
TARGET_OS := dos
else ifneq ($(filter msdos%,$(triplet)),)
TARGET_OS := dos
else ifneq ($(filter mingw%,$(triplet)),)
TARGET_OS := win32
else ifneq ($(filter emscripten%,$(triplet)),)
TARGET_OS := js
else ifneq ($(filter js%,$(triplet)),)
TARGET_OS := js
else
TARGET_OS := unix
endif
else
ifndef HOST
CHECKHOST_MSG := $(error error: TARGET_OS not defined and HOST couldn't be guessed)
else
CHECKHOST_MSG :=
endif
TARGET_OS := $(HOST)
endif
endif
# set default command names
#
ifeq ($(HOST),unix)
EXEEXT :=
else
EXEEXT := .exe
endif
ifeq ($(TARGET_OS),unix)
TARGET_EXEEXT :=
else ifeq ($(TARGET_OS),js)
ifeq ($(NODEJS),)
TARGET_EXEEXT := .html
else
TARGET_EXEEXT := .js
endif
else
TARGET_EXEEXT := .exe
endif