diff --git a/Makefile b/Makefile index b2260d616..ec7fe788c 100644 --- a/Makefile +++ b/Makefile @@ -96,12 +96,13 @@ command = sh -c '$(1)' # Main exe build rule define EXE_BUILD +-include build/$(1).d ifeq ($(wildcard $(1)/Makefile),) -build/$(1): $(1)/$(1).rs common/*.rs | build - $(call command,$(RUSTC) $(RUSTCFLAGS) -o build/$(1) $(1)/$(1).rs) +build/$(1): $(1)/$(1).rs | build + $(call command,$(RUSTC) $(RUSTCFLAGS) --dep-info build/$(1).d -o build/$(1) $(1)/$(1).rs) clean_$(1): else -build/$(1): $(1)/$(1).rs common/*.rs | build +build/$(1): $(1)/$(1).rs | build cd $(1) && make clean_$(1): cd $(1) && make clean @@ -109,8 +110,9 @@ endif endef define CRATE_BUILD -build/$(2): $(1)/$(1).rs common/*.rs | build - $(call command,$(RUSTC) $(RUSTCFLAGS) --crate-type rlib $(1)/$(1).rs --out-dir build) +-include build/$(1).d +build/$(2): $(1)/$(1).rs | build + $(call command,$(RUSTC) $(RUSTCFLAGS) --crate-type rlib --dep-info build/$(1).d $(1)/$(1).rs --out-dir build) endef # Test exe built rules @@ -128,8 +130,10 @@ all: $(EXES_PATHS) else all: build/uutils +-include build/uutils.d + build/uutils: uutils/uutils.rs $(addprefix build/, $(foreach crate,$(CRATES),$(shell $(RUSTC) --crate-type rlib --crate-file-name $(crate)/$(crate).rs))) - $(RUSTC) $(RUSTCFLAGS) -L build/ uutils/uutils.rs -o $@ + $(RUSTC) $(RUSTCFLAGS) -L build/ --dep-info $@.d uutils/uutils.rs -o $@ endif test: tmp $(addprefix test_,$(TESTS))