PageRenderTime 26ms CodeModel.GetById 15ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/mk/clean.mk

http://github.com/jruderman/rust
Makefile | 116 lines | 96 code | 17 blank | 3 comment | 0 complexity | fddcf7cdd0a763cb249dacfe771f684c MD5 | raw file
  1######################################################################
  2# Cleanup
  3######################################################################
  4
  5CLEAN_STAGE_RULES =								\
  6 $(foreach stage, $(STAGES),					\
  7  $(foreach host, $(CFG_TARGET_TRIPLES),		\
  8   clean$(stage)_H_$(host)						\
  9   $(foreach target, $(CFG_TARGET_TRIPLES),		\
 10    clean$(stage)_T_$(target)_H_$(host))))
 11
 12CLEAN_LLVM_RULES = 								\
 13 $(foreach target, $(CFG_TARGET_TRIPLES),		\
 14  clean-llvm$(target))
 15
 16.PHONY: clean clean-all clean-misc
 17
 18clean-all: clean clean-llvm
 19
 20clean-llvm: $(CLEAN_LLVM_RULES)
 21
 22clean: clean-misc $(CLEAN_STAGE_RULES)
 23
 24clean-misc:
 25	@$(call E, cleaning)
 26	$(Q)find rustllvm rt $(CFG_HOST_TRIPLE)/test \
 27         -name '*.[odasS]' -o \
 28         -name '*.so' -o      \
 29         -name '*.dylib' -o   \
 30         -name '*.dll' -o     \
 31         -name '*.def' -o     \
 32         -name '*.bc'         \
 33         | xargs rm -f
 34	$(Q)find rustllvm rt $(CFG_HOST_TRIPLE)\
 35         -name '*.dSYM'       \
 36         | xargs rm -Rf
 37	$(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)
 38	$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
 39	$(Q)rm -Rf $(DOCS)
 40	$(Q)rm -Rf $(GENERATED)
 41	$(Q)rm -f tmp/*.log tmp/*.rc tmp/*.rs
 42	$(Q)rm -Rf $(PKG_NAME)-*.tar.gz dist
 43	$(Q)rm -Rf $(foreach ext, \
 44                 html aux cp fn ky log pdf pg toc tp vr cps, \
 45                 $(wildcard doc/*.$(ext) \
 46                            doc/*/*.$(ext) \
 47                            doc/*/*/*.$(ext)))
 48	$(Q)rm -Rf doc/version.md
 49	$(Q)rm -Rf $(foreach sub, index styles files search javascript, \
 50                 $(wildcard doc/*/$(sub)))
 51
 52define CLEAN_HOST_STAGE_N
 53
 54clean$(1)_H_$(2):
 55	$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustc$(X)
 56	$(Q)rm -f $$(HBIN$(1)_H_$(2))/fuzzer$(X)
 57	$(Q)rm -f $$(HBIN$(1)_H_$(2))/cargo$(X)
 58	$(Q)rm -f $$(HBIN$(1)_H_$(2))/serializer$(X)
 59	$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustdoc$(X)
 60	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME)
 61	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_CORELIB)
 62	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_STDLIB)
 63	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTC)
 64	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBSYNTAX)
 65	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CORELIB_GLOB)
 66	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(STDLIB_GLOB)
 67	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTC_GLOB)
 68	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBSYNTAX_GLOB)
 69	$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUSTLLVM)
 70	$(Q)rm -f $$(HLIB$(1)_H_$(2))/libstd.rlib
 71
 72endef
 73
 74$(foreach host, $(CFG_TARGET_TRIPLES), \
 75 $(eval $(foreach stage, $(STAGES), \
 76  $(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host))))))
 77
 78define CLEAN_TARGET_STAGE_N
 79
 80clean$(1)_T_$(2)_H_$(3):
 81	$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$(X)
 82	$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/fuzzer$(X)
 83	$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/cargo$(X)
 84	$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/serializer$(X)
 85	$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustdoc$(X)
 86	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME)
 87	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB)
 88	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB)
 89	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC)
 90	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX)
 91	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CORELIB_GLOB)
 92	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(STDLIB_GLOB)
 93	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB)
 94	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_GLOB)
 95	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM)
 96	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
 97	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
 98endef
 99
100$(foreach host, $(CFG_TARGET_TRIPLES), \
101 $(eval $(foreach target, $(CFG_TARGET_TRIPLES), \
102  $(eval $(foreach stage, 0 1 2 3, \
103   $(eval $(call CLEAN_TARGET_STAGE_N,$(stage),$(target),$(host))))))))
104
105define DEF_CLEAN_LLVM_TARGET
106ifeq ($(CFG_LLVM_ROOT),)
107clean-llvm$(1):
108	$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
109else
110clean-llvm$(1): ;
111
112endif
113endef
114
115$(foreach target, $(CFG_TARGET_TRIPLES), \
116 $(eval $(call DEF_CLEAN_LLVM_TARGET,$(target))))