diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 36 |
1 files changed, 29 insertions, 7 deletions
@@ -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 |