@@ -86,13 +86,13 @@ CFG_INFO := $(info cfg: version $(CFG_VERSION))
8686
8787MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR ) mk/,* )
8888MKFILES_FOR_TARBALL: =$(MKFILE_DEPS )
89- ifneq ( $( NO_MKFILE_DEPS ) ,)
89+ ifdef NO_MKFILE_DEPS
9090MKFILE_DEPS :=
9191endif
9292NON_BUILD_HOST = $(filter-out $(CFG_BUILD ) ,$(CFG_HOST ) )
9393NON_BUILD_TARGET = $(filter-out $(CFG_BUILD ) ,$(CFG_TARGET ) )
9494
95- ifneq ( $( MAKE_RESTARTS ) ,)
95+ ifdef MAKE_RESTARTS
9696CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS ) )
9797endif
9898
@@ -107,28 +107,40 @@ ifneq ($(wildcard $(NON_BUILD_TARGET)),)
107107CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET ) )
108108endif
109109
110- CFG_RUSTC_FLAGS := $(RUSTFLAGS )
110+ CFG_RUSTC_FLAGS :=
111+ ifdef RUSTFLAGS
112+ CFG_RUSTC_FLAGS += $(RUSTFLAGS )
113+ endif
111114CFG_GCCISH_CFLAGS :=
112115CFG_GCCISH_LINK_FLAGS :=
113116
114117CFG_JEMALLOC_FLAGS :=
118+ ifdef JEMALLOC_FLAGS
119+ CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS )
120+ endif
115121
116122ifdef CFG_DISABLE_OPTIMIZE
117123 $(info cfg : disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
118- CFG_RUSTC_FLAGS +=
119124 CFG_JEMALLOC_FLAGS += --enable-debug
120125else
121126 # The rtopt cfg turns off runtime sanity checks
122127 CFG_RUSTC_FLAGS += -O --cfg rtopt
123128endif
124129
125- CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS )
126-
127130ifdef CFG_ENABLE_DEBUG_ASSERTIONS
128131 $(info cfg : enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS))
129132 CFG_RUSTC_FLAGS += -C debug-assertions=on
130133endif
131134
135+ define DEF_RUSTFLAGS_STAGE
136+ RUSTFLAGS_STAGE$(1 ) :=
137+ endef
138+
139+ STAGES = 0 1 2 3
140+
141+ $(foreach stage,$(STAGES), \
142+ $(eval $(call DEF_RUSTFLAGS_STAGE,$(stage))))
143+
132144ifdef CFG_ENABLE_DEBUGINFO
133145 $(info cfg : enabling debuginfo (CFG_ENABLE_DEBUGINFO))
134146 CFG_RUSTC_FLAGS += -g
@@ -186,9 +198,9 @@ endif
186198
187199
188200ifndef CFG_DISABLE_VALGRIND_RPASS
189- $(info cfg : enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS) )
201+ $(info cfg : enabling valgrind run-pass tests)
190202 $(info cfg : valgrind-rpass command set to $(CFG_VALGRIND ) )
191- CFG_VALGRIND_RPASS :=$(CFG_VALGRIND )
203+ CFG_VALGRIND_RPASS := $(CFG_VALGRIND )
192204else
193205 $(info cfg : disabling valgrind run-pass tests)
194206 CFG_VALGRIND_RPASS :=
@@ -372,8 +384,6 @@ export CFG_BOOTSTRAP_KEY
372384TRIPLE_TO_DEBUGGER_SCRIPT_SETTING =\
373385 $(if $(findstring windows,$(1 ) ) ,none,$(if $(findstring darwin,$(1 ) ) ,lldb,gdb) )
374386
375- STAGES = 0 1 2 3
376-
377387define SREQ
378388# $(1) is the stage number
379389# $(2) is the target triple
0 commit comments