# Makefile for the sitemap distribution

# Don't forget to update the spec file.
VERS=2.3

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

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

install: sitemap.1
	cp sitemap $(BINDIR)
	cp sitemap.1 $(MANDIR)/sitemap.1

sitemap.1: sitemap.xml
	xmlto man sitemap.xml
 
SOURCES = README sitemap sitemap.xml sitemap.1 Makefile sitemaprc

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

dist: sitemap-$(VERS).tar.gz

# Make RPMs.  You need to be root to make this work
RPMROOT=/usr/src/redhat
RPM = rpm
RPMFLAGS = -bb --target noarch
rpm: sitemap-$(VERS).tar.gz
	cp sitemap-$(VERS).tar.gz $(RPMROOT)/SOURCES;
	cp sitemap.spec $(RPMROOT)/SPECS/sitemap.spec
	(cd $(RPMROOT)/SPECS; $(RPM) $(RPMFLAGS) sitemap.spec)
	cp $(RPMROOT)/RPMS/noarch/sitemap-$(VERS)*.rpm .
	chown $$USER *
