]> git.lizzy.rs Git - rust.git/blob - mk/dist.mk
Emit lifetime end markers for function arguments
[rust.git] / mk / dist.mk
1 # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
4 #
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
10
11 ######################################################################
12 # Distribution
13 ######################################################################
14
15 # Primary targets:
16 #
17 # * dist - make all distribution artifacts
18 # * distcheck - sanity check dist artifacts
19 # * dist-tar-src - source tarballs
20 # * dist-win - Windows exe installers
21 # * dist-osx - OS X .pkg installers
22 # * dist-tar-bins - Ad-hoc Unix binary installers
23 # * dist-docs - Stage docs for upload
24
25 PKG_NAME := $(CFG_PACKAGE_NAME)
26
27 # License suitable for displaying in a popup
28 LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
29         cat $^ > $@
30
31
32 ######################################################################
33 # Source tarball
34 ######################################################################
35
36 PKG_TAR = dist/$(PKG_NAME).tar.gz
37
38 PKG_GITMODULES := $(S)src/llvm $(S)src/compiler-rt \
39                   $(S)src/rt/hoedown $(S)src/jemalloc
40 PKG_FILES := \
41     $(S)COPYRIGHT                              \
42     $(S)LICENSE-APACHE                         \
43     $(S)LICENSE-MIT                            \
44     $(S)AUTHORS.txt                            \
45     $(S)CONTRIBUTING.md                        \
46     $(S)README.md                              \
47     $(S)RELEASES.md                            \
48     $(S)configure $(S)Makefile.in              \
49     $(S)man                                    \
50     $(addprefix $(S)src/,                      \
51       README.md                                \
52       compiletest                              \
53       doc                                      \
54       driver                                   \
55       etc                                      \
56       $(foreach crate,$(CRATES),lib$(crate))   \
57       libcoretest                              \
58       libbacktrace                             \
59       rt                                       \
60       rustllvm                                 \
61       snapshots.txt                            \
62       test)                                    \
63     $(PKG_GITMODULES)                          \
64     $(filter-out config.stamp, \
65                  $(MKFILES_FOR_TARBALL))
66
67 UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
68
69 $(PKG_TAR): $(PKG_FILES)
70         @$(call E, making dist dir)
71         $(Q)rm -Rf tmp/dist/$(PKG_NAME)
72         $(Q)mkdir -p tmp/dist/$(PKG_NAME)
73         $(Q)tar \
74          -C $(S) \
75          --exclude-vcs \
76          --exclude=*~ \
77          --exclude=*/llvm/test/*/*.ll \
78          --exclude=*/llvm/test/*/*.td \
79          --exclude=*/llvm/test/*/*.s \
80          --exclude=*/llvm/test/*/*/*.ll \
81          --exclude=*/llvm/test/*/*/*.td \
82          --exclude=*/llvm/test/*/*/*.s \
83          -c $(UNROOTED_PKG_FILES) | tar -x -C tmp/dist/$(PKG_NAME)
84         @$(call E, making $@)
85         $(Q)tar -czf $(PKG_TAR) -C tmp/dist $(PKG_NAME)
86         $(Q)rm -Rf tmp/dist/$(PKG_NAME)
87
88 dist-tar-src: $(PKG_TAR)
89
90 distcheck-tar-src: dist-tar-src
91         $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
92         $(Q)rm -Rf tmp/distcheck/srccheck
93         $(Q)mkdir -p tmp/distcheck
94         @$(call E, unpacking $(PKG_TAR) in tmp/distcheck/$(PKG_NAME))
95         $(Q)cd tmp/distcheck && tar -xzf ../../$(PKG_TAR)
96         @$(call E, configuring in tmp/distcheck/srccheck)
97         $(Q)mkdir -p tmp/distcheck/srccheck
98         $(Q)cd tmp/distcheck/srccheck && ../$(PKG_NAME)/configure
99         @$(call E, making 'check' in tmp/distcheck/srccheck)
100         $(Q)+make -C tmp/distcheck/srccheck check
101         @$(call E, making 'clean' in tmp/distcheck/srccheck)
102         $(Q)+make -C tmp/distcheck/srccheck clean
103         $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
104         $(Q)rm -Rf tmp/distcheck/srccheck
105
106
107 ######################################################################
108 # Windows .exe installer
109 ######################################################################
110
111 # FIXME Needs to support all hosts, but making rust.iss compatible looks like a chore
112
113 ifdef CFG_ISCC
114
115 PKG_EXE = dist/$(PKG_NAME)-$(CFG_BUILD).exe
116
117 %.iss: $(S)src/etc/pkg/%.iss
118         cp $< $@
119
120 %.ico: $(S)src/etc/pkg/%.ico
121         cp $< $@
122
123 $(PKG_EXE): rust.iss modpath.iss upgrade.iss LICENSE.txt rust-logo.ico \
124             $(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
125             dist-prepare-win
126         $(CFG_PYTHON) $(S)src/etc/make-win-dist.py tmp/dist/win $(CFG_BUILD)
127         @$(call E, ISCC: $@)
128         $(Q)"$(CFG_ISCC)" $<
129
130 $(eval $(call DEF_PREPARE,win))
131
132 dist-prepare-win: PREPARE_HOST=$(CFG_BUILD)
133 dist-prepare-win: PREPARE_TARGETS=$(CFG_BUILD)
134 dist-prepare-win: PREPARE_DEST_DIR=tmp/dist/win
135 dist-prepare-win: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
136 dist-prepare-win: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
137 dist-prepare-win: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
138 dist-prepare-win: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
139 dist-prepare-win: PREPARE_CLEAN=true
140 dist-prepare-win: prepare-base-win
141
142 endif
143
144 dist-win: $(PKG_EXE)
145
146 distcheck-win: dist-win
147
148 ######################################################################
149 # OS X .pkg installer
150 ######################################################################
151
152 ifeq ($(CFG_OSTYPE), apple-darwin)
153
154 define DEF_OSX_PKG
155
156 $$(eval $$(call DEF_PREPARE,osx-$(1)))
157
158 dist-prepare-osx-$(1): PREPARE_HOST=$(1)
159 dist-prepare-osx-$(1): PREPARE_TARGETS=$(2)
160 dist-prepare-osx-$(1): PREPARE_DEST_DIR=tmp/dist/pkgroot-$(1)
161 dist-prepare-osx-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
162 dist-prepare-osx-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
163 dist-prepare-osx-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
164 dist-prepare-osx-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
165 dist-prepare-osx-$(1): prepare-base-osx-$(1)
166
167 dist/$(PKG_NAME)-$(1).pkg: $(S)src/etc/pkg/Distribution.xml LICENSE.txt \
168                 dist-prepare-osx-$(1) \
169                 tmp/dist/pkgres-$(1)/LICENSE.txt \
170                 tmp/dist/pkgres-$(1)/welcome.rtf \
171                 tmp/dist/pkgres-$(1)/rust-logo.png
172         @$$(call E, making OS X pkg)
173         $(Q)pkgbuild --identifier org.rust-lang.rust --root tmp/dist/pkgroot-$(1) rust.pkg
174         $(Q)productbuild --distribution $(S)src/etc/pkg/Distribution.xml \
175               --resources tmp/dist/pkgres-$(1) dist/$(PKG_NAME)-$(1).pkg
176         $(Q)rm -rf tmp rust.pkg
177
178 tmp/dist/pkgres-$(1)/LICENSE.txt: LICENSE.txt
179         @$$(call E,pkg resource LICENSE.txt)
180         $(Q)mkdir -p $$(@D)
181         $(Q)cp $$< $$@
182
183 tmp/dist/pkgres-$(1)/%: $(S)src/etc/pkg/%
184         @$$(call E,pkg resource $$*)
185         $(Q)mkdir -p $$(@D)
186         $(Q)cp -r $$< $$@
187
188 endef
189
190 ifneq ($(CFG_ENABLE_DIST_HOST_ONLY),)
191 $(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host),$(host))))
192 else
193 $(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host),$(TARGET))))
194 endif
195
196 dist-osx: $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).pkg)
197
198 else
199
200 dist-osx:
201
202 endif
203
204 # FIXME should do something
205 distcheck-osx: dist-osx
206
207
208 ######################################################################
209 # Unix binary installer tarballs
210 ######################################################################
211
212 define DEF_INSTALLER
213
214 $$(eval $$(call DEF_PREPARE,dir-$(1)))
215
216 dist-install-dir-$(1): PREPARE_HOST=$(1)
217 dist-install-dir-$(1): PREPARE_TARGETS=$(2)
218 dist-install-dir-$(1): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
219 dist-install-dir-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
220 dist-install-dir-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
221 dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
222 dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
223 dist-install-dir-$(1): PREPARE_CLEAN=true
224 dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs
225         $$(Q)(cd $$(PREPARE_DEST_DIR)/ && find . -type f | sed 's/^\.\///') \
226       > tmp/dist/manifest-$(1).in
227         $$(Q)mv tmp/dist/manifest-$(1).in $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest.in
228 # Add remaining non-installed files
229         $$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)
230         $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)
231         $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)
232         $$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)
233         $$(Q)cp -r doc $$(PREPARE_DEST_DIR)
234         $$(Q)$$(PREPARE_BIN_CMD) $$(S)src/etc/install.sh $$(PREPARE_DEST_DIR)
235
236 dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)
237         @$(call E, build: $$@)
238         $$(Q)tar -czf dist/$$(PKG_NAME)-$(1).tar.gz -C tmp/dist $$(PKG_NAME)-$(1)
239
240 endef
241
242 ifneq ($(CFG_ENABLE_DIST_HOST_ONLY),)
243 $(foreach host,$(CFG_HOST),\
244   $(eval $(call DEF_INSTALLER,$(host),$(host))))
245 else
246 $(foreach host,$(CFG_HOST),\
247   $(eval $(call DEF_INSTALLER,$(host),$(CFG_TARGET))))
248 endif
249
250 dist-install-dirs: $(foreach host,$(CFG_HOST),dist-install-dir-$(host))
251
252 dist-tar-bins: $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).tar.gz)
253
254 # Just try to run the compiler for the build host
255 distcheck-tar-bins: dist-tar-bins
256         @$(call E, checking binary tarball)
257         $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
258         $(Q)rm -Rf tmp/distcheck/tarbininstall
259         $(Q)mkdir -p tmp/distcheck
260         $(Q)cd tmp/distcheck && tar -xzf ../../dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz
261         $(Q)mkdir -p tmp/distcheck/tarbininstall
262         $(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall
263         $(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall --uninstall
264         $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
265         $(Q)rm -Rf tmp/distcheck/tarbininstall
266
267 ######################################################################
268 # Docs
269 ######################################################################
270
271 # Just copy the docs to a folder under dist with the appropriate name
272 # for uploading to S3
273 dist-docs: docs compiler-docs
274         $(Q) rm -Rf dist/doc
275         $(Q) mkdir -p dist/doc/
276         $(Q) cp -r doc dist/doc/$(CFG_PACKAGE_VERS)
277
278 distcheck-docs: dist-docs
279
280 ######################################################################
281 # Primary targets (dist, distcheck)
282 ######################################################################
283
284 ifdef CFG_WINDOWSY_$(CFG_BUILD)
285
286 dist: dist-win dist-tar-bins
287
288 distcheck: distcheck-win
289         $(Q)rm -Rf tmp/distcheck
290         @echo
291         @echo -----------------------------------------------
292         @echo "Rust ready for distribution (see ./dist)"
293         @echo -----------------------------------------------
294
295 else
296
297 # FIXME #13224: On OS X don't produce tarballs simply because --exclude-vcs don't work.
298 # This is a huge hack because I just don't have time to figure out another solution.
299 ifeq ($(CFG_OSTYPE), apple-darwin)
300 MAYBE_DIST_TAR_SRC=
301 MAYBE_DISTCHECK_TAR_SRC=
302 else
303 MAYBE_DIST_TAR_SRC=dist-tar-src
304 MAYBE_DISTCHECK_TAR_SRC=distcheck-tar-src
305 endif
306
307 dist: $(MAYBE_DIST_TAR_SRC) dist-osx dist-tar-bins dist-docs
308
309 distcheck: $(MAYBE_DISTCHECK_TAR_SRC) distcheck-osx distcheck-tar-bins distcheck-docs
310         $(Q)rm -Rf tmp/distcheck
311         @echo
312         @echo -----------------------------------------------
313         @echo "Rust ready for distribution (see ./dist)"
314         @echo -----------------------------------------------
315
316 endif
317
318 .PHONY: dist distcheck