]> git.lizzy.rs Git - rust.git/blob - mk/reconfig.mk
Rollup merge of #38299 - achanda:ctrl-c, r=brson
[rust.git] / mk / reconfig.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 # Recursive wildcard function
12 # http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
13 rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
14   $(filter $(subst *,%,$2),$d))
15
16 ifndef CFG_DISABLE_MANAGE_SUBMODULES
17 # This is a pretty expensive operation but I don't see any way to avoid it
18 # NB: This only looks for '+' status (wrong commit checked out), not '-' status
19 # (nothing checked out at all).  `./configure --{llvm,jemalloc}-root`
20 # will explicitly deinitialize the corresponding submodules, and we don't
21 # want to force constant rebuilds in that case.
22 NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+')
23 else
24 NEED_GIT_RECONFIG=0
25 endif
26
27 ifeq ($(NEED_GIT_RECONFIG),0)
28 else
29 # If the submodules have changed then always execute config.mk
30 .PHONY: config.stamp
31 endif
32
33 Makefile config.mk: config.stamp
34
35 ifeq ($(SREL),)
36 SREL_ROOT := ./
37 else
38 SREL_ROOT := $(SREL)
39 endif
40
41 config.stamp: $(S)configure $(S)Makefile.in $(S)src/stage0.txt
42         @$(call E, cfg: reconfiguring)
43         $(SREL_ROOT)configure $(CFG_CONFIGURE_ARGS)