From 4f2461c427d432ecd1968e6935f2b3bd4ce36b38 Mon Sep 17 00:00:00 2001 From: KokaKiwi Date: Fri, 25 Oct 2013 13:10:52 +0200 Subject: [PATCH] Modified Makefile (see PR #3) --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 3d83dc911..2cf89aec8 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,27 @@ +# Binaries RUSTC ?= rustc +RM = rm +# Flags RUSTCFLAGS := +RMFLAGS := +# Output names EXES := false printenv true yes cat whoami TESTS := cat +# Utils stuff EXES_PATHS := $(addprefix build/,$(EXES)) command = sh -c '$(1)' +# Main exe build rule define EXE_BUILD build/$(1): $(1)/$(1).rs $(call command,$(RUSTC) $(RUSTCFLAGS) -o build/$(1) $(1)/$(1).rs) endef +# Test exe built rules define TEST_BUILD test_$(1): 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 endef +# Main rules all: build $(EXES_PATHS) test: tmp $(addprefix test_,$(TESTS)) @@ -36,6 +45,7 @@ build: tmp: mkdir tmp +# Creating necessary rules for each targets $(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe)))) $(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test))))