# Makefile - makefile for xhotkeys webpage
PACKAGE=xhotkeys

# Useful variables
DEBIANDIR=../../debian
DEBIANVERSION=$(shell cat $(DEBIANDIR)/changelog | head -n1 | awk '{print $$2}' | tr -d '()')
VERSION=$(shell echo $(DEBIANVERSION) | sed "s/-//")
TARBALL=$(PACKAGE)-$(VERSION).tar.gz
ARCH=$(shell cat $(DEBIANDIR)/control | grep ^Architecture | head -n1 | awk '{print $$2}')
DEBPACKAGE=$(PACKAGE)_$(DEBIANVERSION)_$(ARCH).deb

PAGES=index.html howtouse.html contact.html

all: web

upload: all
	cvs ci -m "automatic commit" .
	
web: $(PAGES) ChangeLog

ChangeLog: $(DEBIANDIR)/changelog
	cat $(DEBIANDIR)/changelog | sed "s/^\(xhotkeys (.*)\).*$$/\1/" > ChangeLog

%.html: %-template.html header.html foot.html
	cat header.html $< foot.html | sed "s/@DEBIANPACKAGE@/$(DEBPACKAGE)/" | \
		sed "s/@TARBALL@/$(TARBALL)/" | \
		sed "s/@DATE@/$(shell LC_ALL=C date)/" | \
		sed "s/@SHORTDATE@/$(shell LC_ALL=C date +"%b %Y")/" | \
		sed "s/@VERSION@/$(VERSION)/" > $@

clean:
	rm -f $(PAGES) ChangeLog
