~sircmpwn/public-inbox

powerctl: Makefile: cleanup and make posix v1 PROPOSED

Fredrik Foss-Indrehus: 1
 Makefile: cleanup and make posix

 1 files changed, 15 insertions(+), 12 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/public-inbox/patches/56844/mbox | git am -3
Learn more about email & git

[PATCH powerctl] Makefile: cleanup and make posix Export this patch

Signed-off-by: Fredrik Foss-Indrehus <fred@ffoss.net>
---

Just some misc changes, take what you want. Neither the $(RM)[1] macro
nor the install[1] command is part of POSIX 2024 as far as I can tell.

[1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/contents.html
[2] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html

 Makefile | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index a3f458e..9c886bb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,36 +1,39 @@
.POSIX:
.PREFIXES:
.SUFFIXES:
HARE=hare
SCDOC=scdoc

DESTDIR=
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man
DESTDIR=

all: powerctl docs

powerctl: *.ha
	hare build -o powerctl
	$(HARE) build -o powerctl

powerctl.8: powerctl.8.scd
	scdoc < powerctl.8.scd > powerctl.8
	$(SCDOC) < powerctl.8.scd > powerctl.8

docs: powerctl.8

clean:
	$(RM) powerctl.8
	$(RM) powerctl
	rm -f powerctl
	rm -f powerctl.8

install: powerctl.8 powerctl
install: powerctl powerctl.8
	mkdir -p $(DESTDIR)/$(BINDIR)
	mkdir -p $(DESTDIR)/$(MANDIR)/man8
	install -Dm644 powerctl.8 $(DESTDIR)/$(MANDIR)/man8/powerctl.8
	install -Dm755 powerctl $(DESTDIR)/$(BINDIR)/powerctl
	chmod u+s $(DESTDIR)/$(BINDIR)/powerctl

	cp powerctl $(DESTDIR)/$(BINDIR)/powerctl
	cp powerctl.8 $(DESTDIR)/$(MANDIR)/man8/powerctl.8

	chmod 4755 $(DESTDIR)/$(BINDIR)/powerctl
	chmod 644 $(DESTDIR)/$(MANDIR)/man8/powerctl.8

uninstall:
	$(RM) $(DESTDIR)/$(MANDIR)/man8/powerctl.8
	$(RM) $(DESTDIR)/$(BINDIR)/powerctl
	rm -f $(DESTDIR)/$(BINDIR)/powerctl
	rm -f $(DESTDIR)/$(MANDIR)/man8/powerctl.8

.PHONY: all docs clean install uninstall
-- 
2.47.1