summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAyush Agarwal <ayushnix@fastmail.com>2023-03-23 02:55:16 +0530
committerAyush Agarwal <ayushnix@fastmail.com>2023-03-23 02:55:16 +0530
commite36e3f8af817bb9612d1aff98aeee0fb342a8126 (patch)
treeb65de1f7e606810634d162346483ae1ae17c2f31 /Makefile
parent7222b686ee76ea86bae6c418ea4f76329780f26e (diff)
make: add help target
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 18 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 896548b..23c527d 100644
--- a/Makefile
+++ b/Makefile
@@ -16,45 +16,60 @@ SHCHK = shellcheck
SHFMT = shfmt
INSTALL = install
-.PHONY: all install minimal bashcomp fishcomp man expatch clean uninstall
+.PHONY: all help install minimal bashcomp fishcomp man expatch clean uninstall
-all:
- @echo "$(PROG) is a shell script and doesn't need to be compiled"
+##all: print the help message and an instruction for installation
+all: help
+ @echo ""
+ @echo "$(PROG) is a bash script and doesn't need to be compiled"
@echo "To install it, enter \"make install\""
+##help: print this help message
+help: Makefile
+ @sed -n 's/^##//p' $<
+
+##install: install the program, its man pages, configuration files, and shell completion files
install: man bashcomp fishcomp minimal
@echo ""
@echo "$(PROG) has been installed succesfully"
+##minimal: install the program and its default configuration file
minimal:
$(INSTALL) -Dm 0755 $(PROG) -t $(DESTDIR)$(BINDIR)
$(INSTALL) -Dm 0644 $(PROGCFG) -t $(DESTDIR)$(CONFDIRS)/$(PROG)
+##man: build and install the man pages for this program
man: man/$(PROG).1 man/$(PROG).5
$(INSTALL) -Dm 0644 man/$(PROG).1 -t $(DESTDIR)$(MANDIR)/man1
$(INSTALL) -Dm 0644 man/$(PROG).5 -t $(DESTDIR)$(MANDIR)/man5
+##expatch: apply the explicit path patch to the program
expatch:
patch -N $(PROG) < $(EXPATH)
man/%: man/%.scd
$(SCDOC) < $^ > $@
+##bashcomp: install the bash shell completion file
bashcomp:
$(INSTALL) -Dm 0644 completion/$(PROG).bash-completion $(DESTDIR)$(BASHCOMPDIR)/$(PROG)
+##fishcomp: install the fish shell completion file
fishcomp:
$(INSTALL) -Dm 0644 completion/$(PROG).fish-completion $(DESTDIR)$(FISHCOMPDIR)/$(PROG).fish
+##clean: remove files that might've been generated while installing this program
clean:
rm -f man/$(PROG).1
rm -f man/$(PROG).5
rm -f $(PROG).rej
+##check: lint the program using shellcheck and report formatting errors, if any, using shfmt
check:
$(SHCHK) $(PROG)
$(SHFMT) -d -s -i 2 -bn -ci -sr $(PROG)
+##uninstall: uninstall the program, its man pages, configuration files, and shell completion files
uninstall:
rm -f "$(DESTDIR)$(BINDIR)/$(PROG)"
rm -f "$(DESTDIR)$(MANDIR)/man1/$(PROG).1"