2
0
mirror of https://github.com/xvxx/phetch synced 2024-11-05 00:00:58 +00:00
phetch/Makefile

56 lines
1.2 KiB
Makefile
Raw Normal View History

2019-12-31 03:10:17 +00:00
# Simple, stupid makefile to make phetch
2020-01-08 21:19:46 +00:00
PREFIX ?= /usr/local
_INSTDIR = $(DESTDIR)$(PREFIX)
BINDIR ?= $(_INSTDIR)/bin
MANDIR ?= $(_INSTDIR)/share/man
2019-12-31 03:10:17 +00:00
PHETCH_RELEASE = target/release/phetch
PHETCH_DEBUG = target/debug/phetch
2020-01-06 10:10:33 +00:00
RSFILES = $(wildcard src/*.rs src/**/*.rs)
2019-12-31 03:10:17 +00:00
2020-01-08 21:19:46 +00:00
.PHONY: all release debug clean install manual scdoc
2019-12-31 03:10:17 +00:00
# Default target
2020-01-08 21:19:46 +00:00
all: release manual
# Release build for distribution
release: $(PHETCH_RELEASE)
2019-12-31 03:10:17 +00:00
# Binary with debugging info
debug: $(PHETCH_DEBUG)
2019-12-31 03:13:03 +00:00
# Remove the release directory and its contents
2019-12-31 03:10:17 +00:00
clean:
2020-01-06 10:10:33 +00:00
@rm -rf target
2019-12-31 03:10:17 +00:00
# Build the release version
2019-12-31 03:10:17 +00:00
$(PHETCH_RELEASE): $(RSFILES)
cargo build --release
2019-12-31 03:10:17 +00:00
# Build the debug version
$(PHETCH_DEBUG): $(RSFILES)
2020-01-08 21:19:46 +00:00
cargo build
# 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
2020-01-08 21:15:36 +00:00
# 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)