-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
38 lines (29 loc) · 630 Bytes
/
Makefile
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
34
35
36
37
38
CARGO=cargo
CARGO_FLAGS=
PREFIX?=/usr
EXAMPLES:=$(wildcard examples/*.json)
ifneq ($(MODE),debug)
TARGET=target/release/explain
CARGO_FLAGS+=--release
else
TARGET=target/debug/explain
endif
all: $(TARGET)
.PHONY: all
$(TARGET):
$(CARGO) build $(CARGO_FLAGS)
install:
install --directory $(PREFIX)/bin
install $(TARGET) $(PREFIX)/bin/
.PHONY: install
examples: $(EXAMPLES:.json=.png)
.PHONY: examples
%.dot: %.json $(TARGET)
$(TARGET) --dry-run --file $< --output $@
%.png: %.dot
dot -Tpng $^ > $@
test: examples
git diff examples/*.json
git diff-index --quiet HEAD examples/*.json
.PHONY: test
.PRECIOUS: %.dot