rust/mk/autodep.mk
2011-11-05 13:23:11 -07:00

31 lines
882 B
Makefile

######################################################################
# Auto-dependency
######################################################################
C_DEPFILES := $(RUNTIME_CS:%.cpp=%.d) $(RUSTLLVM_LIB_CS:%.cpp=%.d) \
$(RUSTLLVM_OBJS_CS:%.cpp=%.d)
rt/%.d: rt/%.cpp $(MKFILES)
@$(call E, dep: $@)
$(Q)$(call CFG_DEPEND_C, $@ \
$(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \
$(RUNTIME_INCS)) $< >$@.tmp
$(Q)$(CFG_PATH_MUNGE) $@.tmp
$(Q)rm -f $@.tmp.bak
$(Q)mv $@.tmp $@
rustllvm/%.d: rustllvm/%.cpp $(MKFILES) $(LLVM_CONFIG)
@$(call E, dep: $@)
$(Q)$(call CFG_DEPEND_C, $@ \
$(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \
$(LLVM_CXXFLAGS) $(RUSTLLVM_INCS)) $< >$@.tmp
$(Q)$(CFG_PATH_MUNGE) $@.tmp
$(Q)rm -f $@.tmp.bak
$(Q)mv $@.tmp $@
ifneq ($(MAKECMDGOALS),clean)
-include $(C_DEPFILES)
endif
depend: $(C_DEPFILES)