aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTill Hoeppner2014-08-07 13:30:21 +0100
committerTill Hoeppner2014-08-07 13:30:21 +0100
commitce640c2c25b0e16c567553c5774d633c13cbf0ee (patch)
tree5bf8f3c73fe4933f55044d42eb431ebe6767ae1a /Makefile
downloadirsc-ce640c2c25b0e16c567553c5774d633c13cbf0ee.tar.gz
irsc-ce640c2c25b0e16c567553c5774d633c13cbf0ee.tar.xz
irsc-ce640c2c25b0e16c567553c5774d633c13cbf0ee.zip
Setup
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 33 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..58dec28
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,33 @@
+RUSTC ?= rustc
+RUSTC_FLAGS ?=
+NAME ?= irsc
+
+SRC = $(shell find src -name '*.rs')
+
+all: $(NAME)
+
+$(NAME): $(SRC)
+ mkdir -p target
+ $(RUSTC) --out-dir target $(RUSTC_FLAGS) src/$(NAME).rs
+
+opt: RUSTC_FLAGS += --opt-level=3 -Z lto
+opt: $(NAME)
+
+small: opt
+ upx -9 ./target/$(NAME)
+
+debug: RUSTC_FLAGS += -g
+debug: $(NAME)
+
+run: $(NAME)
+ ./target/$(NAME)
+
+test: $(SRC)
+ mkdir -p target
+ $(RUSTC) --test --out-dir target src/$(NAME).rs
+ ./target/$(NAME)
+
+clean:
+ @rm -rf target
+
+.PHONY: clean