# Makefile for miragextract #### # Packagers: override these on the 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 # Normally these will end up as root and root (or possibly wheel). You # could also set 'CHOWN=/bin/true' to skip it. OWNER=$(shell id -u 0) GROUP=$(shell id -ng 0) # These are only used if you're rebuilding the man and/or html pages, # e.g. because you've patched them. RST2MAN=rst2man.py RST2HTML=rst2html4.py # ### # Hopefully, no user-serviceable parts below this line. PROJ=miragextract VERSION=0.1.0 BINS=$(PROJ) cuerecover MANS=$(PROJ).1 cuerecover.1 HTMLS=$(PROJ).html cuerecover.html DOCS=README FAQ ChangeLog LICENSE $(PROJ).html cuerecover.html SNDFILE_CFLAGS:=$(shell pkg-config --cflags sndfile) SNDFILE_LIBS:=$(shell pkg-config --libs sndfile) MIRAGE_CFLAGS:=$(shell pkg-config --cflags libmirage) MIRAGE_LIBS:=$(shell pkg-config --libs libmirage) PROJCFLAGS=-Wall $(OPTFLAGS) -DVERSION=\"$(VERSION)\" CFLAGS=$(PROJCFLAGS) $(MIRAGE_CFLAGS) $(SNDFILE_CFLAGS) LDFLAGS=$(MIRAGE_LIBS) $(SNDFILE_LIBS)$ $(LDEXTRA) all: $(BINS) man: $(MANS) html: $(HTMLS) # don't need to use libmirage and libsndfile flags with this one cuerecover: cuerecover.c $(CC) $(PROJCFLAGS) -o $@ $< %.1: %.rst $(RST2MAN) $< > $@ || rm -f $@ %.html: %.rst $(RST2HTML) $< > $@ || rm -f $@ 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) $(OWNER):$(GROUP) $(DESTDIR)$(DOCDIR)/$$i; \ done # The rest are maintainer-specific targets. test: all ./$(PROJ) test.cue push: all man html git add $(PROJ).1 $(PROJ).html git commit -m'auto-regenerate man/html pages' || true git push release: sh ./check_version $(VERSION) mkdir $(PROJ)-$(VERSION) cp $(PROJ).c $(PROJ).1 $(PROJ).rst $(DOCS) $(PROJ)-$(VERSION) tar cvfJ $(PROJ)-$(VERSION).tar.xz $(PROJ)-$(VERSION) .PHONY: all man html test push install