[corlib] Import FileSystemInfo and family from CoreFX (#11342)
[mono-project.git] / sdks / builds / Makefile
blob2934d044f8729ce7c14da58b7151a11454e62e5e
1 TOP=$(realpath $(CURDIR)/../..)
2 -include $(TOP)/sdks/Make.config
4 all: package
6 MAKEFLAGS += --no-builtin-rules
8 CONFIGURATION?=release
10 RELEASE=$(if $(filter $(CONFIGURATION),release),1)
12 lowercase=$(shell echo "$(1)" | tr '[:upper:]' '[:lower:]')
14 CCACHE:=$(if $(DISABLE_CCACHE),,$(shell which ccache))
15 NINJA:=$(shell which ninja)
17 UNAME=$(shell uname)
19 ifneq ($(UNAME),Darwin)
20 ifneq ($(UNAME),Linux)
21 $(error "Unsupported UNAME=$(UNAME)")
22 endif
23 endif
25 ifneq ($(UNAME),Darwin)
26 # iOS requires Xcode to be available, and Xcode is only available on macOS
27 DISABLE_IOS=1
28 endif
30 include $(TOP)/sdks/versions.mk
31 include $(TOP)/sdks/paths.mk
33 #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
34 #this is due mono not being compatible with xcode's libtool, which is what's on path by default
35 ifeq (, $(shell which glibtoolize))
36 EXTRA_PATH=$(wildcard /usr/local/Cellar/libtool/*/bin/)
37 endif
39 all: package
41 ## Common Mono targets
43 .PHONY: configure-mono
44 configure-mono: $(TOP)/configure
46 $(TOP)/configure: $(TOP)/configure.ac $(TOP)/autogen.sh
47 cd $(TOP) && PATH=$(EXTRA_PATH):$$PATH NOCONFIGURE=1 ./autogen.sh
49 ## Archive targets
51 ifndef DISABLE_ANDROID
52 android_ARCHIVE=
53 endif
55 ifndef DISABLE_IOS
56 ios_ARCHIVE=
57 endif
59 ifndef DISABLE_WASM
60 wasm_ARCHIVE=
61 endif
64 # Parameters:
65 # $(1): target (android, ios, wasm)
66 define ArchiveTemplate
67 _$(1)_HASH = $$(shell git -C $$(TOP) rev-parse HEAD)
68 _$(1)_PACKAGE = $(1)-$$(CONFIGURATION)-$$(UNAME)-$$(_$(1)_HASH).zip
70 .PHONY: archive-$(1)
71 archive-$(1):
72 cd $$(TOP)/sdks/out && 7z a $$(TOP)/$$(_$(1)_PACKAGE) $$(sort $$($(1)_ARCHIVE))
73 endef
75 ifndef DISABLE_ANDROID
76 $(eval $(call ArchiveTemplate,android))
77 endif
79 ifndef DISABLE_IOS
80 $(eval $(call ArchiveTemplate,ios))
81 endif
83 ifndef DISABLE_WASM
84 $(eval $(call ArchiveTemplate,wasm))
85 endif
87 ## Targets
89 .PHONY: build-custom-%
90 build-custom-%:
91 $(MAKE) -C $*
93 .PHONY: setup-custom-%
94 setup-custom-%:
95 mkdir -p $(TOP)/sdks/out/$*
98 # Parameters:
99 # $(1): product
100 # $(2): target
101 define TargetTemplate
103 .PHONY: toolchain-$(1)-$(2)
104 toolchain-$(1)-$(2): .stamp-$(1)-$(2)-toolchain
106 .PHONY: toolchain
107 toolchain: toolchain-$(1)-$(2)
109 .stamp-$(1)-$(2)-configure: .stamp-$(1)-$(2)-toolchain
111 .PHONY: configure-$(1)-$(2)
112 configure-$(1)-$(2): .stamp-$(1)-$(2)-configure
114 .PHONY: configure
115 configure: configure-$(1)-$(2)
117 .PHONY: build-$(1)-$(2)
118 build-$(1)-$(2): .stamp-$(1)-$(2)-configure
119 $$(MAKE) build-custom-$(1)-$(2)
121 .PHONY: build
122 build: build-$(1)-$(2)
124 .PHONY: setup-$(1)-$(2)
125 setup-$(1)-$(2):
126 $$(MAKE) setup-custom-$(1)-$(2)
128 .PHONY: package-$(1)-$(2)
129 package-$(1)-$(2): setup-$(1)-$(2) build-$(1)-$(2)
131 .PHONY: package
132 package: package-$(1)-$(2)
134 .PHONY: clean-$(1)-$(2)
135 clean-$(1)-$(2):
137 .PHONY: clean
138 clean: clean-$(1)-$(2)
140 endef
142 ## Products
144 include runtime.mk
145 include bcl.mk
147 ## MXE targets
148 ifeq ($(and $(DISABLE_ANDROID),$(DISABLE_WASM_CROSS)),)
149 # FIXME add iOS support(?)
150 include mxe.mk
151 endif
153 ## LLVM targets
154 include llvm.mk
156 ## Android targets
157 ifndef DISABLE_ANDROID
158 include android.mk
159 endif
161 ## iOS targets
162 ifndef DISABLE_IOS
163 include ios.mk
164 endif
166 ## Desktop targets
167 ## To run host-side tests
168 ifndef DISABLE_DESKTOP
169 include desktop.mk
170 endif
172 ## WASM targets
173 ifndef DISABLE_WASM
174 include wasm.mk
175 endif