aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-01-31 02:01:17 -0500
committerB. Watson <urchlay@slackware.uk>2024-01-31 02:01:17 -0500
commitabb5e0fa6b34e991dc7b2a5b83e032f52acac868 (patch)
treeb24e728b560491852d4a916a2056eb25dd41e426
parentc4cab5b2199018dd15cc80141c2a3b0e0a7d03cf (diff)
downloadxdeadzone-abb5e0fa6b34e991dc7b2a5b83e032f52acac868.tar.gz
Add install target.
-rw-r--r--Makefile36
1 files changed, 29 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b0ccfc2..f1e51db 100644
--- a/Makefile
+++ b/Makefile
@@ -7,23 +7,45 @@ OPTFLAGS=-O2 -fPIC
# Add any extra libraries you need here.
LIBS=
+# Install locations (these don't affect the binary).
+PREFIX = /usr
+BINDIR = $(PREFIX)/bin
+SHAREDIR = $(PREFIX)/share
+MANDIR = $(SHAREDIR)/man
+MAN1DIR = $(MANDIR)/man1
+DOCDIR = $(SHAREDIR)/doc/$(PROJ)
+INSTALL = install
+INSTALL_DATA = $(INSTALL) -m0644
+INSTALL_PROG = $(INSTALL) -s -m0755
+MKDIR_P = mkdir -p
+GZIP = gzip
+
# Shouldn't need to override these.
+PROJ=xdeadzone
VERSION=0.1
CFLAGS=-Wall -DVERSION="\"$(VERSION)"\" $(OPTFLAGS)
LDFLAGS=-lX11 $(LIBS)
-all: xdeadzone xdeadzone.1
+all: $(PROJ) $(PROJ).1
-xdeadzone: xdeadzone.c
+$(PROJ): $(PROJ).c
-xdeadzone.1: xdeadzone.rst
+$(PROJ).1: $(PROJ).rst
echo ".. |version| replace:: $(VERSION)" > version.rst
- rst2man xdeadzone.rst > xdeadzone.1
+ rst2man $(PROJ).rst > $(PROJ).1
clean:
- rm -f xdeadzone *.o core
+ rm -f $(PROJ) *.o core
realclean: clean
- rm -f xdeadzone.1 version.rst
+ rm -f $(PROJ).1 version.rst
+
+install: all
+ $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SHAREDIR) \
+ $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(DOCDIR)
+ $(INSTALL_PROG) $(PROJ) $(DESTDIR)$(BINDIR)
+ $(INSTALL_DATA) $(PROJ).1 $(DESTDIR)$(MAN1DIR)
+ $(INSTALL_DATA) README $(DESTDIR)$(DOCDIR)
+ $(GZIP) -9f $(DESTDIR)$(MAN1DIR)/$(PROJ).1
-.PHONY: all clean realclean
+.PHONY: all clean realclean install