aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile57
1 files changed, 53 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 96a0566..f8c5de9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,32 @@
-PROJ=miragextract
+# Makefile for miragextract
+
+####
+# Packagers: override these the make command line as needed.
-# Packagers: override these on make command line as needed.
+# Intended for optimizations, but you could include other flags here.
OPTFLAGS=-O2
+
+# -L, -l, and maybe -Wl flags here.
LDEXTRA=
+# Where 'make install' puts things.
+PREFIX=/usr/local
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/share/man
+MAN1DIR=$(MANDIR)/man1
+DOCDIR=$(PREFIX)/share/doc/$(PROJ)
+DESTDIR=
+
+# Booleans: 'y' or 'n' for these.
+STRIPBIN=y
+GZIPMAN=y
+
+#
+###
+
+PROJ=miragextract
+DOCS=README FAQ ChangeLog $(PROJ).html
+
SNDFILE_CFLAGS:=$(shell pkg-config --cflags sndfile)
SNDFILE_LIBS:=$(shell pkg-config --libs sndfile)
@@ -11,7 +34,7 @@ MIRAGE_CFLAGS:=$(shell pkg-config --cflags libmirage)
MIRAGE_LIBS:=$(shell pkg-config --libs libmirage)
CFLAGS=-Wall $(OPTFLAGS) $(MIRAGE_CFLAGS) $(SNDFILE_CFLAGS)
-LDFLAGS=$(LDEXTRA) $(MIRAGE_LIBS) $(SNDFILE_LIBS)
+LDFLAGS=$(MIRAGE_LIBS) $(SNDFILE_LIBS)$ $(LDEXTRA)
all: $(PROJ)
@@ -33,4 +56,30 @@ $(PROJ).1: $(PROJ).rst
$(PROJ).html: $(PROJ).rst
rst2html4.py $(PROJ).rst > $(PROJ).html
-.PHONY: all man html test push
+ifeq ($(shell whoami),root)
+CHOWN=chown
+else
+CHOWN=: chown
+endif
+
+install: all man html
+ mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(DOCDIR)
+ cp $(PROJ) $(DESTDIR)$(BINDIR)
+ $(CHOWN) root:root $(DESTDIR)$(BINDIR)/$(PROJ)
+ chmod 755 $(DESTDIR)$(BINDIR)/$(PROJ)
+ifeq ($(STRIPBIN),y)
+ strip $(DESTDIR)$(BINDIR)/$(PROJ)
+endif
+ cp $(PROJ).1 $(DESTDIR)$(MAN1DIR)
+ifeq ($(GZIPMAN),y)
+ gzip -9 $(DESTDIR)$(MAN1DIR)/$(PROJ).1
+endif
+ $(CHOWN) root:root $(DESTDIR)$(MAN1DIR)/$(PROJ).1
+ chmod 644 $(DESTDIR)$(MAN1DIR)/$(PROJ).1
+ for i in $(DOCS); do \
+ cp $$i $(DESTDIR)$(DOCDIR); \
+ chmod 644 $(DESTDIR)$(DOCDIR)/$$i; \
+ $(CHOWN) root:root $(DESTDIR)$(DOCDIR)/$$i; \
+ done
+
+.PHONY: all man html test push install