summaryrefslogtreecommitdiff
path: root/Makefile
blob: 50dd1b2e9f845e3007229fd93b0e3b749c5e5054 (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
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
manpage		= doc/vtcol.1.gz
cargo-target 	= ./target
bin 		= $(cargo-target)/release/vtcol
lib 		= $(cargo-target)/release/libvtcol.rlib
bin-src 	= src/vtcol.rs
lib-src 	= src/lib.rs
src	 	= $(bin-src) $(lib-src)
meta 		= Cargo.toml
rustdoc-entry	= target/doc/vtcol/index.html
cargo-lock	= Cargo.lock
cargo-lock-patch= misc/nixos/pkgs/os-specific/linux/vtcol/cargo-lock.patch

all: bin lib doc nix

check: $(src)
	cargo test 

lib: $(lib)

bin: $(bin)

doc: man rustdoc

man: $(manpage)

rustdoc: $(rustdoc-entry)

nix: lockpatch

lockpatch: $(cargo-lock-patch)

$(cargo-lock-patch): $(meta)
	rm -f -- $(cargo-lock)
	cargo update
	cargo generate-lockfile
	mkdir -p tmp
	mv -f -- $(cargo-lock) tmp/
	diff -u /dev/null tmp/$(cargo-lock) >$(cargo-lock-patch) ; :

$(lib): $(lib-src) $(meta)
	cargo build --release 

$(bin): $(src) $(meta)
	cargo build --bin=vtcol --features=vtcol-bin --release 

$(manpage): doc/vtcol.rst
	rst2man $< |gzip > $@

$(rustdoc-entry): $(src) $(meta)
	cargo doc --bins

clean:
	rm -f -- $(manpage)
	rm -f -- $(cargo-lock)
	rm -rf -- $(cargo-target)
	rm -rf -- tmp

.PHONY: clean check