aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-08-06 00:22:40 +0200
committerTeddy Wing2020-08-06 00:22:40 +0200
commit16ff238363973e980201f441a802308257c382b0 (patch)
tree3904dae1a0ddc50969be4641715e14388869892c
parentbf2d539332e2f83605fe8386670d9377bc505d23 (diff)
downloadgit-suggestion-16ff238363973e980201f441a802308257c382b0.tar.bz2
Makefile: Copy release products to `dist/`
Add recipes to build release targets and copy the binaries and man pages into the `dist/` folder. We'll use this to package a release archive.
-rw-r--r--.gitignore1
-rw-r--r--Makefile27
2 files changed, 28 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index ea8c4bf..48681a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
+/dist/
/target
diff --git a/Makefile b/Makefile
index dd4c8c1..33f5367 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,18 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
+SOURCES := $(shell find . -name '*.rs')
MAN_PAGES := $(patsubst doc/%.1.txt,doc/%.1,$(wildcard doc/*.1.txt))
+# PRODUCTS := $(patsubst src/bin/%.rs,target/release/%,$(wildcard src/bin/*.rs))
+PRODUCTS := $(patsubst src/bin/%.rs,%,$(wildcard src/bin/*.rs))
+RELEASE_PRODUCTS := $(patsubst %,target/release/%,$(PRODUCTS))
+
+DIST := $(abspath dist)
+DIST_PRODUCTS := $(patsubst %,dist/%,$(PRODUCTS))
+DIST_MAN_PAGES := $(patsubst doc/%,dist/%,$(MAN_PAGES))
+
+
.PHONY: doc
doc: $(MAN_PAGES)
@@ -23,3 +33,20 @@ doc/%.1: doc/%.1.txt
sed 's/`/*/g' $< > $@.transformed
a2x --no-xmllint --format manpage $@.transformed
rm $@.transformed
+
+
+$(RELEASE_PRODUCTS): $(SOURCES)
+ cargo build --release
+
+
+.PHONY: dist
+dist: $(DIST_PRODUCTS) $(DIST_MAN_PAGES)
+
+$(DIST):
+ mkdir -p $@
+
+$(DIST_PRODUCTS): $(DIST) $(RELEASE_PRODUCTS)
+ cp $(RELEASE_PRODUCTS) $(DIST)
+
+$(DIST_MAN_PAGES): $(DIST) $(MAN_PAGES)
+ cp $(MAN_PAGES) $(DIST)