updates makefile with proper vars and installer
This commit is contained in:
parent
b327b432a5
commit
8f4f89d754
45
Makefile
45
Makefile
|
@ -1,26 +1,29 @@
|
||||||
PREFIX ?= /usr/local
|
# Install to /usr/local unless otherwise specified, such as `make PREFIX=/app`
|
||||||
BINDIR ?= $(PREFIX)/bin
|
PREFIX?=/usr/local
|
||||||
MANDIR ?= $(PREFIX)/share/man/man1
|
|
||||||
|
|
||||||
install: $(BINDIR)/todo $(MANDIR)/todo.1
|
# What to run to install various files
|
||||||
install-man: $(MANDIR)/todo.1
|
INSTALL?=install
|
||||||
|
# Run to install the actual binary
|
||||||
|
INSTALL_PROGRAM=$(INSTALL) -Dm 755
|
||||||
|
# Run to install application data, with differing permissions
|
||||||
|
INSTALL_DATA=$(INSTALL) -Dm 644
|
||||||
|
|
||||||
$(BINDIR)/todo: todo
|
# Directories into which to install the various files
|
||||||
@echo Installing the executable to $(BINDIR)
|
bindir=$(DESTDIR)$(PREFIX)/bin
|
||||||
@mkdir -p $(BINDIR)
|
sharedir=$(DESTDIR)$(PREFIX)/share
|
||||||
@cp -f todo $(BINDIR)/todo
|
|
||||||
@chmod 755 $(BINDIR)/todo
|
|
||||||
|
|
||||||
$(MANDIR)/todo.1: todo.1
|
help:
|
||||||
@echo Installing the manual page to $(MANDIR)
|
@echo "targets:"
|
||||||
@mkdir -p $(MANDIR)
|
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
||||||
@cp -f todo.1 $(MANDIR)/todo.1
|
| sed -n 's/^\(.*\): \(.*\)##\(.*\)/ \1|\3/p' \
|
||||||
@chmod 644 $(MANDIR)/todo.1
|
| column -t -s '|'
|
||||||
|
|
||||||
uninstall:
|
install: todo todo.1 ## system install
|
||||||
@echo Removing the executable from $(BINDIR)
|
$(INSTALL_PROGRAM) todo $(bindir)/todo
|
||||||
@rm -f $(BINDIR)/todo
|
$(INSTALL_DATA) todo.1 $(sharedir)/man/man1/todo.1
|
||||||
@echo Removing the manual page from $(MANDIR)
|
|
||||||
@rm -f $(MANDIR)/todo.1
|
|
||||||
|
|
||||||
.PHONY: install install-man uninstall
|
uninstall: ## system uninstall
|
||||||
|
rm -f $(bindir)/todo
|
||||||
|
rm -f $(sharedir)/man/man1/todo.1
|
||||||
|
|
||||||
|
.PHONY: install uninstall
|
||||||
|
|
Loading…
Reference in New Issue