forked from xvxx/phetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (45 loc) · 1.32 KB
/
Makefile
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
59
60
61
# Simple, stupid makefile to make phetch
PREFIX ?= /usr/local
_INSTDIR = $(DESTDIR)$(PREFIX)
BINDIR ?= $(_INSTDIR)/bin
MANDIR ?= $(_INSTDIR)/share/man
PHETCH_RELEASE = target/release/phetch
PHETCH_DEBUG = target/debug/phetch
RSFILES = $(wildcard src/*.rs src/**/*.rs)
.PHONY: all release debug clean install manual scdoc
# Default target
all: release manual
# Release build for distribution
release: $(PHETCH_RELEASE)
# Binary with debugging info
debug: $(PHETCH_DEBUG)
./target/debug/phetch
# Remove the release directory and its contents
clean:
@rm -rf target
# Run tests
test:
cargo clippy --all-features
cargo test --all-features
# Build the release version
$(PHETCH_RELEASE): $(RSFILES)
cargo build --release
# Build the debug version
$(PHETCH_DEBUG): $(RSFILES)
cargo build --no-default-features
# Install phetch and its manual.
install: all
mkdir -p $(BINDIR) $(MANDIR)/man1
install -m755 $(PHETCH_RELEASE) $(BINDIR)/phetch
install -m644 doc/phetch.1 $(MANDIR)/man1/phetch.1
# Undo
uninstall:
rm -f $(BINDIR)/phetch $(MANDIR)/man1/phetch.1
# Build manual
manual: doc/phetch.1
doc/phetch.1: doc/phetch.1.md scdoc
scdoc < doc/phetch.1.md > doc/phetch.1
# Must have scdoc installed to build manual.
scdoc:
@which scdoc || (echo "scdoc(1) not found."; \
echo "install it: https://repology.org/project/scdoc"; exit 1)