mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Modified Makefile (see PR #3)
This commit is contained in:
parent
a910b54e4a
commit
4f2461c427
1 changed files with 10 additions and 0 deletions
10
Makefile
10
Makefile
|
@ -1,19 +1,27 @@
|
||||||
|
# Binaries
|
||||||
RUSTC ?= rustc
|
RUSTC ?= rustc
|
||||||
|
RM = rm
|
||||||
|
|
||||||
|
# Flags
|
||||||
RUSTCFLAGS :=
|
RUSTCFLAGS :=
|
||||||
|
RMFLAGS :=
|
||||||
|
|
||||||
|
# Output names
|
||||||
EXES := false printenv true yes cat whoami
|
EXES := false printenv true yes cat whoami
|
||||||
TESTS := cat
|
TESTS := cat
|
||||||
|
|
||||||
|
# Utils stuff
|
||||||
EXES_PATHS := $(addprefix build/,$(EXES))
|
EXES_PATHS := $(addprefix build/,$(EXES))
|
||||||
|
|
||||||
command = sh -c '$(1)'
|
command = sh -c '$(1)'
|
||||||
|
|
||||||
|
# Main exe build rule
|
||||||
define EXE_BUILD
|
define EXE_BUILD
|
||||||
build/$(1): $(1)/$(1).rs
|
build/$(1): $(1)/$(1).rs
|
||||||
$(call command,$(RUSTC) $(RUSTCFLAGS) -o build/$(1) $(1)/$(1).rs)
|
$(call command,$(RUSTC) $(RUSTCFLAGS) -o build/$(1) $(1)/$(1).rs)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Test exe built rules
|
||||||
define TEST_BUILD
|
define TEST_BUILD
|
||||||
test_$(1): tmp/$(1)_test
|
test_$(1): tmp/$(1)_test
|
||||||
$(call command,tmp/$(1)_test)
|
$(call command,tmp/$(1)_test)
|
||||||
|
@ -22,6 +30,7 @@ tmp/$(1)_test: $(1)/test.rs
|
||||||
$(RUSTC) $(RUSTCFLAGS) -o tmp/$(1)_test $(1)/test.rs
|
$(RUSTC) $(RUSTCFLAGS) -o tmp/$(1)_test $(1)/test.rs
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Main rules
|
||||||
all: build $(EXES_PATHS)
|
all: build $(EXES_PATHS)
|
||||||
|
|
||||||
test: tmp $(addprefix test_,$(TESTS))
|
test: tmp $(addprefix test_,$(TESTS))
|
||||||
|
@ -36,6 +45,7 @@ build:
|
||||||
tmp:
|
tmp:
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
|
|
||||||
|
# Creating necessary rules for each targets
|
||||||
$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe))))
|
$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe))))
|
||||||
$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
|
$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue