commit 1db90468c669bcefc0d58280b7c0d94995c6e149
parent 72898803cfc5b2670d25558aaeb6e8a342e64800
Author: hhvn <dev@hhvn.uk>
Date: Sun, 20 Mar 2022 16:02:15 +0000
Install/uninstall targets for misc/ programs
Diffstat:
3 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -15,7 +15,7 @@ LDFLAGS = -lncursesw
include config.mk
-all: $(BIN) $(MAN)
+all: $(BIN) $(MAN) misc
# Some make implementation will
# use a target to create an include
@@ -39,6 +39,22 @@ $(MAN): $(BIN) $(MAN).header $(MAN).footer
cat $(MAN).header - $(MAN).footer | \
sed "s/COMMIT/$(COMMIT)/" > $(MAN)
+misc:
+ cd misc/ && make
+
+misc-install:
+ cd misc/ && make install \
+ CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
+ PREFIX="$(PREFIX)" \
+ BINDIR="$(BINDIR)" \
+ MANDIR="$(MANDIR)"
+
+misc-uninstall:
+ cd misc/ && make uninstall \
+ PREFIX="$(PREFIX)" \
+ BINDIR="$(BINDIR)" \
+ MANDIR="$(MANDIR)"
+
install: all
mkdir -p $(BINDIR) $(MANDIR)/man1
install -m0755 $(BIN) $(BINDIR)/$(BIN)
@@ -56,4 +72,4 @@ clean:
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
-.PHONY: clean install uninstall
+.PHONY: all misc clean install uninstall
diff --git a/misc/Makefile b/misc/Makefile
@@ -1,4 +1,24 @@
+PREFIX = /usr/local
+BINDIR = $(PREFIX)/bin
+MANDIR = $(PREFIX)/share/man
+BINS = irccat
+MANS = irccat.1
+
+include ../config.mk
+
+all: $(BINS)
irccat: irccat.c
+install:
+ mkdir -p $(BINDIR) $(MANDIR)/man1
+ install -m0755 $(BINS) $(BINDIR)/
+ for f in $(MANS); do \
+ sed 's/COMMIT/$(COMMIT)/' \
+ < $$f \
+ > $(MANDIR)/man1/$$f; \
+ done
+
.c:
cc -o $(<:.c=) $<
+
+.PHONY: install uninstall
diff --git a/misc/irccat.1 b/misc/irccat.1
@@ -0,0 +1,22 @@
+.\" vim: set syntax=nroff :
+.Dd COMMIT
+.Dt irccat 1
+.Os
+.Sh NAME
+.Nm irccat
+.Nd mIRC formatting code aware
+.Xr cat 1
+.Sh SYNOPSIS
+.Nm
+.Op Ar FILES...
+.Sh DESCRIPTION
+.Nm
+concatenates input files and converts them to ANSI-formatted output.
+
+If '-' is passed as a file,
+.Nm
+will read from standard input.
+.Sh SEE ALSO
+.Xr hirc 1
+.Sh AUTHOR
+.An hhvn Aq Mt dev@hhvn.uk