summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2021-11-15 20:14:50 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2021-11-15 20:14:17 +0100
commit3d5a3545f7d900177ecee5046d6660f878d96537 (patch)
tree02d2693e1c6d90771cd1f104f606772db5edd998
parent10f04a80a878fd164ec01d4832f11c3cd63712eb (diff)
downloadvtcol-3d5a3545f7d900177ecee5046d6660f878d96537.tar.gz
decontaminate library from clap and anyhow deps
-rw-r--r--Cargo.toml21
-rw-r--r--Makefile19
2 files changed, 28 insertions, 12 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 63c199b..d1483dc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,17 +13,22 @@ readme = "README.rst"
license = "GPL-3.0"
edition = "2021"
+[dependencies]
+libc = "0.2"
+clap = { version = "2.33", optional = true }
+anyhow = { version = "1.0", optional = true }
+
+[features]
+vtcol-bin = [ "anyhow", "clap" ]
+
[[bin]]
-name = "vtcol"
-path = "src/vtcol.rs"
-test = false
-doc = false
+name = "vtcol"
+path = "src/vtcol.rs"
+test = false
+doc = false
+required-features = [ "vtcol-bin" ]
[lib]
# doctests suck
doctest = false
-[dependencies]
-clap = "2.33"
-libc = "0.2"
-anyhow = "1.0"
diff --git a/Makefile b/Makefile
index 446ffe9..a8db336 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,19 @@
manpage = doc/vtcol.1.gz
cargo-target = ./target
bin = $(cargo-target)/release/vtcol
-src = src/vtcol.rs
+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
-all: bin doc
+all: bin lib doc
+
+check: $(src)
+ cargo test
+
+lib: $(lib)
bin: $(bin)
@@ -15,8 +23,11 @@ man: $(manpage)
rustdoc: $(rustdoc-entry)
+$(lib): $(lib-src) $(meta)
+ cargo build --release
+
$(bin): $(src) $(meta)
- cargo build --release
+ cargo build --bin=vtcol --features=vtcol-bin --release
$(manpage): doc/vtcol.rst
rst2man $< |gzip > $@
@@ -28,4 +39,4 @@ clean:
rm -f -- $(manpage)
rm -rf -- $(cargo-target)
-.PHONY: clean
+.PHONY: clean check