From 178d4b0fd3d81983627dfeff8a9218b404140469 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 1 Feb 2016 23:27:04 -0800 Subject: [PATCH] Revert "mk: fix some undefined variable warnings" This reverts commit d03712977d7c913044f2b863269c4491d7fa7c36. --- mk/cfg/aarch64-linux-android.mk | 1 + mk/cfg/x86_64-apple-ios.mk | 2 +- mk/cfg/x86_64-unknown-bitrig.mk | 2 +- mk/crates.mk | 6 +++--- mk/docs.mk | 4 ++-- mk/grammar.mk | 4 ++-- mk/host.mk | 2 +- mk/install.mk | 2 +- mk/llvm.mk | 5 ++++- mk/main.mk | 30 ++++++++++-------------------- mk/platform.mk | 31 +++++++++++++++---------------- mk/rt.mk | 4 +++- mk/target.mk | 4 ++-- mk/tests.mk | 24 ++++++++++-------------- 14 files changed, 56 insertions(+), 65 deletions(-) diff --git a/mk/cfg/aarch64-linux-android.mk b/mk/cfg/aarch64-linux-android.mk index 140c4af8297..274f73834d4 100644 --- a/mk/cfg/aarch64-linux-android.mk +++ b/mk/cfg/aarch64-linux-android.mk @@ -1,4 +1,5 @@ # aarch64-linux-android configuration +# CROSS_PREFIX_aarch64-linux-android- CC_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc CXX_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-g++ CPP_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc -E diff --git a/mk/cfg/x86_64-apple-ios.mk b/mk/cfg/x86_64-apple-ios.mk index 3faf0c6a3f2..dd6080fdb0b 100644 --- a/mk/cfg/x86_64-apple-ios.mk +++ b/mk/cfg/x86_64-apple-ios.mk @@ -29,4 +29,4 @@ CFG_UNIXY_x86_64-apple-ios := 1 CFG_LDPATH_x86_64-apple-ios := CFG_RUN_x86_64-apple-ios = $(2) CFG_RUN_TARG_x86_64-apple-ios = $(call CFG_RUN_x86_64-apple-ios,,$(2)) -CFG_GNU_TRIPLE_x86_64-apple-ios := x86_64-apple-ios +CFG_GNU_TRIPLE_i386-apple-ios := x86_64-apple-ios diff --git a/mk/cfg/x86_64-unknown-bitrig.mk b/mk/cfg/x86_64-unknown-bitrig.mk index 3ed94011c48..afffec1a53a 100644 --- a/mk/cfg/x86_64-unknown-bitrig.mk +++ b/mk/cfg/x86_64-unknown-bitrig.mk @@ -9,7 +9,7 @@ CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS) CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -Wall -Werror -fPIE -fPIC -m64 -I/usr/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 +CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS) CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list= CFG_LLC_FLAGS_x86_64-unknown-bitrig := CFG_INSTALL_NAME_x86_64-unknown-bitrig = diff --git a/mk/crates.mk b/mk/crates.mk index 4db8f32bb16..f47c4857ef8 100644 --- a/mk/crates.mk +++ b/mk/crates.mk @@ -139,13 +139,13 @@ ONLY_RLIB_alloc_system := 1 # Documented-by-default crates DOC_CRATES := std alloc collections core libc rustc_unicode -ifdef CFG_DISABLE_JEMALLOC -RUSTFLAGS_rustc_back := --cfg disable_jemalloc -else +ifeq ($(CFG_DISABLE_JEMALLOC),) TARGET_CRATES += alloc_jemalloc DEPS_std += alloc_jemalloc DEPS_alloc_jemalloc := core libc native:jemalloc ONLY_RLIB_alloc_jemalloc := 1 +else +RUSTFLAGS_rustc_back := --cfg disable_jemalloc endif ################################################################################ diff --git a/mk/docs.mk b/mk/docs.mk index 81aabe60ff3..f76368e3d0b 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -71,7 +71,7 @@ DOC_L10N_TARGETS := # If NO_REBUILD is set then break the dependencies on rustdoc so we # build the documentation without having to rebuild rustdoc. -ifndef NO_REBUILD +ifeq ($(NO_REBUILD),) HTML_DEPS := $(RUSTDOC_EXE) else HTML_DEPS := @@ -152,7 +152,7 @@ define DEF_LIB_DOC # If NO_REBUILD is set then break the dependencies on rustdoc so we # build crate documentation without having to rebuild rustdoc. -ifndef NO_REBUILD +ifeq ($(NO_REBUILD),) LIB_DOC_DEP_$(1) = \ $$(CRATEFILE_$(1)) \ $$(RSINPUTS_$(1)) \ diff --git a/mk/grammar.mk b/mk/grammar.mk index 8956983e3be..0d527bd0688 100644 --- a/mk/grammar.mk +++ b/mk/grammar.mk @@ -41,8 +41,8 @@ $(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4 check-build-lexer-verifier: $(BG)verify -ifndef NO_REBUILD -VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc +ifeq ($(NO_REBUILD),) +VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc else VERIFY_DEPS := endif diff --git a/mk/host.mk b/mk/host.mk index 2faed75ac07..59a00950b5c 100644 --- a/mk/host.mk +++ b/mk/host.mk @@ -18,7 +18,7 @@ # $(5) - the name of the crate being processed define CP_HOST_STAGE_N_CRATE -ifndef ONLY_RLIB_$(5) +ifeq ($$(ONLY_RLIB_$(5)),) $$(HLIB$(2)_H_$(4))/stamp.$(5): \ $$(TLIB$(1)_T_$(3)_H_$(4))/stamp.$(5) \ $$(RUST_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \ diff --git a/mk/install.mk b/mk/install.mk index 6d9d86c3eb8..af6f3ff6ad2 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -121,7 +121,7 @@ install-runtime-target-$(1)-cleanup: endef $(foreach target,$(CFG_TARGET), \ - $(if $(findstring $(CFG_ADB_DEVICE_STATUS),true), \ + $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \ $(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \ $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,$(target))) \ )) diff --git a/mk/llvm.mk b/mk/llvm.mk index d250ede9958..a4174efa5ef 100644 --- a/mk/llvm.mk +++ b/mk/llvm.mk @@ -71,7 +71,7 @@ $$(LLVM_STAMP_$(1)): $$(S)src/rustllvm/llvm-auto-clean-trigger @$$(call E, make: done cleaning llvm) touch -r $$@.start_time $$@ && rm $$@.start_time -ifdef CFG_ENABLE_LLVM_STATIC_STDCPP +ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1) LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \ -print-file-name=lib$(CFG_STDCPP_NAME).a))" else @@ -95,6 +95,9 @@ endef $(foreach host,$(CFG_HOST), \ $(eval $(call DEF_LLVM_RULES,$(host)))) +$(foreach host,$(CFG_HOST), \ + $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host)))) + # This can't be done in target.mk because it's included before this file. define LLVM_LINKAGE_DEPS $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $$(LLVM_LINKAGE_PATH_$(2)) diff --git a/mk/main.mk b/mk/main.mk index b272a80eaf7..9d75771dc80 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -86,13 +86,13 @@ CFG_INFO := $(info cfg: version $(CFG_VERSION)) MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*) MKFILES_FOR_TARBALL:=$(MKFILE_DEPS) -ifdef NO_MKFILE_DEPS +ifneq ($(NO_MKFILE_DEPS),) MKFILE_DEPS := endif NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST)) NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET)) -ifdef MAKE_RESTARTS +ifneq ($(MAKE_RESTARTS),) CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS)) endif @@ -107,40 +107,28 @@ ifneq ($(wildcard $(NON_BUILD_TARGET)),) CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET)) endif -CFG_RUSTC_FLAGS := -ifdef RUSTFLAGS - CFG_RUSTC_FLAGS += $(RUSTFLAGS) -endif +CFG_RUSTC_FLAGS := $(RUSTFLAGS) CFG_GCCISH_CFLAGS := CFG_GCCISH_LINK_FLAGS := CFG_JEMALLOC_FLAGS := -ifdef JEMALLOC_FLAGS - CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS) -endif ifdef CFG_DISABLE_OPTIMIZE $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE)) + CFG_RUSTC_FLAGS += CFG_JEMALLOC_FLAGS += --enable-debug else # The rtopt cfg turns off runtime sanity checks CFG_RUSTC_FLAGS += -O --cfg rtopt endif +CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS) + ifdef CFG_ENABLE_DEBUG_ASSERTIONS $(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS)) CFG_RUSTC_FLAGS += -C debug-assertions=on endif -define DEF_RUSTFLAGS_STAGE -RUSTFLAGS_STAGE$(1) := -endef - -STAGES = 0 1 2 3 - -$(foreach stage,$(STAGES), \ - $(eval $(call DEF_RUSTFLAGS_STAGE,$(stage)))) - ifdef CFG_ENABLE_DEBUGINFO $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO)) CFG_RUSTC_FLAGS += -g @@ -198,9 +186,9 @@ endif ifndef CFG_DISABLE_VALGRIND_RPASS - $(info cfg: enabling valgrind run-pass tests) + $(info cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS)) $(info cfg: valgrind-rpass command set to $(CFG_VALGRIND)) - CFG_VALGRIND_RPASS := $(CFG_VALGRIND) + CFG_VALGRIND_RPASS :=$(CFG_VALGRIND) else $(info cfg: disabling valgrind run-pass tests) CFG_VALGRIND_RPASS := @@ -384,6 +372,8 @@ export CFG_BOOTSTRAP_KEY TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\ $(if $(findstring windows,$(1)),none,$(if $(findstring darwin,$(1)),lldb,gdb)) +STAGES = 0 1 2 3 + define SREQ # $(1) is the stage number # $(2) is the target triple diff --git a/mk/platform.mk b/mk/platform.mk index d702cca209d..9c74e657a84 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -82,11 +82,12 @@ AR := ar define SET_FROM_CFG ifdef CFG_$(1) ifeq ($(origin $(1)),undefined) - $$(info cfg: using $(1)=$$(CFG_$(1)) (CFG_$(1))) - $(1)=$$(CFG_$(1)) - else ifeq ($(origin $(1)),default) - $$(info cfg: using $(1)=$$(CFG_$(1)) (CFG_$(1))) - $(1)=$$(CFG_$(1)) + $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1))) + $(1)=$(CFG_$(1)) + endif + ifeq ($(origin $(1)),default) + $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1))) + $(1)=$(CFG_$(1)) endif endif endef @@ -100,9 +101,7 @@ include $(wildcard $(CFG_SRC_DIR)mk/cfg/*.mk) define ADD_INSTALLED_OBJECTS INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1)) - ifdef CFG_THIRD_PARTY_OBJECTS_$(1) - REQUIRED_OBJECTS_$(1) += $$(CFG_THIRD_PARTY_OBJECTS_$(1)) - endif + REQUIRED_OBJECTS_$(1) += $$(CFG_THIRD_PARTY_OBJECTS_$(1)) INSTALLED_OBJECTS_$(1) += $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt) REQUIRED_OBJECTS_$(1) += $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt) endef @@ -164,15 +163,15 @@ define CFG_MAKE_TOOLCHAIN # Prepend the tools with their prefix if cross compiling ifneq ($(CFG_BUILD),$(1)) ifneq ($$(findstring msvc,$(1)),msvc) - CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1)) - CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1)) - CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1)) - AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) - LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1)) - RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \ - -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) + CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1)) + CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1)) + CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1)) + AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) + LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1)) + RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \ + -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) - RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) + RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) endif endif diff --git a/mk/rt.mk b/mk/rt.mk index 394fbe1ba0f..9dbbcbebb97 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -107,6 +107,8 @@ $$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1)): $$(OBJS_$(2)_$(1)) endef +$(foreach target,$(CFG_TARGET), \ + $(eval $(call RUNTIME_RULES,$(target)))) $(foreach lib,$(NATIVE_LIBS), \ $(foreach target,$(CFG_TARGET), \ $(eval $(call THIRD_PARTY_LIB,$(target),$(lib))))) @@ -169,7 +171,7 @@ endif # See #17183 for details, this file is touched during the build process so we # don't want to consider it as a dependency. -JEMALLOC_DEPS := $(filter-out $(S)src/jemalloc/VERSION,$$(JEMALLOC_DEPS)) +JEMALLOC_DEPS := $(filter-out $(S)src/jemalloc/VERSION,$(JEMALLOC_DEPS)) JEMALLOC_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc) ifeq ($$(CFG_WINDOWSY_$(1)),1) diff --git a/mk/target.mk b/mk/target.mk index 1fcc87f0c35..32a3eb5c20d 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -138,12 +138,12 @@ define TARGET_RUSTRT_STARTUP_OBJ $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o: \ $(S)src/rtstartup/$(4).rs \ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core \ - $$(HSREQ$(1)_H_$(3)) \ + $$(HSREQ$(1)_T_$(2)_H_$(3)) \ | $$(TBIN$(1)_T_$(2)_H_$(3))/ @$$(call E, rustc: $$@) $$(STAGE$(1)_T_$(2)_H_$(3)) --emit=obj -o $$@ $$< -ifdef CFG_RUSTRT_HAS_STARTUP_OBJS_$(2) +ifeq ($$(CFG_RUSTRT_HAS_STARTUP_OBJS_$(2)), 1) # Add dependencies on Rust startup objects to all crates that depend on core. # This ensures that they are built after core (since they depend on it), # but before everything else (since they are needed for linking dylib crates). diff --git a/mk/tests.mk b/mk/tests.mk index bce5a52118b..19587a28d55 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -36,8 +36,6 @@ TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES) # Environment configuration ###################################################################### -TESTARGS := - # The arguments to all test runners ifdef TESTNAME TESTARGS += $(TESTNAME) @@ -50,8 +48,6 @@ endif # Arguments to the cfail/rfail/rpass tests ifdef CFG_VALGRIND CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)" -else - CTEST_RUNTOOL = endif CTEST_TESTARGS := $(TESTARGS) @@ -147,11 +143,10 @@ else CFG_ADB_TEST_DIR= endif -DOC_NAMES := # $(1) - name of doc test # $(2) - file of the test define DOCTEST -DOC_NAMES += $(1) +DOC_NAMES := $$(DOC_NAMES) $(1) DOCFILE_$(1) := $(2) endef @@ -367,7 +362,7 @@ define TEST_RUNNER # If NO_REBUILD is set then break the dependencies on everything but # the source files so we can test crates without rebuilding any of the # parent crates. -ifndef NO_REBUILD +ifeq ($(NO_REBUILD),) TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \ $$(foreach crate,$$(TARGET_CRATES), \ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \ @@ -452,7 +447,7 @@ $(foreach host,$(CFG_HOST), \ $(if $(findstring $(target),$(CFG_BUILD)), \ $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \ $(if $(findstring android, $(target)), \ - $(if $(findstring $(CFG_ADB_DEVICE_STATUS),true), \ + $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \ $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \ $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \ ), \ @@ -705,14 +700,14 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4 # (Encoded as a separate variable because GNU make does not have a # good way to express OR on ifeq commands) -ifdef CTEST_DISABLE_$(4) +ifneq ($$(CTEST_DISABLE_$(4)),) # Test suite is disabled for all configured targets. CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4)) else # else, check if non-self-hosted target (i.e. target not-in hosts) ... ifeq ($$(findstring $(2),$$(CFG_HOST)),) # ... if so, then check if this test suite is disabled for non-selfhosts. -ifdef CTEST_DISABLE_NONSELFHOST_$(4) +ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),) # Test suite is disabled for this target. CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4)) endif @@ -720,7 +715,7 @@ endif # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test. endif -ifndef CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) +ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),) $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3)) @@ -829,7 +824,7 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3) # If NO_REBUILD is set then break the dependencies on everything but # the source files so we can test documentation without rebuilding # rustdoc etc. -ifndef NO_REBUILD +ifeq ($(NO_REBUILD),) DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \ $$(DOCFILE_$(4)) \ $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ @@ -864,7 +859,7 @@ define DEF_CRATE_DOC_TEST # If NO_REBUILD is set then break the dependencies on everything but # the source files so we can test crate documentation without # rebuilding any of the parent crates. -ifndef NO_REBUILD +ifeq ($(NO_REBUILD),) CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \ $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \ @@ -927,7 +922,8 @@ TEST_GROUPS = \ pretty-rpass-full \ pretty-rfail-full \ pretty-rfail \ - pretty-pretty + pretty-pretty \ + $(NULL) define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec