Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
hakavlad committed May 13, 2024
1 parent 1bff713 commit 1ac8752
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ NAME = tird
DESTDIR ?=
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man

PANDOC := $(shell command -v pandoc 2> /dev/null)

all:
@ echo "Use: make install, make uninstall, make manpage, make build-deb, make install-deb"
@ echo "Use: make install, make uninstall, make build-deb, make install-deb, make manpage"

install:
install -p -d $(DESTDIR)$(BINDIR)
Expand All @@ -13,16 +17,24 @@ install:
uninstall:
rm -fv $(DESTDIR)$(BINDIR)/$(NAME)

manpage:
pandoc docs/MANPAGE.md -s -t man > docs/$(NAME).1
man ./docs/$(NAME).1

build-deb:
install -p -d deb/$(NAME)
install -p -d deb/$(NAME)/usr/bin
install -p -m0755 $(NAME)/$(NAME).py deb/$(NAME)/usr/bin/$(NAME)
install -p -d deb/$(NAME)/usr/share/man/man1
gzip -9cn docs/$(NAME).1 > deb/$(NAME)/usr/share/man/man1/$(NAME).1.gz
cp -r deb/DEBIAN deb/$(NAME)/
fakeroot dpkg-deb --build deb/$(NAME)
## Now you can run
## sudo make install-deb

install-deb:
apt install -o Acquire::AllowUnsizedPackages=1 --reinstall ./deb/$(NAME).deb

manpage:

ifdef PANDOC
pandoc docs/MANPAGE.md -s -t man > docs/$(NAME).1
man ./docs/$(NAME).1
else
@echo "pandoc is not installed, skipping manpage generation"
endif

0 comments on commit 1ac8752

Please sign in to comment.