rust/mk/clean.mk

122 lines
4.2 KiB
Makefile
Raw Normal View History

2011-05-01 22:18:52 +02:00
######################################################################
# Cleanup
######################################################################
2011-11-21 22:11:40 +01:00
CLEAN_STAGE_RULES = \
$(foreach stage, $(STAGES), \
$(foreach host, $(CFG_TARGET_TRIPLES), \
clean$(stage)_H_$(host) \
$(foreach target, $(CFG_TARGET_TRIPLES), \
2011-11-24 00:23:40 +01:00
clean$(stage)_T_$(target)_H_$(host))))
2011-09-29 20:48:44 +02:00
2011-11-21 22:11:40 +01:00
CLEAN_LLVM_RULES = \
$(foreach target, $(CFG_TARGET_TRIPLES), \
clean-llvm$(target))
2011-09-29 20:48:44 +02:00
.PHONY: clean clean-all clean-misc
clean-all: clean clean-llvm
clean-llvm: $(CLEAN_LLVM_RULES)
2011-05-01 22:18:52 +02:00
2011-09-29 20:48:44 +02:00
clean: clean-misc $(CLEAN_STAGE_RULES)
clean-misc:
2011-05-01 22:18:52 +02:00
@$(call E, cleaning)
$(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)
$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
$(Q)rm -f $(ML_DEPFILES) $(C_DEPFILES) $(CRATE_DEPFILES)
$(Q)rm -f $(ML_DEPFILES:%.d=%.d.tmp)
$(Q)rm -f $(C_DEPFILES:%.d=%.d.tmp)
$(Q)rm -f $(CRATE_DEPFILES:%.d=%.d.tmp)
2011-12-30 21:47:43 +01:00
$(Q)rm -Rf $(DOCS)
$(Q)rm -Rf $(GENERATED)
2011-05-01 22:18:52 +02:00
$(Q)rm -f rustllvm/$(CFG_RUSTLLVM) rustllvm/rustllvmbits.a
$(Q)rm -f rt/$(CFG_RUNTIME)
$(Q)find rustllvm rt -name '*.[odasS]' -delete
$(Q)find rustllvm rt -name '*.so' -delete
$(Q)find rustllvm rt -name '*.dylib' -delete
$(Q)find rustllvm rt -name '*.dll' -delete
2011-12-30 21:47:43 +01:00
$(Q)find rustllvm rt -name '*.def' -delete
$(Q)rm -Rf $(wildcard rt/*/libuv/Default)
The Big Test Suite Overhaul This replaces the make-based test runner with a set of Rust-based test runners. I believe that all existing functionality has been preserved. The primary objective is to dogfood the Rust test framework. A few main things happen here: 1) The run-pass/lib-* tests are all moved into src/test/stdtest. This is a standalone test crate intended for all standard library tests. It compiles to build/test/stdtest.stageN. 2) rustc now compiles into yet another build artifact, this one a test runner that runs any tests contained directly in the rustc crate. This allows much more fine-grained unit testing of the compiler. It compiles to build/test/rustctest.stageN. 3) There is a new custom test runner crate at src/test/compiletest that reproduces all the functionality for running the compile-fail, run-fail, run-pass and bench tests while integrating with Rust's test framework. It compiles to build/test/compiletest.stageN. 4) The build rules have been completely changed to use the new test runners, while also being less redundant, following the example of the recent stageN.mk rewrite. It adds two new features to the cfail/rfail/rpass/bench tests: 1) Tests can specify multiple 'error-pattern' directives which must be satisfied in order. 2) Tests can specify a 'compile-flags' directive which will make the test runner provide additional command line arguments to rustc. There are some downsides, the primary being that Rust has to be functioning pretty well just to run _any_ tests, which I imagine will be the source of some frustration when the entire test suite breaks. Will also cause some headaches during porting. Not having individual make rules, each rpass, etc test no longer remembers between runs whether it completed successfully. As a result, it's not possible to incrementally fix multiple tests by just running 'make check', fixing a test, and repeating without re-running all the tests contained in the test runner. Instead you can filter just the tests you want to run by using the TESTNAME environment variable. This also dispenses with the ability to run stage0 tests, but they tended to be broken more often than not anyway.
2011-07-13 04:01:09 +02:00
$(Q)rm -f test/run_pass_stage2.rc test/run_pass_stage2_driver.rs
2011-05-01 22:18:52 +02:00
$(Q)rm -Rf $(PKG_NAME)-*.tar.gz dist
$(Q)rm -Rf $(foreach ext,out out.tmp \
stage0$(X) stage1$(X) stage2$(X) \
2011-12-30 21:47:43 +01:00
bc o s so dll exe dSYM, \
$(wildcard test/*.$(ext) \
test/*/*.$(ext) \
test/bench/*/*.$(ext)))
2011-05-01 22:18:52 +02:00
$(Q)rm -Rf $(foreach ext, \
html aux cp fn ky log pdf pg toc tp vr cps, \
2011-12-30 21:47:43 +01:00
$(wildcard doc/*.$(ext) \
doc/*/*.$(ext) \
doc/*/*/*.$(ext)))
$(Q)rm -Rf doc/keywords.md
$(Q)rm -Rf doc/version.md
2011-12-30 21:47:43 +01:00
$(Q)rm -Rf $(foreach sub, index styles files search javascript, \
$(wildcard doc/*/$(sub)))
2011-11-08 23:36:19 +01:00
$(Q)rm -rf libuv
2011-09-29 20:48:44 +02:00
2011-11-21 22:11:40 +01:00
define CLEAN_HOST_STAGE_N
clean$(1)_H_$(2):
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustc$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/fuzzer$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/cargo$(X)
2011-12-30 21:47:43 +01:00
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustdoc$(X)
2011-11-21 22:11:40 +01:00
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_CORELIB)
2011-11-21 22:11:40 +01:00
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_STDLIB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTC)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CORELIB_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(STDLIB_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTC_GLOB)
2011-11-21 22:11:40 +01:00
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUSTLLVM)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/libstd.rlib
2011-09-29 20:48:44 +02:00
endef
2011-11-21 22:11:40 +01:00
$(foreach host, $(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage, $(STAGES), \
$(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host))))))
define CLEAN_TARGET_STAGE_N
2011-11-24 00:23:40 +01:00
clean$(1)_T_$(2)_H_$(3):
2011-11-21 22:11:40 +01:00
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$(X)
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/fuzzer$(X)
2011-12-30 21:47:43 +01:00
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/cargo$(X)
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustdoc$(X)
2011-11-21 22:11:40 +01:00
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME)
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB)
2011-11-21 22:11:40 +01:00
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB)
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC)
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CORELIB_GLOB)
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(STDLIB_GLOB)
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB)
2011-11-21 22:11:40 +01:00
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM)
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.bc
2011-12-30 21:47:43 +01:00
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
2011-11-21 22:11:40 +01:00
endef
$(foreach host, $(CFG_TARGET_TRIPLES), \
$(eval $(foreach target, $(CFG_TARGET_TRIPLES), \
2011-11-24 00:23:40 +01:00
$(eval $(foreach stage, 0 1 2 3, \
2011-11-21 22:11:40 +01:00
$(eval $(call CLEAN_TARGET_STAGE_N,$(stage),$(target),$(host))))))))
define DEF_CLEAN_LLVM_TARGET
ifeq ($(CFG_LLVM_ROOT),)
clean-llvm$(1):
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
else
clean-llvm$(1): ;
endif
endef
$(foreach target, $(CFG_TARGET_TRIPLES), \
2011-11-08 23:36:19 +01:00
$(eval $(call DEF_CLEAN_LLVM_TARGET,$(target))))