ASCIIDOC_HTML=asciidoc --unsafe --backend=xhtml11 --conf-file=config.html --attribute icons --attribute iconsdir=graphics

DEPS = config.html layout1.css Makefile

OUTS = index.html sjd.html contact.html jobs.html libidn.html		\
	gsasl.html shishi.html gss.html gnutls.html projects.html	\
	pubs.html support.html libtasn1.html libntlm.html openwrt.html

all: htmls vc

htmls: $(OUTS)

sjd.html: sjd.txt $(DEPS)
	$(ASCIIDOC_HTML)  --attribute=index-only sjd.txt

index.html: sjd.html
	sed -e 's,\(<link rel="stylesheet" href="./xhtml11.css" type="text/css" />\),\1\r\n    <link rel="openid.server" href="https://openid.yubico.com/server.php" />\r\n    <link rel="openid.delegate" href="https://openid.yubico.com/server.php/idpage?user=ccccccbljude" />\r\n    <link rel="openid2.provider" href="https://openid.yubico.com/server.php" />\r\n    <link rel="openid2.local_id" href="https://openid.yubico.com/server.php/idpage?user=ccccccbljude" />,' \
	-e 's,\(<div id="preamble">\),<div style="float: right">\r\n  <img src="graphics/simon.jpg" alt="Image of Simon Josefsson" title="Image of Simon Josefsson" />\r\n</div>\r\n\1,' < sjd.html > index.html

contact.html: contact.txt contact-omap-include.html
	$(ASCIIDOC_HTML) $<
	grep -B 9999999 MAGIC-COOKIE $@ | grep -v MAGIC-COOKIE > tmp.html
	cat contact-omap-include.html >> tmp.html
	grep -A 9999999 MAGIC-COOKIE $@ | grep -v MAGIC-COOKIE >> tmp.html
	mv tmp.html $@

%.html: %.txt $(DEPS)
	$(ASCIIDOC_HTML) $<

%.php: %.txt $(DEPS)
	$(ASCIIDOC_HTML) -o $@ $<

vc:
	git commit -m Update. $(OUTS) $(DEPS)
	$(MAKE) update

update:
	git push
	ssh -l jas yxa-vi.extundo.com 'cd web && git pull'

clean:
	rm -f $(OUTS)
