1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

Begin using dependency info in the Makefile

This commit is contained in:
Arcterus 2014-06-18 17:31:00 -07:00
parent 7866f967ef
commit 3dc2064477

View file

@ -96,12 +96,13 @@ command = sh -c '$(1)'
# Main exe build rule # Main exe build rule
define EXE_BUILD define EXE_BUILD
-include build/$(1).d
ifeq ($(wildcard $(1)/Makefile),) ifeq ($(wildcard $(1)/Makefile),)
build/$(1): $(1)/$(1).rs common/*.rs | build build/$(1): $(1)/$(1).rs | build
$(call command,$(RUSTC) $(RUSTCFLAGS) -o build/$(1) $(1)/$(1).rs) $(call command,$(RUSTC) $(RUSTCFLAGS) --dep-info build/$(1).d -o build/$(1) $(1)/$(1).rs)
clean_$(1): clean_$(1):
else else
build/$(1): $(1)/$(1).rs common/*.rs | build build/$(1): $(1)/$(1).rs | build
cd $(1) && make cd $(1) && make
clean_$(1): clean_$(1):
cd $(1) && make clean cd $(1) && make clean
@ -109,8 +110,9 @@ endif
endef endef
define CRATE_BUILD define CRATE_BUILD
build/$(2): $(1)/$(1).rs common/*.rs | build -include build/$(1).d
$(call command,$(RUSTC) $(RUSTCFLAGS) --crate-type rlib $(1)/$(1).rs --out-dir build) 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 endef
# Test exe built rules # Test exe built rules
@ -128,8 +130,10 @@ all: $(EXES_PATHS)
else else
all: build/uutils 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))) 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 endif
test: tmp $(addprefix test_,$(TESTS)) test: tmp $(addprefix test_,$(TESTS))