]> git.lizzy.rs Git - rust.git/blob - mk/dist.mk
8e568124d4152c47a1650843e2c4064599f142ab
[rust.git] / mk / dist.mk
1 ######################################################################
2 # Distribution
3 ######################################################################
4
5 PKG_NAME := rust
6 PKG_DIR = $(PKG_NAME)-$(CFG_RELEASE)
7 PKG_TAR = $(PKG_DIR).tar.gz
8
9 ifdef CFG_ISCC
10 PKG_ISS = $(wildcard $(S)src/etc/pkg/*.iss)
11 PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
12 PKG_EXE = $(PKG_DIR)-install.exe
13 endif
14
15 PKG_GITMODULES := $(S)src/libuv $(S)src/llvm
16
17 PKG_FILES := \
18     $(S)COPYRIGHT                              \
19     $(S)LICENSE-APACHE                         \
20     $(S)LICENSE-MIT                            \
21     $(S)AUTHORS.txt                            \
22     $(S)CONTRIBUTING.md                        \
23     $(S)README.md                              \
24     $(S)RELEASES.txt                           \
25     $(S)configure $(S)Makefile.in              \
26     $(S)man                                    \
27     $(S)doc                                    \
28     $(addprefix $(S)src/,                      \
29       README.txt                               \
30       driver                                   \
31       librustpkg                               \
32       librusti                                 \
33       librust                                  \
34       librustc                                 \
35       compiletest                              \
36       etc                                      \
37       libextra                                 \
38       libstd                                   \
39       libsyntax                                \
40       rt                                       \
41       librustdoc                               \
42       rustllvm                                 \
43       snapshots.txt                            \
44       test)                                    \
45     $(PKG_GITMODULES)                          \
46     $(filter-out Makefile config.stamp config.mk, \
47                  $(MKFILE_DEPS))
48
49 UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
50
51 ifdef CFG_ISCC
52 LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
53         cat $^ > $@
54
55 %.iss: $(S)src/etc/pkg/%.iss
56         cp $< $@
57
58 %.ico: $(S)src/etc/pkg/%.ico
59         cp $< $@
60
61 $(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
62             $(PKG_FILES) $(CSREQ3_T_$(CFG_BUILD_TRIPLE)_H_$(CFG_BUILD_TRIPLE))
63         @$(call E, ISCC: $@)
64         $(Q)"$(CFG_ISCC)" $<
65 endif
66
67
68 $(PKG_TAR): $(PKG_FILES)
69         @$(call E, making dist dir)
70         $(Q)rm -Rf dist
71         $(Q)mkdir -p dist/$(PKG_DIR)
72         $(Q)tar \
73          -C $(S) \
74          --exclude-vcs \
75          --exclude=*~ \
76          --exclude=*/llvm/test/*/*.ll \
77          --exclude=*/llvm/test/*/*.td \
78          --exclude=*/llvm/test/*/*.s \
79          --exclude=*/llvm/test/*/*/*.ll \
80          --exclude=*/llvm/test/*/*/*.td \
81          --exclude=*/llvm/test/*/*/*.s \
82          -c $(UNROOTED_PKG_FILES) | tar -x -C dist/$(PKG_DIR)
83         $(Q)tar -czf $(PKG_TAR) -C dist $(PKG_DIR)
84         $(Q)rm -Rf dist
85
86 .PHONY: dist distcheck
87
88 ifdef CFG_WINDOWSY_$(CFG_BUILD_TRIPLE)
89
90 dist: $(PKG_EXE)
91
92 distcheck: dist
93         @echo
94         @echo -----------------------------------------------
95         @echo $(PKG_EXE) ready for distribution
96         @echo -----------------------------------------------
97
98 else
99
100 dist: $(PKG_TAR)
101
102 distcheck: $(PKG_TAR)
103         $(Q)rm -Rf dist
104         $(Q)mkdir -p dist
105         @$(call E, unpacking $(PKG_TAR) in dist/$(PKG_DIR))
106         $(Q)cd dist && tar -xzf ../$(PKG_TAR)
107         @$(call E, configuring in dist/$(PKG_DIR)-build)
108         $(Q)mkdir -p dist/$(PKG_DIR)-build
109         $(Q)cd dist/$(PKG_DIR)-build && ../$(PKG_DIR)/configure
110         @$(call E, making 'check' in dist/$(PKG_DIR)-build)
111         $(Q)+make -C dist/$(PKG_DIR)-build check
112         @$(call E, making 'clean' in dist/$(PKG_DIR)-build)
113         $(Q)+make -C dist/$(PKG_DIR)-build clean
114         $(Q)rm -Rf dist
115         @echo
116         @echo -----------------------------------------------
117         @echo $(PKG_TAR) ready for distribution
118         @echo -----------------------------------------------
119
120 endif