forked from oki-miyuki/x3f
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sys.mk
117 lines (103 loc) · 2.38 KB
/
sys.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
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
HOST_SYS =
HOST_CPU =
ifdef COMSPEC
HOST_SYS = windows
HOST_CPU = $(shell uname -m)
else
UNAME = $(shell uname -s)
ifeq ($(UNAME), Linux)
HOST_SYS = linux
HOST_CPU = $(shell uname -m)
else
ifeq ($(UNAME), Darwin)
HOST_SYS = osx
HOST_CPU = universal
endif
endif
endif
ifndef HOST_SYS
HOST_SYS = generic
$(warning WARNING: Could not determine host system, assuming $(HOST_SYS))
endif
ifndef HOST_CPU
HOST_CPU = generic
$(warning WARNING: Could not determine host CPU, assuming $(HOST_CPU))
endif
HOST = $(HOST_SYS)-$(HOST_CPU)
ifndef TARGET
TARGET = $(HOST)
endif
TARGET_SYS = $(shell echo $(TARGET) | sed "s/-.*$$//")
TARGET_CPU = $(shell echo $(TARGET) | sed "s/^$(TARGET_SYS)-//")
CC =
CXX =
CMAKE_TOOLCHAIN =
LIPO =
SDKFLAGS =
STRIP = strip
INSTFLAGS =
ifeq ($(HOST), $(TARGET))
CC = gcc
CXX = g++
ifeq ($(HOST_SYS), osx)
LIPO = lipo
endif
else # Cross compilation
ifeq ($(HOST_SYS), linux)
ifeq ($(TARGET), windows-x86_64)
CC = x86_64-w64-mingw32-gcc
CXX = x86_64-w64-mingw32-g++
CMAKE_TOOLCHAIN = x86_64-w64-mingw32.cmake
else
ifeq ($(TARGET), windows-i686)
CC = i686-w64-mingw32-gcc
CXX = i686-w64-mingw32-g++
CMAKE_TOOLCHAIN = i686-w64-mingw32.cmake
else
ifeq ($(TARGET), osx-x86_64)
CC = x86_64-apple-darwin11-gcc
CXX = x86_64-apple-darwin11-g++
CMAKE_TOOLCHAIN = x86_64-apple-darwin11.cmake
SDKFLAGS = -mmacosx-version-min=10.7 -arch x86_64
STRIP = x86_64-apple-darwin11-strip
else
ifeq ($(TARGET), osx-i386)
CC = i386-apple-darwin11-gcc
CXX = i386-apple-darwin11-g++
CMAKE_TOOLCHAIN = i386-apple-darwin11.cmake
SDKFLAGS = -mmacosx-version-min=10.7 -arch i386
STRIP = i386-apple-darwin11-strip
else
ifeq ($(TARGET), osx-universal)
LIPO = x86_64-apple-darwin11-lipo
STRIP = x86_64-apple-darwin11-strip
endif
endif
endif
endif
endif
else
ifeq ($(HOST_SYS), osx)
ifeq ($(TARGET_SYS), osx)
CC = gcc
CXX = g++
SDKFLAGS = -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -arch $(TARGET_CPU)
endif
endif
endif
endif
ifneq ($(STRIP), strip)
INSTFLAGS = --strip-program=$(STRIP)
endif
ifeq ($(TARGET), osx-universal)
ifndef LIPO
$(error Building universal binaries for target $(TARGET) on host $(HOST) is unsupported)
endif
else
ifndef CC
$(error C compilation for target $(TARGET) on host $(HOST) is unsupported)
endif
ifndef CXX
$(error C++ compilation for target $(TARGET) on host $(HOST) is unsupported)
endif
endif