forked from Kalpanika/x3f
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsys.mk
More file actions
131 lines (116 loc) · 2.63 KB
/
Copy pathsys.mk
File metadata and controls
131 lines (116 loc) · 2.63 KB
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
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 = $(shell uname -m)
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++
# Use native SDK without explicit path
SDKFLAGS =
ifeq ($(TARGET_CPU), x86_64)
# Cross-compile to x86_64 on ARM Mac
SDKFLAGS = -arch x86_64
endif
ifeq ($(TARGET_CPU), arm64)
# Cross-compile to arm64 on Intel Mac (or native on ARM)
SDKFLAGS = -arch arm64
endif
endif
endif
endif
endif
ifneq ($(STRIP), strip)
INSTFLAGS = --strip-program=$(STRIP)
endif
ifeq ($(TARGET), osx-universal)
ifeq ($(HOST_SYS), osx)
# Native macOS supports lipo
LIPO = lipo
endif
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