Makefile: Add install/uninstall targets.

This commit is contained in:
parazyd
2021-10-11 17:23:03 +02:00
parent 4fb500ac93
commit cdaa3cb3eb

View File

@@ -1,8 +1,12 @@
.POSIX:
CARGO = cargo
PREFIX = /usr/local
CONFDIR = $(HOME)/.config/darkfi
all:
mkdir -p $(CONFDIR)
@echo "$(CONFDIR)" > .confdir
$(CARGO) build --release --all-features
test:
@@ -14,4 +18,26 @@ fix:
clippy:
$(CARGO) clippy --release --all-features
.PHONY: all test fix clippy
install:
@if ! [ -f target/release/drk ]; then \
echo "Please run 'make' as user first." ; \
exit 1 ; \
fi;
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f target/release/cashierd $(DESTDIR)$(PREFIX)/bin
cp -f target/release/darkfid $(DESTDIR)$(PREFIX)/bin
cp -f target/release/drk $(DESTDIR)$(PREFIX)/bin
cp -f target/release/gatewayd $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/cashierd
chmod 755 $(DESTDIR)$(PREFIX)/bin/darkfid
chmod 755 $(DESTDIR)$(PREFIX)/bin/drk
chmod 755 $(DESTDIR)$(PREFIX)/bin/gatewayd
cp example/config/*.toml "$(shell cat .confdir)"
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/cashierd
rm -f $(DESTDIR)$(PREFIX)/bin/darkfid
rm -f $(DESTDIR)$(PREFIX)/bin/drk
rm -f $(DESTDIR)$(PREFIX)/bin/gatewayd
.PHONY: all test fix clippy install uninstall