From 9c00c62b08c1c2c5162ab8179096e88de3a203bc Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 23 Nov 2011 15:20:28 -0800 Subject: [PATCH] fix makefiles, add option to ignore changes in makefiles --- Makefile.in | 6 ++++++ mk/autodep.mk | 4 ++-- mk/dist.mk | 2 +- mk/docs.mk | 2 +- mk/rt.mk | 21 +++++++++++---------- mk/rustllvm.mk | 4 ++-- mk/stage0.mk | 6 ++++-- mk/tests.mk | 36 ++++++++++++++++++------------------ mk/tools.mk | 7 ++++--- 9 files changed, 49 insertions(+), 39 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0e5670db7fa..d9f9012f88d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -59,6 +59,12 @@ GEN_MKFILES := $(wildcard $(CFG_SRC_DIR)/mk/libuv/*/*/*) \ MKFILES := $(OUR_MKFILES) $(3RDPARTY_MKFILES) $(GEN_MKFILES) +ifdef IGNORE_MKFILES + MKFILE_DEPS := +else + MKFILE_DEPS := $(MKFILES) +endif + NON_HOST_TRIPLES = $(filter-out $(CFG_HOST_TRIPLE),$(CFG_TARGET_TRIPLES)) ifneq ($(MAKE_RESTARTS),) diff --git a/mk/autodep.mk b/mk/autodep.mk index dc46b540ead..a53d0aa9bdf 100644 --- a/mk/autodep.mk +++ b/mk/autodep.mk @@ -5,7 +5,7 @@ C_DEPFILES := $(RUNTIME_CS:%.cpp=%.d) $(RUSTLLVM_LIB_CS:%.cpp=%.d) \ $(RUSTLLVM_OBJS_CS:%.cpp=%.d) -rt/%.d: rt/%.cpp $(MKFILES) +rt/%.d: rt/%.cpp $(MKFILE_DEPS) @$(call E, dep: $@) $(Q)$(call CFG_DEPEND_C, $@ \ $(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \ @@ -14,7 +14,7 @@ rt/%.d: rt/%.cpp $(MKFILES) $(Q)rm -f $@.tmp.bak $(Q)mv $@.tmp $@ -rustllvm/%.d: rustllvm/%.cpp $(MKFILES) $(LLVM_CONFIG_$(CFG_HOST_TRIPLE)) +rustllvm/%.d: rustllvm/%.cpp $(MKFILE_DEPS) $(LLVM_CONFIG_$(CFG_HOST_TRIPLE)) @$(call E, dep: $@) $(Q)$(call CFG_DEPEND_C, $@ \ $(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \ diff --git a/mk/dist.mk b/mk/dist.mk index 230d325c843..def3cfc1269 100644 --- a/mk/dist.mk +++ b/mk/dist.mk @@ -53,7 +53,7 @@ PKG_FILES = \ $(COMPILETEST_CRATE) \ $(COMPILETEST_INPUTS) \ $(PKG_PP_EXAMPLES) \ - $(MKFILES) + $(MKFILE_DEPS) dist: $(PKG_TAR) $(PKG_EXE) diff --git a/mk/docs.mk b/mk/docs.mk index 62f67bbf105..b4250194c48 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -8,7 +8,7 @@ doc/keywords.texi: $(S)doc/keywords.txt $(S)src/etc/gen-keywords-table.py @$(call E, gen-keywords-table: $@) $(Q)$(S)src/etc/gen-keywords-table.py -doc/version.texi: $(MKFILES) rust.texi +doc/version.texi: $(MKFILE_DEPS) rust.texi @$(call E, version-stamp: $@) $(Q)echo "@macro gitversion" >$@ $(Q)echo "$(CFG_VERSION)" >>$@ diff --git a/mk/rt.mk b/mk/rt.mk index 4f49e5e4c09..57d75e32435 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -131,22 +131,23 @@ RUNTIME_OBJS_$(1) := $$(RUNTIME_CS_$(1):rt/%.cpp=rt/$(1)/%.o) \ $$(RUNTIME_S_$(1):rt/%.S=rt/$(1)/%.o) RUNTIME_LIBS_$(1) := $$(LIBUV_LIB_$(1)) -rt/$(1)/%.o: rt/%.cpp $$(MKFILES) +rt/$(1)/%.o: rt/%.cpp $$(MKFILE_DEPS) @$$(call E, compile: $$@) $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1))) $$< -rt/$(1)/%.o: rt/%.S $$(MKFILES) +rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS) @$$(call E, compile: $$@) $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1))) $$< -rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: rt/$(1)/arch/$$(HOST_$(1))/morestack.o +rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: \ + rt/$(1)/arch/$$(HOST_$(1))/morestack.o @$$(call E, link: $$@) $$(Q)ar rcs $$@ $$< -rt/$(1)/$(CFG_RUNTIME): $$(RUNTIME_OBJS_$(1)) $$(MKFILES) \ - $$(RUNTIME_HDR_$(1)) \ - $$(RUNTIME_DEF_$(1)) \ - $$(RUNTIME_LIBS_$(1)) +rt/$(1)/$(CFG_RUNTIME): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \ + $$(RUNTIME_HDR_$(1)) \ + $$(RUNTIME_DEF_$(1)) \ + $$(RUNTIME_LIBS_$(1)) @$$(call E, link: $$@) $$(Q)$$(call CFG_LINK_C_$(1),$$@, $$(RUNTIME_OBJS_$(1)) \ $$(CFG_GCCISH_POST_LIB_FLAGS) $$(RUNTIME_LIBS_$(1)) \ @@ -172,18 +173,18 @@ $$(LIBUV_LIB_$(1)): $$(wildcard \ # These could go in rt.mk or rustllvm.mk, they're needed for both. # This regexp has a single $, escaped twice -%.linux.def: %.def.in $$(MKFILES) +%.linux.def: %.def.in $$(MKFILE_DEPS) @$$(call E, def: $$@) $$(Q)echo "{" > $$@ $$(Q)sed 's/.$$$$/&;/' $$< >> $$@ $$(Q)echo "};" >> $$@ -%.darwin.def: %.def.in $$(MKFILES) +%.darwin.def: %.def.in $$(MKFILE_DEPS) @$$(call E, def: $$@) $$(Q)sed 's/^./_&/' $$< > $$@ ifdef CFG_WINDOWSY -%.def: %.def.in $$(MKFILES) +%.def: %.def.in $$(MKFILE_DEPS) @$$(call E, def: $$@) $$(Q)echo LIBRARY $$* > $$@ $$(Q)echo EXPORTS >> $$@ diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk index 068c73400f5..dc85cd0943e 100644 --- a/mk/rustllvm.mk +++ b/mk/rustllvm.mk @@ -19,14 +19,14 @@ RUSTLLVM_INCS_$(1) = -iquote $$(LLVM_INCDIR_$(1)) \ RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)/%.o) rustllvm/$(1)/$(CFG_RUSTLLVM): $$(RUSTLLVM_OBJS_OBJS_$(1)) \ - $$(MKFILES) $$(RUSTLLVM_DEF_$(1)) + $$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1)) @$$(call E, link: $$@) $$(Q)$$(call CFG_LINK_C_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \ $$(CFG_GCCISH_PRE_LIB_FLAGS) $$(LLVM_LIBS_$(1)) \ $$(CFG_GCCISH_POST_LIB_FLAGS) \ $$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM)) -rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILES) $$(LLVM_CONFIG_$(1)) +rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1)) @$$(call E, compile: $$@) $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(LLVM_CXXFLAGS_$(1)) $$(RUSTLLVM_INCS_$(1))) $$< endef diff --git a/mk/stage0.mk b/mk/stage0.mk index 39df29577c5..325418181ca 100644 --- a/mk/stage0.mk +++ b/mk/stage0.mk @@ -2,7 +2,7 @@ $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X): \ $(S)src/snapshots.txt \ - $(S)src/etc/get-snapshot.py $(MKFILES) + $(S)src/etc/get-snapshot.py $(MKFILE_DEPS) @$(call E, fetch: $@) $(Q)$(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) $(Q)touch $@ @@ -50,5 +50,7 @@ $$(HLIB0_H_$(1))/$(CFG_RUSTLLVM): \ endef +# Use stage1 to build other architectures: then you don't have to wait +# for stage2, but you get the latest updates to the compiler source. $(foreach t,$(NON_HOST_TRIPLES), \ - $(eval $(call BOOTSTRAP_STAGE0,$(t),2,$(CFG_HOST_TRIPLE)))) + $(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_HOST_TRIPLE)))) diff --git a/mk/tests.mk b/mk/tests.mk index be3bf05e42d..19c9522ccaf 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -201,62 +201,62 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \ --rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)" \ $$(CTEST_TESTARGS) -CFAIL_ARGS$(1)-T-$(2)-H-$(3) := \ +CFAIL_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/compile-fail/ \ - --build-base test/compile-fail/ \ + --build-base $(3)/test/compile-fail/ \ --mode compile-fail -RFAIL_ARGS$(1)-T-$(2)-H-$(3) := \ +RFAIL_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/run-fail/ \ - --build-base test/run-fail/ \ + --build-base $(3)/test/run-fail/ \ --mode run-fail \ $$(CTEST_RUNTOOL) -RPASS_ARGS$(1)-T-$(2)-H-$(3) := \ +RPASS_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/run-pass/ \ - --build-base test/run-pass/ \ + --build-base $(3)/test/run-pass/ \ --mode run-pass \ $$(CTEST_RUNTOOL) -BENCH_ARGS$(1)-T-$(2)-H-$(3) := \ +BENCH_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/bench/ \ - --build-base test/bench/ \ + --build-base $(3)/test/bench/ \ --mode run-pass \ $$(CTEST_RUNTOOL) -PERF_ARGS$(1)-T-$(2)-H-$(3) := \ +PERF_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/bench/ \ - --build-base test/perf/ \ + --build-base $(3)/test/perf/ \ --mode run-pass \ $$(CTEST_PERF_RUNTOOL) -PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3) := \ +PRETTY_RPASS_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/run-pass/ \ - --build-base test/run-pass/ \ + --build-base $(3)/test/run-pass/ \ --mode pretty -PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3) := \ +PRETTY_RFAIL_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/run-fail/ \ - --build-base test/run-fail/ \ + --build-base $(3)/test/run-fail/ \ --mode pretty -PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3) := \ +PRETTY_BENCH_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/bench/ \ - --build-base test/bench/ \ + --build-base $(3)/test/bench/ \ --mode pretty -PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3) := \ +PRETTY_PRETTY_ARGS$(1)-T-$(2)-H-$(3) := \ $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ --src-base $$(S)src/test/pretty/ \ - --build-base test/pretty/ \ + --build-base $(3)/test/pretty/ \ --mode pretty check-stage$(1)-T-$(2)-H-$(3)-cfail-dummy: \ diff --git a/mk/tools.mk b/mk/tools.mk index b87eb19e885..bb36cdf2f36 100644 --- a/mk/tools.mk +++ b/mk/tools.mk @@ -45,6 +45,7 @@ $$(HBIN$(2)_H_$(4))/compiletest$$(X): \ endef -$(eval $(call TOOLS_STAGE_N,0,1,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE))) -$(eval $(call TOOLS_STAGE_N,1,2,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE))) -$(eval $(call TOOLS_STAGE_N,2,3,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE))) +$(foreach host,$(CFG_TARGET_TRIPLES), \ + $(eval $(call TOOLS_STAGE_N,0,1,$(host),$(host))) \ + $(eval $(call TOOLS_STAGE_N,1,2,$(host),$(host))) \ + $(eval $(call TOOLS_STAGE_N,2,3,$(host),$(host))))