aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-03-22 16:57:31 -0700
committerGraydon Hoare <[email protected]>2011-03-22 17:11:47 -0700
commit6e1f52e79e331748429bb3765bfe9e1aabdece7a (patch)
treeff489205822bbcdbec8ede6912e45450cbca2aa3 /Makefile.in
parentAdd a test case for empty mutable vector literals, XFAIL'd in rustboot (diff)
downloadrust-6e1f52e79e331748429bb3765bfe9e1aabdece7a.tar.xz
rust-6e1f52e79e331748429bb3765bfe9e1aabdece7a.zip
Port auto-dep logic to new Makefile.in
Diffstat (limited to 'Makefile.in')
-rw-r--r--Makefile.in81
1 files changed, 80 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index 29d5eb11..a638c4fc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -73,7 +73,7 @@ ifdef CFG_WINDOWSY
CFG_RUN_TEST=PATH="$(CFG_LDPATH)" $(1)
CFG_RUN_TARG=PATH="$(CFG_LDPATH)" $(1)
- CFG_PATH_MUNGE := $(strip | perl -p \
+ CFG_PATH_MUNGE := $(strip perl -i -p \
-e 's@\\(.)@/\1@go;' \
-e 's@^/([a-zA-Z])/@\1:/@o;')
ifdef CFG_FLEXLINK
@@ -86,6 +86,7 @@ endif
ifdef CFG_UNIXY
CFG_INFO := $(info cfg: unix-y environment)
+ CFG_PATH_MUNGE := /bin/true
CFG_EXE_SUFFIX :=
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_LLVM_LIBDIR)
CFG_RUN_TARG=\
@@ -924,6 +925,84 @@ test/compile-fail/%.stage0.out.tmp: test/compile-fail/%.rs $(SREQ0)
$(Q)grep --text --quiet \
"$$(grep error-pattern $< | cut -d : -f 2- | tr -d '\n\r')" $@
+
+######################################################################
+# Auto-dependency
+######################################################################
+
+ML_DEPFILES := $(BOOT_MLS:%.ml=%.d)
+C_DEPFILES := $(RUNTIME_CS:%.cpp=%.d) $(RUSTLLVM_CS:%.cpp=%.d)
+
+rt/%.d: rt/%.cpp $(MKFILES)
+ @$(call E, dep: $@)
+ $(Q)$(call CFG_DEPEND_C, $@ \
+ $(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \
+ $(RUNTIME_INCS)) $< >[email protected]
+ $(Q)$(CFG_PATH_MUNGE) [email protected]
+ $(Q)mv [email protected] $@
+
+rustllvm/%.d: rustllvm/%.cpp $(MKFILES)
+ @$(call E, dep: $@)
+ $(Q)$(call CFG_DEPEND_C, $@ \
+ $(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \
+ $(CFG_LLVM_CXXFLAGS) $(RUSTLLVM_INCS)) $< >[email protected]
+ $(Q)$(CFG_PATH_MUNGE) [email protected]
+ $(Q)mv [email protected] $@
+
+%.d: %.ml $(MKFILES)
+ @$(call E, dep: $@)
+ $(Q)ocamldep$(OPT) -slash $(BOOT_ML_DEP_INCS) $< >[email protected]
+ $(Q)$(CFG_PATH_MUNGE) [email protected]
+ $(Q)perl -i -pe "s@$(S)src/@@go" [email protected]
+ $(Q)mv [email protected] $@
+
+%.d: %.mli $(MKFILES)
+ @$(call E, dep: $@)
+ $(Q)ocamldep$(OPT) -slash $(BOOT_ML_DEP_INCS) $< >[email protected]
+ $(Q)$(CFG_PATH_MUNGE) [email protected]
+ $(Q)perl -i -pe "s@$(S)src/@@go" [email protected]
+ $(Q)mv [email protected] $@
+
+ifneq ($(MAKECMDGOALS),clean)
+-include $(ML_DEPFILES) $(C_DEPFILES)
+endif
+
+RUSTBOOT_PROBE := $(wildcard boot/rustboot$(X))
+
+ifneq ($(RUSTBOOT_PROBE),)
+CFG_INFO := $(info cfg: using built boot/rustboot$(X) for rust deps)
+CRATE_DEPFILES := $(subst $(S)src/,,$(ALL_TEST_CRATES:%.rc=%.d)) \
+ boot/$(CFG_STDLIB).d \
+ stage0/rustc$(X).d \
+ stage0/$(CFG_STDLIB).d
+
+boot/$(CFG_STDLIB).d: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
+ $(MKFILES) boot/rustboot$(X)
+ @$(call E, dep: $@)
+ $(BOOT) -o $(patsubst %.d,%,$@) -shared -rdeps $< >[email protected]
+ $(Q)$(CFG_PATH_MUNGE) [email protected]
+ $(Q)mv [email protected] $@
+
+stage0/rustc$(X).d: $(COMPILER_CRATE) $(COMPILER_INPUTS) \
+ $(STDLIB_CRATE) $(MKFILES) boot/rustboot$(X)
+ @$(call E, dep: $@)
+ $(BOOT) -o $(patsubst %.d,%,$@) -shared -rdeps $< >[email protected]
+ $(Q)$(CFG_PATH_MUNGE) [email protected]
+ $(Q)mv [email protected] $@
+
+%.d: %.rc $(MKFILES) boot/rustboot$(X)
+ @$(call E, dep: $@)
+ $(BOOT) -o $(patsubst %.d,%,$@) -rdeps $< >[email protected]
+ $(Q)$(CFG_PATH_MUNGE) [email protected]
+ $(Q)mv [email protected] $@
+
+ifneq ($(MAKECMDGOALS),clean)
+-include $(CRATE_DEPFILES)
+endif
+endif
+
+depend: boot/rustboot$(X) $(CRATE_DEPFILES) $(ML_DEPFILES) $(C_DEPFILES)
+
######################################################################
# Distribution
######################################################################