PageRenderTime 24ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/mk/dist.mk

http://github.com/jruderman/rust
Makefile | 112 lines | 90 code | 19 blank | 3 comment | 4 complexity | 0f29db533d8e4a26db27b1b9043c146b MD5 | raw file
  1######################################################################
  2# Distribution
  3######################################################################
  4
  5PKG_NAME := rust
  6PKG_DIR = $(PKG_NAME)-$(CFG_RELEASE)
  7PKG_TAR = $(PKG_DIR).tar.gz
  8
  9ifdef CFG_ISCC
 10PKG_ISS = $(wildcard $(S)src/etc/pkg/*.iss)
 11PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
 12PKG_EXE = $(PKG_DIR)-install.exe
 13endif
 14
 15PKG_GITMODULES := $(S)src/libuv $(S)src/llvm
 16
 17PKG_FILES := \
 18    $(S)LICENSE.txt $(S)README.md              \
 19    $(S)configure $(S)Makefile.in              \
 20    $(S)man                                    \
 21    $(S)doc                                    \
 22    $(addprefix $(S)src/,                      \
 23      README.txt                               \
 24      cargo                                    \
 25      rustc                                    \
 26      compiletest                              \
 27      etc                                      \
 28      fuzzer                                   \
 29      libcore                                  \
 30      libsyntax                                \
 31      libstd                                   \
 32      rt                                       \
 33      rustdoc                                  \
 34      rustllvm                                 \
 35      snapshots.txt                            \
 36      test)                                    \
 37    $(PKG_GITMODULES)                          \
 38    $(filter-out Makefile config.stamp config.mk, \
 39                 $(MKFILE_DEPS))
 40
 41UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
 42
 43ifdef CFG_ISCC
 44LICENSE.txt: $(S)LICENSE.txt
 45	cp $< $@
 46
 47%.iss: $(S)src/etc/pkg/%.iss
 48	cp $< $@
 49
 50%.ico: $(S)src/etc/pkg/%.ico
 51	cp $< $@
 52
 53$(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
 54            $(PKG_FILES) all rustc-stage3
 55	@$(call E, ISCC: $@)
 56	$(Q)"$(CFG_ISCC)" $<
 57endif
 58
 59
 60$(PKG_TAR): $(PKG_FILES)
 61	@$(call E, making dist dir)
 62	$(Q)rm -Rf dist
 63	$(Q)mkdir -p dist/$(PKG_DIR)
 64	$(Q)tar \
 65         -C $(S) \
 66         --exclude-vcs \
 67         --exclude=*~ \
 68         --exclude=*/llvm/test/*/*.ll \
 69         --exclude=*/llvm/test/*/*.td \
 70         --exclude=*/llvm/test/*/*.s \
 71         --exclude=*/llvm/test/*/*/*.ll \
 72         --exclude=*/llvm/test/*/*/*.td \
 73         --exclude=*/llvm/test/*/*/*.s \
 74         -c $(UNROOTED_PKG_FILES) | tar -x -C dist/$(PKG_DIR)
 75	$(Q)tar -czf $(PKG_TAR) -C dist $(PKG_DIR)
 76	$(Q)rm -Rf dist
 77
 78.PHONY: dist distcheck
 79
 80ifdef CFG_WINDOWSY
 81
 82dist: $(PKG_EXE)
 83
 84distcheck: dist
 85	@echo
 86	@echo -----------------------------------------------
 87	@echo $(PKG_EXE) ready for distribution
 88	@echo -----------------------------------------------
 89
 90else
 91
 92dist: $(PKG_TAR)
 93
 94distcheck: $(PKG_TAR)
 95	$(Q)rm -Rf dist
 96	$(Q)mkdir -p dist
 97	@$(call E, unpacking $(PKG_TAR) in dist/$(PKG_DIR))
 98	$(Q)cd dist && tar -xzf ../$(PKG_TAR)
 99	@$(call E, configuring in dist/$(PKG_DIR)-build)
100	$(Q)mkdir -p dist/$(PKG_DIR)-build
101	$(Q)cd dist/$(PKG_DIR)-build && ../$(PKG_DIR)/configure
102	@$(call E, making 'check' in dist/$(PKG_DIR)-build)
103	$(Q)+make -C dist/$(PKG_DIR)-build check
104	@$(call E, making 'clean' in dist/$(PKG_DIR)-build)
105	$(Q)+make -C dist/$(PKG_DIR)-build clean
106	$(Q)rm -Rf dist
107	@echo
108	@echo -----------------------------------------------
109	@echo $(PKG_TAR) ready for distribution
110	@echo -----------------------------------------------
111
112endif