EPS_IMAGES18 =

EPS_IMAGES = \
	$(EPS_IMAGES18)

PNG_IMAGES = \
	$(EPS_IMAGES:%.eps=gen-images/%.png)

DEMOS = $(patsubst demo/%.cc,demo/build/%,$(wildcard demo/*.cc))

GS_COMMAND=gs -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4

all: demos html

$(EPS_IMAGES18:%.eps=gen-images/%.png): gen-images/%.png: images/%.eps
	-mkdir -p gen-images
	$(GS_COMMAND) -sDEVICE=pngalpha -r18 -sOutputFile=$@ $<

html: Doxyfile-gen $(PNG_IMAGES)
	-mkdir -p gen-dox
	./scripts/titlegen.py
	doxygen Doxyfile

demos: $(DEMOS)

Doxyfile-gen:
	sed -e 's/@version@/'`./scripts/chg-len.py`'/g' \
	    -e 's/@lemon_doc_prefix@/@make_lemon_doc_prefix@/g' \
	< Doxyfile.in >Doxyfile

clean:
	-rm -rf html
	-rm -f doxygen.log
	-rm -f $(PNG_IMAGES)
	-rm -rf gen-images
	-rm -rf $(DEMOS)

update-external-tags:
	wget -O libstdc++.tag.tmp http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.3/libstdc++.tag && \
	mv libstdc++.tag.tmp libstdc++.tag || \
	rm libstdc++.tag.tmp
	wget -O lemon.tag.tmp http://lemon.cs.elte.hu/pub/doc/1.0/lemon.tag && \
	mv lemon.tag.tmp lemon.tag || \
	rm lemon.tag.tmp


$(DEMOS): demo/build/%: demo/%.cc
	-mkdir -p demo/build
	g++ -o $@ @lemon_cflags@ @lemon_libs@ \
	-Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy \
	-Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings \
	-Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align \
	-Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing \
	-Wold-style-cast -Wno-unknown-pragmas \
	-ggdb -O0 $<


.PHONY: update-external-tags html demos Doxyfile-gen

