MKDIR=mkdir -p
COPY=cp
RM=rm -f -r

helpset	: jmakepdfx/Map.jhm
	#$(COPY) images/*.png jmakepdfx 
	$(MKDIR) ../resources/helpsets/jmakepdfx-en
	$(COPY) jmakepdfx/*.html ../resources/helpsets/jmakepdfx-en/
	$(COPY) jmakepdfx/*.xml ../resources/helpsets/jmakepdfx-en/
	$(COPY) jmakepdfx/*.jhm ../resources/helpsets/jmakepdfx-en/
	$(COPY) jmakepdfx/*.hs ../resources/helpsets/jmakepdfx-en/
	$(COPY) jmakepdfx/*.css ../resources/helpsets/jmakepdfx-en/
	$(COPY) jmakepdfx/*.png ../resources/helpsets/jmakepdfx-en/
	$(COPY) Makefile.jhindexer ../resources/helpsets/jmakepdfx-en/Makefile
	make -C ../resources/helpsets/jmakepdfx-en/

jmakepdfx/Map.jhm	: jmakepdfx/jmakepdfx.html makehelpset
	makehelpset -dd / -dir jmakepdfx \
	-dict ../resources/dictionaries/jmakepdfx-en.prop \
	-idx jmakepdfx/jmakepdfxIDX.tmp \
	-appname Jmakepdfx \
	-toc jmakepdfx/*contents*.html jmakepdfx

jmakepdfx/jmakepdfx.html	: jmakepdfx.pdf \
			jmakepdfx.perl fixpaths \
			dictionary.txt
			$(MKDIR) jmakepdfx
			$(COPY) jmakepdfx.sty jmakepdfx/
			$(COPY) images/*.png jmakepdfx/
			$(RM) jmakepdfx/*contents*.html
			latex2html \
			-custom_titles \
			-nocontents_in_navigation \
			-noindex_in_navigation \
			-nofootnode -numbered_footnotes \
			-noinfo -local_icons \
			-noaddress -noindex \
			jmakepdfx
			./fixpaths jmakepdfx

jmakepdfx.pdf	: jmakepdfx.tex jmakepdfx.sty dictionary.tex version.tex
		pdflatex jmakepdfx
		makeglossaries jmakepdfx
		makeindex jmakepdfx.idx
		pdflatex jmakepdfx
		pdflatex jmakepdfx

version.tex	: getversion ../src/Jmakepdfx.java
		./getversion ../src/Jmakepdfx.java

dictionary.tex	: transdict.pl ../resources/dictionaries/jmakepdfx-en.prop
		./transdict.pl  ../resources/dictionaries/jmakepdfx-en.prop

dictionary.txt	:
		ln -s ../resources/dictionaries/jmakepdfx-en.prop dictionary.txt

clean	:
	$(RM) jmakepdfx.{aux,glg,glo,gls,idx,ilg,ind,ist,log,out,pdf,toc,acr,acn,alg}
	$(RM) jmakepdfx/*
	$(RM) dictionary.tex
	$(RM) version.tex
	$(RM) ../resources/helpsets/jmakepdfx-en/*

