aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 58dec28fdefee2e5620c5ed476ce919b9632d8b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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