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

add uutils multicall binary

This commit is contained in:
Michael Gehring 2014-05-28 13:43:37 +02:00
parent 9665fb0a26
commit 13f01e4c11
42 changed files with 293 additions and 80 deletions

View file

@ -58,6 +58,9 @@ BUILD ?= $(PROGS)
EXES := \
$(sort $(filter $(BUILD),$(filter-out $(DONT_BUILD),$(PROGS))))
CRATES := \
$(sort $(filter $(EXES), $(filter-out md5sum, $(EXES))))
# Programs with usable tests
TEST_PROGS := \
cat \
@ -89,6 +92,11 @@ clean_$(1):
endif
endef
define CRATE_BUILD
build/$(2): $(1)/$(1).rs
$(call command,$(RUSTC) $(RUSTCFLAGS) --crate-type rlib $(1)/$(1).rs --out-dir build)
endef
# Test exe built rules
define TEST_BUILD
test_$(1): tmp/$(1)_test build build/$(1)
@ -99,7 +107,14 @@ tmp/$(1)_test: $(1)/test.rs
endef
# Main rules
ifneq ($(MULTICALL), 1)
all: build $(EXES_PATHS)
else
all: build build/uutils
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 $@
endif
test: tmp $(addprefix test_,$(TESTS))
$(RM) -rf tmp
@ -117,5 +132,8 @@ tmp:
# Creating necessary rules for each targets
$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe))))
$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
ifeq ($(MULTICALL), 1)
$(foreach crate,$(CRATES),$(eval $(call CRATE_BUILD,$(crate),$(shell $(RUSTC) --crate-type rlib --crate-file-name --out-dir build $(crate)/$(crate).rs))))
endif
.PHONY: all test clean