Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile « builds « sdks - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 35dfe845c50fd326302d1db46735a23fd3bec438 (plain)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
TOP=$(realpath $(CURDIR)/../..)
-include $(TOP)/sdks/Make.config

MAKEFLAGS += --no-builtin-rules

CONFIGURATION?=release

RELEASE=$(if $(filter $(CONFIGURATION),release),1)

lowercase=$(shell echo "$(1)" | tr '[:upper:]' '[:lower:]')

UNAME=$(shell uname)

ifneq (,$(findstring CYGWIN,$(UNAME)))
UNAME=Windows
endif

ifeq ($(UNAME),Linux)
UNAME_WSL_CHECK=$(shell uname -a)
ifneq (,$(findstring Microsoft,$(UNAME_WSL_CHECK)))
UNAME=Windows
endif
endif

ifneq ($(UNAME),Darwin)
ifneq ($(UNAME),Linux)
ifneq ($(UNAME),Windows)
$(error "Unsupported UNAME=$(UNAME)")
endif
endif
endif

ifeq ($(UNAME),Windows)
# x86_64 or i686
HOST_ARCH_MINGW32=$(shell uname -m)
endif

ifneq ($(UNAME),Darwin)
# iOS and Mac requires Xcode to be available, and Xcode is only available on macOS
ENABLE_IOS=
ENABLE_MAC=
endif

# On Windows, we will just trigger LLVM and Android builds using this Makefile.
ifeq ($(UNAME),Windows)
ENABLE_IOS=
ENABLE_MAC=
ENABLE_WASM=
ENABLE_WASM_CROSS=
ENABLE_DESKTOP=
DISABLE_CCACHE=1
DISABLE_LIBTOOLIZE=1
IGNORE_PROVISION_MXE=1
endif

CCACHE:=$(if $(DISABLE_CCACHE),,$(shell which ccache))
NINJA:=$(shell which ninja)

include $(TOP)/sdks/versions.mk
include $(TOP)/sdks/paths.mk

ifndef DISABLE_LIBTOOLIZE
#brew's libtool is not compatible with some of the deps needed (I.E. V8) so in those systems we need to explicit add to the path
#this is due mono not being compatible with xcode's libtool, which is what's on path by default
ifeq (, $(shell which glibtoolize))
EXTRA_PATH=$(wildcard /usr/local/Cellar/libtool/*/bin/)
endif
endif

.PHONY: all
all:

## Common Mono targets

.PHONY: configure-mono
configure-mono: $(TOP)/configure


ifeq ($(UNAME),Darwin)
.stamp-ulimit-check:
	@if [ $$(ulimit -n) -lt 1024 ] ; then \
		echo "Error: Increase ulimit -n to at least 1024"; \
		exit 1; \
	fi
	touch $@
else
.stamp-ulimit-check:
	touch $@
endif

$(TOP)/configure: $(TOP)/configure.ac $(TOP)/autogen.sh .stamp-ulimit-check
	cd $(TOP) && PATH=$(EXTRA_PATH):$$PATH NOCONFIGURE=1 ./autogen.sh $(if $(wildcard $(TOP)/../mono-extensions),--enable-extension-module=xamarin --enable-extension-module)

## Archive targets

ifdef ENABLE_ANDROID
android_ARCHIVE=
endif

ifdef ENABLE_IOS
ios_ARCHIVE=
endif

ifdef ENABLE_MAC
mac_ARCHIVE=
endif

ifdef ENABLE_WASM
wasm_ARCHIVE=
endif

##
# Parameters:
#  $(1): target (android, ios, mac, wasm)
#  $(2): compression format (7z, zip)
define ArchiveTemplate
_$(1)_HASH = $$(shell git -C $$(TOP) rev-parse HEAD)
_$(1)_PACKAGE = $(1)-$$(CONFIGURATION)-$$(UNAME)-$$(_$(1)_HASH).$(2)

ifeq ($(2),7z)
_$(1)_COMPRESSION_ARGS = -t7z -mx=9
endif

.PHONY: archive-$(1)
archive-$(1):
	cd $$(TOP)/sdks/out && 7z a $$(_$(1)_COMPRESSION_ARGS) $$(TOP)/$$(_$(1)_PACKAGE) $$(sort $$($(1)_ARCHIVE))
endef

ifdef ENABLE_ANDROID
$(eval $(call ArchiveTemplate,android,7z))
endif

ifdef ENABLE_IOS
$(eval $(call ArchiveTemplate,ios,7z))
endif

ifdef ENABLE_MAC
$(eval $(call ArchiveTemplate,mac,7z))
endif

ifdef ENABLE_WASM
$(eval $(call ArchiveTemplate,wasm,zip))
endif

## Targets

.PHONY: build-custom-%
build-custom-%:
	$(MAKE) -C $*

.PHONY: setup-custom-%
setup-custom-%:
	mkdir -p $(TOP)/sdks/out/$*

##
# Parameters:
# $(1): product
# $(2): target
define TargetTemplate

.PHONY: toolchain-$(1)-$(2)
toolchain-$(1)-$(2): .stamp-$(1)-$(2)-toolchain

.PHONY: toolchain
toolchain: toolchain-$(1)-$(2)

.stamp-$(1)-$(2)-configure: .stamp-$(1)-$(2)-toolchain

.PHONY: configure-$(1)-$(2)
configure-$(1)-$(2): .stamp-$(1)-$(2)-configure

.PHONY: configure
configure: configure-$(1)-$(2)

.PHONY: build-$(1)-$(2)
build-$(1)-$(2): .stamp-$(1)-$(2)-configure
	$$(MAKE) build-custom-$(1)-$(2)

.PHONY: build
build: build-$(1)-$(2)

.PHONY: setup-$(1)-$(2)
setup-$(1)-$(2):
	$$(MAKE) setup-custom-$(1)-$(2)

.PHONY: package-$(1)-$(2)
package-$(1)-$(2): setup-$(1)-$(2) build-$(1)-$(2)

.PHONY: clean-$(1)-$(2)
clean-$(1)-$(2):

.PHONY: clean
clean: clean-$(1)-$(2)

endef

## Products

include runtime.mk
include bcl.mk

## MXE targets
ifeq ($(and $(DISABLE_ANDROID),$(DISABLE_WASM_CROSS)),)
# FIXME add iOS support(?)
include mxe.mk
endif

## LLVM targets
include llvm.mk

## Android targets
ifdef ENABLE_ANDROID
include android.mk
endif

## iOS targets
ifdef ENABLE_IOS
include ios.mk
endif

## Mac targets
ifdef ENABLE_MAC
include mac.mk
endif

## Desktop targets
## To run host-side tests
ifdef ENABLE_DESKTOP
include desktop.mk
endif

## WASM targets
include wasm.mk