mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Begin using dependency info in the Makefile
This commit is contained in:
parent
7866f967ef
commit
3dc2064477
1 changed files with 10 additions and 6 deletions
16
Makefile
16
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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue