aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-11-03 01:11:34 +0100
committerTeddy Wing2019-11-03 01:11:34 +0100
commite82da4bc84db0d59f163186eaee2e04a67c99c94 (patch)
treec6bcc3de77503faa7967c9733a98ca44cb9d23fb
parentb42fb3276bb22374eb2c38b727c068e15a419c96 (diff)
downloadpdf-urls-e82da4bc84db0d59f163186eaee2e04a67c99c94.tar.bz2
Makefile: Add release packaging
Use `make pkg` to package the release into a tar archive.
-rw-r--r--.gitignore1
-rw-r--r--Makefile33
2 files changed, 34 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 53eaa21..7e32182 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+/dist/
/target
**/*.rs.bk
diff --git a/Makefile b/Makefile
index 201e839..5dfb2ca 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,38 @@
+VERSION := $(shell fgrep 'const VERSION' src/main.rs | awk -F '"' '{ print $$2 }')
+TOOLCHAIN := $(shell fgrep default_host_triple ~/.rustup/settings.toml | awk -F '"' '{ print $$2 }')
+
+RELEASE_PRODUCT := target/release/pdf-urls
+
+
+.PHONY: release
+release: $(RELEASE_PRODUCT)
+
+$(RELEASE_PRODUCT): src/*
+ cargo build --release
+
+
.PHONY: doc
doc: doc/pdf-urls.1
doc/pdf-urls.1: doc/pdf-urls.1.txt
a2x --no-xmllint --format manpage $<
+
+
+.PHONY: dist-all
+dist-all: dist/pdf-urls dist/pdf-urls.1
+
+dist:
+ mkdir -p dist
+
+dist/pdf-urls: $(RELEASE_PRODUCT) dist
+ cp $< $@
+
+dist/pdf-urls.1: doc/pdf-urls.1 dist
+ cp $< $@
+
+
+.PHONY: pkg
+pkg: pdf-urls_$(VERSION)_$(TOOLCHAIN).tar.bz2
+
+pdf-urls_$(VERSION)_$(TOOLCHAIN).tar.bz2: dist-all
+ tar cjv -s /dist/pdf-urls_$(VERSION)_$(TOOLCHAIN)/ -f $@ dist