forked from docopt/docopt.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (54 loc) · 1.73 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
RUSTC ?= rustc
RUSTDOC ?= rustdoc
BUILD ?= ./build
TARGET ?= ./target
RUST_PATH ?= -L $(BUILD) -L target
# RUSTFLAGS ?= --opt-level=3
RUSTFLAGS ?=
RUSTTESTFLAGS ?=
LIB ?= $(BUILD)/.libdocopt.timestamp
LIB_NAME = docopt
LIB_FILES = src/lib.rs src/parse.rs src/synonym.rs
TEST_FILES = $(wildcard src/test/*.rs)
MACRO_LIB ?= $(BUILD)/.libdocopt_macros.timestamp
MACRO_LIB_NAME = docopt_macros
MACRO_LIB_FILES = docopt_macros/src/macro.rs
ARGS ?=
all: $(LIB) $(MACRO_LIB)
install:
cargo-lite install
$(MACRO_LIB): $(MACRO_LIB_FILES)
@mkdir -p $(BUILD) $(TARGET)
$(RUSTC) $(RUSTFLAGS) $(RUST_PATH) ./docopt_macros/src/macro.rs --out-dir=$(TARGET)
@touch $(MACRO_LIB)
$(LIB): $(LIB_FILES)
@mkdir -p $(BUILD) $(TARGET)
$(RUSTC) $(RUSTFLAGS) ./src/lib.rs --out-dir=$(TARGET)
@touch $(LIB)
docs: $(LIB_FILES)
cargo doc
# WTF is rustdoc doing?
in-dir ./target/doc fix-perms
rscp ./target/doc/* gopher:~/www/burntsushi.net/rustdoc/
src/test/testcases.rs: src/test/testcases.docopt scripts/mk-testcases
./scripts/mk-testcases ./src/test/testcases.docopt > ./src/test/testcases.rs
test: build/tests
RUST_TEST_TASKS=1 RUST_LOG=$(LIB_NAME) ./build/tests $(ARGS)
build/tests: $(TEST_FILES) $(LIB)
$(RUSTC) $(RUSTTESTFLAGS) $(RUST_PATH) --test src/lib.rs -o ./build/tests
scratch: build/scratch
RUST_TEST_TASKS=1 RUST_LOG=$(LIB_NAME) ./build/scratch $(ARGS)
build/scratch: $(LIB) scratch.rs
$(RUSTC) $(RUST_PATH) $(RUSTTESTFLAGS) scratch.rs -o ./build/scratch
ex_%: build/%
./build/$* $(ARGS)
build/%: examples/%.rs $(LIB)
$(RUSTC) $(RUST_PATH) --out-dir $(BUILD) $<
ctags:
ctags --recurse --options=ctags.rust --languages=Rust
clean:
rm -f $(BUILD)/.*.timestamp $(BUILD)/*
rm -rf target
push:
git push origin master
git push github master