# Makefile for the doclifter project
VERS=$(shell sed <doclifter.spec -n -e '/Version: \(.*\)/s//\1/p')

MANDIR=/usr/share/man/man1
BINDIR=/usr/bin

DOCS    = README COPYING TODO BUGS doclifter.spec \
		doclifter.xml doclifter.1 manlifter.xml manlifter.1
TEST    = docliftertest1.man test.troff
SOURCES = doclifter manlifter Makefile $(DOCS) $(TEST)

all: doclifter-$(VERS).tar.gz

install: doclifter.1
	cp doclifter $(BINDIR)
	gzip <doclifter.1 >$(MANDIR)/doclifter.1.gz
	rm doclifter.1

doclifter.1: doclifter.xml
	xmlto man doclifter.xml

manlifter.1: manlifter.xml
	xmlto man manlifter.xml

doclifter.html: doclifter.xml
	xmlto xhtml-nochunks doclifter.xml

manlifter.html: manlifter.xml
	xmlto xhtml-nochunks manlifter.xml

doclifter-$(VERS).tar.gz: $(SOURCES)
	mkdir doclifter-$(VERS)
	cp $(SOURCES) doclifter-$(VERS)
	tar -czf doclifter-$(VERS).tar.gz doclifter-$(VERS)
	rm -fr doclifter-$(VERS)
	ls -l doclifter-$(VERS).tar.gz

dist: doclifter-$(VERS).tar.gz doclifter.html manlifter.html
	ln -sf doclifter-$(VERS).tar.gz doclifter.tar.gz
